diff --git a/.mailmap b/.mailmap index d265f45c5caf..073308628494 100644 --- a/.mailmap +++ b/.mailmap @@ -161,6 +161,7 @@ Michael Woerister MickaΓ«l Raybaud-Roig m-r-r Ms2ger Mukilan Thiagarajan +Nathan West Nathan Wilson Nathaniel Herman Nathaniel Herman Neil Pankey diff --git a/Cargo.lock b/Cargo.lock index 2b17a6acbaa6..39ecc880097e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -230,7 +230,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cargo" -version = "0.35.0" +version = "0.36.0" dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "bufstream 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -238,7 +238,7 @@ dependencies = [ "bytesize 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "crates-io 0.23.0", + "crates-io 0.24.0", "crossbeam-utils 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "crypto-hash 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", @@ -374,7 +374,7 @@ dependencies = [ "clippy-mini-macro-test 0.2.0", "clippy_dev 0.0.1", "clippy_lints 0.0.212", - "compiletest_rs 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", + "compiletest_rs 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -493,7 +493,7 @@ dependencies = [ [[package]] name = "compiletest_rs" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -508,6 +508,7 @@ dependencies = [ "serde_derive 1.0.81 (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)", + "tester 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -539,7 +540,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "crates-io" -version = "0.23.0" +version = "0.24.0" dependencies = [ "curl 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -744,7 +745,7 @@ dependencies = [ [[package]] name = "dlmalloc" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1339,7 +1340,7 @@ dependencies = [ [[package]] name = "lsp-codec" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1399,7 +1400,7 @@ dependencies = [ "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "string_cache_codegen 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1590,7 +1591,7 @@ dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "compiletest_rs 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", + "compiletest_rs 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1936,14 +1937,6 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "proc-macro2" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "proc-macro2" version = "0.4.24" @@ -2015,14 +2008,6 @@ name = "quote" version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "quote" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "quote" version = "0.6.10" @@ -2247,7 +2232,7 @@ dependencies = [ name = "rls" version = "1.34.0" dependencies = [ - "cargo 0.35.0", + "cargo 0.36.0", "cargo_metadata 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "clippy_lints 0.0.212", "crossbeam-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2261,7 +2246,7 @@ dependencies = [ "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-codec 0.1.2 (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)", @@ -2272,7 +2257,7 @@ dependencies = [ "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.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-rustc 0.6.0", "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)", @@ -2325,8 +2310,7 @@ dependencies = [ [[package]] name = "rls-rustc" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +version = "0.6.0" [[package]] name = "rls-span" @@ -2374,14 +2358,15 @@ dependencies = [ "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "polonius-engine 0.6.2 (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)", + "rustc-rayon 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-rayon-core 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_apfloat 0.0.0", "rustc_data_structures 0.0.0", "rustc_errors 0.0.0", "rustc_fs_util 0.0.0", + "rustc_macros 0.1.0", "rustc_target 0.0.0", - "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serialize 0.0.0", "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "syntax 0.0.0", @@ -2425,8 +2410,8 @@ dependencies = [ "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)", + "rustc-rayon 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-rayon-core 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)", "stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2524,23 +2509,23 @@ dependencies = [ [[package]] name = "rustc-rayon" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-rayon-core 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-rayon-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2640,6 +2625,7 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", "rustc-demangle 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_allocator 0.0.0", @@ -2688,11 +2674,13 @@ 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)", "graphviz 0.0.0", + "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)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (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)", + "rustc-rayon 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-rayon-core 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_cratesio_shim 0.0.0", "serialize 0.0.0", "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2708,13 +2696,14 @@ dependencies = [ "graphviz 0.0.0", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", - "rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-rayon 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_allocator 0.0.0", "rustc_borrowck 0.0.0", "rustc_codegen_utils 0.0.0", "rustc_data_structures 0.0.0", "rustc_errors 0.0.0", "rustc_incremental 0.0.0", + "rustc_interface 0.0.0", "rustc_lint 0.0.0", "rustc_metadata 0.0.0", "rustc_mir 0.0.0", @@ -2726,7 +2715,7 @@ dependencies = [ "rustc_target 0.0.0", "rustc_traits 0.0.0", "rustc_typeck 0.0.0", - "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serialize 0.0.0", "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "syntax 0.0.0", @@ -2758,7 +2747,7 @@ version = "0.0.0" dependencies = [ "graphviz 0.0.0", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", "rustc_data_structures 0.0.0", "rustc_fs_util 0.0.0", @@ -2767,6 +2756,36 @@ dependencies = [ "syntax_pos 0.0.0", ] +[[package]] +name = "rustc_interface" +version = "0.0.0" +dependencies = [ + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc 0.0.0", + "rustc-rayon 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_allocator 0.0.0", + "rustc_borrowck 0.0.0", + "rustc_codegen_utils 0.0.0", + "rustc_data_structures 0.0.0", + "rustc_errors 0.0.0", + "rustc_incremental 0.0.0", + "rustc_lint 0.0.0", + "rustc_metadata 0.0.0", + "rustc_mir 0.0.0", + "rustc_passes 0.0.0", + "rustc_plugin 0.0.0", + "rustc_privacy 0.0.0", + "rustc_resolve 0.0.0", + "rustc_traits 0.0.0", + "rustc_typeck 0.0.0", + "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serialize 0.0.0", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syntax 0.0.0", + "syntax_ext 0.0.0", + "syntax_pos 0.0.0", +] + [[package]] name = "rustc_lint" version = "0.0.0" @@ -2798,6 +2817,16 @@ dependencies = [ "core 0.0.0", ] +[[package]] +name = "rustc_macros" +version = "0.1.0" +dependencies = [ + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rustc_metadata" version = "0.0.0" @@ -3090,6 +3119,11 @@ name = "scoped-tls" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "scoped-tls" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "scoped_threadpool" version = "0.1.9" @@ -3230,7 +3264,7 @@ dependencies = [ "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", "compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "core 0.0.0", - "dlmalloc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "dlmalloc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "fortanix-sgx-abi 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "panic_abort 0.0.0", @@ -3255,19 +3289,19 @@ dependencies = [ "phf_shared 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", "precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", - "string_cache_codegen 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "string_cache_codegen" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "phf_generator 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", "phf_shared 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3345,7 +3379,7 @@ dependencies = [ "rustc_data_structures 0.0.0", "rustc_errors 0.0.0", "rustc_target 0.0.0", - "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serialize 0.0.0", "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "syntax_pos 0.0.0", @@ -3372,7 +3406,7 @@ dependencies = [ "arena 0.0.0", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_data_structures 0.0.0", - "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serialize 0.0.0", "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3415,6 +3449,15 @@ dependencies = [ name = "term" version = "0.0.0" +[[package]] +name = "term" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "term" version = "0.5.1" @@ -3451,6 +3494,16 @@ dependencies = [ "term 0.0.0", ] +[[package]] +name = "tester" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "textwrap" version = "0.10.0" @@ -3976,7 +4029,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum commoncrypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d056a8586ba25a1e4d61cb090900e495952c7886786fc55f909ab2f819b69007" "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 compiletest_rs 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "56c799b1f7142badf3b047b4c1f2074cc96b6b784fb2432f2ed9c87da0a03749" "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" @@ -4000,7 +4053,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "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 dlmalloc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f283302e035e61c23f2b86b3093e8c6273a4c3125742d6087e96ade001ca5e63" "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" @@ -4064,7 +4117,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum lock_api 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "949826a5ccf18c1b3a7c3d57692778d21768b79e46eb9dd07bfc4c2160036c54" "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-codec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "169d737ad89cf8ddd82d1804d9122f54568c49377665157277cc90d747b1d31a" "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" @@ -4124,7 +4177,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" "checksum pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a029430f0d744bc3d15dd474d591bed2402b645d024583082b9f63bb936dac6" "checksum pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df8b3f4e0475def7d9c2e5de8e5a1306949849761e107b360d03e98eafaffd61" -"checksum proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1b06e2f335f48d24442b35a19df506a835fb3547bc3c06ef27340da9acf5cae7" "checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" "checksum proptest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "926d0604475349f463fe44130aae73f2294b5309ab2ca0310b998bd334ef191f" "checksum pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d6fdf85cda6cadfae5428a54661d431330b312bc767ddbc57adbedc24da66e32" @@ -4132,7 +4184,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "07589615d719a60c8dd8a4622e7946465dfef20d1a428f969e3443e7386d5f45" "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.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" @@ -4158,7 +4209,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "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.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.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 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8be999235b541fc8eb54901b66e899a06076709ac5f53d6b2c5c59d29ad54780" @@ -4172,8 +4222,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "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" -"checksum rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40f06724db71e18d68b3b946fdf890ca8c921d9edccc1404fdfdb537b0d12649" +"checksum rustc-rayon 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8d98c51d9cbbe810c8b6693236d3412d8cd60513ff27a3e1b6af483dca0af544" +"checksum rustc-rayon-core 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "526e7b6d2707a5b9bec3927d424ad70fa3cfc68e0ac1b75e46cdbbc95adc5108" "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" "checksum rustc_tools_util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c5a95edfa0c893236ae4778bb7c4752760e4c0d245e19b5eff33c5aa5eb9dc" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" @@ -4183,6 +4233,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-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" "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" @@ -4201,7 +4252,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7" "checksum stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbc596e092fe5f598b12ef46cc03754085ac2f4d8c739ad61c4ae266cc3b3fa" "checksum string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25d70109977172b127fe834e5449e5ab1740b9ba49fa18a2020f509174f25423" -"checksum string_cache_codegen 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "35293b05cf1494e8ddd042a7df6756bf18d07f42d234f32e71dce8a7aabb0191" +"checksum string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eea1eee654ef80933142157fdad9dd8bc43cf7c74e999e369263496f04ff4da" "checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc" "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" "checksum strum 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f6c3a2071519ab6a48f465808c4c1ffdd00dfc8e93111d02b4fc5abab177676e" @@ -4213,9 +4264,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum tar 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "a303ba60a099fcd2aaa646b14d2724591a96a75283e4b7ed3d1a1658909d9ae2" "checksum tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7e91405c14320e5c79b3d148e1c86f40749a36e490642202a31689cb1a3452b2" "checksum tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9de21546595a0873061940d994bbbc5c35f024ae4fd61ec5c5b159115684f508" +"checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" "checksum term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5e6b677dd1e8214ea1ef4297f85dbcbed8e8cdddb561040cc998ca2551c37561" "checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" +"checksum tester 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5e812cb26c597f86a49b26dbb58b878bd2a2b4b93fc069dc39499228fe556ff6" "checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "d825be0eb33fda1a7e68012d51e9c7f451dc1a69391e7fdc197060bb8c56667b" diff --git a/RELEASES.md b/RELEASES.md index 841467b69c98..4cda02c5c2eb 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -4,10 +4,10 @@ Version 1.33.0 (2019-02-28) Language -------- - [You can now use the `cfg(target_vendor)` attribute.][57465] E.g. - `#[cfg(target_vendor="linux")] fn main() { println!("Hello Linux!"); }` + `#[cfg(target_vendor="apple")] fn main() { println!("Hello Apple!"); }` - [Integer patterns such as in a match expression can now be exhaustive.][56362] E.g. You can have match statement on a `u8` that covers `0..=255` and - you would no longer be required to have a `_ => unreachable!()` case. + you would no longer be required to have a `_ => unreachable!()` case. - [You can now have multiple patterns in `if let` and `while let` expressions.][57532] You can do this with the same syntax as a `match` expression. E.g. @@ -51,8 +51,7 @@ Language // Allowed as there is only one `Read` in the module. pub trait Read {} ``` -- [`extern` functions will now abort by default when panicking.][55982] - This was previously undefined behaviour. +- [You may now use `Rc`, `Arc`, and `Pin` as method receivers][56805]. Compiler -------- @@ -109,27 +108,30 @@ Compatibility Notes are now deprecated in the standard library, and their usage will now produce a warning. Please use the `str::{trim_start, trim_end, trim_start_matches, trim_end_matches}` methods instead. +- The `Error::cause` method has been deprecated in favor of `Error::source` which supports + downcasting. -[57615]: https://github.com/rust-lang/rust/pull/57615/ -[57465]: https://github.com/rust-lang/rust/pull/57465/ -[57532]: https://github.com/rust-lang/rust/pull/57532/ -[57535]: https://github.com/rust-lang/rust/pull/57535/ -[57566]: https://github.com/rust-lang/rust/pull/57566/ +[55982]: https://github.com/rust-lang/rust/pull/55982/ +[56303]: https://github.com/rust-lang/rust/pull/56303/ +[56351]: https://github.com/rust-lang/rust/pull/56351/ +[56362]: https://github.com/rust-lang/rust/pull/56362 +[56642]: https://github.com/rust-lang/rust/pull/56642/ +[56769]: https://github.com/rust-lang/rust/pull/56769/ +[56805]: https://github.com/rust-lang/rust/pull/56805 +[56947]: https://github.com/rust-lang/rust/pull/56947/ +[57049]: https://github.com/rust-lang/rust/pull/57049/ +[57067]: https://github.com/rust-lang/rust/pull/57067/ +[57105]: https://github.com/rust-lang/rust/pull/57105 [57130]: https://github.com/rust-lang/rust/pull/57130/ [57167]: https://github.com/rust-lang/rust/pull/57167/ [57175]: https://github.com/rust-lang/rust/pull/57175/ [57234]: https://github.com/rust-lang/rust/pull/57234/ [57332]: https://github.com/rust-lang/rust/pull/57332/ -[56947]: https://github.com/rust-lang/rust/pull/56947/ -[57049]: https://github.com/rust-lang/rust/pull/57049/ -[57067]: https://github.com/rust-lang/rust/pull/57067/ -[56769]: https://github.com/rust-lang/rust/pull/56769/ -[56642]: https://github.com/rust-lang/rust/pull/56642/ -[56303]: https://github.com/rust-lang/rust/pull/56303/ -[56351]: https://github.com/rust-lang/rust/pull/56351/ -[55982]: https://github.com/rust-lang/rust/pull/55982/ -[56362]: https://github.com/rust-lang/rust/pull/56362 -[57105]: https://github.com/rust-lang/rust/pull/57105 +[57465]: https://github.com/rust-lang/rust/pull/57465/ +[57532]: https://github.com/rust-lang/rust/pull/57532/ +[57535]: https://github.com/rust-lang/rust/pull/57535/ +[57566]: https://github.com/rust-lang/rust/pull/57566/ +[57615]: https://github.com/rust-lang/rust/pull/57615/ [cargo/6484]: https://github.com/rust-lang/cargo/pull/6484/ [`unix::FileExt::read_exact_at`]: https://doc.rust-lang.org/std/os/unix/fs/trait.FileExt.html#method.read_exact_at [`unix::FileExt::write_all_at`]: https://doc.rust-lang.org/std/os/unix/fs/trait.FileExt.html#method.write_all_at @@ -170,7 +172,7 @@ Language - [You can now match against literals in macros with the `literal` specifier.][56072] This will match against a literal of any type. E.g. `1`, `'A'`, `"Hello World"` -- [Self can now be used as a constructor and pattern for unit and tuple structs.][56365] E.g. +- [Self can now be used as a constructor and pattern for unit and tuple structs.][56365] E.g. ```rust struct Point(i32, i32); @@ -460,7 +462,7 @@ Version 1.31.0 (2018-12-06) Language -------- -- πŸŽ‰ [This version marks the release of the 2018 edition of Rust.][54057] πŸŽ‰ +- πŸŽ‰ [This version marks the release of the 2018 edition of Rust.][54057] πŸŽ‰ - [New lifetime elision rules now allow for eliding lifetimes in functions and impl headers.][54778] E.g. `impl<'a> Reader for BufReader<'a> {}` can now be `impl Reader for BufReader<'_> {}`. Lifetimes are still required to be defined diff --git a/appveyor.yml b/appveyor.yml index 3a0cb8b4fcee..d70ad54b1c81 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,11 +5,6 @@ environment: # server goes down presumably. See #43333 for more info CARGO_HTTP_CHECK_REVOKE: false - # Execute the builds on GCE instead of Hyper-V. Those builders have a 3-4 - # minute startup overhead, but AppVeyor support recommended this as a - # possible solution for #58160 (spurious 259 exit codes) - appveyor_build_worker_cloud: gce - matrix: # 32/64 bit MSVC tests - MSYS_BITS: 64 diff --git a/config.toml.example b/config.toml.example index f45db37c33b8..9afbd937c422 100644 --- a/config.toml.example +++ b/config.toml.example @@ -61,7 +61,7 @@ # support. You'll need to write a target specification at least, and most # likely, teach rustc about the C ABI of the target. Get in touch with the # Rust team and file an issue if you need assistance in porting! -#targets = "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX;Hexagon" +#targets = "X86;ARM;AArch64;Mips;PowerPC;SystemZ;MSP430;Sparc;NVPTX;Hexagon" # LLVM experimental targets to build support for. These targets are specified in # the same format as above, but since these targets are experimental, they are @@ -104,6 +104,8 @@ # The value specified here will be passed as `-DLLVM_USE_LINKER` to CMake. #use-linker = "lld" +# Whether or not to specify `-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=YES` +#allow-old-toolchain = false # ============================================================================= # General build configuration options @@ -162,6 +164,9 @@ # Python interpreter to use for various tasks throughout the build, notably # rustdoc tests, the lldb python interpreter, and some dist bits and pieces. # Note that Python 2 is currently required. +# +# Defaults to python2.7, then python2. If neither executable can be found, then +# it defaults to the Python interpreter used to execute x.py. #python = "python2.7" # Force Cargo to check that Cargo.lock describes the precise dependency diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index b6afe317a07b..ca86aeb8100a 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -107,6 +107,14 @@ fn main() { // actually downloaded, so we just always pass the `--sysroot` option. cmd.arg("--sysroot").arg(&sysroot); + cmd.arg("-Zexternal-macro-backtrace"); + + // Link crates to the proc macro crate for the target, but use a host proc macro crate + // to actually run the macros + if env::var_os("RUST_DUAL_PROC_MACROS").is_some() { + cmd.arg("-Zdual-proc-macros"); + } + // When we build Rust dylibs they're all intended for intermediate // usage, so make sure we pass the -Cprefer-dynamic flag instead of // linking all deps statically into the dylib. @@ -256,13 +264,6 @@ fn main() { } } - // Force all crates compiled by this compiler to (a) be unstable and (b) - // allow the `rustc_private` feature to link to other unstable crates - // also in the sysroot. - if env::var_os("RUSTC_FORCE_UNSTABLE").is_some() { - cmd.arg("-Z").arg("force-unstable-if-unmarked"); - } - if let Ok(map) = env::var("RUSTC_DEBUGINFO_MAP") { cmd.arg("--remap-path-prefix").arg(&map); } @@ -282,6 +283,14 @@ fn main() { } } + // Force all crates compiled by this compiler to (a) be unstable and (b) + // allow the `rustc_private` feature to link to other unstable crates + // also in the sysroot. We also do this for host crates, since those + // may be proc macros, in which case we might ship them. + if env::var_os("RUSTC_FORCE_UNSTABLE").is_some() && (stage != "0" || target.is_some()) { + cmd.arg("-Z").arg("force-unstable-if-unmarked"); + } + if env::var_os("RUSTC_PARALLEL_COMPILER").is_some() { cmd.arg("--cfg").arg("parallel_compiler"); } diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 119b38bcc99d..8af7aa4856c3 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -262,6 +262,10 @@ def default_build_triple(): cputype = 'arm' if ostype == 'linux-android': ostype = 'linux-androideabi' + elif ostype == 'unknown-freebsd': + cputype = subprocess.check_output( + ['uname', '-p']).strip().decode(default_encoding) + ostype = 'unknown-freebsd' elif cputype == 'armv6l': cputype = 'arm' if ostype == 'linux-android': @@ -830,7 +834,7 @@ def main(): # x.py help ... if len(sys.argv) > 1 and sys.argv[1] == 'help': - sys.argv = sys.argv[:1] + [sys.argv[2], '-h'] + sys.argv[3:] + sys.argv = [sys.argv[0], '-h'] + sys.argv[2:] help_triggered = ( '-h' in sys.argv) or ('--help' in sys.argv) or (len(sys.argv) == 1) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 6c2785a3723d..1a36cb45d269 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -405,7 +405,8 @@ impl<'a> Builder<'a> { test::Miri, test::Clippy, test::CompiletestTest, - test::RustdocJS, + test::RustdocJSStd, + test::RustdocJSNotStd, test::RustdocTheme, // Run bootstrap close to the end as it's unlikely to fail test::Bootstrap, @@ -813,6 +814,17 @@ impl<'a> Builder<'a> { cargo.env("RUST_CHECK", "1"); } + match mode { + Mode::Std | Mode::Test | Mode::ToolBootstrap | Mode::ToolStd | Mode::ToolTest=> {}, + Mode::Rustc | Mode::Codegen | Mode::ToolRustc => { + // Build proc macros both for the host and the target + if target != compiler.host && cmd != "check" { + cargo.arg("-Zdual-proc-macros"); + cargo.env("RUST_DUAL_PROC_MACROS", "1"); + } + }, + } + cargo.arg("-j").arg(self.jobs().to_string()); // Remove make-related flags to ensure Cargo can correctly set things up cargo.env_remove("MAKEFLAGS"); diff --git a/src/bootstrap/channel.rs b/src/bootstrap/channel.rs index 0b2f62485c9e..aa683161b654 100644 --- a/src/bootstrap/channel.rs +++ b/src/bootstrap/channel.rs @@ -14,7 +14,7 @@ use crate::Build; use crate::config::Config; // The version number -pub const CFG_RELEASE_NUM: &str = "1.34.0"; +pub const CFG_RELEASE_NUM: &str = "1.35.0"; pub struct GitInfo { inner: Option, diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 20370372082b..a30b465698e2 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -42,7 +42,8 @@ impl Step for Std { true); let libdir = builder.sysroot_libdir(compiler, target); - add_to_sysroot(&builder, &libdir, &libstd_stamp(builder, compiler, target)); + let hostdir = builder.sysroot_libdir(compiler, compiler.host); + add_to_sysroot(&builder, &libdir, &hostdir, &libstd_stamp(builder, compiler, target)); } } @@ -88,7 +89,8 @@ impl Step for Rustc { true); let libdir = builder.sysroot_libdir(compiler, target); - add_to_sysroot(&builder, &libdir, &librustc_stamp(builder, compiler, target)); + let hostdir = builder.sysroot_libdir(compiler, compiler.host); + add_to_sysroot(&builder, &libdir, &hostdir, &librustc_stamp(builder, compiler, target)); } } @@ -175,7 +177,8 @@ impl Step for Test { true); let libdir = builder.sysroot_libdir(compiler, target); - add_to_sysroot(builder, &libdir, &libtest_stamp(builder, compiler, target)); + let hostdir = builder.sysroot_libdir(compiler, compiler.host); + add_to_sysroot(builder, &libdir, &hostdir, &libtest_stamp(builder, compiler, target)); } } @@ -222,7 +225,8 @@ impl Step for Rustdoc { true); let libdir = builder.sysroot_libdir(compiler, target); - add_to_sysroot(&builder, &libdir, &rustdoc_stamp(builder, compiler, target)); + let hostdir = builder.sysroot_libdir(compiler, compiler.host); + add_to_sysroot(&builder, &libdir, &hostdir, &rustdoc_stamp(builder, compiler, target)); builder.cargo(compiler, Mode::ToolRustc, target, "clean"); } } diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 249a18318904..9498dbb59523 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -224,7 +224,8 @@ impl Step for StdLink { target_compiler.host, target)); let libdir = builder.sysroot_libdir(target_compiler, target); - add_to_sysroot(builder, &libdir, &libstd_stamp(builder, compiler, target)); + let hostdir = builder.sysroot_libdir(target_compiler, compiler.host); + add_to_sysroot(builder, &libdir, &hostdir, &libstd_stamp(builder, compiler, target)); if builder.config.sanitizers && compiler.stage != 0 && target == "x86_64-apple-darwin" { // The sanitizers are only built in stage1 or above, so the dylibs will @@ -431,8 +432,12 @@ impl Step for TestLink { &compiler.host, target_compiler.host, target)); - add_to_sysroot(builder, &builder.sysroot_libdir(target_compiler, target), - &libtest_stamp(builder, compiler, target)); + add_to_sysroot( + builder, + &builder.sysroot_libdir(target_compiler, target), + &builder.sysroot_libdir(target_compiler, compiler.host), + &libtest_stamp(builder, compiler, target) + ); builder.cargo(target_compiler, Mode::ToolTest, target, "clean"); } @@ -496,8 +501,8 @@ impl Step for Rustc { return; } - // Ensure that build scripts have a std to link against. - builder.ensure(Std { + // Ensure that build scripts and proc macros have a std / libproc_macro to link against. + builder.ensure(Test { compiler: builder.compiler(self.compiler.stage, builder.config.build), target: builder.config.build, }); @@ -592,8 +597,12 @@ impl Step for RustcLink { &compiler.host, target_compiler.host, target)); - add_to_sysroot(builder, &builder.sysroot_libdir(target_compiler, target), - &librustc_stamp(builder, compiler, target)); + add_to_sysroot( + builder, + &builder.sysroot_libdir(target_compiler, target), + &builder.sysroot_libdir(target_compiler, compiler.host), + &librustc_stamp(builder, compiler, target) + ); builder.cargo(target_compiler, Mode::ToolRustc, target, "clean"); } } @@ -1015,10 +1024,20 @@ impl Step for Assemble { /// /// For a particular stage this will link the file listed in `stamp` into the /// `sysroot_dst` provided. -pub fn add_to_sysroot(builder: &Builder<'_>, sysroot_dst: &Path, stamp: &Path) { +pub fn add_to_sysroot( + builder: &Builder<'_>, + sysroot_dst: &Path, + sysroot_host_dst: &Path, + stamp: &Path +) { t!(fs::create_dir_all(&sysroot_dst)); - for path in builder.read_stamp_file(stamp) { - builder.copy(&path, &sysroot_dst.join(path.file_name().unwrap())); + t!(fs::create_dir_all(&sysroot_host_dst)); + for (path, host) in builder.read_stamp_file(stamp) { + if host { + builder.copy(&path, &sysroot_host_dst.join(path.file_name().unwrap())); + } else { + builder.copy(&path, &sysroot_dst.join(path.file_name().unwrap())); + } } } @@ -1047,8 +1066,14 @@ pub fn run_cargo(builder: &Builder<'_>, let mut deps = Vec::new(); let mut toplevel = Vec::new(); let ok = stream_cargo(builder, cargo, &mut |msg| { - let filenames = match msg { - CargoMessage::CompilerArtifact { filenames, .. } => filenames, + let (filenames, crate_types) = match msg { + CargoMessage::CompilerArtifact { + filenames, + target: CargoTarget { + crate_types, + }, + .. + } => (filenames, crate_types), _ => return, }; for filename in filenames { @@ -1063,15 +1088,19 @@ pub fn run_cargo(builder: &Builder<'_>, let filename = Path::new(&*filename); // If this was an output file in the "host dir" we don't actually - // worry about it, it's not relevant for us. + // worry about it, it's not relevant for us if filename.starts_with(&host_root_dir) { + // Unless it's a proc macro used in the compiler + if crate_types.iter().any(|t| t == "proc-macro") { + deps.push((filename.to_path_buf(), true)); + } continue; } // If this was output in the `deps` dir then this is a precise file // name (hash included) so we start tracking it. if filename.starts_with(&target_deps_dir) { - deps.push(filename.to_path_buf()); + deps.push((filename.to_path_buf(), false)); continue; } @@ -1124,10 +1153,10 @@ pub fn run_cargo(builder: &Builder<'_>, let candidate = format!("{}.lib", path_to_add); let candidate = PathBuf::from(candidate); if candidate.exists() { - deps.push(candidate); + deps.push((candidate, false)); } } - deps.push(path_to_add.into()); + deps.push((path_to_add.into(), false)); } // Now we want to update the contents of the stamp file, if necessary. First @@ -1140,12 +1169,13 @@ pub fn run_cargo(builder: &Builder<'_>, let mut new_contents = Vec::new(); let mut max = None; let mut max_path = None; - for dep in deps.iter() { + for (dep, proc_macro) in deps.iter() { let mtime = mtime(dep); if Some(mtime) > max { max = Some(mtime); max_path = Some(dep.clone()); } + new_contents.extend(if *proc_macro { b"h" } else { b"t" }); new_contents.extend(dep.to_str().unwrap().as_bytes()); new_contents.extend(b"\0"); } @@ -1157,7 +1187,7 @@ pub fn run_cargo(builder: &Builder<'_>, if contents_equal && max <= stamp_mtime { builder.verbose(&format!("not updating {:?}; contents equal and {:?} <= {:?}", stamp, max, stamp_mtime)); - return deps + return deps.into_iter().map(|(d, _)| d).collect() } if max > stamp_mtime { builder.verbose(&format!("updating {:?} as {:?} changed", stamp, max_path)); @@ -1165,7 +1195,7 @@ pub fn run_cargo(builder: &Builder<'_>, builder.verbose(&format!("updating {:?} as deps changed", stamp)); } t!(fs::write(&stamp, &new_contents)); - deps + deps.into_iter().map(|(d, _)| d).collect() } pub fn stream_cargo( @@ -1211,6 +1241,11 @@ pub fn stream_cargo( status.success() } +#[derive(Deserialize)] +pub struct CargoTarget<'a> { + crate_types: Vec>, +} + #[derive(Deserialize)] #[serde(tag = "reason", rename_all = "kebab-case")] pub enum CargoMessage<'a> { @@ -1218,6 +1253,7 @@ pub enum CargoMessage<'a> { package_id: Cow<'a, str>, features: Vec>, filenames: Vec>, + target: CargoTarget<'a>, }, BuildScriptExecuted { package_id: Cow<'a, str>, diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 7d3e584f1a6f..d20958854ed6 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -78,6 +78,7 @@ pub struct Config { pub llvm_link_jobs: Option, pub llvm_version_suffix: Option, pub llvm_use_linker: Option, + pub llvm_allow_old_toolchain: Option, pub lld_enabled: bool, pub lldb_enabled: bool, @@ -263,6 +264,7 @@ struct Llvm { ldflags: Option, use_libcxx: Option, use_linker: Option, + allow_old_toolchain: Option, } #[derive(Deserialize, Default, Clone)] @@ -530,6 +532,7 @@ impl Config { config.llvm_ldflags = llvm.ldflags.clone(); set(&mut config.llvm_use_libcxx, llvm.use_libcxx); config.llvm_use_linker = llvm.use_linker.clone(); + config.llvm_allow_old_toolchain = llvm.allow_old_toolchain.clone(); } if let Some(ref rust) = toml.rust { diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 2dae3f9135d8..2c40dd6d2961 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -904,6 +904,8 @@ impl Step for Src { "src/stdsimd", "src/libproc_macro", "src/tools/rustc-std-workspace-core", + "src/librustc", + "src/libsyntax", ]; copy_src_dirs(builder, &std_src_dirs[..], &[], &dst_src); diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 40f0e5ede8bd..e0ad0422a6ce 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -60,7 +60,7 @@ macro_rules! book { // NOTE: When adding a book here, make sure to ALSO build the book by // adding a build step in `src/bootstrap/builder.rs`! book!( - EditionGuide, "src/doc/edition-guide", "edition-guide", RustbookVersion::MdBook1; + EditionGuide, "src/doc/edition-guide", "edition-guide", RustbookVersion::MdBook2; EmbeddedBook, "src/doc/embedded-book", "embedded-book", RustbookVersion::MdBook2; Nomicon, "src/doc/nomicon", "nomicon", RustbookVersion::MdBook1; Reference, "src/doc/reference", "reference", RustbookVersion::MdBook1; diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 84e2c5aab54a..9317a40545ea 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -1129,7 +1129,7 @@ impl Build { ret } - fn read_stamp_file(&self, stamp: &Path) -> Vec { + fn read_stamp_file(&self, stamp: &Path) -> Vec<(PathBuf, bool)> { if self.config.dry_run { return Vec::new(); } @@ -1142,8 +1142,9 @@ impl Build { if part.is_empty() { continue } - let path = PathBuf::from(t!(str::from_utf8(part))); - paths.push(path); + let host = part[0] as char == 'h'; + let path = PathBuf::from(t!(str::from_utf8(&part[1..]))); + paths.push((path, host)); } paths } diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 192b1cd1fbb7..d78670cfe515 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -238,6 +238,10 @@ impl Step for Llvm { cfg.define("LLVM_USE_LINKER", linker); } + if let Some(true) = builder.config.llvm_allow_old_toolchain { + cfg.define("LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN", "YES"); + } + if let Some(ref python) = builder.config.python { cfg.define("PYTHON_EXECUTABLE", python); } diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs index ff4fb85bbfad..b9f456e91003 100644 --- a/src/bootstrap/sanity.rs +++ b/src/bootstrap/sanity.rs @@ -34,15 +34,17 @@ impl Finder { fn maybe_have>(&mut self, cmd: S) -> Option { let cmd: OsString = cmd.as_ref().into(); - let path = self.path.clone(); + let path = &self.path; self.cache.entry(cmd.clone()).or_insert_with(|| { - for path in env::split_paths(&path) { + for path in env::split_paths(path) { let target = path.join(&cmd); - let mut cmd_alt = cmd.clone(); - cmd_alt.push(".exe"); - if target.is_file() || // some/path/git - target.with_extension("exe").exists() || // some/path/git.exe - target.join(&cmd_alt).exists() { // some/path/git/git.exe + let mut cmd_exe = cmd.clone(); + cmd_exe.push(".exe"); + + if target.is_file() // some/path/git + || path.join(&cmd_exe).exists() // some/path/git.exe + || target.join(&cmd_exe).exists() // some/path/git/git.exe + { return Some(target); } } @@ -107,9 +109,9 @@ pub fn check(build: &mut Build) { } build.config.python = build.config.python.take().map(|p| cmd_finder.must_have(p)) - .or_else(|| env::var_os("BOOTSTRAP_PYTHON").map(PathBuf::from)) // set by bootstrap.py .or_else(|| cmd_finder.maybe_have("python2.7")) .or_else(|| cmd_finder.maybe_have("python2")) + .or_else(|| env::var_os("BOOTSTRAP_PYTHON").map(PathBuf::from)) // set by bootstrap.py .or_else(|| Some(cmd_finder.must_have("python"))); build.config.nodejs = build.config.nodejs.take().map(|p| cmd_finder.must_have(p)) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 9cd2f95d752e..cb66eb238b34 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -574,12 +574,52 @@ impl Step for RustdocTheme { } #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub struct RustdocJS { +pub struct RustdocJSStd { pub host: Interned, pub target: Interned, } -impl Step for RustdocJS { +impl Step for RustdocJSStd { + type Output = (); + const DEFAULT: bool = true; + const ONLY_HOSTS: bool = true; + + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { + run.path("src/test/rustdoc-js-std") + } + + fn make_run(run: RunConfig<'_>) { + run.builder.ensure(RustdocJSStd { + host: run.host, + target: run.target, + }); + } + + fn run(self, builder: &Builder<'_>) { + if let Some(ref nodejs) = builder.config.nodejs { + let mut command = Command::new(nodejs); + command.args(&["src/tools/rustdoc-js-std/tester.js", &*self.host]); + builder.ensure(crate::doc::Std { + target: self.target, + stage: builder.top_stage, + }); + builder.run(&mut command); + } else { + builder.info( + "No nodejs found, skipping \"src/test/rustdoc-js-std\" tests" + ); + } + } +} + +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub struct RustdocJSNotStd { + pub host: Interned, + pub target: Interned, + pub compiler: Compiler, +} + +impl Step for RustdocJSNotStd { type Output = (); const DEFAULT: bool = true; const ONLY_HOSTS: bool = true; @@ -589,21 +629,24 @@ impl Step for RustdocJS { } fn make_run(run: RunConfig<'_>) { - run.builder.ensure(RustdocJS { + let compiler = run.builder.compiler(run.builder.top_stage, run.host); + run.builder.ensure(RustdocJSNotStd { host: run.host, target: run.target, + compiler, }); } fn run(self, builder: &Builder<'_>) { - if let Some(ref nodejs) = builder.config.nodejs { - let mut command = Command::new(nodejs); - command.args(&["src/tools/rustdoc-js/tester.js", &*self.host]); - builder.ensure(crate::doc::Std { + if builder.config.nodejs.is_some() { + builder.ensure(Compiletest { + compiler: self.compiler, target: self.target, - stage: builder.top_stage, + mode: "js-doc-test", + suite: "rustdoc-js", + path: None, + compare_mode: None, }); - builder.run(&mut command); } else { builder.info( "No nodejs found, skipping \"src/test/rustdoc-js\" tests" @@ -996,12 +1039,13 @@ impl Step for Compiletest { .arg(builder.sysroot_libdir(compiler, target)); cmd.arg("--rustc-path").arg(builder.rustc(compiler)); - let is_rustdoc_ui = suite.ends_with("rustdoc-ui"); + let is_rustdoc = suite.ends_with("rustdoc-ui") || suite.ends_with("rustdoc-js"); // Avoid depending on rustdoc when we don't need it. if mode == "rustdoc" || (mode == "run-make" && suite.ends_with("fulldeps")) - || (mode == "ui" && is_rustdoc_ui) + || (mode == "ui" && is_rustdoc) + || mode == "js-doc-test" { cmd.arg("--rustdoc-path") .arg(builder.rustdoc(compiler.host)); @@ -1035,12 +1079,12 @@ impl Step for Compiletest { cmd.arg("--nodejs").arg(nodejs); } - let mut flags = if is_rustdoc_ui { + let mut flags = if is_rustdoc { Vec::new() } else { vec!["-Crpath".to_string()] }; - if !is_rustdoc_ui { + if !is_rustdoc { if builder.config.rust_optimize_tests { flags.push("-O".to_string()); } diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index fc1a17d54667..9dbcacf70262 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -91,7 +91,8 @@ impl Step for ToolBuild { compile::CargoMessage::CompilerArtifact { package_id, features, - filenames + filenames, + target: _, } => { (package_id, features, filenames) } diff --git a/src/ci/docker/dist-x86_64-netbsd/Dockerfile b/src/ci/docker/dist-x86_64-netbsd/Dockerfile index a17a7ebc03dd..44b1aaa24b19 100644 --- a/src/ci/docker/dist-x86_64-netbsd/Dockerfile +++ b/src/ci/docker/dist-x86_64-netbsd/Dockerfile @@ -3,23 +3,8 @@ FROM ubuntu:16.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -# Ubuntu 16.04 (this container) ships with make 4, but something in the -# toolchains we build below chokes on that, so go back to make 3 -COPY scripts/make3.sh /scripts/ -RUN sh /scripts/make3.sh - -COPY scripts/crosstool-ng.sh /scripts/ -RUN sh /scripts/crosstool-ng.sh - -COPY scripts/rustbuild-setup.sh /scripts/ -RUN sh /scripts/rustbuild-setup.sh -USER rustbuild -WORKDIR /tmp - COPY dist-x86_64-netbsd/build-netbsd-toolchain.sh /tmp/ -RUN ./build-netbsd-toolchain.sh - -USER root +RUN /tmp/build-netbsd-toolchain.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/dist-x86_64-netbsd/build-netbsd-toolchain.sh b/src/ci/docker/dist-x86_64-netbsd/build-netbsd-toolchain.sh index ac92d68a1f50..b5377c64b1f5 100755 --- a/src/ci/docker/dist-x86_64-netbsd/build-netbsd-toolchain.sh +++ b/src/ci/docker/dist-x86_64-netbsd/build-netbsd-toolchain.sh @@ -28,15 +28,15 @@ mkdir -p /x-tools/x86_64-unknown-netbsd/sysroot URL=https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror # Originally from ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-$BSD/source/sets/*.tgz -curl $URL/2017-03-17-netbsd-src.tgz | tar xzf - -curl $URL/2017-03-17-netbsd-gnusrc.tgz | tar xzf - -curl $URL/2017-03-17-netbsd-sharesrc.tgz | tar xzf - -curl $URL/2017-03-17-netbsd-syssrc.tgz | tar xzf - +curl $URL/2018-03-01-netbsd-src.tgz | tar xzf - +curl $URL/2018-03-01-netbsd-gnusrc.tgz | tar xzf - +curl $URL/2018-03-01-netbsd-sharesrc.tgz | tar xzf - +curl $URL/2018-03-01-netbsd-syssrc.tgz | tar xzf - # Originally from ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-$BSD/amd64/binary/sets/*.tgz -curl $URL/2017-03-17-netbsd-base.tgz | \ +curl $URL/2018-03-01-netbsd-base.tgz | \ tar xzf - -C /x-tools/x86_64-unknown-netbsd/sysroot ./usr/include ./usr/lib ./lib -curl $URL/2017-03-17-netbsd-comp.tgz | \ +curl $URL/2018-03-01-netbsd-comp.tgz | \ tar xzf - -C /x-tools/x86_64-unknown-netbsd/sysroot ./usr/include ./usr/lib cd usr/src diff --git a/src/ci/docker/i686-gnu/Dockerfile b/src/ci/docker/i686-gnu/Dockerfile index daa24e0e8186..17441ddb4546 100644 --- a/src/ci/docker/i686-gnu/Dockerfile +++ b/src/ci/docker/i686-gnu/Dockerfile @@ -18,4 +18,10 @@ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh ENV RUST_CONFIGURE_ARGS --build=i686-unknown-linux-gnu -ENV SCRIPT python2.7 ../x.py test +# Exclude some tests that are unlikely to be platform specific, to speed up +# this slow job. +ENV SCRIPT python2.7 ../x.py test \ + --exclude src/bootstrap \ + --exclude src/test/rustdoc-js \ + --exclude src/tools/error_index_generator \ + --exclude src/tools/linkchecker diff --git a/src/doc/book b/src/doc/book index 0e9061cbaf95..9cffbeabec3b 160000 --- a/src/doc/book +++ b/src/doc/book @@ -1 +1 @@ -Subproject commit 0e9061cbaf95adfb9f3ed36c6cef4c046f282e86 +Subproject commit 9cffbeabec3bcec42d09432bfe7705125c848889 diff --git a/src/doc/edition-guide b/src/doc/edition-guide index 419edb885ec1..aa0022c87590 160000 --- a/src/doc/edition-guide +++ b/src/doc/edition-guide @@ -1 +1 @@ -Subproject commit 419edb885ec1a98c0747b3907003d79e3e6b93a9 +Subproject commit aa0022c875907886cae8f3ef8e9ebf6e2a5e728d diff --git a/src/doc/embedded-book b/src/doc/embedded-book index bd2778f30498..9e656ead82bf 160000 --- a/src/doc/embedded-book +++ b/src/doc/embedded-book @@ -1 +1 @@ -Subproject commit bd2778f304989ee52be8201504d6ec621dd60ca9 +Subproject commit 9e656ead82bfe869493dec82653a52e27fa6a05c diff --git a/src/doc/nomicon b/src/doc/nomicon index b7eb4a087207..f1ff93b66844 160000 --- a/src/doc/nomicon +++ b/src/doc/nomicon @@ -1 +1 @@ -Subproject commit b7eb4a087207af2405c0669fa577f8545b894c66 +Subproject commit f1ff93b66844493a7b03101c7df66ac958c62418 diff --git a/src/doc/reference b/src/doc/reference index 1c775a1dc5e2..41493ffce5d0 160000 --- a/src/doc/reference +++ b/src/doc/reference @@ -1 +1 @@ -Subproject commit 1c775a1dc5e29bc44b36604b510d6196d98077fa +Subproject commit 41493ffce5d0e17d54eaf5ec9a995054e2b9aece diff --git a/src/doc/rustdoc/src/unstable-features.md b/src/doc/rustdoc/src/unstable-features.md index 3463cdb126cc..3938df1a6826 100644 --- a/src/doc/rustdoc/src/unstable-features.md +++ b/src/doc/rustdoc/src/unstable-features.md @@ -53,7 +53,7 @@ For example, in the following code: ```rust /// Does the thing. pub fn do_the_thing(_: SomeType) { - println!("Let's do the thing!"); + println!("Let's do the thing!"); } /// Token you use to [`do_the_thing`]. @@ -66,15 +66,15 @@ target out also works: ```rust pub mod some_module { - /// Token you use to do the thing. - pub struct SomeStruct; + /// Token you use to do the thing. + pub struct SomeStruct; } /// Does the thing. Requires one [`SomeStruct`] for the thing to work. /// /// [`SomeStruct`]: some_module::SomeStruct pub fn do_the_thing(_: some_module::SomeStruct) { - println!("Let's do the thing!"); + println!("Let's do the thing!"); } ``` @@ -428,3 +428,30 @@ $ rustdoc src/lib.rs --test -Z unstable-options --persist-doctests target/rustdo This flag allows you to keep doctest executables around after they're compiled or run. Usually, rustdoc will immediately discard a compiled doctest after it's been tested, but with this option, you can keep those binaries around for farther testing. + +### `--show-coverage`: calculate the percentage of items with documentation + +Using this flag looks like this: + +```bash +$ rustdoc src/lib.rs -Z unstable-options --show-coverage +``` + +If you want to determine how many items in your crate are documented, pass this flag to rustdoc. +When it receives this flag, it will count the public items in your crate that have documentation, +and print out the counts and a percentage instead of generating docs. + +Some methodology notes about what rustdoc counts in this metric: + +* Rustdoc will only count items from your crate (i.e. items re-exported from other crates don't + count). +* Docs written directly onto inherent impl blocks are not counted, even though their doc comments + are displayed, because the common pattern in Rust code is to write all inherent methods into the + same impl block. +* Items in a trait implementation are not counted, as those impls will inherit any docs from the + trait itself. +* By default, only public items are counted. To count private items as well, pass + `--document-private-items` at the same time. + +Public items that are not documented can be seen with the built-in `missing_docs` lint. Private +items that are not documented can be seen with Clippy's `missing_docs_in_private_items` lint. diff --git a/src/doc/unstable-book/src/language-features/c-variadic.md b/src/doc/unstable-book/src/language-features/c-variadic.md new file mode 100644 index 000000000000..9e7968d906fb --- /dev/null +++ b/src/doc/unstable-book/src/language-features/c-variadic.md @@ -0,0 +1,24 @@ +# `c_variadic` + +The tracking issue for this feature is: [#44930] + +[#44930]: https://github.com/rust-lang/rust/issues/44930 + +------------------------ + +The `c_variadic` language feature enables C-variadic functions to be +defined in Rust. The may be called both from within Rust and via FFI. + +## Examples + +```rust +#![feature(c_variadic)] + +pub unsafe extern "C" fn add(n: usize, mut args: ...) -> usize { + let mut sum = 0; + for _ in 0..n { + sum += args.arg::(); + } + sum +} +``` diff --git a/src/doc/unstable-book/src/library-features/c-variadic.md b/src/doc/unstable-book/src/library-features/c-variadic.md new file mode 100644 index 000000000000..77762116e6b1 --- /dev/null +++ b/src/doc/unstable-book/src/library-features/c-variadic.md @@ -0,0 +1,26 @@ +# `c_variadic` + +The tracking issue for this feature is: [#44930] + +[#44930]: https://github.com/rust-lang/rust/issues/44930 + +------------------------ + +The `c_variadic` library feature exposes the `VaList` structure, +Rust's analogue of C's `va_list` type. + +## Examples + +```rust +#![feature(c_variadic)] + +use std::ffi::VaList; + +pub unsafe extern "C" fn vadd(n: usize, mut args: VaList) -> usize { + let mut sum = 0; + for _ in 0..n { + sum += args.arg::(); + } + sum +} +``` diff --git a/src/etc/lldb_rust_formatters.py b/src/etc/lldb_rust_formatters.py index 2c651c90f82e..fdc1c4fa0cc3 100644 --- a/src/etc/lldb_rust_formatters.py +++ b/src/etc/lldb_rust_formatters.py @@ -290,6 +290,8 @@ def print_array_of_values(array_name, data_ptr_val, length, internal_dict): def read_utf8_string(ptr_val, byte_count): + if byte_count == 0: + return '""' error = lldb.SBError() process = ptr_val.get_wrapped_value().GetProcess() data = process.ReadMemory(ptr_val.as_integer(), byte_count, error) diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 74325a69e15e..9bce142b483f 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -489,7 +489,7 @@ impl From> for Pin> { } #[stable(feature = "box_from_slice", since = "1.17.0")] -impl<'a, T: Copy> From<&'a [T]> for Box<[T]> { +impl From<&[T]> for Box<[T]> { /// Converts a `&[T]` into a `Box<[T]>` /// /// This conversion allocates on the heap @@ -503,7 +503,7 @@ impl<'a, T: Copy> From<&'a [T]> for Box<[T]> { /// /// println!("{:?}", boxed_slice); /// ``` - fn from(slice: &'a [T]) -> Box<[T]> { + fn from(slice: &[T]) -> Box<[T]> { let mut boxed = unsafe { RawVec::with_capacity(slice.len()).into_box() }; boxed.copy_from_slice(slice); boxed @@ -511,7 +511,7 @@ impl<'a, T: Copy> From<&'a [T]> for Box<[T]> { } #[stable(feature = "box_from_slice", since = "1.17.0")] -impl<'a> From<&'a str> for Box { +impl From<&str> for Box { /// Converts a `&str` into a `Box` /// /// This conversion allocates on the heap @@ -523,7 +523,7 @@ impl<'a> From<&'a str> for Box { /// println!("{}", boxed); /// ``` #[inline] - fn from(s: &'a str) -> Box { + fn from(s: &str) -> Box { unsafe { from_boxed_utf8_unchecked(Box::from(s.as_bytes())) } } } diff --git a/src/liballoc/macros.rs b/src/liballoc/macros.rs index eb3410078513..dd128e096f95 100644 --- a/src/liballoc/macros.rs +++ b/src/liballoc/macros.rs @@ -34,8 +34,7 @@ #[cfg(not(test))] #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] -#[cfg_attr(not(stage0), allow_internal_unstable(box_syntax))] -#[cfg_attr(stage0, allow_internal_unstable)] +#[allow_internal_unstable(box_syntax)] macro_rules! vec { ($elem:expr; $n:expr) => ( $crate::vec::from_elem($elem, $n) diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 12f75d84211e..68eecd97ea11 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -1145,7 +1145,7 @@ impl From for Rc { } #[stable(feature = "shared_from_slice", since = "1.21.0")] -impl<'a, T: Clone> From<&'a [T]> for Rc<[T]> { +impl From<&[T]> for Rc<[T]> { #[inline] fn from(v: &[T]) -> Rc<[T]> { >::from_slice(v) @@ -1153,7 +1153,7 @@ impl<'a, T: Clone> From<&'a [T]> for Rc<[T]> { } #[stable(feature = "shared_from_slice", since = "1.21.0")] -impl<'a> From<&'a str> for Rc { +impl From<&str> for Rc { #[inline] fn from(v: &str) -> Rc { let rc = Rc::<[u8]>::from(v.as_bytes()); diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index 84c35c6f1bd2..a3e2098695f7 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -486,7 +486,7 @@ impl String { /// [`str::from_utf8`]: ../../std/str/fn.from_utf8.html /// [`as_bytes`]: struct.String.html#method.as_bytes /// [`FromUtf8Error`]: struct.FromUtf8Error.html - /// [`Err`]: ../../stdresult/enum.Result.html#variant.Err + /// [`Err`]: ../../std/result/enum.Result.html#variant.Err #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn from_utf8(vec: Vec) -> Result { @@ -2073,48 +2073,17 @@ impl ops::DerefMut for String { /// [`String`]: struct.String.html /// [`from_str`]: ../../std/str/trait.FromStr.html#tymethod.from_str #[stable(feature = "str_parse_error", since = "1.5.0")] -#[derive(Copy)] -pub enum ParseError {} +pub type ParseError = core::convert::Infallible; #[stable(feature = "rust1", since = "1.0.0")] impl FromStr for String { - type Err = ParseError; + type Err = core::convert::Infallible; #[inline] fn from_str(s: &str) -> Result { Ok(String::from(s)) } } -#[stable(feature = "str_parse_error", since = "1.5.0")] -impl Clone for ParseError { - fn clone(&self) -> ParseError { - match *self {} - } -} - -#[stable(feature = "str_parse_error", since = "1.5.0")] -impl fmt::Debug for ParseError { - fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result { - match *self {} - } -} - -#[stable(feature = "str_parse_error2", since = "1.8.0")] -impl fmt::Display for ParseError { - fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result { - match *self {} - } -} - -#[stable(feature = "str_parse_error", since = "1.5.0")] -impl PartialEq for ParseError { - fn eq(&self, _: &ParseError) -> bool { - match *self {} - } -} - -#[stable(feature = "str_parse_error", since = "1.5.0")] -impl Eq for ParseError {} /// A trait for converting a value to a `String`. /// @@ -2203,9 +2172,9 @@ impl AsRef<[u8]> for String { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a> From<&'a str> for String { +impl From<&str> for String { #[inline] - fn from(s: &'a str) -> String { + fn from(s: &str) -> String { s.to_owned() } } diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 229dafc5fdc3..cd62c3e05244 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -1260,7 +1260,7 @@ impl Vec { /// This method uses a closure to create new values on every push. If /// you'd rather [`Clone`] a given value, use [`resize`]. If you want /// to use the [`Default`] trait to generate values, you can pass - /// [`Default::default()`] as the second argument.. + /// [`Default::default()`] as the second argument. /// /// # Examples /// @@ -2182,25 +2182,25 @@ impl AsMut<[T]> for Vec { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T: Clone> From<&'a [T]> for Vec { +impl From<&[T]> for Vec { #[cfg(not(test))] - fn from(s: &'a [T]) -> Vec { + fn from(s: &[T]) -> Vec { s.to_vec() } #[cfg(test)] - fn from(s: &'a [T]) -> Vec { + fn from(s: &[T]) -> Vec { crate::slice::to_vec(s) } } #[stable(feature = "vec_from_mut", since = "1.19.0")] -impl<'a, T: Clone> From<&'a mut [T]> for Vec { +impl From<&mut [T]> for Vec { #[cfg(not(test))] - fn from(s: &'a mut [T]) -> Vec { + fn from(s: &mut [T]) -> Vec { s.to_vec() } #[cfg(test)] - fn from(s: &'a mut [T]) -> Vec { + fn from(s: &mut [T]) -> Vec { crate::slice::to_vec(s) } } @@ -2231,8 +2231,8 @@ impl From> for Box<[T]> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a> From<&'a str> for Vec { - fn from(s: &'a str) -> Vec { +impl From<&str> for Vec { + fn from(s: &str) -> Vec { From::from(s.as_bytes()) } } @@ -2468,6 +2468,25 @@ impl fmt::Debug for Drain<'_, T> { } } +impl<'a, T> Drain<'a, T> { + /// Returns the remaining items of this iterator as a slice. + /// + /// # Examples + /// + /// ``` + /// # #![feature(vec_drain_as_slice)] + /// let mut vec = vec!['a', 'b', 'c']; + /// let mut drain = vec.drain(..); + /// assert_eq!(drain.as_slice(), &['a', 'b', 'c']); + /// let _ = drain.next().unwrap(); + /// assert_eq!(drain.as_slice(), &['b', 'c']); + /// ``` + #[unstable(feature = "vec_drain_as_slice", reason = "recently added", issue = "58957")] + pub fn as_slice(&self) -> &[T] { + self.iter.as_slice() + } +} + #[stable(feature = "drain", since = "1.6.0")] unsafe impl Sync for Drain<'_, T> {} #[stable(feature = "drain", since = "1.6.0")] diff --git a/src/libcore/array.rs b/src/libcore/array.rs index 3a27a39af4ac..dcd9ce6dad75 100644 --- a/src/libcore/array.rs +++ b/src/libcore/array.rs @@ -49,7 +49,7 @@ unsafe impl> FixedSizeArray for A { } /// The error type returned when a conversion from a slice to an array fails. -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] #[derive(Debug, Copy, Clone)] pub struct TryFromSliceError(()); @@ -138,8 +138,8 @@ macro_rules! array_impls { } } - #[unstable(feature = "try_from", issue = "33417")] - impl<'a, T> TryFrom<&'a [T]> for [T; $N] where T: Copy { + #[stable(feature = "try_from", since = "1.34.0")] + impl TryFrom<&[T]> for [T; $N] where T: Copy { type Error = TryFromSliceError; fn try_from(slice: &[T]) -> Result<[T; $N], TryFromSliceError> { @@ -147,7 +147,7 @@ macro_rules! array_impls { } } - #[unstable(feature = "try_from", issue = "33417")] + #[stable(feature = "try_from", since = "1.34.0")] impl<'a, T> TryFrom<&'a [T]> for &'a [T; $N] { type Error = TryFromSliceError; @@ -161,7 +161,7 @@ macro_rules! array_impls { } } - #[unstable(feature = "try_from", issue = "33417")] + #[stable(feature = "try_from", since = "1.34.0")] impl<'a, T> TryFrom<&'a mut [T]> for &'a mut [T; $N] { type Error = TryFromSliceError; diff --git a/src/libcore/benches/iter.rs b/src/libcore/benches/iter.rs index fe852e42b5cd..825bd368bdf1 100644 --- a/src/libcore/benches/iter.rs +++ b/src/libcore/benches/iter.rs @@ -35,7 +35,7 @@ fn scatter(x: i32) -> i32 { (x * 31) % 127 } fn bench_max_by_key(b: &mut Bencher) { b.iter(|| { let it = 0..100; - it.max_by_key(|&x| scatter(x)) + it.map(black_box).max_by_key(|&x| scatter(x)) }) } @@ -56,7 +56,7 @@ fn bench_max_by_key2(b: &mut Bencher) { fn bench_max(b: &mut Bencher) { b.iter(|| { let it = 0..100; - it.map(scatter).max() + it.map(black_box).map(scatter).max() }) } @@ -185,13 +185,13 @@ bench_sums! { bench_sums! { bench_filter_sum, bench_filter_ref_sum, - (0i64..1000000).filter(|x| x % 2 == 0) + (0i64..1000000).filter(|x| x % 3 == 0) } bench_sums! { bench_filter_chain_sum, bench_filter_chain_ref_sum, - (0i64..1000000).chain(0..1000000).filter(|x| x % 2 == 0) + (0i64..1000000).chain(0..1000000).filter(|x| x % 3 == 0) } bench_sums! { @@ -306,3 +306,31 @@ fn bench_skip_then_zip(b: &mut Bencher) { assert_eq!(s, 2009900); }); } + +#[bench] +fn bench_filter_count(b: &mut Bencher) { + b.iter(|| { + (0i64..1000000).map(black_box).filter(|x| x % 3 == 0).count() + }) +} + +#[bench] +fn bench_filter_ref_count(b: &mut Bencher) { + b.iter(|| { + (0i64..1000000).map(black_box).by_ref().filter(|x| x % 3 == 0).count() + }) +} + +#[bench] +fn bench_filter_chain_count(b: &mut Bencher) { + b.iter(|| { + (0i64..1000000).chain(0..1000000).map(black_box).filter(|x| x % 3 == 0).count() + }) +} + +#[bench] +fn bench_filter_chain_ref_count(b: &mut Bencher) { + b.iter(|| { + (0i64..1000000).chain(0..1000000).map(black_box).by_ref().filter(|x| x % 3 == 0).count() + }) +} diff --git a/src/libcore/char/convert.rs b/src/libcore/char/convert.rs index 4a1a236b669f..6a5abfb408f5 100644 --- a/src/libcore/char/convert.rs +++ b/src/libcore/char/convert.rs @@ -218,7 +218,7 @@ impl FromStr for char { } -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] impl TryFrom for char { type Error = CharTryFromError; @@ -233,11 +233,11 @@ impl TryFrom for char { } /// The error type returned when a conversion from u32 to char fails. -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub struct CharTryFromError(()); -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] impl fmt::Display for CharTryFromError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { "converted integer out of range for `char`".fmt(f) diff --git a/src/libcore/char/mod.rs b/src/libcore/char/mod.rs index 15e153bdfada..f3369c4d9401 100644 --- a/src/libcore/char/mod.rs +++ b/src/libcore/char/mod.rs @@ -30,7 +30,7 @@ pub use self::convert::{from_u32, from_digit}; pub use self::convert::from_u32_unchecked; #[stable(feature = "char_from_str", since = "1.20.0")] pub use self::convert::ParseCharError; -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] pub use self::convert::CharTryFromError; #[stable(feature = "decode_utf16", since = "1.9.0")] pub use self::decode::{decode_utf16, DecodeUtf16, DecodeUtf16Error}; diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index 81fcdeee12d2..94bed3708369 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -1004,26 +1004,26 @@ mod impls { // & pointers #[stable(feature = "rust1", since = "1.0.0")] - impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b B> for &'a A where A: PartialEq { + impl PartialEq<&B> for &A where A: PartialEq { #[inline] - fn eq(&self, other: & &'b B) -> bool { PartialEq::eq(*self, *other) } + fn eq(&self, other: & &B) -> bool { PartialEq::eq(*self, *other) } #[inline] - fn ne(&self, other: & &'b B) -> bool { PartialEq::ne(*self, *other) } + fn ne(&self, other: & &B) -> bool { PartialEq::ne(*self, *other) } } #[stable(feature = "rust1", since = "1.0.0")] - impl<'a, 'b, A: ?Sized, B: ?Sized> PartialOrd<&'b B> for &'a A where A: PartialOrd { + impl PartialOrd<&B> for &A where A: PartialOrd { #[inline] - fn partial_cmp(&self, other: &&'b B) -> Option { + fn partial_cmp(&self, other: &&B) -> Option { PartialOrd::partial_cmp(*self, *other) } #[inline] - fn lt(&self, other: & &'b B) -> bool { PartialOrd::lt(*self, *other) } + fn lt(&self, other: & &B) -> bool { PartialOrd::lt(*self, *other) } #[inline] - fn le(&self, other: & &'b B) -> bool { PartialOrd::le(*self, *other) } + fn le(&self, other: & &B) -> bool { PartialOrd::le(*self, *other) } #[inline] - fn ge(&self, other: & &'b B) -> bool { PartialOrd::ge(*self, *other) } + fn ge(&self, other: & &B) -> bool { PartialOrd::ge(*self, *other) } #[inline] - fn gt(&self, other: & &'b B) -> bool { PartialOrd::gt(*self, *other) } + fn gt(&self, other: & &B) -> bool { PartialOrd::gt(*self, *other) } } #[stable(feature = "rust1", since = "1.0.0")] impl Ord for &A where A: Ord { @@ -1036,26 +1036,26 @@ mod impls { // &mut pointers #[stable(feature = "rust1", since = "1.0.0")] - impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b mut B> for &'a mut A where A: PartialEq { + impl PartialEq<&mut B> for &mut A where A: PartialEq { #[inline] - fn eq(&self, other: &&'b mut B) -> bool { PartialEq::eq(*self, *other) } + fn eq(&self, other: &&mut B) -> bool { PartialEq::eq(*self, *other) } #[inline] - fn ne(&self, other: &&'b mut B) -> bool { PartialEq::ne(*self, *other) } + fn ne(&self, other: &&mut B) -> bool { PartialEq::ne(*self, *other) } } #[stable(feature = "rust1", since = "1.0.0")] - impl<'a, 'b, A: ?Sized, B: ?Sized> PartialOrd<&'b mut B> for &'a mut A where A: PartialOrd { + impl PartialOrd<&mut B> for &mut A where A: PartialOrd { #[inline] - fn partial_cmp(&self, other: &&'b mut B) -> Option { + fn partial_cmp(&self, other: &&mut B) -> Option { PartialOrd::partial_cmp(*self, *other) } #[inline] - fn lt(&self, other: &&'b mut B) -> bool { PartialOrd::lt(*self, *other) } + fn lt(&self, other: &&mut B) -> bool { PartialOrd::lt(*self, *other) } #[inline] - fn le(&self, other: &&'b mut B) -> bool { PartialOrd::le(*self, *other) } + fn le(&self, other: &&mut B) -> bool { PartialOrd::le(*self, *other) } #[inline] - fn ge(&self, other: &&'b mut B) -> bool { PartialOrd::ge(*self, *other) } + fn ge(&self, other: &&mut B) -> bool { PartialOrd::ge(*self, *other) } #[inline] - fn gt(&self, other: &&'b mut B) -> bool { PartialOrd::gt(*self, *other) } + fn gt(&self, other: &&mut B) -> bool { PartialOrd::gt(*self, *other) } } #[stable(feature = "rust1", since = "1.0.0")] impl Ord for &mut A where A: Ord { @@ -1066,18 +1066,18 @@ mod impls { impl Eq for &mut A where A: Eq {} #[stable(feature = "rust1", since = "1.0.0")] - impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b mut B> for &'a A where A: PartialEq { + impl PartialEq<&mut B> for &A where A: PartialEq { #[inline] - fn eq(&self, other: &&'b mut B) -> bool { PartialEq::eq(*self, *other) } + fn eq(&self, other: &&mut B) -> bool { PartialEq::eq(*self, *other) } #[inline] - fn ne(&self, other: &&'b mut B) -> bool { PartialEq::ne(*self, *other) } + fn ne(&self, other: &&mut B) -> bool { PartialEq::ne(*self, *other) } } #[stable(feature = "rust1", since = "1.0.0")] - impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b B> for &'a mut A where A: PartialEq { + impl PartialEq<&B> for &mut A where A: PartialEq { #[inline] - fn eq(&self, other: &&'b B) -> bool { PartialEq::eq(*self, *other) } + fn eq(&self, other: &&B) -> bool { PartialEq::eq(*self, *other) } #[inline] - fn ne(&self, other: &&'b B) -> bool { PartialEq::ne(*self, *other) } + fn ne(&self, other: &&B) -> bool { PartialEq::ne(*self, *other) } } } diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index b8d751cfbb6d..774d648558b4 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -41,6 +41,8 @@ #![stable(feature = "rust1", since = "1.0.0")] +use fmt; + /// An identity function. /// /// Two things are important to note about this function: @@ -359,30 +361,88 @@ pub trait From: Sized { /// An attempted conversion that consumes `self`, which may or may not be /// expensive. /// -/// Library authors should not directly implement this trait, but should prefer -/// implementing the [`TryFrom`] trait, which offers greater flexibility and -/// provides an equivalent `TryInto` implementation for free, thanks to a -/// blanket implementation in the standard library. For more information on this, -/// see the documentation for [`Into`]. +/// Library authors should usually not directly implement this trait, +/// but should prefer implementing the [`TryFrom`] trait, which offers +/// greater flexibility and provides an equivalent `TryInto` +/// implementation for free, thanks to a blanket implementation in the +/// standard library. For more information on this, see the +/// documentation for [`Into`]. +/// +/// # Implementing `TryInto` +/// +/// This suffers the same restrictions and reasoning as implementing +/// [`Into`], see there for details. /// /// [`TryFrom`]: trait.TryFrom.html /// [`Into`]: trait.Into.html -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] pub trait TryInto: Sized { /// The type returned in the event of a conversion error. + #[stable(feature = "try_from", since = "1.34.0")] type Error; /// Performs the conversion. + #[stable(feature = "try_from", since = "1.34.0")] fn try_into(self) -> Result; } -/// Attempt to construct `Self` via a conversion. -#[unstable(feature = "try_from", issue = "33417")] +/// Simple and safe type conversions that may fail in a controlled +/// way under some circumstances. It is the reciprocal of [`TryInto`]. +/// +/// This is useful when you are doing a type conversion that may +/// trivially succeed but may also need special handling. +/// For example, there is no way to convert an `i64` into an `i32` +/// using the [`From`] trait, because an `i64` may contain a value +/// that an `i32` cannot represent and so the conversion would lose data. +/// This might be handled by truncating the `i64` to an `i32` (essentially +/// giving the `i64`'s value modulo `i32::MAX`) or by simply returning +/// `i32::MAX`, or by some other method. The `From` trait is intended +/// for perfect conversions, so the `TryFrom` trait informs the +/// programmer when a type conversion could go bad and lets them +/// decide how to handle it. +/// +/// # Generic Implementations +/// +/// - `TryFrom for U` implies [`TryInto`]` for T` +/// - [`try_from`] is reflexive, which means that `TryFrom for T` +/// is implemented and cannot fail -- the associated `Error` type for +/// calling `T::try_from()` on a value of type `T` is `Infallible`. +/// When the `!` type is stablized `Infallible` and `!` will be +/// equivalent. +/// +/// # Examples +/// +/// As described, [`i32`] implements `TryFrom`: +/// +/// ``` +/// use std::convert::TryFrom; +/// +/// let big_number = 1_000_000_000_000i64; +/// // Silently truncates `big_number`, requires detecting +/// // and handling the truncation after the fact. +/// let smaller_number = big_number as i32; +/// assert_eq!(smaller_number, -727379968); +/// +/// // Returns an error because `big_number` is too big to +/// // fit in an `i32`. +/// let try_smaller_number = i32::try_from(big_number); +/// assert!(try_smaller_number.is_err()); +/// +/// // Returns `Ok(3)`. +/// let try_successful_smaller_number = i32::try_from(3); +/// assert!(try_successful_smaller_number.is_ok()); +/// ``` +/// +/// [`try_from`]: trait.TryFrom.html#tymethod.try_from +/// [`TryInto`]: trait.TryInto.html +#[stable(feature = "try_from", since = "1.34.0")] pub trait TryFrom: Sized { /// The type returned in the event of a conversion error. + #[stable(feature = "try_from", since = "1.34.0")] type Error; /// Performs the conversion. + #[stable(feature = "try_from", since = "1.34.0")] fn try_from(value: T) -> Result; } @@ -450,7 +510,7 @@ impl From for T { // TryFrom implies TryInto -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] impl TryInto for T where U: TryFrom { type Error = U::Error; @@ -462,9 +522,9 @@ impl TryInto for T where U: TryFrom // Infallible conversions are semantically equivalent to fallible conversions // with an uninhabited error type. -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] impl TryFrom for T where U: Into { - type Error = !; + type Error = Infallible; fn try_from(value: U) -> Result { Ok(U::into(value)) @@ -496,3 +556,115 @@ impl AsRef for str { self } } + +//////////////////////////////////////////////////////////////////////////////// +// THE NO-ERROR ERROR TYPE +//////////////////////////////////////////////////////////////////////////////// + +/// The error type for errors that can never happen. +/// +/// Since this enum has no variant, a value of this type can never actually exist. +/// This can be useful for generic APIs that use [`Result`] and parameterize the error type, +/// to indicate that the result is always [`Ok`]. +/// +/// For example, the [`TryFrom`] trait (conversion that returns a [`Result`]) +/// has a blanket implementation for all types where a reverse [`Into`] implementation exists. +/// +/// ```ignore (illustrates std code, duplicating the impl in a doctest would be an error) +/// impl TryFrom for T where U: Into { +/// type Error = Infallible; +/// +/// fn try_from(value: U) -> Result { +/// Ok(U::into(value)) // Never returns `Err` +/// } +/// } +/// ``` +/// +/// # Future compatibility +/// +/// This enum has the same role as [the `!` β€œnever” type][never], +/// which is unstable in this version of Rust. +/// When `!` is stabilized, we plan to make `Infallible` a type alias to it: +/// +/// ```ignore (illustrates future std change) +/// pub type Infallible = !; +/// ``` +/// +/// … and eventually deprecate `Infallible`. +/// +/// +/// However there is one case where `!` syntax can be used +/// before `!` is stabilized as a full-fleged type: in the position of a function’s return type. +/// Specifically, it is possible implementations for two different function pointer types: +/// +/// ``` +/// trait MyTrait {} +/// impl MyTrait for fn() -> ! {} +/// impl MyTrait for fn() -> std::convert::Infallible {} +/// ``` +/// +/// With `Infallible` being an enum, this code is valid. +/// However when `Infallible` becomes an alias for the never type, +/// the two `impl`s will start to overlap +/// and therefore will be disallowed by the language’s trait coherence rules. +/// +/// [`Ok`]: ../result/enum.Result.html#variant.Ok +/// [`Result`]: ../result/enum.Result.html +/// [`TryFrom`]: trait.TryFrom.html +/// [`Into`]: trait.Into.html +/// [never]: ../../std/primitive.never.html +#[stable(feature = "convert_infallible", since = "1.34.0")] +#[derive(Copy)] +pub enum Infallible {} + +#[stable(feature = "convert_infallible", since = "1.34.0")] +impl Clone for Infallible { + fn clone(&self) -> Infallible { + match *self {} + } +} + +#[stable(feature = "convert_infallible", since = "1.34.0")] +impl fmt::Debug for Infallible { + fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result { + match *self {} + } +} + +#[stable(feature = "convert_infallible", since = "1.34.0")] +impl fmt::Display for Infallible { + fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result { + match *self {} + } +} + +#[stable(feature = "convert_infallible", since = "1.34.0")] +impl PartialEq for Infallible { + fn eq(&self, _: &Infallible) -> bool { + match *self {} + } +} + +#[stable(feature = "convert_infallible", since = "1.34.0")] +impl Eq for Infallible {} + +#[stable(feature = "convert_infallible", since = "1.34.0")] +impl PartialOrd for Infallible { + fn partial_cmp(&self, _other: &Self) -> Option { + match *self {} + } +} + +#[stable(feature = "convert_infallible", since = "1.34.0")] +impl Ord for Infallible { + fn cmp(&self, _other: &Self) -> crate::cmp::Ordering { + match *self {} + } +} + +#[stable(feature = "convert_infallible", since = "1.34.0")] +impl From for Infallible { + fn from(x: !) -> Self { + x + } +} diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs index 20c626cef1b1..edeb65afd67b 100644 --- a/src/libcore/fmt/float.rs +++ b/src/libcore/fmt/float.rs @@ -15,6 +15,7 @@ fn float_to_decimal_common_exact(fmt: &mut Formatter, num: &T, // FIXME(#53491): Technically, this is calling `get_mut` on an uninitialized // `MaybeUninit` (here and elsewhere in this file). Revisit this once // we decided whether that is valid or not. + // Using `freeze` is *not enough*; `flt2dec::Part` is an enum! let formatted = flt2dec::to_exact_fixed_str(flt2dec::strategy::grisu::format_exact, *num, sign, precision, false, buf.get_mut(), parts.get_mut()); @@ -33,6 +34,7 @@ fn float_to_decimal_common_shortest(fmt: &mut Formatter, num: &T, // enough for f32 and f64 let mut buf = MaybeUninit::<[u8; flt2dec::MAX_SIG_DIGITS]>::uninitialized(); let mut parts = MaybeUninit::<[flt2dec::Part; 4]>::uninitialized(); + // FIXME(#53491) let formatted = flt2dec::to_shortest_str(flt2dec::strategy::grisu::format_shortest, *num, sign, precision, false, buf.get_mut(), parts.get_mut()); @@ -71,6 +73,7 @@ fn float_to_exponential_common_exact(fmt: &mut Formatter, num: &T, unsafe { let mut buf = MaybeUninit::<[u8; 1024]>::uninitialized(); // enough for f32 and f64 let mut parts = MaybeUninit::<[flt2dec::Part; 6]>::uninitialized(); + // FIXME(#53491) let formatted = flt2dec::to_exact_exp_str(flt2dec::strategy::grisu::format_exact, *num, sign, precision, upper, buf.get_mut(), parts.get_mut()); @@ -90,6 +93,7 @@ fn float_to_exponential_common_shortest(fmt: &mut Formatter, // enough for f32 and f64 let mut buf = MaybeUninit::<[u8; flt2dec::MAX_SIG_DIGITS]>::uninitialized(); let mut parts = MaybeUninit::<[flt2dec::Part; 6]>::uninitialized(); + // FIXME(#53491) let formatted = flt2dec::to_shortest_exp_str(flt2dec::strategy::grisu::format_shortest, *num, sign, (0, 0), upper, buf.get_mut(), parts.get_mut()); diff --git a/src/libcore/internal_macros.rs b/src/libcore/internal_macros.rs index faca785e488c..b5c20582986b 100644 --- a/src/libcore/internal_macros.rs +++ b/src/libcore/internal_macros.rs @@ -37,21 +37,21 @@ macro_rules! forward_ref_binop { } #[$attr] - impl<'a> $imp<&'a $u> for $t { + impl $imp<&$u> for $t { type Output = <$t as $imp<$u>>::Output; #[inline] - fn $method(self, other: &'a $u) -> <$t as $imp<$u>>::Output { + fn $method(self, other: &$u) -> <$t as $imp<$u>>::Output { $imp::$method(self, *other) } } #[$attr] - impl<'a, 'b> $imp<&'a $u> for &'b $t { + impl $imp<&$u> for &$t { type Output = <$t as $imp<$u>>::Output; #[inline] - fn $method(self, other: &'a $u) -> <$t as $imp<$u>>::Output { + fn $method(self, other: &$u) -> <$t as $imp<$u>>::Output { $imp::$method(*self, *other) } } @@ -67,9 +67,9 @@ macro_rules! forward_ref_op_assign { }; (impl $imp:ident, $method:ident for $t:ty, $u:ty, #[$attr:meta]) => { #[$attr] - impl<'a> $imp<&'a $u> for $t { + impl $imp<&$u> for $t { #[inline] - fn $method(&mut self, other: &'a $u) { + fn $method(&mut self, other: &$u) { $imp::$method(self, *other); } } diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index e6098b1b24cc..75a33394e3d2 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -1282,13 +1282,11 @@ extern "rust-intrinsic" { /// The stabilized versions of this intrinsic are available on the integer /// primitives via the `saturating_add` method. For example, /// [`std::u32::saturating_add`](../../std/primitive.u32.html#method.saturating_add) - #[cfg(not(stage0))] pub fn saturating_add(a: T, b: T) -> T; /// Computes `a - b`, while saturating at numeric bounds. /// The stabilized versions of this intrinsic are available on the integer /// primitives via the `saturating_sub` method. For example, /// [`std::u32::saturating_sub`](../../std/primitive.u32.html#method.saturating_sub) - #[cfg(not(stage0))] pub fn saturating_sub(a: T, b: T) -> T; /// Returns the value of the discriminant for the variant in 'v', diff --git a/src/libcore/iter/adapters/mod.rs b/src/libcore/iter/adapters/mod.rs index bca1b76dbb97..d4ad22c16bbf 100644 --- a/src/libcore/iter/adapters/mod.rs +++ b/src/libcore/iter/adapters/mod.rs @@ -681,12 +681,7 @@ impl Iterator for Filter where P: FnMut(&I::Item) -> bool #[inline] fn next(&mut self) -> Option { - for x in &mut self.iter { - if (self.predicate)(&x) { - return Some(x); - } - } - None + self.try_for_each(Err).err() } #[inline] @@ -707,12 +702,9 @@ impl Iterator for Filter where P: FnMut(&I::Item) -> bool // Using the branchless version will also simplify the LLVM byte code, thus // leaving more budget for LLVM optimizations. #[inline] - fn count(mut self) -> usize { - let mut count = 0; - for x in &mut self.iter { - count += (self.predicate)(&x) as usize; - } - count + fn count(self) -> usize { + let mut predicate = self.predicate; + self.iter.map(|x| predicate(&x) as usize).sum() } #[inline] @@ -746,12 +738,7 @@ impl DoubleEndedIterator for Filter { #[inline] fn next_back(&mut self) -> Option { - for x in self.iter.by_ref().rev() { - if (self.predicate)(&x) { - return Some(x); - } - } - None + self.try_rfold((), |_, x| Err(x)).err() } #[inline] @@ -820,12 +807,7 @@ impl Iterator for FilterMap #[inline] fn next(&mut self) -> Option { - for x in self.iter.by_ref() { - if let Some(y) = (self.f)(x) { - return Some(y); - } - } - None + self.try_for_each(Err).err() } #[inline] @@ -863,12 +845,7 @@ impl DoubleEndedIterator for FilterMap { #[inline] fn next_back(&mut self) -> Option { - for x in self.iter.by_ref().rev() { - if let Some(y) = (self.f)(x) { - return Some(y); - } - } - None + self.try_rfold((), |_, x| Err(x)).err() } #[inline] diff --git a/src/libcore/iter/traits/iterator.rs b/src/libcore/iter/traits/iterator.rs index 861e9c3157a7..ca7feed0712d 100644 --- a/src/libcore/iter/traits/iterator.rs +++ b/src/libcore/iter/traits/iterator.rs @@ -2008,12 +2008,7 @@ pub trait Iterator { #[stable(feature = "rust1", since = "1.0.0")] fn max(self) -> Option where Self: Sized, Self::Item: Ord { - select_fold1(self, - |_| (), - // switch to y even if it is only equal, to preserve - // stability. - |_, x, _, y| *x <= *y) - .map(|(_, x)| x) + self.max_by(Ord::cmp) } /// Returns the minimum element of an iterator. @@ -2038,12 +2033,7 @@ pub trait Iterator { #[stable(feature = "rust1", since = "1.0.0")] fn min(self) -> Option where Self: Sized, Self::Item: Ord { - select_fold1(self, - |_| (), - // only switch to y if it is strictly smaller, to - // preserve stability. - |_, x, _, y| *x > *y) - .map(|(_, x)| x) + self.min_by(Ord::cmp) } /// Returns the element that gives the maximum value from the @@ -2062,15 +2052,11 @@ pub trait Iterator { /// ``` #[inline] #[stable(feature = "iter_cmp_by_key", since = "1.6.0")] - fn max_by_key(self, f: F) -> Option + fn max_by_key(self, mut f: F) -> Option where Self: Sized, F: FnMut(&Self::Item) -> B, { - select_fold1(self, - f, - // switch to y even if it is only equal, to preserve - // stability. - |x_p, _, y_p, _| x_p <= y_p) - .map(|(_, x)| x) + // switch to y even if it is only equal, to preserve stability. + select_fold1(self.map(|x| (f(&x), x)), |(x_p, _), (y_p, _)| x_p <= y_p).map(|(_, x)| x) } /// Returns the element that gives the maximum value with respect to the @@ -2092,12 +2078,8 @@ pub trait Iterator { fn max_by(self, mut compare: F) -> Option where Self: Sized, F: FnMut(&Self::Item, &Self::Item) -> Ordering, { - select_fold1(self, - |_| (), - // switch to y even if it is only equal, to preserve - // stability. - |_, x, _, y| Ordering::Greater != compare(x, y)) - .map(|(_, x)| x) + // switch to y even if it is only equal, to preserve stability. + select_fold1(self, |x, y| compare(x, y) != Ordering::Greater) } /// Returns the element that gives the minimum value from the @@ -2115,15 +2097,11 @@ pub trait Iterator { /// assert_eq!(*a.iter().min_by_key(|x| x.abs()).unwrap(), 0); /// ``` #[stable(feature = "iter_cmp_by_key", since = "1.6.0")] - fn min_by_key(self, f: F) -> Option + fn min_by_key(self, mut f: F) -> Option where Self: Sized, F: FnMut(&Self::Item) -> B, { - select_fold1(self, - f, - // only switch to y if it is strictly smaller, to - // preserve stability. - |x_p, _, y_p, _| x_p > y_p) - .map(|(_, x)| x) + // only switch to y if it is strictly smaller, to preserve stability. + select_fold1(self.map(|x| (f(&x), x)), |(x_p, _), (y_p, _)| x_p > y_p).map(|(_, x)| x) } /// Returns the element that gives the minimum value with respect to the @@ -2145,12 +2123,8 @@ pub trait Iterator { fn min_by(self, mut compare: F) -> Option where Self: Sized, F: FnMut(&Self::Item, &Self::Item) -> Ordering, { - select_fold1(self, - |_| (), - // switch to y even if it is strictly smaller, to - // preserve stability. - |_, x, _, y| Ordering::Greater == compare(x, y)) - .map(|(_, x)| x) + // only switch to y if it is strictly smaller, to preserve stability. + select_fold1(self, |x, y| compare(x, y) == Ordering::Greater) } @@ -2693,34 +2667,23 @@ pub trait Iterator { } } -/// Select an element from an iterator based on the given "projection" -/// and "comparison" function. +/// Select an element from an iterator based on the given "comparison" +/// function. /// /// This is an idiosyncratic helper to try to factor out the /// commonalities of {max,min}{,_by}. In particular, this avoids /// having to implement optimizations several times. #[inline] -fn select_fold1(mut it: I, - mut f_proj: FProj, - mut f_cmp: FCmp) -> Option<(B, I::Item)> - where I: Iterator, - FProj: FnMut(&I::Item) -> B, - FCmp: FnMut(&B, &I::Item, &B, &I::Item) -> bool +fn select_fold1(mut it: I, mut f: F) -> Option + where + I: Iterator, + F: FnMut(&I::Item, &I::Item) -> bool, { // start with the first element as our selection. This avoids // having to use `Option`s inside the loop, translating to a // sizeable performance gain (6x in one case). it.next().map(|first| { - let first_p = f_proj(&first); - - it.fold((first_p, first), |(sel_p, sel), x| { - let x_p = f_proj(&x); - if f_cmp(&sel_p, &sel, &x_p, &x) { - (x_p, x) - } else { - (sel_p, sel) - } - }) + it.fold(first, |sel, x| if f(&sel, &x) { x } else { sel }) }) } diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index f2165c676fd4..63688e70c45c 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -123,7 +123,6 @@ #![feature(abi_unadjusted)] #![feature(adx_target_feature)] #![feature(maybe_uninit, maybe_uninit_slice, maybe_uninit_array)] -#![feature(unrestricted_attribute_tokens)] #![feature(external_doc)] #[prelude_import] diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index fdbfa56000b8..b052f59b0f5c 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -1,7 +1,6 @@ /// Entry point of thread panic. For details, see `std::macros`. #[macro_export] -#[cfg_attr(not(stage0), allow_internal_unstable(core_panic, __rust_unstable_column))] -#[cfg_attr(stage0, allow_internal_unstable)] +#[allow_internal_unstable(core_panic, __rust_unstable_column)] #[stable(feature = "core", since = "1.6.0")] macro_rules! panic { () => ( @@ -422,8 +421,7 @@ macro_rules! write { /// ``` #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] -#[cfg_attr(stage0, allow_internal_unstable)] -#[cfg_attr(not(stage0), allow_internal_unstable(format_args_nl))] +#[allow_internal_unstable(format_args_nl)] macro_rules! writeln { ($dst:expr) => ( write!($dst, "\n") diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index 29606cb19038..9b1ead7edd68 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -636,7 +636,7 @@ unsafe impl Freeze for &mut T {} /// [`Pin

`]: ../pin/struct.Pin.html /// [`pin module`]: ../../std/pin/index.html #[stable(feature = "pin", since = "1.33.0")] -#[cfg_attr(not(stage0), lang = "unpin")] +#[lang = "unpin"] pub auto trait Unpin {} /// A marker type which does not implement `Unpin`. diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index f41d293e80ad..90e84d0b28c3 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -900,10 +900,16 @@ pub fn discriminant(v: &T) -> Discriminant { } } +// FIXME: Reference `MaybeUninit` from these docs, once that is stable. /// A wrapper to inhibit compiler from automatically calling `T`’s destructor. /// /// This wrapper is 0-cost. /// +/// `ManuallyDrop` is subject to the same layout optimizations as `T`. +/// As a consequence, it has *no effect* on the assumptions that the compiler makes +/// about all values being initialized at their type. In particular, initializing +/// a `ManuallyDrop<&mut T>` with [`mem::zeroed`] is undefined behavior. +/// /// # Examples /// /// This wrapper helps with explicitly documenting the drop order dependencies between fields of @@ -935,6 +941,8 @@ pub fn discriminant(v: &T) -> Discriminant { /// } /// } /// ``` +/// +/// [`mem::zeroed`]: fn.zeroed.html #[stable(feature = "manually_drop", since = "1.20.0")] #[lang = "manually_drop"] #[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] @@ -1035,7 +1043,7 @@ impl DerefMut for ManuallyDrop { } } -/// A newtype to construct uninitialized instances of `T`. +/// A wrapper to construct uninitialized instances of `T`. /// /// The compiler, in general, assumes that variables are properly initialized /// at their respective type. For example, a variable of reference type must @@ -1049,33 +1057,43 @@ impl DerefMut for ManuallyDrop { /// use std::mem::{self, MaybeUninit}; /// /// let x: &i32 = unsafe { mem::zeroed() }; // undefined behavior! -/// // equivalent code with `MaybeUninit` +/// // The equivalent code with `MaybeUninit<&i32>`: /// let x: &i32 = unsafe { MaybeUninit::zeroed().into_initialized() }; // undefined behavior! /// ``` /// /// This is exploited by the compiler for various optimizations, such as eliding /// run-time checks and optimizing `enum` layout. /// -/// Not initializing memory at all (instead of zero-initializing it) causes the same -/// issue: after all, the initial value of the variable might just happen to be -/// one that violates the invariant. Moreover, uninitialized memory is special -/// in that the compiler knows that it does not have a fixed value. This makes -/// it undefined behavior to have uninitialized data in a variable even if that -/// variable has otherwise no restrictions about which values are valid: +/// Similarly, entirely uninitialized memory may have any content, while a `bool` must +/// always be `true` or `false`. Hence, creating an uninitialized `bool` is undefined behavior: +/// +/// ```rust,no_run +/// #![feature(maybe_uninit)] +/// use std::mem::{self, MaybeUninit}; +/// +/// let b: bool = unsafe { mem::uninitialized() }; // undefined behavior! +/// // The equivalent code with `MaybeUninit`: +/// let b: bool = unsafe { MaybeUninit::uninitialized().into_initialized() }; // undefined behavior! +/// ``` +/// +/// Moreover, uninitialized memory is special in that the compiler knows that +/// it does not have a fixed value. This makes it undefined behavior to have +/// uninitialized data in a variable even if that variable has an integer type, +/// which otherwise can hold any bit pattern: /// /// ```rust,no_run /// #![feature(maybe_uninit)] /// use std::mem::{self, MaybeUninit}; /// /// let x: i32 = unsafe { mem::uninitialized() }; // undefined behavior! -/// // equivalent code with `MaybeUninit` +/// // The equivalent code with `MaybeUninit`: /// let x: i32 = unsafe { MaybeUninit::uninitialized().into_initialized() }; // undefined behavior! /// ``` /// (Notice that the rules around uninitialized integers are not finalized yet, but /// until they are, it is advisable to avoid them.) /// -/// `MaybeUninit` serves to enable unsafe code to deal with uninitialized data: -/// it is a signal to the compiler indicating that the data here might *not* +/// `MaybeUninit` serves to enable unsafe code to deal with uninitialized data. +/// It is a signal to the compiler indicating that the data here might *not* /// be initialized: /// /// ```rust @@ -1083,7 +1101,7 @@ impl DerefMut for ManuallyDrop { /// use std::mem::MaybeUninit; /// /// // Create an explicitly uninitialized reference. The compiler knows that data inside -/// // a `MaybeUninit` may be invalid, and hence this is not UB: +/// // a `MaybeUninit` may be invalid, and hence this is not UB: /// let mut x = MaybeUninit::<&i32>::uninitialized(); /// // Set it to a valid value. /// x.set(&0); @@ -1092,20 +1110,30 @@ impl DerefMut for ManuallyDrop { /// let x = unsafe { x.into_initialized() }; /// ``` /// -/// The compiler then knows to not optimize this code. +/// The compiler then knows to not make any incorrect assumptions or optimizations on this code. // FIXME before stabilizing, explain how to initialize a struct field-by-field. #[allow(missing_debug_implementations)] #[unstable(feature = "maybe_uninit", issue = "53491")] -// NOTE after stabilizing `MaybeUninit` proceed to deprecate `mem::{uninitialized,zeroed}` +#[derive(Copy)] +// NOTE after stabilizing `MaybeUninit` proceed to deprecate `mem::uninitialized`. pub union MaybeUninit { uninit: (), value: ManuallyDrop, } +#[unstable(feature = "maybe_uninit", issue = "53491")] +impl Clone for MaybeUninit { + #[inline(always)] + fn clone(&self) -> Self { + // Not calling T::clone(), we cannot know if we are initialized enough for that. + *self + } +} + impl MaybeUninit { - /// Create a new `MaybeUninit` initialized with the given value. + /// Create a new `MaybeUninit` initialized with the given value. /// - /// Note that dropping a `MaybeUninit` will never call `T`'s drop code. + /// Note that dropping a `MaybeUninit` will never call `T`'s drop code. /// It is your responsibility to make sure `T` gets dropped if it got initialized. #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] @@ -1113,9 +1141,9 @@ impl MaybeUninit { MaybeUninit { value: ManuallyDrop::new(val) } } - /// Creates a new `MaybeUninit` in an uninitialized state. + /// Creates a new `MaybeUninit` in an uninitialized state. /// - /// Note that dropping a `MaybeUninit` will never call `T`'s drop code. + /// Note that dropping a `MaybeUninit` will never call `T`'s drop code. /// It is your responsibility to make sure `T` gets dropped if it got initialized. #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] @@ -1123,14 +1151,43 @@ impl MaybeUninit { MaybeUninit { uninit: () } } - /// Creates a new `MaybeUninit` in an uninitialized state, with the memory being + /// Creates a new `MaybeUninit` in an uninitialized state, with the memory being /// filled with `0` bytes. It depends on `T` whether that already makes for /// proper initialization. For example, `MaybeUninit::zeroed()` is initialized, /// but `MaybeUninit<&'static i32>::zeroed()` is not because references must not /// be null. /// - /// Note that dropping a `MaybeUninit` will never call `T`'s drop code. + /// Note that dropping a `MaybeUninit` will never call `T`'s drop code. /// It is your responsibility to make sure `T` gets dropped if it got initialized. + /// + /// # Example + /// + /// Correct usage of this function: initializing a struct with zero, where all + /// fields of the struct can hold the bit-pattern 0 as a valid value. + /// + /// ```rust + /// #![feature(maybe_uninit)] + /// use std::mem::MaybeUninit; + /// + /// let x = MaybeUninit::<(u8, bool)>::zeroed(); + /// let x = unsafe { x.into_initialized() }; + /// assert_eq!(x, (0, false)); + /// ``` + /// + /// *Incorrect* usage of this function: initializing a struct with zero, where some fields + /// cannot hold 0 as a valid value. + /// + /// ```rust,no_run + /// #![feature(maybe_uninit)] + /// use std::mem::MaybeUninit; + /// + /// enum NotZero { One = 1, Two = 2 }; + /// + /// let x = MaybeUninit::<(u8, NotZero)>::zeroed(); + /// let x = unsafe { x.into_initialized() }; + /// // Inside a pair, we create a `NotZero` that does not have a valid discriminant. + /// // This is undefined behavior. + /// ``` #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline] pub fn zeroed() -> MaybeUninit { @@ -1141,9 +1198,10 @@ impl MaybeUninit { u } - /// Sets the value of the `MaybeUninit`. This overwrites any previous value without dropping it. - /// For your convenience, this also returns a mutable reference to the (now safely initialized) - /// contents of `self`. + /// Sets the value of the `MaybeUninit`. This overwrites any previous value + /// without dropping it, so be careful not to use this twice unless you want to + /// skip running the destructor. For your convenience, this also returns a mutable + /// reference to the (now safely initialized) contents of `self`. #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] pub fn set(&mut self, val: T) -> &mut T { @@ -1154,7 +1212,35 @@ impl MaybeUninit { } /// Gets a pointer to the contained value. Reading from this pointer or turning it - /// into a reference will be undefined behavior unless the `MaybeUninit` is initialized. + /// into a reference is undefined behavior unless the `MaybeUninit` is initialized. + /// + /// # Examples + /// + /// Correct usage of this method: + /// + /// ```rust + /// #![feature(maybe_uninit)] + /// use std::mem::MaybeUninit; + /// + /// let mut x = MaybeUninit::>::uninitialized(); + /// unsafe { x.as_mut_ptr().write(vec![0,1,2]); } + /// // Create a reference into the `MaybeUninit`. This is okay because we initialized it. + /// let x_vec = unsafe { &*x.as_ptr() }; + /// assert_eq!(x_vec.len(), 3); + /// ``` + /// + /// *Incorrect* usage of this method: + /// + /// ```rust,no_run + /// #![feature(maybe_uninit)] + /// use std::mem::MaybeUninit; + /// + /// let x = MaybeUninit::>::uninitialized(); + /// let x_vec = unsafe { &*x.as_ptr() }; + /// // We have created a reference to an uninitialized vector! This is undefined behavior. + /// ``` + /// (Notice that the rules around references to uninitialized data are not finalized yet, but + /// until they are, it is advisable to avoid them.) #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] pub fn as_ptr(&self) -> *const T { @@ -1162,22 +1248,77 @@ impl MaybeUninit { } /// Gets a mutable pointer to the contained value. Reading from this pointer or turning it - /// into a reference will be undefined behavior unless the `MaybeUninit` is initialized. + /// into a reference is undefined behavior unless the `MaybeUninit` is initialized. + /// + /// # Examples + /// + /// Correct usage of this method: + /// + /// ```rust + /// #![feature(maybe_uninit)] + /// use std::mem::MaybeUninit; + /// + /// let mut x = MaybeUninit::>::uninitialized(); + /// unsafe { x.as_mut_ptr().write(vec![0,1,2]); } + /// // Create a reference into the `MaybeUninit>`. + /// // This is okay because we initialized it. + /// let x_vec = unsafe { &mut *x.as_mut_ptr() }; + /// x_vec.push(3); + /// assert_eq!(x_vec.len(), 4); + /// ``` + /// + /// *Incorrect* usage of this method: + /// + /// ```rust,no_run + /// #![feature(maybe_uninit)] + /// use std::mem::MaybeUninit; + /// + /// let mut x = MaybeUninit::>::uninitialized(); + /// let x_vec = unsafe { &mut *x.as_mut_ptr() }; + /// // We have created a reference to an uninitialized vector! This is undefined behavior. + /// ``` + /// (Notice that the rules around references to uninitialized data are not finalized yet, but + /// until they are, it is advisable to avoid them.) #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] pub fn as_mut_ptr(&mut self) -> *mut T { unsafe { &mut *self.value as *mut T } } - /// Extracts the value from the `MaybeUninit` container. This is a great way + /// Extracts the value from the `MaybeUninit` container. This is a great way /// to ensure that the data will get dropped, because the resulting `T` is /// subject to the usual drop handling. /// /// # Safety /// - /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized + /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized /// state. Calling this when the content is not yet fully initialized causes undefined /// behavior. + /// + /// # Examples + /// + /// Correct usage of this method: + /// + /// ```rust + /// #![feature(maybe_uninit)] + /// use std::mem::MaybeUninit; + /// + /// let mut x = MaybeUninit::::uninitialized(); + /// unsafe { x.as_mut_ptr().write(true); } + /// let x_init = unsafe { x.into_initialized() }; + /// assert_eq!(x_init, true); + /// ``` + /// + /// *Incorrect* usage of this method: + /// + /// ```rust,no_run + /// #![feature(maybe_uninit)] + /// use std::mem::MaybeUninit; + /// + /// let x = MaybeUninit::>::uninitialized(); + /// let x_init = unsafe { x.into_initialized() }; + /// // `x` had not been initialized yet, so this last line caused undefined behavior. + /// ``` #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] pub unsafe fn into_initialized(self) -> T { @@ -1185,11 +1326,73 @@ impl MaybeUninit { ManuallyDrop::into_inner(self.value) } + /// Reads the value from the `MaybeUninit` container. The resulting `T` is subject + /// to the usual drop handling. + /// + /// Whenever possible, it is preferrable to use [`into_initialized`] instead, which + /// prevents duplicating the content of the `MaybeUninit`. + /// + /// # Safety + /// + /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized + /// state. Calling this when the content is not yet fully initialized causes undefined + /// behavior. + /// + /// Moreover, this leaves a copy of the same data behind in the `MaybeUninit`. When using + /// multiple copies of the data (by calling `read_initialized` multiple times, or first + /// calling `read_initialized` and then [`into_initialized`]), it is your responsibility + /// to ensure that that data may indeed be duplicated. + /// + /// [`into_initialized`]: #method.into_initialized + /// + /// # Examples + /// + /// Correct usage of this method: + /// + /// ```rust + /// #![feature(maybe_uninit)] + /// use std::mem::MaybeUninit; + /// + /// let mut x = MaybeUninit::::uninitialized(); + /// x.set(13); + /// let x1 = unsafe { x.read_initialized() }; + /// // `u32` is `Copy`, so we may read multiple times. + /// let x2 = unsafe { x.read_initialized() }; + /// assert_eq!(x1, x2); + /// + /// let mut x = MaybeUninit::>>::uninitialized(); + /// x.set(None); + /// let x1 = unsafe { x.read_initialized() }; + /// // Duplicating a `None` value is okay, so we may read multiple times. + /// let x2 = unsafe { x.read_initialized() }; + /// assert_eq!(x1, x2); + /// ``` + /// + /// *Incorrect* usage of this method: + /// + /// ```rust,no_run + /// #![feature(maybe_uninit)] + /// use std::mem::MaybeUninit; + /// + /// let mut x = MaybeUninit::>>::uninitialized(); + /// x.set(Some(vec![0,1,2])); + /// let x1 = unsafe { x.read_initialized() }; + /// let x2 = unsafe { x.read_initialized() }; + /// // We now created two copies of the same vector, leading to a double-free when + /// // they both get dropped! + /// ``` + #[unstable(feature = "maybe_uninit", issue = "53491")] + #[inline(always)] + pub unsafe fn read_initialized(&self) -> T { + intrinsics::panic_if_uninhabited::(); + self.as_ptr().read() + } + /// Gets a reference to the contained value. /// /// # Safety /// - /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized + /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized /// state. Calling this when the content is not yet fully initialized causes undefined /// behavior. #[unstable(feature = "maybe_uninit_ref", issue = "53491")] @@ -1202,7 +1405,7 @@ impl MaybeUninit { /// /// # Safety /// - /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized + /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized /// state. Calling this when the content is not yet fully initialized causes undefined /// behavior. // FIXME(#53491): We currently rely on the above being incorrect, i.e., we have references diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 5b7d5f45d924..d93cfbc2a28a 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -2,7 +2,7 @@ #![stable(feature = "rust1", since = "1.0.0")] -use convert::TryFrom; +use convert::{TryFrom, Infallible}; use fmt; use intrinsics; use mem; @@ -346,7 +346,7 @@ $EndFeature, " concat!("Shifts the bits to the left by a specified amount, `n`, wrapping the truncated bits to the end of the resulting integer. -Please note this isn't the same operation as `<<`! +Please note this isn't the same operation as the `<<` shifting operator! # Examples @@ -370,7 +370,7 @@ assert_eq!(n.rotate_left(", $rot, "), m); wrapping the truncated bits to the beginning of the resulting integer. -Please note this isn't the same operation as `>>`! +Please note this isn't the same operation as the `>>` shifting operator! # Examples @@ -874,33 +874,6 @@ bounds instead of overflowing. Basic usage: -``` -", $Feature, "assert_eq!(100", stringify!($SelfT), ".saturating_add(1), 101); -assert_eq!(", stringify!($SelfT), "::max_value().saturating_add(100), ", stringify!($SelfT), -"::max_value());", -$EndFeature, " -```"), - #[stable(feature = "rust1", since = "1.0.0")] - #[inline] - #[cfg(stage0)] - pub fn saturating_add(self, rhs: Self) -> Self { - match self.checked_add(rhs) { - Some(x) => x, - None if rhs >= 0 => Self::max_value(), - None => Self::min_value(), - } - } - - } - - doc_comment! { - concat!("Saturating integer addition. Computes `self + rhs`, saturating at the numeric -bounds instead of overflowing. - -# Examples - -Basic usage: - ``` ", $Feature, "assert_eq!(100", stringify!($SelfT), ".saturating_add(1), 101); assert_eq!(", stringify!($SelfT), "::max_value().saturating_add(100), ", stringify!($SelfT), @@ -911,37 +884,11 @@ $EndFeature, " #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_saturating_int_methods")] #[inline] - #[cfg(not(stage0))] pub const fn saturating_add(self, rhs: Self) -> Self { intrinsics::saturating_add(self, rhs) } } - doc_comment! { - concat!("Saturating integer subtraction. Computes `self - rhs`, saturating at the -numeric bounds instead of overflowing. - -# Examples - -Basic usage: - -``` -", $Feature, "assert_eq!(100", stringify!($SelfT), ".saturating_sub(127), -27); -assert_eq!(", stringify!($SelfT), "::min_value().saturating_sub(100), ", stringify!($SelfT), -"::min_value());", -$EndFeature, " -```"), - #[stable(feature = "rust1", since = "1.0.0")] - #[inline] - #[cfg(stage0)] - pub fn saturating_sub(self, rhs: Self) -> Self { - match self.checked_sub(rhs) { - Some(x) => x, - None if rhs >= 0 => Self::min_value(), - None => Self::max_value(), - } - } - } doc_comment! { concat!("Saturating integer subtraction. Computes `self - rhs`, saturating at the @@ -960,7 +907,6 @@ $EndFeature, " #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_saturating_int_methods")] #[inline] - #[cfg(not(stage0))] pub const fn saturating_sub(self, rhs: Self) -> Self { intrinsics::saturating_sub(self, rhs) } @@ -2000,7 +1946,6 @@ assert_eq!(value, ", $swap_op, "); When starting from a slice rather than an array, fallible conversion APIs can be used: ``` -#![feature(try_from)] use std::convert::TryInto; fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { @@ -2032,13 +1977,12 @@ assert_eq!(value, ", $swap_op, "); When starting from a slice rather than an array, fallible conversion APIs can be used: ``` -#![feature(try_from)] use std::convert::TryInto; -fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { +fn read_le_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">()); *input = rest; - ", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap()) + ", stringify!($SelfT), "::from_le_bytes(int_bytes.try_into().unwrap()) } ```"), #[stable(feature = "int_to_from_bytes", since = "1.32.0")] @@ -2074,13 +2018,12 @@ assert_eq!(value, ", $swap_op, "); When starting from a slice rather than an array, fallible conversion APIs can be used: ``` -#![feature(try_from)] use std::convert::TryInto; -fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { +fn read_ne_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">()); *input = rest; - ", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap()) + ", stringify!($SelfT), "::from_ne_bytes(int_bytes.try_into().unwrap()) } ```"), #[stable(feature = "int_to_from_bytes", since = "1.32.0")] @@ -2303,7 +2246,7 @@ assert_eq!(n.trailing_zeros(), 3);", $EndFeature, " concat!("Shifts the bits to the left by a specified amount, `n`, wrapping the truncated bits to the end of the resulting integer. -Please note this isn't the same operation as `<<`! +Please note this isn't the same operation as the `<<` shifting operator! # Examples @@ -2327,7 +2270,7 @@ assert_eq!(n.rotate_left(", $rot, "), m); wrapping the truncated bits to the beginning of the resulting integer. -Please note this isn't the same operation as `>>`! +Please note this isn't the same operation as the `>>` shifting operator! # Examples @@ -2783,29 +2726,6 @@ the numeric bounds instead of overflowing. Basic usage: -``` -", $Feature, "assert_eq!(100", stringify!($SelfT), ".saturating_add(1), 101); -assert_eq!(200u8.saturating_add(127), 255);", $EndFeature, " -```"), - #[stable(feature = "rust1", since = "1.0.0")] - #[inline] - #[cfg(stage0)] - pub fn saturating_add(self, rhs: Self) -> Self { - match self.checked_add(rhs) { - Some(x) => x, - None => Self::max_value(), - } - } - } - - doc_comment! { - concat!("Saturating integer addition. Computes `self + rhs`, saturating at -the numeric bounds instead of overflowing. - -# Examples - -Basic usage: - ``` ", $Feature, "assert_eq!(100", stringify!($SelfT), ".saturating_add(1), 101); assert_eq!(200u8.saturating_add(127), 255);", $EndFeature, " @@ -2814,7 +2734,6 @@ assert_eq!(200u8.saturating_add(127), 255);", $EndFeature, " #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_saturating_int_methods")] #[inline] - #[cfg(not(stage0))] pub const fn saturating_add(self, rhs: Self) -> Self { intrinsics::saturating_add(self, rhs) } @@ -2828,29 +2747,6 @@ at the numeric bounds instead of overflowing. Basic usage: -``` -", $Feature, "assert_eq!(100", stringify!($SelfT), ".saturating_sub(27), 73); -assert_eq!(13", stringify!($SelfT), ".saturating_sub(127), 0);", $EndFeature, " -```"), - #[stable(feature = "rust1", since = "1.0.0")] - #[inline] - #[cfg(stage0)] - pub fn saturating_sub(self, rhs: Self) -> Self { - match self.checked_sub(rhs) { - Some(x) => x, - None => Self::min_value(), - } - } - } - - doc_comment! { - concat!("Saturating integer subtraction. Computes `self - rhs`, saturating -at the numeric bounds instead of overflowing. - -# Examples - -Basic usage: - ``` ", $Feature, "assert_eq!(100", stringify!($SelfT), ".saturating_sub(27), 73); assert_eq!(13", stringify!($SelfT), ".saturating_sub(127), 0);", $EndFeature, " @@ -2858,7 +2754,6 @@ assert_eq!(13", stringify!($SelfT), ".saturating_sub(127), 0);", $EndFeature, " #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_unstable(feature = "const_saturating_int_methods")] #[inline] - #[cfg(not(stage0))] pub const fn saturating_sub(self, rhs: Self) -> Self { intrinsics::saturating_sub(self, rhs) } @@ -3767,7 +3662,6 @@ assert_eq!(value, ", $swap_op, "); When starting from a slice rather than an array, fallible conversion APIs can be used: ``` -#![feature(try_from)] use std::convert::TryInto; fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { @@ -3799,13 +3693,12 @@ assert_eq!(value, ", $swap_op, "); When starting from a slice rather than an array, fallible conversion APIs can be used: ``` -#![feature(try_from)] use std::convert::TryInto; -fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { +fn read_le_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">()); *input = rest; - ", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap()) + ", stringify!($SelfT), "::from_le_bytes(int_bytes.try_into().unwrap()) } ```"), #[stable(feature = "int_to_from_bytes", since = "1.32.0")] @@ -3841,13 +3734,12 @@ assert_eq!(value, ", $swap_op, "); When starting from a slice rather than an array, fallible conversion APIs can be used: ``` -#![feature(try_from)] use std::convert::TryInto; -fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { +fn read_ne_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " { let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">()); *input = rest; - ", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap()) + ", stringify!($SelfT), "::from_ne_bytes(int_bytes.try_into().unwrap()) } ```"), #[stable(feature = "int_to_from_bytes", since = "1.32.0")] @@ -4504,7 +4396,7 @@ macro_rules! from_str_radix_int_impl { from_str_radix_int_impl! { isize i8 i16 i32 i64 i128 usize u8 u16 u32 u64 u128 } /// The error type returned when a checked integral type conversion fails. -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub struct TryFromIntError(()); @@ -4519,27 +4411,40 @@ impl TryFromIntError { } } -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] impl fmt::Display for TryFromIntError { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { self.__description().fmt(fmt) } } -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] +impl From for TryFromIntError { + fn from(x: Infallible) -> TryFromIntError { + match x {} + } +} + +#[unstable(feature = "never_type", issue = "35121")] impl From for TryFromIntError { fn from(never: !) -> TryFromIntError { - never + // Match rather than coerce to make sure that code like + // `From for TryFromIntError` above will keep working + // when `Infallible` becomes an alias to `!`. + match never {} } } // no possible bounds violation macro_rules! try_from_unbounded { ($source:ty, $($target:ty),*) => {$( - #[unstable(feature = "try_from", issue = "33417")] + #[stable(feature = "try_from", since = "1.34.0")] impl TryFrom<$source> for $target { type Error = TryFromIntError; + /// Try to create the target number type from a source + /// number type. This returns an error if the source value + /// is outside of the range of the target type. #[inline] fn try_from(value: $source) -> Result { Ok(value as $target) @@ -4551,10 +4456,13 @@ macro_rules! try_from_unbounded { // only negative bounds macro_rules! try_from_lower_bounded { ($source:ty, $($target:ty),*) => {$( - #[unstable(feature = "try_from", issue = "33417")] + #[stable(feature = "try_from", since = "1.34.0")] impl TryFrom<$source> for $target { type Error = TryFromIntError; + /// Try to create the target number type from a source + /// number type. This returns an error if the source value + /// is outside of the range of the target type. #[inline] fn try_from(u: $source) -> Result<$target, TryFromIntError> { if u >= 0 { @@ -4570,10 +4478,13 @@ macro_rules! try_from_lower_bounded { // unsigned to signed (only positive bound) macro_rules! try_from_upper_bounded { ($source:ty, $($target:ty),*) => {$( - #[unstable(feature = "try_from", issue = "33417")] + #[stable(feature = "try_from", since = "1.34.0")] impl TryFrom<$source> for $target { type Error = TryFromIntError; + /// Try to create the target number type from a source + /// number type. This returns an error if the source value + /// is outside of the range of the target type. #[inline] fn try_from(u: $source) -> Result<$target, TryFromIntError> { if u > (<$target>::max_value() as $source) { @@ -4589,10 +4500,13 @@ macro_rules! try_from_upper_bounded { // all other cases macro_rules! try_from_both_bounded { ($source:ty, $($target:ty),*) => {$( - #[unstable(feature = "try_from", issue = "33417")] + #[stable(feature = "try_from", since = "1.34.0")] impl TryFrom<$source> for $target { type Error = TryFromIntError; + /// Try to create the target number type from a source + /// number type. This returns an error if the source value + /// is outside of the range of the target type. #[inline] fn try_from(u: $source) -> Result<$target, TryFromIntError> { let min = <$target>::min_value() as $source; @@ -4613,7 +4527,7 @@ macro_rules! rev { )*} } -/// intra-sign conversions +// intra-sign conversions try_from_upper_bounded!(u16, u8); try_from_upper_bounded!(u32, u16, u8); try_from_upper_bounded!(u64, u32, u16, u8); diff --git a/src/libcore/num/wrapping.rs b/src/libcore/num/wrapping.rs index 50e189c9e364..9cd5108ade41 100644 --- a/src/libcore/num/wrapping.rs +++ b/src/libcore/num/wrapping.rs @@ -429,7 +429,8 @@ assert_eq!(n.trailing_zeros(), 3); /// wrapping the truncated bits to the end of the resulting /// integer. /// - /// Please note this isn't the same operation as `>>`! + /// Please note this isn't the same operation as the `>>` shifting + /// operator! /// /// # Examples /// @@ -454,7 +455,8 @@ assert_eq!(n.trailing_zeros(), 3); /// wrapping the truncated bits to the beginning of the resulting /// integer. /// - /// Please note this isn't the same operation as `<<`! + /// Please note this isn't the same operation as the `<<` shifting + /// operator! /// /// # Examples /// diff --git a/src/libcore/ops/range.rs b/src/libcore/ops/range.rs index 998b597d5e11..81a8d001dd9c 100644 --- a/src/libcore/ops/range.rs +++ b/src/libcore/ops/range.rs @@ -26,11 +26,13 @@ use hash::{Hash, Hasher}; /// Used as a [slicing index], `RangeFull` produces the full array as a slice. /// /// ``` -/// let arr = [0, 1, 2, 3]; -/// assert_eq!(arr[ .. ], [0,1,2,3]); // RangeFull -/// assert_eq!(arr[ ..3], [0,1,2 ]); -/// assert_eq!(arr[1.. ], [ 1,2,3]); -/// assert_eq!(arr[1..3], [ 1,2 ]); +/// let arr = [0, 1, 2, 3, 4]; +/// assert_eq!(arr[ .. ], [0,1,2,3,4]); // RangeFull +/// assert_eq!(arr[ .. 3], [0,1,2 ]); +/// assert_eq!(arr[ ..=3], [0,1,2,3 ]); +/// assert_eq!(arr[1.. ], [ 1,2,3,4]); +/// assert_eq!(arr[1.. 3], [ 1,2 ]); +/// assert_eq!(arr[1..=3], [ 1,2,3 ]); /// ``` /// /// [`IntoIterator`]: ../iter/trait.Iterator.html @@ -60,11 +62,13 @@ impl fmt::Debug for RangeFull { /// assert_eq!((3..5), std::ops::Range { start: 3, end: 5 }); /// assert_eq!(3 + 4 + 5, (3..6).sum()); /// -/// let arr = ['a', 'b', 'c', 'd']; -/// assert_eq!(arr[ .. ], ['a', 'b', 'c', 'd']); -/// assert_eq!(arr[ ..3], ['a', 'b', 'c', ]); -/// assert_eq!(arr[1.. ], [ 'b', 'c', 'd']); -/// assert_eq!(arr[1..3], [ 'b', 'c' ]); // Range +/// let arr = [0, 1, 2, 3, 4]; +/// assert_eq!(arr[ .. ], [0,1,2,3,4]); +/// assert_eq!(arr[ .. 3], [0,1,2 ]); +/// assert_eq!(arr[ ..=3], [0,1,2,3 ]); +/// assert_eq!(arr[1.. ], [ 1,2,3,4]); +/// assert_eq!(arr[1.. 3], [ 1,2 ]); // Range +/// assert_eq!(arr[1..=3], [ 1,2,3 ]); /// ``` #[doc(alias = "..")] #[derive(Clone, PartialEq, Eq, Hash)] // not Copy -- see #27186 @@ -160,11 +164,13 @@ impl> Range { /// assert_eq!((2..), std::ops::RangeFrom { start: 2 }); /// assert_eq!(2 + 3 + 4, (2..).take(3).sum()); /// -/// let arr = [0, 1, 2, 3]; -/// assert_eq!(arr[ .. ], [0,1,2,3]); -/// assert_eq!(arr[ ..3], [0,1,2 ]); -/// assert_eq!(arr[1.. ], [ 1,2,3]); // RangeFrom -/// assert_eq!(arr[1..3], [ 1,2 ]); +/// let arr = [0, 1, 2, 3, 4]; +/// assert_eq!(arr[ .. ], [0,1,2,3,4]); +/// assert_eq!(arr[ .. 3], [0,1,2 ]); +/// assert_eq!(arr[ ..=3], [0,1,2,3 ]); +/// assert_eq!(arr[1.. ], [ 1,2,3,4]); // RangeFrom +/// assert_eq!(arr[1.. 3], [ 1,2 ]); +/// assert_eq!(arr[1..=3], [ 1,2,3 ]); /// ``` /// /// [`Iterator`]: ../iter/trait.IntoIterator.html @@ -240,11 +246,13 @@ impl> RangeFrom { /// elements before the index indicated by `end`. /// /// ``` -/// let arr = [0, 1, 2, 3]; -/// assert_eq!(arr[ .. ], [0,1,2,3]); -/// assert_eq!(arr[ ..3], [0,1,2 ]); // RangeTo -/// assert_eq!(arr[1.. ], [ 1,2,3]); -/// assert_eq!(arr[1..3], [ 1,2 ]); +/// let arr = [0, 1, 2, 3, 4]; +/// assert_eq!(arr[ .. ], [0,1,2,3,4]); +/// assert_eq!(arr[ .. 3], [0,1,2 ]); // RangeTo +/// assert_eq!(arr[ ..=3], [0,1,2,3 ]); +/// assert_eq!(arr[1.. ], [ 1,2,3,4]); +/// assert_eq!(arr[1.. 3], [ 1,2 ]); +/// assert_eq!(arr[1..=3], [ 1,2,3 ]); /// ``` /// /// [`IntoIterator`]: ../iter/trait.Iterator.html @@ -312,9 +320,13 @@ impl> RangeTo { /// assert_eq!((3..=5), std::ops::RangeInclusive::new(3, 5)); /// assert_eq!(3 + 4 + 5, (3..=5).sum()); /// -/// let arr = [0, 1, 2, 3]; -/// assert_eq!(arr[ ..=2], [0,1,2 ]); -/// assert_eq!(arr[1..=2], [ 1,2 ]); // RangeInclusive +/// let arr = [0, 1, 2, 3, 4]; +/// assert_eq!(arr[ .. ], [0,1,2,3,4]); +/// assert_eq!(arr[ .. 3], [0,1,2 ]); +/// assert_eq!(arr[ ..=3], [0,1,2,3 ]); +/// assert_eq!(arr[1.. ], [ 1,2,3,4]); +/// assert_eq!(arr[1.. 3], [ 1,2 ]); +/// assert_eq!(arr[1..=3], [ 1,2,3 ]); // RangeInclusive /// ``` #[doc(alias = "..=")] #[derive(Clone)] // not Copy -- see #27186 @@ -569,9 +581,13 @@ impl> RangeInclusive { /// array elements up to and including the index indicated by `end`. /// /// ``` -/// let arr = [0, 1, 2, 3]; -/// assert_eq!(arr[ ..=2], [0,1,2 ]); // RangeToInclusive -/// assert_eq!(arr[1..=2], [ 1,2 ]); +/// let arr = [0, 1, 2, 3, 4]; +/// assert_eq!(arr[ .. ], [0,1,2,3,4]); +/// assert_eq!(arr[ .. 3], [0,1,2 ]); +/// assert_eq!(arr[ ..=3], [0,1,2,3 ]); // RangeToInclusive +/// assert_eq!(arr[1.. ], [ 1,2,3,4]); +/// assert_eq!(arr[1.. 3], [ 1,2 ]); +/// assert_eq!(arr[1..=3], [ 1,2,3 ]); /// ``` /// /// [`IntoIterator`]: ../iter/trait.Iterator.html @@ -676,7 +692,7 @@ pub enum Bound { #[stable(feature = "collections_range", since = "1.28.0")] /// `RangeBounds` is implemented by Rust's built-in range types, produced -/// by range syntax like `..`, `a..`, `..b` or `c..d`. +/// by range syntax like `..`, `a..`, `..b`, `..=c`, `d..e`, or `f..=g`. pub trait RangeBounds { /// Start index bound. /// diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 60aed7ce09d7..46dfe28da622 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -1286,7 +1286,7 @@ impl> FromIterator> for Option { /// # Examples /// /// Here is an example which increments every integer in a vector. - /// `We use the checked variant of `add` that returns `None` when the + /// We use the checked variant of `add` that returns `None` when the /// calculation would result in an overflow. /// /// ``` diff --git a/src/libcore/pin.rs b/src/libcore/pin.rs index f9f20dcea9e2..fb78f5e5a238 100644 --- a/src/libcore/pin.rs +++ b/src/libcore/pin.rs @@ -215,7 +215,7 @@ //! had a method `fn get_pin_mut(self: Pin<&mut Self>) -> Pin<&mut T>`. //! Then we could do the following: //! ```compile_fail -//! fn exploit_ref_cell(rc: Pin<&mut RefCell) { +//! fn exploit_ref_cell(rc: Pin<&mut RefCell>) { //! { let p = rc.as_mut().get_pin_mut(); } // Here we get pinned access to the `T`. //! let rc_shr: &RefCell = rc.into_ref().get_ref(); //! let b = rc_shr.borrow_mut(); @@ -279,7 +279,7 @@ use ops::{Deref, DerefMut, Receiver, CoerceUnsized, DispatchFromDyn}; // implementations, are allowed because they all only use `&P`, so they cannot move // the value behind `pointer`. #[stable(feature = "pin", since = "1.33.0")] -#[cfg_attr(not(stage0), lang = "pin")] +#[lang = "pin"] #[fundamental] #[repr(transparent)] #[derive(Copy, Clone, Hash, Eq, Ord)] diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 866c8d0896b3..a9a029d606d6 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -301,7 +301,7 @@ pub unsafe fn swap(x: *mut T, y: *mut T) { // Perform the swap copy_nonoverlapping(x, tmp.as_mut_ptr(), 1); copy(y, x, 1); // `x` and `y` may overlap - copy_nonoverlapping(tmp.get_ref(), y, 1); + copy_nonoverlapping(tmp.as_ptr(), y, 1); } /// Swaps `count * size_of::()` bytes between the two regions of memory @@ -2790,7 +2790,7 @@ impl Unique { } /// Acquires the underlying `*mut` pointer. - pub fn as_ptr(self) -> *mut T { + pub const fn as_ptr(self) -> *mut T { self.pointer as *mut T } @@ -2837,15 +2837,15 @@ impl fmt::Pointer for Unique { } #[unstable(feature = "ptr_internals", issue = "0")] -impl<'a, T: ?Sized> From<&'a mut T> for Unique { - fn from(reference: &'a mut T) -> Self { +impl From<&mut T> for Unique { + fn from(reference: &mut T) -> Self { unsafe { Unique { pointer: reference as *mut T, _marker: PhantomData } } } } #[unstable(feature = "ptr_internals", issue = "0")] -impl<'a, T: ?Sized> From<&'a T> for Unique { - fn from(reference: &'a T) -> Self { +impl From<&T> for Unique { + fn from(reference: &T) -> Self { unsafe { Unique { pointer: reference as *const T, _marker: PhantomData } } } } @@ -2874,6 +2874,16 @@ impl<'a, T: ?Sized> From> for Unique { /// Usually this won't be necessary; covariance is correct for most safe abstractions, /// such as Box, Rc, Arc, Vec, and LinkedList. This is the case because they /// provide a public API that follows the normal shared XOR mutable rules of Rust. +/// +/// Notice that `NonNull` has a `From` instance for `&T`. However, this does +/// not change the fact that mutating through a (pointer derived from a) shared +/// reference is undefined behavior unless the mutation happens inside an +/// [`UnsafeCell`]. The same goes for creating a mutable reference from a shared +/// reference. When using this `From` instance without an `UnsafeCell`, +/// it is your responsibility to ensure that `as_mut` is never called, and `as_ptr` +/// is never used for mutation. +/// +/// [`UnsafeCell`]: ../cell/struct.UnsafeCell.html #[stable(feature = "nonnull", since = "1.25.0")] #[repr(transparent)] #[rustc_layout_scalar_valid_range_start(1)] @@ -2903,7 +2913,8 @@ impl NonNull { /// some other means. #[stable(feature = "nonnull", since = "1.25.0")] #[inline] - pub fn dangling() -> Self { + #[cfg_attr(not(stage0), rustc_const_unstable(feature = "const_ptr_nonnull"))] + pub const fn dangling() -> Self { unsafe { let ptr = mem::align_of::() as *mut T; NonNull::new_unchecked(ptr) @@ -2966,7 +2977,8 @@ impl NonNull { /// Cast to a pointer of another type #[stable(feature = "nonnull_cast", since = "1.27.0")] #[inline] - pub fn cast(self) -> NonNull { + #[cfg_attr(not(stage0), rustc_const_unstable(feature = "const_ptr_nonnull"))] + pub const fn cast(self) -> NonNull { unsafe { NonNull::new_unchecked(self.as_ptr() as *mut U) } @@ -3047,17 +3059,17 @@ impl From> for NonNull { } #[stable(feature = "nonnull", since = "1.25.0")] -impl<'a, T: ?Sized> From<&'a mut T> for NonNull { +impl From<&mut T> for NonNull { #[inline] - fn from(reference: &'a mut T) -> Self { + fn from(reference: &mut T) -> Self { unsafe { NonNull { pointer: reference as *mut T } } } } #[stable(feature = "nonnull", since = "1.25.0")] -impl<'a, T: ?Sized> From<&'a T> for NonNull { +impl From<&T> for NonNull { #[inline] - fn from(reference: &'a T) -> Self { + fn from(reference: &T) -> Self { unsafe { NonNull { pointer: reference as *const T } } } } diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 92d29f6ee8a3..2bd6b536301e 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -1200,7 +1200,7 @@ impl> FromIterator> for Result { /// let res: Result, &'static str> = v.iter().map(|x: &u32| /// x.checked_add(1).ok_or("Overflow!") /// ).collect(); - /// assert!(res == Ok(vec![2, 3])); + /// assert_eq!(res, Ok(vec![2, 3])); /// ``` #[inline] fn from_iter>>(iter: I) -> Result { diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index 2063f8ffaf65..b3594f8a3858 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -3288,6 +3288,34 @@ impl<'a, T> IterMut<'a, T> { pub fn into_slice(self) -> &'a mut [T] { unsafe { from_raw_parts_mut(self.ptr, len!(self)) } } + + /// Views the underlying data as a subslice of the original data. + /// + /// To avoid creating `&mut [T]` references that alias, the returned slice + /// borrows its lifetime from the iterator the method is applied on. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// # #![feature(slice_iter_mut_as_slice)] + /// let mut slice: &mut [usize] = &mut [1, 2, 3]; + /// + /// // First, we get the iterator: + /// let mut iter = slice.iter_mut(); + /// // So if we check what the `as_slice` method returns here, we have "[1, 2, 3]": + /// assert_eq!(iter.as_slice(), &[1, 2, 3]); + /// + /// // Next, we move to the second element of the slice: + /// iter.next(); + /// // Now `as_slice` returns "[2, 3]": + /// assert_eq!(iter.as_slice(), &[2, 3]); + /// ``` + #[unstable(feature = "slice_iter_mut_as_slice", reason = "recently added", issue = "58957")] + pub fn as_slice(&self) -> &[T] { + self.make_slice() + } } iterator!{struct IterMut -> *mut T, &'a mut T, mut, {mut}, {}} diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 8b51d8465141..53334adadb85 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -3965,7 +3965,7 @@ impl str { me.make_ascii_lowercase() } - /// Return an iterator that escapes each char in `s` with [`char::escape_debug`]. + /// Return an iterator that escapes each char in `self` with [`char::escape_debug`]. /// /// Note: only extended grapheme codepoints that begin the string will be /// escaped. @@ -4013,7 +4013,7 @@ impl str { } } - /// Return an iterator that escapes each char in `s` with [`char::escape_default`]. + /// Return an iterator that escapes each char in `self` with [`char::escape_default`]. /// /// [`char::escape_default`]: ../std/primitive.char.html#method.escape_default /// @@ -4051,7 +4051,7 @@ impl str { EscapeDefault { inner: self.chars().flat_map(CharEscapeDefault) } } - /// Return an iterator that escapes each char in `s` with [`char::escape_unicode`]. + /// Return an iterator that escapes each char in `self` with [`char::escape_unicode`]. /// /// [`char::escape_unicode`]: ../std/primitive.char.html#method.escape_unicode /// diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index d0ee5fa9e6b3..04a49d253015 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -290,15 +290,11 @@ pub enum Ordering { /// [`AtomicBool`]: struct.AtomicBool.html #[cfg(target_has_atomic = "8")] #[stable(feature = "rust1", since = "1.0.0")] -#[cfg_attr(not(stage0), rustc_deprecated( +#[rustc_deprecated( since = "1.34.0", reason = "the `new` function is now preferred", suggestion = "AtomicBool::new(false)", -))] -#[cfg_attr(stage0, rustc_deprecated( - since = "1.34.0", - reason = "the `new` function is now preferred", -))] +)] pub const ATOMIC_BOOL_INIT: AtomicBool = AtomicBool::new(false); #[cfg(target_has_atomic = "8")] @@ -1158,15 +1154,11 @@ macro_rules! atomic_int { /// An atomic integer initialized to `0`. #[$stable_init_const] - #[cfg_attr(stage0, rustc_deprecated( - since = "1.34.0", - reason = "the `new` function is now preferred", - ))] - #[cfg_attr(not(stage0), rustc_deprecated( + #[rustc_deprecated( since = "1.34.0", reason = "the `new` function is now preferred", suggestion = $atomic_new, - ))] + )] pub const $atomic_init: $atomic_type = $atomic_type::new(0); #[$stable] diff --git a/src/libcore/tests/fmt/num.rs b/src/libcore/tests/fmt/num.rs index 6d9494ec289a..10fcf8b76ccb 100644 --- a/src/libcore/tests/fmt/num.rs +++ b/src/libcore/tests/fmt/num.rs @@ -3,146 +3,146 @@ fn test_format_int() { // Formatting integers should select the right implementation based off // the type of the argument. Also, hex/octal/binary should be defined // for integers, but they shouldn't emit the negative sign. - assert!(format!("{}", 1isize) == "1"); - assert!(format!("{}", 1i8) == "1"); - assert!(format!("{}", 1i16) == "1"); - assert!(format!("{}", 1i32) == "1"); - assert!(format!("{}", 1i64) == "1"); - assert!(format!("{}", -1isize) == "-1"); - assert!(format!("{}", -1i8) == "-1"); - assert!(format!("{}", -1i16) == "-1"); - assert!(format!("{}", -1i32) == "-1"); - assert!(format!("{}", -1i64) == "-1"); - assert!(format!("{:?}", 1isize) == "1"); - assert!(format!("{:?}", 1i8) == "1"); - assert!(format!("{:?}", 1i16) == "1"); - assert!(format!("{:?}", 1i32) == "1"); - assert!(format!("{:?}", 1i64) == "1"); - assert!(format!("{:b}", 1isize) == "1"); - assert!(format!("{:b}", 1i8) == "1"); - assert!(format!("{:b}", 1i16) == "1"); - assert!(format!("{:b}", 1i32) == "1"); - assert!(format!("{:b}", 1i64) == "1"); - assert!(format!("{:x}", 1isize) == "1"); - assert!(format!("{:x}", 1i8) == "1"); - assert!(format!("{:x}", 1i16) == "1"); - assert!(format!("{:x}", 1i32) == "1"); - assert!(format!("{:x}", 1i64) == "1"); - assert!(format!("{:X}", 1isize) == "1"); - assert!(format!("{:X}", 1i8) == "1"); - assert!(format!("{:X}", 1i16) == "1"); - assert!(format!("{:X}", 1i32) == "1"); - assert!(format!("{:X}", 1i64) == "1"); - assert!(format!("{:o}", 1isize) == "1"); - assert!(format!("{:o}", 1i8) == "1"); - assert!(format!("{:o}", 1i16) == "1"); - assert!(format!("{:o}", 1i32) == "1"); - assert!(format!("{:o}", 1i64) == "1"); + assert_eq!(format!("{}", 1isize), "1"); + assert_eq!(format!("{}", 1i8), "1"); + assert_eq!(format!("{}", 1i16), "1"); + assert_eq!(format!("{}", 1i32), "1"); + assert_eq!(format!("{}", 1i64), "1"); + assert_eq!(format!("{}", -1isize), "-1"); + assert_eq!(format!("{}", -1i8), "-1"); + assert_eq!(format!("{}", -1i16), "-1"); + assert_eq!(format!("{}", -1i32), "-1"); + assert_eq!(format!("{}", -1i64), "-1"); + assert_eq!(format!("{:?}", 1isize), "1"); + assert_eq!(format!("{:?}", 1i8), "1"); + assert_eq!(format!("{:?}", 1i16), "1"); + assert_eq!(format!("{:?}", 1i32), "1"); + assert_eq!(format!("{:?}", 1i64), "1"); + assert_eq!(format!("{:b}", 1isize), "1"); + assert_eq!(format!("{:b}", 1i8), "1"); + assert_eq!(format!("{:b}", 1i16), "1"); + assert_eq!(format!("{:b}", 1i32), "1"); + assert_eq!(format!("{:b}", 1i64), "1"); + assert_eq!(format!("{:x}", 1isize), "1"); + assert_eq!(format!("{:x}", 1i8), "1"); + assert_eq!(format!("{:x}", 1i16), "1"); + assert_eq!(format!("{:x}", 1i32), "1"); + assert_eq!(format!("{:x}", 1i64), "1"); + assert_eq!(format!("{:X}", 1isize), "1"); + assert_eq!(format!("{:X}", 1i8), "1"); + assert_eq!(format!("{:X}", 1i16), "1"); + assert_eq!(format!("{:X}", 1i32), "1"); + assert_eq!(format!("{:X}", 1i64), "1"); + assert_eq!(format!("{:o}", 1isize), "1"); + assert_eq!(format!("{:o}", 1i8), "1"); + assert_eq!(format!("{:o}", 1i16), "1"); + assert_eq!(format!("{:o}", 1i32), "1"); + assert_eq!(format!("{:o}", 1i64), "1"); - assert!(format!("{}", 1usize) == "1"); - assert!(format!("{}", 1u8) == "1"); - assert!(format!("{}", 1u16) == "1"); - assert!(format!("{}", 1u32) == "1"); - assert!(format!("{}", 1u64) == "1"); - assert!(format!("{:?}", 1usize) == "1"); - assert!(format!("{:?}", 1u8) == "1"); - assert!(format!("{:?}", 1u16) == "1"); - assert!(format!("{:?}", 1u32) == "1"); - assert!(format!("{:?}", 1u64) == "1"); - assert!(format!("{:b}", 1usize) == "1"); - assert!(format!("{:b}", 1u8) == "1"); - assert!(format!("{:b}", 1u16) == "1"); - assert!(format!("{:b}", 1u32) == "1"); - assert!(format!("{:b}", 1u64) == "1"); - assert!(format!("{:x}", 1usize) == "1"); - assert!(format!("{:x}", 1u8) == "1"); - assert!(format!("{:x}", 1u16) == "1"); - assert!(format!("{:x}", 1u32) == "1"); - assert!(format!("{:x}", 1u64) == "1"); - assert!(format!("{:X}", 1usize) == "1"); - assert!(format!("{:X}", 1u8) == "1"); - assert!(format!("{:X}", 1u16) == "1"); - assert!(format!("{:X}", 1u32) == "1"); - assert!(format!("{:X}", 1u64) == "1"); - assert!(format!("{:o}", 1usize) == "1"); - assert!(format!("{:o}", 1u8) == "1"); - assert!(format!("{:o}", 1u16) == "1"); - assert!(format!("{:o}", 1u32) == "1"); - assert!(format!("{:o}", 1u64) == "1"); + assert_eq!(format!("{}", 1usize), "1"); + assert_eq!(format!("{}", 1u8), "1"); + assert_eq!(format!("{}", 1u16), "1"); + assert_eq!(format!("{}", 1u32), "1"); + assert_eq!(format!("{}", 1u64), "1"); + assert_eq!(format!("{:?}", 1usize), "1"); + assert_eq!(format!("{:?}", 1u8), "1"); + assert_eq!(format!("{:?}", 1u16), "1"); + assert_eq!(format!("{:?}", 1u32), "1"); + assert_eq!(format!("{:?}", 1u64), "1"); + assert_eq!(format!("{:b}", 1usize), "1"); + assert_eq!(format!("{:b}", 1u8), "1"); + assert_eq!(format!("{:b}", 1u16), "1"); + assert_eq!(format!("{:b}", 1u32), "1"); + assert_eq!(format!("{:b}", 1u64), "1"); + assert_eq!(format!("{:x}", 1usize), "1"); + assert_eq!(format!("{:x}", 1u8), "1"); + assert_eq!(format!("{:x}", 1u16), "1"); + assert_eq!(format!("{:x}", 1u32), "1"); + assert_eq!(format!("{:x}", 1u64), "1"); + assert_eq!(format!("{:X}", 1usize), "1"); + assert_eq!(format!("{:X}", 1u8), "1"); + assert_eq!(format!("{:X}", 1u16), "1"); + assert_eq!(format!("{:X}", 1u32), "1"); + assert_eq!(format!("{:X}", 1u64), "1"); + assert_eq!(format!("{:o}", 1usize), "1"); + assert_eq!(format!("{:o}", 1u8), "1"); + assert_eq!(format!("{:o}", 1u16), "1"); + assert_eq!(format!("{:o}", 1u32), "1"); + assert_eq!(format!("{:o}", 1u64), "1"); // Test a larger number - assert!(format!("{:b}", 55) == "110111"); - assert!(format!("{:o}", 55) == "67"); - assert!(format!("{}", 55) == "55"); - assert!(format!("{:x}", 55) == "37"); - assert!(format!("{:X}", 55) == "37"); + assert_eq!(format!("{:b}", 55), "110111"); + assert_eq!(format!("{:o}", 55), "67"); + assert_eq!(format!("{}", 55), "55"); + assert_eq!(format!("{:x}", 55), "37"); + assert_eq!(format!("{:X}", 55), "37"); } #[test] fn test_format_int_zero() { - assert!(format!("{}", 0) == "0"); - assert!(format!("{:?}", 0) == "0"); - assert!(format!("{:b}", 0) == "0"); - assert!(format!("{:o}", 0) == "0"); - assert!(format!("{:x}", 0) == "0"); - assert!(format!("{:X}", 0) == "0"); + assert_eq!(format!("{}", 0), "0"); + assert_eq!(format!("{:?}", 0), "0"); + assert_eq!(format!("{:b}", 0), "0"); + assert_eq!(format!("{:o}", 0), "0"); + assert_eq!(format!("{:x}", 0), "0"); + assert_eq!(format!("{:X}", 0), "0"); - assert!(format!("{}", 0u32) == "0"); - assert!(format!("{:?}", 0u32) == "0"); - assert!(format!("{:b}", 0u32) == "0"); - assert!(format!("{:o}", 0u32) == "0"); - assert!(format!("{:x}", 0u32) == "0"); - assert!(format!("{:X}", 0u32) == "0"); + assert_eq!(format!("{}", 0u32), "0"); + assert_eq!(format!("{:?}", 0u32), "0"); + assert_eq!(format!("{:b}", 0u32), "0"); + assert_eq!(format!("{:o}", 0u32), "0"); + assert_eq!(format!("{:x}", 0u32), "0"); + assert_eq!(format!("{:X}", 0u32), "0"); } #[test] fn test_format_int_flags() { - assert!(format!("{:3}", 1) == " 1"); - assert!(format!("{:>3}", 1) == " 1"); - assert!(format!("{:>+3}", 1) == " +1"); - assert!(format!("{:<3}", 1) == "1 "); - assert!(format!("{:#}", 1) == "1"); - assert!(format!("{:#x}", 10) == "0xa"); - assert!(format!("{:#X}", 10) == "0xA"); - assert!(format!("{:#5x}", 10) == " 0xa"); - assert!(format!("{:#o}", 10) == "0o12"); - assert!(format!("{:08x}", 10) == "0000000a"); - assert!(format!("{:8x}", 10) == " a"); - assert!(format!("{:<8x}", 10) == "a "); - assert!(format!("{:>8x}", 10) == " a"); - assert!(format!("{:#08x}", 10) == "0x00000a"); - assert!(format!("{:08}", -10) == "-0000010"); - assert!(format!("{:x}", !0u8) == "ff"); - assert!(format!("{:X}", !0u8) == "FF"); - assert!(format!("{:b}", !0u8) == "11111111"); - assert!(format!("{:o}", !0u8) == "377"); - assert!(format!("{:#x}", !0u8) == "0xff"); - assert!(format!("{:#X}", !0u8) == "0xFF"); - assert!(format!("{:#b}", !0u8) == "0b11111111"); - assert!(format!("{:#o}", !0u8) == "0o377"); + assert_eq!(format!("{:3}", 1), " 1"); + assert_eq!(format!("{:>3}", 1), " 1"); + assert_eq!(format!("{:>+3}", 1), " +1"); + assert_eq!(format!("{:<3}", 1), "1 "); + assert_eq!(format!("{:#}", 1), "1"); + assert_eq!(format!("{:#x}", 10), "0xa"); + assert_eq!(format!("{:#X}", 10), "0xA"); + assert_eq!(format!("{:#5x}", 10), " 0xa"); + assert_eq!(format!("{:#o}", 10), "0o12"); + assert_eq!(format!("{:08x}", 10), "0000000a"); + assert_eq!(format!("{:8x}", 10), " a"); + assert_eq!(format!("{:<8x}", 10), "a "); + assert_eq!(format!("{:>8x}", 10), " a"); + assert_eq!(format!("{:#08x}", 10), "0x00000a"); + assert_eq!(format!("{:08}", -10), "-0000010"); + assert_eq!(format!("{:x}", !0u8), "ff"); + assert_eq!(format!("{:X}", !0u8), "FF"); + assert_eq!(format!("{:b}", !0u8), "11111111"); + assert_eq!(format!("{:o}", !0u8), "377"); + assert_eq!(format!("{:#x}", !0u8), "0xff"); + assert_eq!(format!("{:#X}", !0u8), "0xFF"); + assert_eq!(format!("{:#b}", !0u8), "0b11111111"); + assert_eq!(format!("{:#o}", !0u8), "0o377"); } #[test] fn test_format_int_sign_padding() { - assert!(format!("{:+5}", 1) == " +1"); - assert!(format!("{:+5}", -1) == " -1"); - assert!(format!("{:05}", 1) == "00001"); - assert!(format!("{:05}", -1) == "-0001"); - assert!(format!("{:+05}", 1) == "+0001"); - assert!(format!("{:+05}", -1) == "-0001"); + assert_eq!(format!("{:+5}", 1), " +1"); + assert_eq!(format!("{:+5}", -1), " -1"); + assert_eq!(format!("{:05}", 1), "00001"); + assert_eq!(format!("{:05}", -1), "-0001"); + assert_eq!(format!("{:+05}", 1), "+0001"); + assert_eq!(format!("{:+05}", -1), "-0001"); } #[test] fn test_format_int_twos_complement() { - use core::{i8, i16, i32, i64}; - assert!(format!("{}", i8::MIN) == "-128"); - assert!(format!("{}", i16::MIN) == "-32768"); - assert!(format!("{}", i32::MIN) == "-2147483648"); - assert!(format!("{}", i64::MIN) == "-9223372036854775808"); + use core::{i16, i32, i64, i8}; + assert_eq!(format!("{}", i8::MIN), "-128"); + assert_eq!(format!("{}", i16::MIN), "-32768"); + assert_eq!(format!("{}", i32::MIN), "-2147483648"); + assert_eq!(format!("{}", i64::MIN), "-9223372036854775808"); } #[test] fn test_format_debug_hex() { - assert!(format!("{:02x?}", b"Foo\0") == "[46, 6f, 6f, 00]"); - assert!(format!("{:02X?}", b"Foo\0") == "[46, 6F, 6F, 00]"); + assert_eq!(format!("{:02x?}", b"Foo\0"), "[46, 6f, 6f, 00]"); + assert_eq!(format!("{:02X?}", b"Foo\0"), "[46, 6F, 6F, 00]"); } diff --git a/src/libcore/tests/iter.rs b/src/libcore/tests/iter.rs index d880abb181c2..a9db9b35d8d8 100644 --- a/src/libcore/tests/iter.rs +++ b/src/libcore/tests/iter.rs @@ -1082,12 +1082,39 @@ fn test_iterator_product_result() { assert_eq!(v.iter().cloned().product::>(), Err(())); } +/// A wrapper struct that implements `Eq` and `Ord` based on the wrapped +/// integer modulo 3. Used to test that `Iterator::max` and `Iterator::min` +/// return the correct element if some of them are equal. +#[derive(Debug)] +struct Mod3(i32); + +impl PartialEq for Mod3 { + fn eq(&self, other: &Self) -> bool { + self.0 % 3 == other.0 % 3 + } +} + +impl Eq for Mod3 {} + +impl PartialOrd for Mod3 { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +impl Ord for Mod3 { + fn cmp(&self, other: &Self) -> core::cmp::Ordering { + (self.0 % 3).cmp(&(other.0 % 3)) + } +} + #[test] fn test_iterator_max() { let v: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; assert_eq!(v[..4].iter().cloned().max(), Some(3)); assert_eq!(v.iter().cloned().max(), Some(10)); assert_eq!(v[..0].iter().cloned().max(), None); + assert_eq!(v.iter().cloned().map(Mod3).max().map(|x| x.0), Some(8)); } #[test] @@ -1096,6 +1123,7 @@ fn test_iterator_min() { assert_eq!(v[..4].iter().cloned().min(), Some(0)); assert_eq!(v.iter().cloned().min(), Some(0)); assert_eq!(v[..0].iter().cloned().min(), None); + assert_eq!(v.iter().cloned().map(Mod3).min().map(|x| x.0), Some(0)); } #[test] diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index 4cd734bad90a..d00213763897 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -26,7 +26,6 @@ #![feature(str_internals)] #![feature(test)] #![feature(trusted_len)] -#![feature(try_from)] #![feature(try_trait)] #![feature(align_offset)] #![feature(reverse_bits)] diff --git a/src/librustc/Cargo.toml b/src/librustc/Cargo.toml index e83adad4e2a0..31e10c19c7a6 100644 --- a/src/librustc/Cargo.toml +++ b/src/librustc/Cargo.toml @@ -17,13 +17,14 @@ graphviz = { path = "../libgraphviz" } jobserver = "0.1" lazy_static = "1.0.0" num_cpus = "1.0" -scoped-tls = { version = "0.1.1", features = ["nightly"] } +scoped-tls = "1.0" log = { version = "0.4", features = ["release_max_level_info", "std"] } polonius-engine = "0.6.2" -rustc-rayon = "0.1.1" -rustc-rayon-core = "0.1.1" +rustc-rayon = "0.1.2" +rustc-rayon-core = "0.1.2" rustc_apfloat = { path = "../librustc_apfloat" } rustc_target = { path = "../librustc_target" } +rustc_macros = { path = "../librustc_macros" } rustc_data_structures = { path = "../librustc_data_structures" } errors = { path = "../librustc_errors", package = "rustc_errors" } serialize = { path = "../libserialize" } diff --git a/src/librustc/cfg/construct.rs b/src/librustc/cfg/construct.rs index 9eeae6eeb5f3..e96709f6d14e 100644 --- a/src/librustc/cfg/construct.rs +++ b/src/librustc/cfg/construct.rs @@ -398,7 +398,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { args: I) -> CFGIndex { let func_or_rcvr_exit = self.expr(func_or_rcvr, pred); let ret = self.straightline(call_expr, func_or_rcvr_exit, args); - let m = self.tcx.hir().get_module_parent(call_expr.id); + let m = self.tcx.hir().get_module_parent_by_hir_id(call_expr.hir_id); if self.tcx.is_ty_uninhabited_from(m, self.tables.expr_ty(call_expr)) { self.add_unreachable_node() } else { @@ -571,9 +571,9 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { match destination.target_id { Ok(loop_id) => { for b in &self.breakable_block_scopes { - if b.block_expr_id == self.tcx.hir().node_to_hir_id(loop_id).local_id { + if b.block_expr_id == loop_id.local_id { let scope = region::Scope { - id: self.tcx.hir().node_to_hir_id(loop_id).local_id, + id: loop_id.local_id, data: region::ScopeData::Node }; return (scope, match scope_cf_kind { @@ -583,9 +583,9 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { } } for l in &self.loop_scopes { - if l.loop_id == self.tcx.hir().node_to_hir_id(loop_id).local_id { + if l.loop_id == loop_id.local_id { let scope = region::Scope { - id: self.tcx.hir().node_to_hir_id(loop_id).local_id, + id: loop_id.local_id, data: region::ScopeData::Node }; return (scope, match scope_cf_kind { diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index 2f91da4f62e3..41a4a8031006 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -67,7 +67,7 @@ use crate::traits::query::{ }; use crate::ty::{TyCtxt, FnSig, Instance, InstanceDef, ParamEnv, ParamEnvAnd, Predicate, PolyFnSig, PolyTraitRef, Ty}; -use crate::ty::subst::Substs; +use crate::ty::subst::SubstsRef; // erase!() just makes tokens go away. It's used to specify which macro argument // is repeated (i.e., which sub-expression of the macro we are in) but don't need @@ -456,6 +456,8 @@ define_dep_nodes!( <'tcx> [eval_always] CoherenceInherentImplOverlapCheck, [] CoherenceCheckTrait(DefId), [eval_always] PrivacyAccessLevels(CrateNum), + [eval_always] CheckPrivateInPublic(CrateNum), + [eval_always] Analysis(CrateNum), // Represents the MIR for a fn; also used as the task node for // things read/modify that MIR. @@ -661,7 +663,7 @@ define_dep_nodes!( <'tcx> [] TypeOpNormalizePolyFnSig(CanonicalTypeOpNormalizeGoal<'tcx, PolyFnSig<'tcx>>), [] TypeOpNormalizeFnSig(CanonicalTypeOpNormalizeGoal<'tcx, FnSig<'tcx>>), - [] SubstituteNormalizeAndTestPredicates { key: (DefId, &'tcx Substs<'tcx>) }, + [] SubstituteNormalizeAndTestPredicates { key: (DefId, SubstsRef<'tcx>) }, [] MethodAutoderefSteps(CanonicalTyGoal<'tcx>), [input] TargetFeaturesWhitelist, diff --git a/src/librustc/hir/check_attr.rs b/src/librustc/hir/check_attr.rs index ddc1eebe645a..86f7e1499648 100644 --- a/src/librustc/hir/check_attr.rs +++ b/src/librustc/hir/check_attr.rs @@ -94,7 +94,7 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> { /// Checks any attribute. fn check_attributes(&self, item: &hir::Item, target: Target) { if target == Target::Fn || target == Target::Const { - self.tcx.codegen_fn_attrs(self.tcx.hir().local_def_id(item.id)); + self.tcx.codegen_fn_attrs(self.tcx.hir().local_def_id_from_hir_id(item.hir_id)); } else if let Some(a) = item.attrs.iter().find(|a| a.check_name("target_feature")) { self.tcx.sess.struct_span_err(a.span, "attribute should be applied to a function") .span_label(item.span, "not a function") @@ -344,12 +344,6 @@ impl<'a, 'tcx> Visitor<'tcx> for CheckAttrVisitor<'a, 'tcx> { } } -pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - for &module in tcx.hir().krate().modules.keys() { - tcx.ensure().check_mod_attrs(tcx.hir().local_def_id(module)); - } -} - fn is_c_like_enum(item: &hir::Item) -> bool { if let hir::ItemKind::Enum(ref def, _) = item.node { for variant in &def.variants { diff --git a/src/librustc/hir/def.rs b/src/librustc/hir/def.rs index f6d864f5b404..b45fc3ffd82f 100644 --- a/src/librustc/hir/def.rs +++ b/src/librustc/hir/def.rs @@ -3,12 +3,13 @@ use crate::util::nodemap::{NodeMap, DefIdMap}; use syntax::ast; use syntax::ext::base::MacroKind; use syntax_pos::Span; +use rustc_macros::HashStable; use crate::hir; use crate::ty; use self::Namespace::*; -#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, HashStable)] pub enum CtorKind { /// Constructor function automatically created by a tuple struct/variant. Fn, @@ -18,7 +19,7 @@ pub enum CtorKind { Fictive, } -#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, HashStable)] pub enum NonMacroAttrKind { /// Single-segment attribute defined by the language (`#[inline]`) Builtin, @@ -32,7 +33,7 @@ pub enum NonMacroAttrKind { Custom, } -#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, HashStable)] pub enum Def { // Type namespace Mod(DefId), @@ -209,7 +210,7 @@ pub type ExportMap = DefIdMap>; /// namespace. pub type ImportMap = NodeMap>>; -#[derive(Copy, Clone, Debug, RustcEncodable, RustcDecodable)] +#[derive(Copy, Clone, Debug, RustcEncodable, RustcDecodable, HashStable)] pub struct Export { /// The name of the target. pub ident: ast::Ident, diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs index 0bc40da7e4f2..977830315e23 100644 --- a/src/librustc/hir/intravisit.rs +++ b/src/librustc/hir/intravisit.rs @@ -34,7 +34,6 @@ use syntax::ast::{Ident, Name, Attribute}; use syntax_pos::Span; use crate::hir::*; -use crate::hir::def::Def; use crate::hir::map::Map; use super::itemlikevisit::DeepVisitor; @@ -228,9 +227,6 @@ pub trait Visitor<'v> : Sized { fn visit_id(&mut self, _hir_id: HirId) { // Nothing to do. } - fn visit_def_mention(&mut self, _def: Def) { - // Nothing to do. - } fn visit_name(&mut self, _span: Span, _name: Name) { // Nothing to do. } @@ -494,13 +490,10 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) { visitor.visit_ty(typ); visitor.visit_generics(type_parameters) } - ItemKind::Existential(ExistTy {ref generics, ref bounds, impl_trait_fn}) => { + ItemKind::Existential(ExistTy { ref generics, ref bounds, impl_trait_fn: _ }) => { visitor.visit_id(item.hir_id); walk_generics(visitor, generics); walk_list!(visitor, visit_param_bound, bounds); - if let Some(impl_trait_fn) = impl_trait_fn { - visitor.visit_def_mention(Def::Fn(impl_trait_fn)) - } } ItemKind::Enum(ref enum_definition, ref type_parameters) => { visitor.visit_generics(type_parameters); @@ -617,6 +610,9 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) { TyKind::Typeof(ref expression) => { visitor.visit_anon_const(expression) } + TyKind::CVarArgs(ref lt) => { + visitor.visit_lifetime(lt) + } TyKind::Infer | TyKind::Err => {} } } @@ -637,7 +633,6 @@ pub fn walk_qpath<'v, V: Visitor<'v>>(visitor: &mut V, qpath: &'v QPath, id: Hir } pub fn walk_path<'v, V: Visitor<'v>>(visitor: &mut V, path: &'v Path) { - visitor.visit_def_mention(path.def); for segment in &path.segments { visitor.visit_path_segment(path.span, segment); } @@ -694,8 +689,7 @@ pub fn walk_pat<'v, V: Visitor<'v>>(visitor: &mut V, pattern: &'v Pat) { PatKind::Ref(ref subpattern, _) => { visitor.visit_pat(subpattern) } - PatKind::Binding(_, canonical_id, _hir_id, ident, ref optional_subpattern) => { - visitor.visit_def_mention(Def::Local(canonical_id)); + PatKind::Binding(_, _hir_id, ident, ref optional_subpattern) => { visitor.visit_ident(ident); walk_list!(visitor, visit_pat, optional_subpattern); } @@ -875,7 +869,6 @@ pub fn walk_trait_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, trait_item_ref: pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplItem) { // N.B., deliberately force a compilation error if/when new fields are added. let ImplItem { - id: _, hir_id: _, ident, ref vis, @@ -1062,18 +1055,12 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr) { ExprKind::Break(ref destination, ref opt_expr) => { if let Some(ref label) = destination.label { visitor.visit_label(label); - if let Ok(node_id) = destination.target_id { - visitor.visit_def_mention(Def::Label(node_id)) - } } walk_list!(visitor, visit_expr, opt_expr); } ExprKind::Continue(ref destination) => { if let Some(ref label) = destination.label { visitor.visit_label(label); - if let Ok(node_id) = destination.target_id { - visitor.visit_def_mention(Def::Label(node_id)) - } } } ExprKind::Ret(ref optional_expression) => { @@ -1103,7 +1090,7 @@ pub fn walk_arm<'v, V: Visitor<'v>>(visitor: &mut V, arm: &'v Arm) { } pub fn walk_vis<'v, V: Visitor<'v>>(visitor: &mut V, vis: &'v Visibility) { - if let VisibilityKind::Restricted { ref path, id: _, hir_id } = vis.node { + if let VisibilityKind::Restricted { ref path, hir_id } = vis.node { visitor.visit_id(hir_id); visitor.visit_path(path, hir_id) } diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index d55f62d3e1a5..949fdd2682b9 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -74,7 +74,7 @@ const HIR_ID_COUNTER_LOCKED: u32 = 0xFFFFFFFF; pub struct LoweringContext<'a> { crate_root: Option<&'static str>, - // Used to assign ids to HIR nodes that do not directly correspond to an AST node. + /// Used to assign ids to HIR nodes that do not directly correspond to an AST node. sess: &'a Session, cstore: &'a dyn CrateStore, @@ -107,25 +107,25 @@ pub struct LoweringContext<'a> { /// written at all (e.g., `&T` or `std::cell::Ref`). anonymous_lifetime_mode: AnonymousLifetimeMode, - // Used to create lifetime definitions from in-band lifetime usages. - // e.g., `fn foo(x: &'x u8) -> &'x u8` to `fn foo<'x>(x: &'x u8) -> &'x u8` - // When a named lifetime is encountered in a function or impl header and - // has not been defined - // (i.e., it doesn't appear in the in_scope_lifetimes list), it is added - // to this list. The results of this list are then added to the list of - // lifetime definitions in the corresponding impl or function generics. + /// Used to create lifetime definitions from in-band lifetime usages. + /// e.g., `fn foo(x: &'x u8) -> &'x u8` to `fn foo<'x>(x: &'x u8) -> &'x u8` + /// When a named lifetime is encountered in a function or impl header and + /// has not been defined + /// (i.e., it doesn't appear in the in_scope_lifetimes list), it is added + /// to this list. The results of this list are then added to the list of + /// lifetime definitions in the corresponding impl or function generics. lifetimes_to_define: Vec<(Span, ParamName)>, - // Whether or not in-band lifetimes are being collected. This is used to - // indicate whether or not we're in a place where new lifetimes will result - // in in-band lifetime definitions, such a function or an impl header, - // including implicit lifetimes from `impl_header_lifetime_elision`. + /// Whether or not in-band lifetimes are being collected. This is used to + /// indicate whether or not we're in a place where new lifetimes will result + /// in in-band lifetime definitions, such a function or an impl header, + /// including implicit lifetimes from `impl_header_lifetime_elision`. is_collecting_in_band_lifetimes: bool, - // Currently in-scope lifetimes defined in impl headers, fn headers, or HRTB. - // When `is_collectin_in_band_lifetimes` is true, each lifetime is checked - // against this list to see if it is already in-scope, or if a definition - // needs to be created for it. + /// Currently in-scope lifetimes defined in impl headers, fn headers, or HRTB. + /// When `is_collectin_in_band_lifetimes` is true, each lifetime is checked + /// against this list to see if it is already in-scope, or if a definition + /// needs to be created for it. in_scope_lifetimes: Vec, current_module: NodeId, @@ -469,8 +469,8 @@ impl<'a> LoweringContext<'a> { fn visit_trait_item(&mut self, item: &'lcx TraitItem) { self.lctx.with_hir_id_owner(item.id, |lctx| { - let id = hir::TraitItemId { node_id: item.id }; let hir_item = lctx.lower_trait_item(item); + let id = hir::TraitItemId { hir_id: hir_item.hir_id }; lctx.trait_items.insert(id, hir_item); lctx.modules.get_mut(&lctx.current_module).unwrap().trait_items.insert(id); }); @@ -480,8 +480,8 @@ impl<'a> LoweringContext<'a> { fn visit_impl_item(&mut self, item: &'lcx ImplItem) { self.lctx.with_hir_id_owner(item.id, |lctx| { - let id = hir::ImplItemId { node_id: item.id }; let hir_item = lctx.lower_impl_item(item); + let id = hir::ImplItemId { hir_id: hir_item.hir_id }; lctx.impl_items.insert(id, hir_item); lctx.modules.get_mut(&lctx.current_module).unwrap().impl_items.insert(id); }); @@ -780,7 +780,6 @@ impl<'a> LoweringContext<'a> { ); hir::GenericParam { - id: node_id, hir_id, name: hir_name, attrs: hir_vec![], @@ -955,7 +954,7 @@ impl<'a> LoweringContext<'a> { let decl = FnDecl { inputs: vec![], output, - variadic: false + c_variadic: false }; let body_id = self.record_body(body_expr, Some(&decl)); self.is_generator = prev_is_generator; @@ -964,7 +963,6 @@ impl<'a> LoweringContext<'a> { let closure_hir_id = self.lower_node_id(closure_node_id).hir_id; let decl = self.lower_fn_decl(&decl, None, /* impl trait allowed */ false, None); let generator = hir::Expr { - id: closure_node_id, hir_id: closure_hir_id, node: hir::ExprKind::Closure(capture_clause, decl, body_id, span, Some(hir::GeneratorMovability::Static)), @@ -1070,7 +1068,7 @@ impl<'a> LoweringContext<'a> { let target_id = match destination { Some((id, _)) => { if let Def::Label(loop_id) = self.expect_full_def(id) { - Ok(self.lower_node_id(loop_id).node_id) + Ok(self.lower_node_id(loop_id).hir_id) } else { Err(hir::LoopIdError::UnresolvedLabel) } @@ -1079,7 +1077,7 @@ impl<'a> LoweringContext<'a> { self.loop_scopes .last() .cloned() - .map(|id| Ok(self.lower_node_id(id).node_id)) + .map(|id| Ok(self.lower_node_id(id).hir_id)) .unwrap_or(Err(hir::LoopIdError::OutsideLoopScope)) .into() } @@ -1153,10 +1151,9 @@ impl<'a> LoweringContext<'a> { fn lower_ty_binding(&mut self, b: &TypeBinding, itctx: ImplTraitContext<'_>) -> hir::TypeBinding { - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(b.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(b.id); hir::TypeBinding { - id: node_id, hir_id, ident: b.ident, ty: self.lower_ty(&b.ty, itctx), @@ -1300,7 +1297,6 @@ impl<'a> LoweringContext<'a> { // Set the name to `impl Bound1 + Bound2`. let ident = Ident::from_str(&pprust::ty_to_string(t)).with_span_pos(span); in_band_ty_params.push(hir::GenericParam { - id: def_node_id, hir_id, name: ParamName::Plain(ident), pure_wrt_drop: false, @@ -1348,11 +1344,16 @@ impl<'a> LoweringContext<'a> { } } TyKind::Mac(_) => panic!("TyMac should have been expanded by now."), + TyKind::CVarArgs => { + // Create the implicit lifetime of the "spoofed" `VaList`. + let span = self.sess.source_map().next_point(t.span.shrink_to_lo()); + let lt = self.new_implicit_lifetime(span); + hir::TyKind::CVarArgs(lt) + }, }; - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(t.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(t.id); hir::Ty { - id: node_id, node: kind, span: t.span, hir_id, @@ -1394,12 +1395,11 @@ impl<'a> LoweringContext<'a> { ); self.with_hir_id_owner(exist_ty_node_id, |lctx| { - let LoweredNodeId { node_id, hir_id } = lctx.next_id(); + let LoweredNodeId { node_id: _, hir_id } = lctx.next_id(); let exist_ty_item_kind = hir::ItemKind::Existential(hir::ExistTy { generics: hir::Generics { params: lifetime_defs, where_clause: hir::WhereClause { - id: node_id, hir_id, predicates: Vec::new().into(), }, @@ -1414,7 +1414,6 @@ impl<'a> LoweringContext<'a> { trace!("exist ty def index: {:#?}", exist_ty_def_index); let exist_ty_item = hir::Item { - id: exist_ty_id.node_id, hir_id: exist_ty_id.hir_id, ident: keywords::Invalid.ident(), attrs: Default::default(), @@ -1533,9 +1532,8 @@ impl<'a> LoweringContext<'a> { && !self.already_defined_lifetimes.contains(&name) { self.already_defined_lifetimes.insert(name); - let LoweredNodeId { node_id, hir_id } = self.context.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.context.next_id(); self.output_lifetimes.push(hir::GenericArg::Lifetime(hir::Lifetime { - id: node_id, hir_id, span: lifetime.span, name, @@ -1569,7 +1567,6 @@ impl<'a> LoweringContext<'a> { }; self.output_lifetime_params.push(hir::GenericParam { - id: def_node_id, hir_id, name, span: lifetime.span, @@ -1935,7 +1932,6 @@ impl<'a> LoweringContext<'a> { hir::PathSegment::new( segment.ident, - Some(id.node_id), Some(id.hir_id), Some(def), generic_args, @@ -1980,17 +1976,16 @@ impl<'a> LoweringContext<'a> { .map(|ty| this.lower_ty_direct(ty, ImplTraitContext::disallowed())) .collect(); let mk_tup = |this: &mut Self, tys, span| { - let LoweredNodeId { node_id, hir_id } = this.next_id(); - hir::Ty { node: hir::TyKind::Tup(tys), id: node_id, hir_id, span } + let LoweredNodeId { node_id: _, hir_id } = this.next_id(); + hir::Ty { node: hir::TyKind::Tup(tys), hir_id, span } }; - let LoweredNodeId { node_id, hir_id } = this.next_id(); + let LoweredNodeId { node_id: _, hir_id } = this.next_id(); ( hir::GenericArgs { args: hir_vec![GenericArg::Type(mk_tup(this, inputs, span))], bindings: hir_vec![ hir::TypeBinding { - id: node_id, hir_id, ident: Ident::from_str(FN_OUTPUT_NAME), ty: output @@ -2009,7 +2004,7 @@ impl<'a> LoweringContext<'a> { } fn lower_local(&mut self, l: &Local) -> (hir::Local, SmallVec<[hir::ItemId; 1]>) { - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(l.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(l.id); let mut ids = SmallVec::<[hir::ItemId; 1]>::new(); if self.sess.features_untracked().impl_trait_in_bindings { if let Some(ref ty) = l.ty { @@ -2019,7 +2014,6 @@ impl<'a> LoweringContext<'a> { } let parent_def_id = DefId::local(self.current_hir_id_owner.last().unwrap().0); (hir::Local { - id: node_id, hir_id, ty: l.ty .as_ref() @@ -2046,9 +2040,8 @@ impl<'a> LoweringContext<'a> { } fn lower_arg(&mut self, arg: &Arg) -> hir::Arg { - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(arg.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(arg.id); hir::Arg { - id: node_id, hir_id, pat: self.lower_pat(&arg.pat), } @@ -2119,7 +2112,7 @@ impl<'a> LoweringContext<'a> { P(hir::FnDecl { inputs, output, - variadic: decl.variadic, + c_variadic: decl.c_variadic, implicit_self: decl.inputs.get(0).map_or( hir::ImplicitSelfKind::None, |arg| { @@ -2318,9 +2311,8 @@ impl<'a> LoweringContext<'a> { this.lower_ty(ty, ImplTraitContext::Existential(Some(fn_def_id))) } FunctionRetTy::Default(span) => { - let LoweredNodeId { node_id, hir_id } = this.next_id(); + let LoweredNodeId { node_id: _, hir_id } = this.next_id(); P(hir::Ty { - id: node_id, hir_id, node: hir::TyKind::Tup(hir_vec![]), span: *span, @@ -2329,13 +2321,12 @@ impl<'a> LoweringContext<'a> { }; // "" - let LoweredNodeId { node_id, hir_id } = this.next_id(); + let LoweredNodeId { node_id: _, hir_id } = this.next_id(); let future_params = P(hir::GenericArgs { args: hir_vec![], bindings: hir_vec![hir::TypeBinding { ident: Ident::from_str(FN_OUTPUT_NAME), ty: output_ty, - id: node_id, hir_id, span, }], @@ -2345,13 +2336,12 @@ impl<'a> LoweringContext<'a> { let future_path = this.std_path(span, &["future", "Future"], Some(future_params), false); - let LoweredNodeId { node_id, hir_id } = this.next_id(); + let LoweredNodeId { node_id: _, hir_id } = this.next_id(); let mut bounds = vec![ hir::GenericBound::Trait( hir::PolyTraitRef { trait_ref: hir::TraitRef { path: future_path, - ref_id: node_id, hir_ref_id: hir_id, }, bound_generic_params: hir_vec![], @@ -2362,17 +2352,16 @@ impl<'a> LoweringContext<'a> { ]; if let Some((name, span)) = bound_lifetime { - let LoweredNodeId { node_id, hir_id } = this.next_id(); + let LoweredNodeId { node_id: _, hir_id } = this.next_id(); bounds.push(hir::GenericBound::Outlives( - hir::Lifetime { id: node_id, hir_id, name, span })); + hir::Lifetime { hir_id, name, span })); } hir::HirVec::from(bounds) }); - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); let impl_trait_ty = P(hir::Ty { - id: node_id, node: impl_trait_ty, span, hir_id, @@ -2431,10 +2420,9 @@ impl<'a> LoweringContext<'a> { span: Span, name: hir::LifetimeName, ) -> hir::Lifetime { - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(id); hir::Lifetime { - id: node_id, hir_id, span, name: name, @@ -2524,10 +2512,9 @@ impl<'a> LoweringContext<'a> { } }; - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(param.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(param.id); hir::GenericParam { - id: node_id, hir_id, name, span: param.ident.span, @@ -2608,10 +2595,9 @@ impl<'a> LoweringContext<'a> { self.with_anonymous_lifetime_mode( AnonymousLifetimeMode::ReportError, |this| { - let LoweredNodeId { node_id, hir_id } = this.lower_node_id(wc.id); + let LoweredNodeId { node_id: _, hir_id } = this.lower_node_id(wc.id); hir::WhereClause { - id: node_id, hir_id, predicates: wc.predicates .iter() @@ -2672,10 +2658,9 @@ impl<'a> LoweringContext<'a> { ref rhs_ty, span, }) => { - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(id); hir::WherePredicate::EqPredicate(hir::WhereEqPredicate { - id: node_id, hir_id, lhs_ty: self.lower_ty(lhs_ty, ImplTraitContext::disallowed()), rhs_ty: self.lower_ty(rhs_ty, ImplTraitContext::disallowed()), @@ -2688,7 +2673,7 @@ impl<'a> LoweringContext<'a> { fn lower_variant_data(&mut self, vdata: &VariantData) -> hir::VariantData { match *vdata { VariantData::Struct(ref fields, id) => { - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(id); hir::VariantData::Struct( fields @@ -2696,12 +2681,11 @@ impl<'a> LoweringContext<'a> { .enumerate() .map(|f| self.lower_struct_field(f)) .collect(), - node_id, hir_id, ) }, VariantData::Tuple(ref fields, id) => { - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(id); hir::VariantData::Tuple( fields @@ -2709,14 +2693,13 @@ impl<'a> LoweringContext<'a> { .enumerate() .map(|f| self.lower_struct_field(f)) .collect(), - node_id, hir_id, ) }, VariantData::Unit(id) => { - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(id); - hir::VariantData::Unit(node_id, hir_id) + hir::VariantData::Unit(hir_id) }, } } @@ -2726,10 +2709,9 @@ impl<'a> LoweringContext<'a> { hir::QPath::Resolved(None, path) => path.and_then(|path| path), qpath => bug!("lower_trait_ref: unexpected QPath `{:?}`", qpath), }; - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(p.ref_id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(p.ref_id); hir::TraitRef { path, - ref_id: node_id, hir_ref_id: hir_id, } } @@ -2757,11 +2739,10 @@ impl<'a> LoweringContext<'a> { } fn lower_struct_field(&mut self, (index, f): (usize, &StructField)) -> hir::StructField { - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(f.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(f.id); hir::StructField { span: f.span, - id: node_id, hir_id, ident: match f.ident { Some(ident) => ident, @@ -2775,10 +2756,9 @@ impl<'a> LoweringContext<'a> { } fn lower_field(&mut self, f: &Field) -> hir::Field { - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); hir::Field { - id: node_id, hir_id, ident: f.ident, expr: P(self.lower_expr(&f.expr)), @@ -2816,10 +2796,9 @@ impl<'a> LoweringContext<'a> { } } - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(b.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(b.id); P(hir::Block { - id: node_id, hir_id, stmts: stmts.into(), expr, @@ -2906,7 +2885,7 @@ impl<'a> LoweringContext<'a> { // `impl Future` here because lower_body // only cares about the input argument patterns in the function // declaration (decl), not the return types. - let body_id = this.lower_async_body(decl, header.asyncness, body); + let body_id = this.lower_async_body(decl, header.asyncness.node, body); let (generics, fn_decl) = this.add_in_band_defs( generics, @@ -2916,7 +2895,7 @@ impl<'a> LoweringContext<'a> { decl, Some((fn_def_id, idty)), true, - header.asyncness.opt_return_id() + header.asyncness.node.opt_return_id() ), ); @@ -3131,12 +3110,11 @@ impl<'a> LoweringContext<'a> { hir::VisibilityKind::Public => hir::VisibilityKind::Public, hir::VisibilityKind::Crate(sugar) => hir::VisibilityKind::Crate(sugar), hir::VisibilityKind::Inherited => hir::VisibilityKind::Inherited, - hir::VisibilityKind::Restricted { ref path, id: _, hir_id: _ } => { + hir::VisibilityKind::Restricted { ref path, hir_id: _ } => { let id = this.next_id(); let path = this.renumber_segment_ids(path); hir::VisibilityKind::Restricted { path, - id: id.node_id, hir_id: id.hir_id, } } @@ -3146,7 +3124,6 @@ impl<'a> LoweringContext<'a> { this.insert_item( new_id.node_id, hir::Item { - id: new_id.node_id, hir_id: new_id.hir_id, ident, attrs: attrs.clone(), @@ -3238,12 +3215,11 @@ impl<'a> LoweringContext<'a> { hir::VisibilityKind::Public => hir::VisibilityKind::Public, hir::VisibilityKind::Crate(sugar) => hir::VisibilityKind::Crate(sugar), hir::VisibilityKind::Inherited => hir::VisibilityKind::Inherited, - hir::VisibilityKind::Restricted { ref path, id: _, hir_id: _ } => { + hir::VisibilityKind::Restricted { ref path, hir_id: _ } => { let id = this.next_id(); let path = this.renumber_segment_ids(path); hir::VisibilityKind::Restricted { path: path, - id: id.node_id, hir_id: id.hir_id, } } @@ -3253,7 +3229,6 @@ impl<'a> LoweringContext<'a> { this.insert_item( new_id, hir::Item { - id: new_id, hir_id: new_hir_id, ident, attrs: attrs.clone(), @@ -3300,10 +3275,8 @@ impl<'a> LoweringContext<'a> { debug!("renumber_segment_ids(path = {:?})", path); let mut path = path.clone(); for seg in path.segments.iter_mut() { - if seg.id.is_some() { - let next_id = self.next_id(); - seg.id = Some(next_id.node_id); - seg.hir_id = Some(next_id.hir_id); + if seg.hir_id.is_some() { + seg.hir_id = Some(self.next_id().hir_id); } } path @@ -3361,7 +3334,6 @@ impl<'a> LoweringContext<'a> { }; hir::TraitItem { - id: node_id, hir_id, ident: i.ident, attrs: self.lower_attrs(&i.attrs), @@ -3388,7 +3360,7 @@ impl<'a> LoweringContext<'a> { TraitItemKind::Macro(..) => unimplemented!(), }; hir::TraitItemRef { - id: hir::TraitItemId { node_id: i.id }, + id: hir::TraitItemId { hir_id: self.lower_node_id(i.id).hir_id }, ident: i.ident, span: i.span, defaultness: self.lower_defaultness(Defaultness::Default, has_default), @@ -3412,14 +3384,14 @@ impl<'a> LoweringContext<'a> { ) } ImplItemKind::Method(ref sig, ref body) => { - let body_id = self.lower_async_body(&sig.decl, sig.header.asyncness, body); + let body_id = self.lower_async_body(&sig.decl, sig.header.asyncness.node, body); let impl_trait_return_allow = !self.is_in_trait_impl; let (generics, sig) = self.lower_method_sig( &i.generics, sig, impl_item_def_id, impl_trait_return_allow, - sig.header.asyncness.opt_return_id(), + sig.header.asyncness.node.opt_return_id(), ); (generics, hir::ImplItemKind::Method(sig, body_id)) } @@ -3437,7 +3409,6 @@ impl<'a> LoweringContext<'a> { }; hir::ImplItem { - id: node_id, hir_id, ident: i.ident, attrs: self.lower_attrs(&i.attrs), @@ -3453,7 +3424,7 @@ impl<'a> LoweringContext<'a> { fn lower_impl_item_ref(&mut self, i: &ImplItem) -> hir::ImplItemRef { hir::ImplItemRef { - id: hir::ImplItemId { node_id: i.id }, + id: hir::ImplItemId { hir_id: self.lower_node_id(i.id).hir_id }, ident: i.ident, span: i.span, vis: self.lower_visibility(&i.vis, Some(i.id)), @@ -3544,7 +3515,6 @@ impl<'a> LoweringContext<'a> { name: ident.name, vis, attrs, - id: i.id, hir_id, span: i.span, body, @@ -3556,10 +3526,9 @@ impl<'a> LoweringContext<'a> { let node = self.lower_item_kind(i.id, &mut ident, &attrs, &mut vis, &i.node); - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(i.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(i.id); Some(hir::Item { - id: node_id, hir_id, ident, attrs, @@ -3573,7 +3542,6 @@ impl<'a> LoweringContext<'a> { let LoweredNodeId { node_id, hir_id } = self.lower_node_id(i.id); let def_id = self.resolver.definitions().local_def_id(node_id); hir::ForeignItem { - id: node_id, hir_id, ident: i.ident, attrs: self.lower_attrs(&i.attrs), @@ -3639,7 +3607,7 @@ impl<'a> LoweringContext<'a> { fn lower_fn_header(&mut self, h: FnHeader) -> hir::FnHeader { hir::FnHeader { unsafety: self.lower_unsafety(h.unsafety), - asyncness: self.lower_asyncness(h.asyncness), + asyncness: self.lower_asyncness(h.asyncness.node), constness: self.lower_constness(h.constness), abi: h.abi, } @@ -3711,11 +3679,10 @@ impl<'a> LoweringContext<'a> { Some(Def::Local(id)) => id, _ => p.id, }; - let hir_id = self.lower_node_id(canonical_id).hir_id; + hir::PatKind::Binding( self.lower_binding_mode(binding_mode), - canonical_id, - hir_id, + self.lower_node_id(canonical_id).hir_id, ident, sub.as_ref().map(|x| self.lower_pat(x)), ) @@ -3767,12 +3734,11 @@ impl<'a> LoweringContext<'a> { let fs = fields .iter() .map(|f| { - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); Spanned { span: f.span, node: hir::FieldPat { - id: node_id, hir_id, ident: f.node.ident, pat: self.lower_pat(&f.node.pat), @@ -3804,9 +3770,8 @@ impl<'a> LoweringContext<'a> { PatKind::Mac(_) => panic!("Shouldn't exist here"), }; - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(p.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(p.id); P(hir::Pat { - id: node_id, hir_id, node, span: p.span, @@ -3822,9 +3787,8 @@ impl<'a> LoweringContext<'a> { fn lower_anon_const(&mut self, c: &AnonConst) -> hir::AnonConst { self.with_new_scopes(|this| { - let LoweredNodeId { node_id, hir_id } = this.lower_node_id(c.id); + let LoweredNodeId { node_id: _, hir_id } = this.lower_node_id(c.id); hir::AnonConst { - id: node_id, hir_id, body: this.lower_body(None, |this| this.lower_expr(&c.value)), } @@ -3900,11 +3864,10 @@ impl<'a> LoweringContext<'a> { // Wrap the `if let` expr in a block. let span = els.span; let els = P(self.lower_expr(els)); - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); let blk = P(hir::Block { stmts: hir_vec![], expr: Some(els), - id: node_id, hir_id, rules: hir::DefaultBlock, span, @@ -3947,10 +3910,9 @@ impl<'a> LoweringContext<'a> { let mut block = this.lower_block(body, true).into_inner(); let tail = block.expr.take().map_or_else( || { - let LoweredNodeId { node_id, hir_id } = this.next_id(); + let LoweredNodeId { node_id: _, hir_id } = this.next_id(); let span = this.sess.source_map().end_point(unstable_span); hir::Expr { - id: node_id, span, node: hir::ExprKind::Tup(hir_vec![]), attrs: ThinVec::new(), @@ -3984,7 +3946,7 @@ impl<'a> LoweringContext<'a> { let outer_decl = FnDecl { inputs: decl.inputs.clone(), output: FunctionRetTy::Default(fn_decl_span), - variadic: false, + c_variadic: false, }; // We need to lower the declaration outside the new scope, because we // have to conserve the state of being inside a loop condition for the @@ -4135,10 +4097,9 @@ impl<'a> LoweringContext<'a> { let struct_path = self.std_path(e.span, &struct_path, None, is_unit); let struct_path = hir::QPath::Resolved(None, P(struct_path)); - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(e.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(e.id); return hir::Expr { - id: node_id, hir_id, node: if is_unit { hir::ExprKind::Path(struct_path) @@ -4384,7 +4345,7 @@ impl<'a> LoweringContext<'a> { let iter = self.str_to_ident("iter"); let next_ident = self.str_to_ident("__next"); - let next_pat = self.pat_ident_binding_mode( + let (next_pat, next_pat_nid) = self.pat_ident_binding_mode( desugared_span, next_ident, hir::BindingAnnotation::Mutable, @@ -4393,9 +4354,9 @@ impl<'a> LoweringContext<'a> { // `::std::option::Option::Some(val) => next = val` let pat_arm = { let val_ident = self.str_to_ident("val"); - let val_pat = self.pat_ident(pat.span, val_ident); - let val_expr = P(self.expr_ident(pat.span, val_ident, val_pat.id)); - let next_expr = P(self.expr_ident(pat.span, next_ident, next_pat.id)); + let (val_pat, val_pat_nid) = self.pat_ident(pat.span, val_ident); + let val_expr = P(self.expr_ident(pat.span, val_ident, val_pat_nid)); + let next_expr = P(self.expr_ident(pat.span, next_ident, next_pat_nid)); let assign = P(self.expr( pat.span, hir::ExprKind::Assign(next_expr, val_expr), @@ -4414,7 +4375,7 @@ impl<'a> LoweringContext<'a> { }; // `mut iter` - let iter_pat = self.pat_ident_binding_mode( + let (iter_pat, iter_pat_nid) = self.pat_ident_binding_mode( desugared_span, iter, hir::BindingAnnotation::Mutable @@ -4422,7 +4383,7 @@ impl<'a> LoweringContext<'a> { // `match ::std::iter::Iterator::next(&mut iter) { ... }` let match_expr = { - let iter = P(self.expr_ident(head_sp, iter, iter_pat.id)); + let iter = P(self.expr_ident(head_sp, iter, iter_pat_nid)); let ref_mut_iter = self.expr_mut_addr_of(head_sp, iter); let next_path = &["iter", "Iterator", "next"]; let next_path = P(self.expr_std_path(head_sp, next_path, None, ThinVec::new())); @@ -4439,15 +4400,14 @@ impl<'a> LoweringContext<'a> { ThinVec::new(), )) }; - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); let match_stmt = hir::Stmt { - id: node_id, hir_id, node: hir::StmtKind::Expr(match_expr), span: head_sp, }; - let next_expr = P(self.expr_ident(head_sp, next_ident, next_pat.id)); + let next_expr = P(self.expr_ident(head_sp, next_ident, next_pat_nid)); // `let mut __next` let next_let = self.stmt_let_pat( @@ -4468,9 +4428,8 @@ impl<'a> LoweringContext<'a> { let body_block = self.with_loop_scope(e.id, |this| this.lower_block(body, false)); let body_expr = P(self.expr_block(body_block, ThinVec::new())); - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); let body_stmt = hir::Stmt { - id: node_id, hir_id, node: hir::StmtKind::Expr(body_expr), span: body.span, @@ -4488,9 +4447,8 @@ impl<'a> LoweringContext<'a> { self.lower_label(opt_label), hir::LoopSource::ForLoop, ); - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(e.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(e.id); let loop_expr = P(hir::Expr { - id: node_id, hir_id, node: loop_expr, span: e.span, @@ -4576,11 +4534,11 @@ impl<'a> LoweringContext<'a> { // `Ok(val) => #[allow(unreachable_code)] val,` let ok_arm = { let val_ident = self.str_to_ident("val"); - let val_pat = self.pat_ident(e.span, val_ident); + let (val_pat, val_pat_nid) = self.pat_ident(e.span, val_ident); let val_expr = P(self.expr_ident_with_attrs( e.span, val_ident, - val_pat.id, + val_pat_nid, ThinVec::from(attrs.clone()), )); let ok_pat = self.pat_ok(e.span, val_pat); @@ -4592,12 +4550,12 @@ impl<'a> LoweringContext<'a> { // return Try::from_error(From::from(err)),` let err_arm = { let err_ident = self.str_to_ident("err"); - let err_local = self.pat_ident(e.span, err_ident); + let (err_local, err_local_nid) = self.pat_ident(e.span, err_ident); let from_expr = { let path = &["convert", "From", "from"]; let from = P(self.expr_std_path( e.span, path, None, ThinVec::new())); - let err_expr = self.expr_ident(e.span, err_ident, err_local.id); + let err_expr = self.expr_ident(e.span, err_ident, err_local_nid); self.expr_call(e.span, from, hir_vec![err_expr]) }; @@ -4606,12 +4564,13 @@ impl<'a> LoweringContext<'a> { let thin_attrs = ThinVec::from(attrs); let catch_scope = self.catch_scopes.last().map(|x| *x); let ret_expr = if let Some(catch_node) = catch_scope { + let target_id = Ok(self.lower_node_id(catch_node).hir_id); P(self.expr( e.span, hir::ExprKind::Break( hir::Destination { label: None, - target_id: Ok(catch_node), + target_id, }, Some(from_err_expr), ), @@ -4635,10 +4594,9 @@ impl<'a> LoweringContext<'a> { ExprKind::Mac(_) => panic!("Shouldn't exist here"), }; - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(e.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(e.id); hir::Expr { - id: node_id, hir_id, node: kind, span: e.span, @@ -4653,10 +4611,9 @@ impl<'a> LoweringContext<'a> { let mut ids: SmallVec<[hir::Stmt; 1]> = item_ids .into_iter() .map(|item_id| { - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); hir::Stmt { - id: node_id, hir_id, node: hir::StmtKind::Item(item_id), span: s.span, @@ -4664,10 +4621,9 @@ impl<'a> LoweringContext<'a> { }) .collect(); ids.push({ - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(s.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(s.id); hir::Stmt { - id: node_id, hir_id, node: hir::StmtKind::Local(P(l)), span: s.span, @@ -4681,12 +4637,11 @@ impl<'a> LoweringContext<'a> { return self.lower_item_id(it) .into_iter() .map(|item_id| { - let LoweredNodeId { node_id, hir_id } = id.take() + let LoweredNodeId { node_id: _, hir_id } = id.take() .map(|id| self.lower_node_id(id)) .unwrap_or_else(|| self.next_id()); hir::Stmt { - id: node_id, hir_id, node: hir::StmtKind::Item(item_id), span: s.span, @@ -4695,20 +4650,18 @@ impl<'a> LoweringContext<'a> { .collect(); } StmtKind::Expr(ref e) => { - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(s.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(s.id); hir::Stmt { - id: node_id, hir_id, node: hir::StmtKind::Expr(P(self.lower_expr(e))), span: s.span, } }, StmtKind::Semi(ref e) => { - let LoweredNodeId { node_id, hir_id } = self.lower_node_id(s.id); + let LoweredNodeId { node_id: _, hir_id } = self.lower_node_id(s.id); hir::Stmt { - id: node_id, hir_id, node: hir::StmtKind::Semi(P(self.lower_expr(e))), span: s.span, @@ -4753,7 +4706,6 @@ impl<'a> LoweringContext<'a> { ParamMode::Explicit, explicit_owner, )), - id: lowered_id.node_id, hir_id: lowered_id.hir_id, } }, @@ -4823,10 +4775,9 @@ impl<'a> LoweringContext<'a> { } fn field(&mut self, ident: Ident, expr: P, span: Span) -> hir::Field { - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); hir::Field { - id: node_id, hir_id, ident, span, @@ -4910,9 +4861,8 @@ impl<'a> LoweringContext<'a> { } fn expr(&mut self, span: Span, node: hir::ExprKind, attrs: ThinVec) -> hir::Expr { - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); hir::Expr { - id: node_id, hir_id, node, span, @@ -4927,22 +4877,20 @@ impl<'a> LoweringContext<'a> { pat: P, source: hir::LocalSource, ) -> hir::Stmt { - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); let local = hir::Local { pat, ty: None, init: ex, - id: node_id, hir_id, span: sp, attrs: ThinVec::new(), source, }; - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); hir::Stmt { - id: node_id, hir_id, node: hir::StmtKind::Local(P(local)), span: sp @@ -4956,15 +4904,15 @@ impl<'a> LoweringContext<'a> { ident: Ident, ex: P, ) -> (hir::Stmt, NodeId) { - let pat = if mutbl { + let (pat, pat_nid) = if mutbl { self.pat_ident_binding_mode(sp, ident, hir::BindingAnnotation::Mutable) } else { self.pat_ident(sp, ident) }; - let pat_id = pat.id; + ( self.stmt_let_pat(sp, Some(ex), pat, hir::LocalSource::Normal), - pat_id, + pat_nid, ) } @@ -4978,12 +4926,11 @@ impl<'a> LoweringContext<'a> { stmts: hir::HirVec, expr: Option>, ) -> hir::Block { - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); hir::Block { stmts, expr, - id: node_id, hir_id, rules: hir::DefaultBlock, span, @@ -5023,7 +4970,7 @@ impl<'a> LoweringContext<'a> { self.pat(span, pt) } - fn pat_ident(&mut self, span: Span, ident: Ident) -> P { + fn pat_ident(&mut self, span: Span, ident: Ident) -> (P, NodeId) { self.pat_ident_binding_mode(span, ident, hir::BindingAnnotation::Unannotated) } @@ -5032,15 +4979,17 @@ impl<'a> LoweringContext<'a> { span: Span, ident: Ident, bm: hir::BindingAnnotation, - ) -> P { + ) -> (P, NodeId) { let LoweredNodeId { node_id, hir_id } = self.next_id(); - P(hir::Pat { - id: node_id, - hir_id, - node: hir::PatKind::Binding(bm, node_id, hir_id, ident.with_span_pos(span), None), - span, - }) + ( + P(hir::Pat { + hir_id, + node: hir::PatKind::Binding(bm, hir_id, ident.with_span_pos(span), None), + span, + }), + node_id + ) } fn pat_wild(&mut self, span: Span) -> P { @@ -5048,9 +4997,8 @@ impl<'a> LoweringContext<'a> { } fn pat(&mut self, span: Span, pat: hir::PatKind) -> P { - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); P(hir::Pat { - id: node_id, hir_id, node: pat, span, @@ -5073,8 +5021,8 @@ impl<'a> LoweringContext<'a> { for seg in path.segments.iter_mut() { - if let Some(id) = seg.id { - seg.id = Some(self.lower_node_id(id).node_id); + if seg.hir_id.is_some() { + seg.hir_id = Some(self.next_id().hir_id); } } path @@ -5091,7 +5039,6 @@ impl<'a> LoweringContext<'a> { bound_generic_params: hir::HirVec::new(), trait_ref: hir::TraitRef { path: path.and_then(|path| path), - ref_id: id.node_id, hir_ref_id: id.hir_id, }, span, @@ -5108,7 +5055,6 @@ impl<'a> LoweringContext<'a> { _ => hir::TyKind::Path(qpath), }; hir::Ty { - id: id.node_id, hir_id: id.hir_id, node, span, @@ -5124,9 +5070,8 @@ impl<'a> LoweringContext<'a> { // `'f`. AnonymousLifetimeMode::CreateParameter => { let fresh_name = self.collect_fresh_in_band_lifetime(span); - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); hir::Lifetime { - id: node_id, hir_id, span, name: hir::LifetimeName::Param(fresh_name), @@ -5227,10 +5172,9 @@ impl<'a> LoweringContext<'a> { } fn new_implicit_lifetime(&mut self, span: Span) -> hir::Lifetime { - let LoweredNodeId { node_id, hir_id } = self.next_id(); + let LoweredNodeId { node_id: _, hir_id } = self.next_id(); hir::Lifetime { - id: node_id, hir_id, span, name: hir::LifetimeName::Implicit, diff --git a/src/librustc/hir/map/blocks.rs b/src/librustc/hir/map/blocks.rs index 6919628c7675..1114ef52bbc0 100644 --- a/src/librustc/hir/map/blocks.rs +++ b/src/librustc/hir/map/blocks.rs @@ -75,10 +75,10 @@ pub enum Code<'a> { } impl<'a> Code<'a> { - pub fn id(&self) -> NodeId { + pub fn id(&self) -> ast::HirId { match *self { Code::FnLike(node) => node.id(), - Code::Expr(block) => block.id, + Code::Expr(block) => block.hir_id, } } @@ -104,7 +104,7 @@ struct ItemFnParts<'a> { vis: &'a ast::Visibility, generics: &'a ast::Generics, body: ast::BodyId, - id: NodeId, + id: ast::HirId, span: Span, attrs: &'a [Attribute], } @@ -114,13 +114,13 @@ struct ItemFnParts<'a> { struct ClosureParts<'a> { decl: &'a FnDecl, body: ast::BodyId, - id: NodeId, + id: ast::HirId, span: Span, attrs: &'a [Attribute], } impl<'a> ClosureParts<'a> { - fn new(d: &'a FnDecl, b: ast::BodyId, id: NodeId, s: Span, attrs: &'a [Attribute]) -> Self { + fn new(d: &'a FnDecl, b: ast::BodyId, id: ast::HirId, s: Span, attrs: &'a [Attribute]) -> Self { ClosureParts { decl: d, body: b, @@ -168,7 +168,7 @@ impl<'a> FnLikeNode<'a> { |c: ClosureParts<'_>| c.span) } - pub fn id(self) -> NodeId { + pub fn id(self) -> ast::HirId { self.handle(|i: ItemFnParts<'_>| i.id, |id, _, _: &'a ast::MethodSig, _, _, _, _| id, |c: ClosureParts<'_>| c.id) @@ -213,7 +213,7 @@ impl<'a> FnLikeNode<'a> { fn handle(self, item_fn: I, method: M, closure: C) -> A where I: FnOnce(ItemFnParts<'a>) -> A, - M: FnOnce(NodeId, + M: FnOnce(ast::HirId, Ident, &'a ast::MethodSig, Option<&'a ast::Visibility>, @@ -227,7 +227,7 @@ impl<'a> FnLikeNode<'a> { map::Node::Item(i) => match i.node { ast::ItemKind::Fn(ref decl, header, ref generics, block) => item_fn(ItemFnParts { - id: i.id, + id: i.hir_id, ident: i.ident, decl: &decl, body: block, @@ -241,21 +241,21 @@ impl<'a> FnLikeNode<'a> { }, map::Node::TraitItem(ti) => match ti.node { ast::TraitItemKind::Method(ref sig, ast::TraitMethod::Provided(body)) => { - method(ti.id, ti.ident, sig, None, body, ti.span, &ti.attrs) + method(ti.hir_id, ti.ident, sig, None, body, ti.span, &ti.attrs) } _ => bug!("trait method FnLikeNode that is not fn-like"), }, map::Node::ImplItem(ii) => { match ii.node { ast::ImplItemKind::Method(ref sig, body) => { - method(ii.id, ii.ident, sig, Some(&ii.vis), body, ii.span, &ii.attrs) + method(ii.hir_id, ii.ident, sig, Some(&ii.vis), body, ii.span, &ii.attrs) } _ => bug!("impl method FnLikeNode that is not fn-like") } }, map::Node::Expr(e) => match e.node { ast::ExprKind::Closure(_, ref decl, block, _fn_decl_span, _gen) => - closure(ClosureParts::new(&decl, block, e.id, e.span, &e.attrs)), + closure(ClosureParts::new(&decl, block, e.hir_id, e.span, &e.attrs)), _ => bug!("expr FnLikeNode that is not fn-like"), }, _ => bug!("other FnLikeNode that is not fn-like"), diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs index 04eec88004aa..9f39d648df1b 100644 --- a/src/librustc/hir/map/collector.rs +++ b/src/librustc/hir/map/collector.rs @@ -356,7 +356,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { fn visit_item(&mut self, i: &'hir Item) { debug!("visit_item: {:?}", i); debug_assert_eq!(i.hir_id.owner, - self.definitions.opt_def_index(i.id).unwrap()); + self.definitions.opt_def_index(self.hir_to_node_id[&i.hir_id]).unwrap()); self.with_dep_node_owner(i.hir_id.owner, i, |this| { this.insert(i.span, i.hir_id, Node::Item(i)); this.with_parent(i.hir_id, |this| { @@ -386,7 +386,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { fn visit_trait_item(&mut self, ti: &'hir TraitItem) { debug_assert_eq!(ti.hir_id.owner, - self.definitions.opt_def_index(ti.id).unwrap()); + self.definitions.opt_def_index(self.hir_to_node_id[&ti.hir_id]).unwrap()); self.with_dep_node_owner(ti.hir_id.owner, ti, |this| { this.insert(ti.span, ti.hir_id, Node::TraitItem(ti)); @@ -398,7 +398,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { fn visit_impl_item(&mut self, ii: &'hir ImplItem) { debug_assert_eq!(ii.hir_id.owner, - self.definitions.opt_def_index(ii.id).unwrap()); + self.definitions.opt_def_index(self.hir_to_node_id[&ii.hir_id]).unwrap()); self.with_dep_node_owner(ii.hir_id.owner, ii, |this| { this.insert(ii.span, ii.hir_id, Node::ImplItem(ii)); @@ -507,7 +507,8 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> { } fn visit_macro_def(&mut self, macro_def: &'hir MacroDef) { - let def_index = self.definitions.opt_def_index(macro_def.id).unwrap(); + let node_id = self.hir_to_node_id[¯o_def.hir_id]; + let def_index = self.definitions.opt_def_index(node_id).unwrap(); self.with_dep_node_owner(def_index, macro_def, |this| { this.insert(macro_def.span, macro_def.hir_id, Node::MacroDef(macro_def)); diff --git a/src/librustc/hir/map/def_collector.rs b/src/librustc/hir/map/def_collector.rs index 72aa9570cc2f..12760f8b9828 100644 --- a/src/librustc/hir/map/def_collector.rs +++ b/src/librustc/hir/map/def_collector.rs @@ -73,7 +73,7 @@ impl<'a> DefCollector<'a> { decl: &'a FnDecl, body: &'a Block, ) { - let (closure_id, return_impl_trait_id) = match header.asyncness { + let (closure_id, return_impl_trait_id) = match header.asyncness.node { IsAsync::Async { closure_id, return_impl_trait_id, @@ -129,10 +129,10 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> { } ItemKind::Fn( ref decl, - ref header @ FnHeader { asyncness: IsAsync::Async { .. }, .. }, + ref header, ref generics, ref body, - ) => { + ) if header.asyncness.node.is_async() => { return self.visit_async_fn( i.id, i.ident.name, @@ -242,9 +242,9 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> { fn visit_impl_item(&mut self, ii: &'a ImplItem) { let def_data = match ii.node { ImplItemKind::Method(MethodSig { - header: ref header @ FnHeader { asyncness: IsAsync::Async { .. }, .. }, + ref header, ref decl, - }, ref body) => { + }, ref body) if header.asyncness.node.is_async() => { return self.visit_async_fn( ii.id, ii.ident.name, diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 39203208855e..86b6805cc9b4 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -319,7 +319,7 @@ impl<'hir> Map<'hir> { match node { Node::Item(item) => { - let def_id = || self.local_def_id(item.id); + let def_id = || self.local_def_id_from_hir_id(item.hir_id); match item.node { ItemKind::Static(_, m, _) => Some(Def::Static(def_id(), m == MutMutable)), @@ -341,7 +341,7 @@ impl<'hir> Map<'hir> { } } Node::ForeignItem(item) => { - let def_id = self.local_def_id(item.id); + let def_id = self.local_def_id_from_hir_id(item.hir_id); match item.node { ForeignItemKind::Fn(..) => Some(Def::Fn(def_id)), ForeignItemKind::Static(_, m) => Some(Def::Static(def_id, m)), @@ -349,7 +349,7 @@ impl<'hir> Map<'hir> { } } Node::TraitItem(item) => { - let def_id = self.local_def_id(item.id); + let def_id = self.local_def_id_from_hir_id(item.hir_id); match item.node { TraitItemKind::Const(..) => Some(Def::AssociatedConst(def_id)), TraitItemKind::Method(..) => Some(Def::Method(def_id)), @@ -357,7 +357,7 @@ impl<'hir> Map<'hir> { } } Node::ImplItem(item) => { - let def_id = self.local_def_id(item.id); + let def_id = self.local_def_id_from_hir_id(item.hir_id); match item.node { ImplItemKind::Const(..) => Some(Def::AssociatedConst(def_id)), ImplItemKind::Method(..) => Some(Def::Method(def_id)), @@ -366,11 +366,11 @@ impl<'hir> Map<'hir> { } } Node::Variant(variant) => { - let def_id = self.local_def_id(variant.node.data.id()); + let def_id = self.local_def_id_from_hir_id(variant.node.data.hir_id()); Some(Def::Variant(def_id)) } Node::StructCtor(variant) => { - let def_id = self.local_def_id(variant.id()); + let def_id = self.local_def_id_from_hir_id(variant.hir_id()); Some(Def::StructCtor(def_id, def::CtorKind::from_hir(variant))) } Node::AnonConst(_) | @@ -387,17 +387,22 @@ impl<'hir> Map<'hir> { Node::Block(_) | Node::Crate => None, Node::Local(local) => { - Some(Def::Local(local.id)) + Some(Def::Local(self.hir_to_node_id(local.hir_id))) } Node::MacroDef(macro_def) => { - Some(Def::Macro(self.local_def_id(macro_def.id), + Some(Def::Macro(self.local_def_id_from_hir_id(macro_def.hir_id), MacroKind::Bang)) } Node::GenericParam(param) => { Some(match param.kind { - GenericParamKind::Lifetime { .. } => Def::Local(param.id), - GenericParamKind::Type { .. } => Def::TyParam(self.local_def_id(param.id)), - GenericParamKind::Const { .. } => Def::ConstParam(self.local_def_id(param.id)), + GenericParamKind::Lifetime { .. } => { + let node_id = self.hir_to_node_id(param.hir_id); + Def::Local(node_id) + }, + GenericParamKind::Type { .. } => Def::TyParam( + self.local_def_id_from_hir_id(param.hir_id)), + GenericParamKind::Const { .. } => Def::ConstParam( + self.local_def_id_from_hir_id(param.hir_id)), }) } } @@ -422,7 +427,7 @@ impl<'hir> Map<'hir> { } pub fn trait_item(&self, id: TraitItemId) -> &'hir TraitItem { - self.read(id.node_id); + self.read_by_hir_id(id.hir_id); // N.B., intentionally bypass `self.forest.krate()` so that we // do not trigger a read of the whole krate here @@ -430,7 +435,7 @@ impl<'hir> Map<'hir> { } pub fn impl_item(&self, id: ImplItemId) -> &'hir ImplItem { - self.read(id.node_id); + self.read_by_hir_id(id.hir_id); // N.B., intentionally bypass `self.forest.krate()` so that we // do not trigger a read of the whole krate here @@ -496,10 +501,10 @@ impl<'hir> Map<'hir> { } /// Given a body owner's id, returns the `BodyId` associated with it. - pub fn body_owned_by(&self, id: NodeId) -> BodyId { - self.maybe_body_owned_by(id).unwrap_or_else(|| { - span_bug!(self.span(id), "body_owned_by: {} has no associated body", - self.node_to_string(id)); + pub fn body_owned_by(&self, id: HirId) -> BodyId { + self.maybe_body_owned_by_by_hir_id(id).unwrap_or_else(|| { + span_bug!(self.span_by_hir_id(id), "body_owned_by: {} has no associated body", + self.hir_to_string(id)); }) } @@ -534,19 +539,19 @@ impl<'hir> Map<'hir> { self.body_owner_kind(node_id) } - pub fn ty_param_owner(&self, id: NodeId) -> NodeId { - match self.get(id) { + pub fn ty_param_owner(&self, id: HirId) -> HirId { + match self.get_by_hir_id(id) { Node::Item(&Item { node: ItemKind::Trait(..), .. }) => id, - Node::GenericParam(_) => self.get_parent_node(id), - _ => bug!("ty_param_owner: {} not a type parameter", self.node_to_string(id)) + Node::GenericParam(_) => self.get_parent_node_by_hir_id(id), + _ => bug!("ty_param_owner: {} not a type parameter", self.hir_to_string(id)) } } - pub fn ty_param_name(&self, id: NodeId) -> Name { - match self.get(id) { + pub fn ty_param_name(&self, id: HirId) -> Name { + match self.get_by_hir_id(id) { Node::Item(&Item { node: ItemKind::Trait(..), .. }) => keywords::SelfUpper.name(), Node::GenericParam(param) => param.name.ident().name, - _ => bug!("ty_param_name: {} not a type parameter", self.node_to_string(id)), + _ => bug!("ty_param_name: {} not a type parameter", self.hir_to_string(id)), } } @@ -613,11 +618,11 @@ impl<'hir> Map<'hir> { } for id in &module.trait_items { - visitor.visit_trait_item(self.expect_trait_item(id.node_id)); + visitor.visit_trait_item(self.expect_trait_item(id.hir_id)); } for id in &module.impl_items { - visitor.visit_impl_item(self.expect_impl_item(id.node_id)); + visitor.visit_impl_item(self.expect_impl_item(id.hir_id)); } } @@ -794,7 +799,7 @@ impl<'hir> Map<'hir> { /// false /// } /// ``` - pub fn get_return_block(&self, id: NodeId) -> Option { + pub fn get_return_block(&self, id: HirId) -> Option { let match_fn = |node: &Node<'_>| { match *node { Node::Item(_) | @@ -817,7 +822,10 @@ impl<'hir> Map<'hir> { } }; - self.walk_parent_nodes(id, match_fn, match_non_returning_block).ok() + let node_id = self.hir_to_node_id(id); + self.walk_parent_nodes(node_id, match_fn, match_non_returning_block) + .ok() + .map(|return_node_id| self.node_to_hir_id(return_node_id)) } /// Retrieves the `NodeId` for `id`'s parent item, or `id` itself if no @@ -921,66 +929,52 @@ impl<'hir> Map<'hir> { // FIXME(@ljedrz): replace the NodeId variant pub fn expect_item_by_hir_id(&self, id: HirId) -> &'hir Item { - let node_id = self.hir_to_node_id(id); - self.expect_item(node_id) - } - - pub fn expect_impl_item(&self, id: NodeId) -> &'hir ImplItem { - match self.find(id) { - Some(Node::ImplItem(item)) => item, - _ => bug!("expected impl item, found {}", self.node_to_string(id)) + match self.find_by_hir_id(id) { // read recorded by `find` + Some(Node::Item(item)) => item, + _ => bug!("expected item, found {}", self.hir_to_string(id)) } } - // FIXME(@ljedrz): replace the NodeId variant - pub fn expect_impl_item_by_hir_id(&self, id: HirId) -> &'hir ImplItem { - let node_id = self.hir_to_node_id(id); - self.expect_impl_item(node_id) + pub fn expect_impl_item(&self, id: HirId) -> &'hir ImplItem { + match self.find_by_hir_id(id) { + Some(Node::ImplItem(item)) => item, + _ => bug!("expected impl item, found {}", self.hir_to_string(id)) + } } - // FIXME(@ljedrz): replace the NodeId variant - pub fn expect_trait_item_by_hir_id(&self, id: HirId) -> &'hir TraitItem { - let node_id = self.hir_to_node_id(id); - self.expect_trait_item(node_id) - } - - pub fn expect_trait_item(&self, id: NodeId) -> &'hir TraitItem { - match self.find(id) { + pub fn expect_trait_item(&self, id: HirId) -> &'hir TraitItem { + match self.find_by_hir_id(id) { Some(Node::TraitItem(item)) => item, - _ => bug!("expected trait item, found {}", self.node_to_string(id)) + _ => bug!("expected trait item, found {}", self.hir_to_string(id)) } } pub fn expect_variant_data(&self, id: HirId) -> &'hir VariantData { - let id = self.hir_to_node_id(id); // FIXME(@ljedrz): remove when possible - - match self.find(id) { + match self.find_by_hir_id(id) { Some(Node::Item(i)) => { match i.node { ItemKind::Struct(ref struct_def, _) | ItemKind::Union(ref struct_def, _) => struct_def, - _ => bug!("struct ID bound to non-struct {}", self.node_to_string(id)) + _ => bug!("struct ID bound to non-struct {}", self.hir_to_string(id)) } } Some(Node::StructCtor(data)) => data, Some(Node::Variant(variant)) => &variant.node.data, - _ => bug!("expected struct or variant, found {}", self.node_to_string(id)) + _ => bug!("expected struct or variant, found {}", self.hir_to_string(id)) } } pub fn expect_variant(&self, id: HirId) -> &'hir Variant { - let id = self.hir_to_node_id(id); // FIXME(@ljedrz): remove when possible - - match self.find(id) { + match self.find_by_hir_id(id) { Some(Node::Variant(variant)) => variant, - _ => bug!("expected variant, found {}", self.node_to_string(id)), + _ => bug!("expected variant, found {}", self.hir_to_string(id)), } } - pub fn expect_foreign_item(&self, id: NodeId) -> &'hir ForeignItem { - match self.find(id) { + pub fn expect_foreign_item(&self, id: HirId) -> &'hir ForeignItem { + match self.find_by_hir_id(id) { Some(Node::ForeignItem(item)) => item, - _ => bug!("expected foreign item, found {}", self.node_to_string(id)) + _ => bug!("expected foreign item, found {}", self.hir_to_string(id)) } } @@ -1008,7 +1002,7 @@ impl<'hir> Map<'hir> { Node::Field(f) => f.ident.name, Node::Lifetime(lt) => lt.name.ident().name, Node::GenericParam(param) => param.name.ident().name, - Node::Binding(&Pat { node: PatKind::Binding(_, _, _, l, _), .. }) => l.name, + Node::Binding(&Pat { node: PatKind::Binding(_, _, l, _), .. }) => l.name, Node::StructCtor(_) => self.name(self.get_parent(id)), _ => bug!("no name for {}", self.node_to_string(id)) } diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index df02b91996f3..88ab58d10fc3 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -19,7 +19,7 @@ use errors::FatalError; use syntax_pos::{Span, DUMMY_SP, symbol::InternedString}; use syntax::source_map::Spanned; use rustc_target::spec::abi::Abi; -use syntax::ast::{self, CrateSugar, Ident, Name, NodeId, DUMMY_NODE_ID, AsmDialect}; +use syntax::ast::{self, CrateSugar, Ident, Name, NodeId, AsmDialect}; use syntax::ast::{Attribute, Label, Lit, StrStyle, FloatTy, IntTy, UintTy}; use syntax::attr::{InlineAttr, OptimizeAttr}; use syntax::ext::hygiene::SyntaxContext; @@ -30,8 +30,9 @@ use syntax::util::parser::ExprPrecedence; use crate::ty::AdtKind; use crate::ty::query::Providers; -use rustc_data_structures::sync::{ParallelIterator, par_iter, Send, Sync}; +use rustc_data_structures::sync::{par_for_each_in, Send, Sync}; use rustc_data_structures::thin_vec::ThinVec; +use rustc_macros::HashStable; use serialize::{self, Encoder, Encodable, Decoder, Decodable}; use std::collections::{BTreeSet, BTreeMap}; @@ -112,19 +113,28 @@ impl serialize::UseSpecializedDecodable for HirId { } } +impl fmt::Display for HirId { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{:?}", self) + } +} + // hack to ensure that we don't try to access the private parts of `ItemLocalId` in this module mod item_local_id_inner { use rustc_data_structures::indexed_vec::Idx; - /// An `ItemLocalId` uniquely identifies something within a given "item-like", - /// that is within a hir::Item, hir::TraitItem, or hir::ImplItem. There is no - /// guarantee that the numerical value of a given `ItemLocalId` corresponds to - /// the node's position within the owning item in any way, but there is a - /// guarantee that the `LocalItemId`s within an owner occupy a dense range of - /// integers starting at zero, so a mapping that maps all or most nodes within - /// an "item-like" to something else can be implement by a `Vec` instead of a - /// tree or hash map. + use rustc_macros::HashStable; newtype_index! { - pub struct ItemLocalId { .. } + /// An `ItemLocalId` uniquely identifies something within a given "item-like", + /// that is within a hir::Item, hir::TraitItem, or hir::ImplItem. There is no + /// guarantee that the numerical value of a given `ItemLocalId` corresponds to + /// the node's position within the owning item in any way, but there is a + /// guarantee that the `LocalItemId`s within an owner occupy a dense range of + /// integers starting at zero, so a mapping that maps all or most nodes within + /// an "item-like" to something else can be implement by a `Vec` instead of a + /// tree or hash map. + pub struct ItemLocalId { + derive [HashStable] + } } } @@ -143,9 +153,8 @@ pub const DUMMY_HIR_ID: HirId = HirId { pub const DUMMY_ITEM_LOCAL_ID: ItemLocalId = ItemLocalId::MAX; -#[derive(Clone, RustcEncodable, RustcDecodable, Copy)] +#[derive(Clone, RustcEncodable, RustcDecodable, Copy, HashStable)] pub struct Lifetime { - pub id: NodeId, pub hir_id: HirId, pub span: Span, @@ -158,7 +167,7 @@ pub struct Lifetime { pub name: LifetimeName, } -#[derive(Debug, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] +#[derive(Debug, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy, HashStable)] pub enum ParamName { /// Some user-given name like `T` or `'x`. Plain(Ident), @@ -201,7 +210,7 @@ impl ParamName { } } -#[derive(Debug, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] +#[derive(Debug, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy, HashStable)] pub enum LifetimeName { /// User-given names or fresh (synthetic) names. Param(ParamName), @@ -266,7 +275,7 @@ impl fmt::Debug for Lifetime { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "lifetime({}: {})", - self.id, + self.hir_id, print::to_string(print::NO_ANN, |s| s.print_lifetime(self))) } } @@ -284,7 +293,7 @@ impl Lifetime { /// A `Path` is essentially Rust's notion of a name; for instance, /// `std::cmp::PartialEq`. It's represented as a sequence of identifiers, /// along with a bunch of supporting information. -#[derive(Clone, RustcEncodable, RustcDecodable)] +#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)] pub struct Path { pub span: Span, /// The definition that the path resolved to. @@ -313,16 +322,16 @@ impl fmt::Display for Path { /// A segment of a path: an identifier, an optional lifetime, and a set of /// types. -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct PathSegment { /// The identifier portion of this path segment. + #[stable_hasher(project(name))] pub ident: Ident, // `id` and `def` are optional. We currently only use these in save-analysis, // any path segments without these will not have save-analysis info and // therefore will not have 'jump to def' in IDEs, but otherwise will not be // affected. (In general, we don't bother to get the defs for synthesized // segments, only for segments which have come from the AST). - pub id: Option, pub hir_id: Option, pub def: Option, @@ -345,7 +354,6 @@ impl PathSegment { pub fn from_ident(ident: Ident) -> PathSegment { PathSegment { ident, - id: None, hir_id: None, def: None, infer_types: true, @@ -355,7 +363,6 @@ impl PathSegment { pub fn new( ident: Ident, - id: Option, hir_id: Option, def: Option, args: GenericArgs, @@ -363,7 +370,6 @@ impl PathSegment { ) -> Self { PathSegment { ident, - id, hir_id, def, infer_types, @@ -389,13 +395,13 @@ impl PathSegment { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct ConstArg { pub value: AnonConst, pub span: Span, } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub enum GenericArg { Lifetime(Lifetime), Type(Ty), @@ -411,16 +417,16 @@ impl GenericArg { } } - pub fn id(&self) -> NodeId { + pub fn id(&self) -> HirId { match self { - GenericArg::Lifetime(l) => l.id, - GenericArg::Type(t) => t.id, - GenericArg::Const(c) => c.value.id, + GenericArg::Lifetime(l) => l.hir_id, + GenericArg::Type(t) => t.hir_id, + GenericArg::Const(c) => c.value.hir_id, } } } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct GenericArgs { /// The generic arguments for this path segment. pub args: HirVec, @@ -484,7 +490,7 @@ impl GenericArgs { /// A modifier on a bound, currently this is only used for `?Sized`, where the /// modifier is `Maybe`. Negative bounds should also be handled here. -#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, HashStable)] pub enum TraitBoundModifier { None, Maybe, @@ -494,7 +500,7 @@ pub enum TraitBoundModifier { /// `typeck::collect::compute_bounds` matches these against /// the "special" built-in traits (see `middle::lang_items`) and /// detects `Copy`, `Send` and `Sync`. -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub enum GenericBound { Trait(PolyTraitRef, TraitBoundModifier), Outlives(Lifetime), @@ -511,7 +517,7 @@ impl GenericBound { pub type GenericBounds = HirVec; -#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Debug, HashStable)] pub enum LifetimeParamKind { // Indicates that the lifetime definition was explicitly declared (e.g., in // `fn foo<'a>(x: &'a u8) -> &'a u8 { x }`). @@ -530,7 +536,7 @@ pub enum LifetimeParamKind { Error, } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub enum GenericParamKind { /// A lifetime definition (e.g., `'a: 'b + 'c + 'd`). Lifetime { @@ -545,9 +551,8 @@ pub enum GenericParamKind { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct GenericParam { - pub id: NodeId, pub hir_id: HirId, pub name: ParamName, pub attrs: HirVec, @@ -567,7 +572,7 @@ pub struct GenericParamCount { /// Represents lifetimes and type parameters attached to a declaration /// of a function, enum, trait, etc. -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct Generics { pub params: HirVec, pub where_clause: WhereClause, @@ -579,7 +584,6 @@ impl Generics { Generics { params: HirVec::new(), where_clause: WhereClause { - id: DUMMY_NODE_ID, hir_id: DUMMY_HIR_ID, predicates: HirVec::new(), }, @@ -616,15 +620,14 @@ impl Generics { /// Synthetic type parameters are converted to another form during lowering; this allows /// us to track the original form they had, and is useful for error messages. -#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, HashStable)] pub enum SyntheticTyParamKind { ImplTrait } /// A where-clause in a definition. -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct WhereClause { - pub id: NodeId, pub hir_id: HirId, pub predicates: HirVec, } @@ -642,7 +645,7 @@ impl WhereClause { } /// A single predicate in a where-clause. -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub enum WherePredicate { /// A type binding (e.g., `for<'c> Foo: Send + Clone + 'c`). BoundPredicate(WhereBoundPredicate), @@ -663,7 +666,7 @@ impl WherePredicate { } /// A type bound (e.g., `for<'c> Foo: Send + Clone + 'c`). -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct WhereBoundPredicate { pub span: Span, /// Any generics from a `for` binding. @@ -675,7 +678,7 @@ pub struct WhereBoundPredicate { } /// A lifetime predicate (e.g., `'a: 'b + 'c`). -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct WhereRegionPredicate { pub span: Span, pub lifetime: Lifetime, @@ -683,9 +686,8 @@ pub struct WhereRegionPredicate { } /// An equality predicate (e.g., `T = int`); currently unsupported. -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct WhereEqPredicate { - pub id: NodeId, pub hir_id: HirId, pub span: Span, pub lhs_ty: P, @@ -781,15 +783,15 @@ impl Crate { where V: itemlikevisit::ParItemLikeVisitor<'hir> + Sync + Send { parallel!({ - par_iter(&self.items).for_each(|(_, item)| { + par_for_each_in(&self.items, |(_, item)| { visitor.visit_item(item); }); }, { - par_iter(&self.trait_items).for_each(|(_, trait_item)| { + par_for_each_in(&self.trait_items, |(_, trait_item)| { visitor.visit_trait_item(trait_item); }); }, { - par_iter(&self.impl_items).for_each(|(_, impl_item)| { + par_for_each_in(&self.impl_items, |(_, impl_item)| { visitor.visit_impl_item(impl_item); }); }); @@ -803,26 +805,25 @@ impl Crate { /// A macro definition, in this crate or imported from another. /// /// Not parsed directly, but created on macro import or `macro_rules!` expansion. -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct MacroDef { pub name: Name, pub vis: Visibility, pub attrs: HirVec, - pub id: NodeId, pub hir_id: HirId, pub span: Span, pub body: TokenStream, pub legacy: bool, } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct Block { /// Statements in a block. pub stmts: HirVec, /// An expression at the end of the block /// without a semicolon, if any. pub expr: Option>, - pub id: NodeId, + #[stable_hasher(ignore)] pub hir_id: HirId, /// Distinguishes between `unsafe { ... }` and `{ ... }`. pub rules: BlockCheckMode, @@ -833,9 +834,9 @@ pub struct Block { pub targeted_by_break: bool, } -#[derive(Clone, RustcEncodable, RustcDecodable)] +#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)] pub struct Pat { - pub id: NodeId, + #[stable_hasher(ignore)] pub hir_id: HirId, pub node: PatKind, pub span: Span, @@ -843,7 +844,7 @@ pub struct Pat { impl fmt::Debug for Pat { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "pat({}: {})", self.id, + write!(f, "pat({}: {})", self.hir_id, print::to_string(print::NO_ANN, |s| s.print_pat(self))) } } @@ -896,11 +897,12 @@ impl Pat { /// Patterns like the fields of Foo `{ x, ref y, ref mut z }` /// are treated the same as` x: x, y: ref y, z: ref mut z`, /// except `is_shorthand` is true. -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct FieldPat { - pub id: NodeId, + #[stable_hasher(ignore)] pub hir_id: HirId, /// The identifier for the field. + #[stable_hasher(project(name))] pub ident: Ident, /// The pattern the field is destructured to. pub pat: P, @@ -910,7 +912,7 @@ pub struct FieldPat { /// Explicit binding annotations given in the HIR for a binding. Note /// that this is not the final binding *mode* that we infer after type /// inference. -#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)] +#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy, HashStable)] pub enum BindingAnnotation { /// No binding annotation given: this means that the final binding mode /// will depend on whether we have skipped through a `&` reference @@ -931,22 +933,22 @@ pub enum BindingAnnotation { RefMut, } -#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)] +#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, HashStable)] pub enum RangeEnd { Included, Excluded, } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub enum PatKind { /// Represents a wildcard pattern (i.e., `_`). Wild, /// A fresh binding `ref mut binding @ OPT_SUBPATTERN`. - /// The `NodeId` is the canonical ID for the variable being bound, + /// The `HirId` is the canonical ID for the variable being bound, /// (e.g., in `Ok(x) | Err(x)`, both `x` use the same canonical ID), /// which is the pattern ID of the first `x`. - Binding(BindingAnnotation, NodeId, HirId, Ident, Option>), + Binding(BindingAnnotation, HirId, Ident, Option>), /// A struct or struct variant pattern (e.g., `Variant {x, y, ..}`). /// The `bool` is `true` in the presence of a `..`. @@ -982,7 +984,8 @@ pub enum PatKind { Slice(HirVec>, Option>, HirVec>), } -#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, HashStable, + RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum Mutability { MutMutable, MutImmutable, @@ -998,7 +1001,7 @@ impl Mutability { } } -#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy, Hash)] +#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy, Hash, HashStable)] pub enum BinOpKind { /// The `+` operator (addition). Add, @@ -1132,7 +1135,7 @@ impl Into for BinOpKind { pub type BinOp = Spanned; -#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy, Hash)] +#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy, Hash, HashStable)] pub enum UnOp { /// The `*` operator (deferencing). UnDeref, @@ -1163,7 +1166,6 @@ impl UnOp { /// A statement. #[derive(Clone, RustcEncodable, RustcDecodable)] pub struct Stmt { - pub id: NodeId, pub hir_id: HirId, pub node: StmtKind, pub span: Span, @@ -1171,12 +1173,12 @@ pub struct Stmt { impl fmt::Debug for Stmt { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "stmt({}: {})", self.id, + write!(f, "stmt({}: {})", self.hir_id, print::to_string(print::NO_ANN, |s| s.print_stmt(self))) } } -#[derive(Clone, RustcEncodable, RustcDecodable)] +#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)] pub enum StmtKind { /// A local (`let`) binding. Local(P), @@ -1203,13 +1205,12 @@ impl StmtKind { } /// Represents a `let` statement (i.e., `let : = ;`). -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct Local { pub pat: P, pub ty: Option>, /// Initializer expression to set the value, if any. pub init: Option>, - pub id: NodeId, pub hir_id: HirId, pub span: Span, pub attrs: ThinVec, @@ -1217,7 +1218,7 @@ pub struct Local { } /// Represents a single arm of a `match` expression. -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct Arm { pub attrs: HirVec, pub pats: HirVec>, @@ -1225,14 +1226,14 @@ pub struct Arm { pub body: P, } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub enum Guard { If(P), } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct Field { - pub id: NodeId, + #[stable_hasher(ignore)] pub hir_id: HirId, pub ident: Ident, pub expr: P, @@ -1240,7 +1241,7 @@ pub struct Field { pub is_shorthand: bool, } -#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)] +#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy, HashStable)] pub enum BlockCheckMode { DefaultBlock, UnsafeBlock(UnsafeSource), @@ -1248,7 +1249,7 @@ pub enum BlockCheckMode { PopUnsafeBlock(UnsafeSource), } -#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)] +#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy, HashStable)] pub enum UnsafeSource { CompilerGenerated, UserProvided, @@ -1324,9 +1325,8 @@ impl BodyOwnerKind { /// These are usually found nested inside types (e.g., array lengths) /// or expressions (e.g., repeat counts), and also used to define /// explicit discriminant values for enum variants. -#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Debug, HashStable)] pub struct AnonConst { - pub id: NodeId, pub hir_id: HirId, pub body: BodyId, } @@ -1334,7 +1334,6 @@ pub struct AnonConst { /// An expression #[derive(Clone, RustcEncodable, RustcDecodable)] pub struct Expr { - pub id: NodeId, pub span: Span, pub node: ExprKind, pub attrs: ThinVec, @@ -1437,12 +1436,12 @@ impl Expr { impl fmt::Debug for Expr { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "expr({}: {})", self.id, + write!(f, "expr({}: {})", self.hir_id, print::to_string(print::NO_ANN, |s| s.print_expr(self))) } } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub enum ExprKind { /// A `box x` expression. Box(P), @@ -1548,7 +1547,7 @@ pub enum ExprKind { } /// Optionally `Self`-qualified value/type path or associated extension. -#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)] pub enum QPath { /// Path to a definition, optionally "fully-qualified" with a `Self` /// type, if the path points to an associated item in a trait. @@ -1568,7 +1567,7 @@ pub enum QPath { } /// Hints at the original code for a let statement. -#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy, HashStable)] pub enum LocalSource { /// A `match _ { .. }`. Normal, @@ -1577,7 +1576,7 @@ pub enum LocalSource { } /// Hints at the original code for a `match _ { .. }`. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy, HashStable)] pub enum MatchSource { /// A `match _ { .. }`. Normal, @@ -1595,7 +1594,7 @@ pub enum MatchSource { } /// The loop type that yielded an `ExprKind::Loop`. -#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)] +#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy, HashStable)] pub enum LoopSource { /// A `loop { .. }` loop. Loop, @@ -1605,7 +1604,7 @@ pub enum LoopSource { ForLoop, } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy, HashStable)] pub enum LoopIdError { OutsideLoopScope, UnlabeledCfInWhileCondition, @@ -1623,23 +1622,24 @@ impl fmt::Display for LoopIdError { } } -#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy, HashStable)] pub struct Destination { // This is `Some(_)` iff there is an explicit user-specified `label pub label: Option

(self, tcx: TyCtxt<'a, 'gcx, 'tcx>, - node_id: ast::NodeId, + hir_id: HirId, attributes: &[ast::Attribute], p: P) -> DataflowResults<'tcx, BD> where P: Fn(&BD, BD::Idx) -> DebugFormatted @@ -158,7 +159,7 @@ impl<'a, 'gcx: 'tcx, 'tcx: 'a, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitD name_found(tcx.sess, attributes, "borrowck_graphviz_postflow"); let mut mbcx = DataflowBuilder { - node_id, + hir_id, print_preflow_to, print_postflow_to, flow_state: self, }; diff --git a/src/librustc_mir/dataflow/move_paths/builder.rs b/src/librustc_mir/dataflow/move_paths/builder.rs index 1ae050654b4b..7a9140bce628 100644 --- a/src/librustc_mir/dataflow/move_paths/builder.rs +++ b/src/librustc_mir/dataflow/move_paths/builder.rs @@ -33,13 +33,13 @@ impl<'a, 'gcx, 'tcx> MoveDataBuilder<'a, 'gcx, 'tcx> { moves: IndexVec::new(), loc_map: LocationMap::new(mir), rev_lookup: MovePathLookup { - locals: mir.local_decls.indices().map(Place::Local).map(|v| { + locals: mir.local_decls.indices().map(PlaceBase::Local).map(|v| { Self::new_move_path( &mut move_paths, &mut path_map, &mut init_path_map, None, - v, + Place::Base(v), ) }).collect(), projections: Default::default(), @@ -96,9 +96,9 @@ impl<'b, 'a, 'gcx, 'tcx> Gatherer<'b, 'a, 'gcx, 'tcx> { { debug!("lookup({:?})", place); match *place { - Place::Local(local) => Ok(self.builder.data.rev_lookup.locals[local]), - Place::Promoted(..) | - Place::Static(..) => { + Place::Base(PlaceBase::Local(local)) => Ok(self.builder.data.rev_lookup.locals[local]), + Place::Base(PlaceBase::Promoted(..)) | + Place::Base(PlaceBase::Static(..)) => { Err(MoveError::cannot_move_out_of(self.loc, Static)) } Place::Projection(ref proj) => { @@ -285,7 +285,7 @@ impl<'b, 'a, 'gcx, 'tcx> Gatherer<'b, 'a, 'gcx, 'tcx> { } StatementKind::StorageLive(_) => {} StatementKind::StorageDead(local) => { - self.gather_move(&Place::Local(local)); + self.gather_move(&Place::Base(PlaceBase::Local(local))); } StatementKind::SetDiscriminant{ .. } => { span_bug!(stmt.source_info.span, @@ -345,7 +345,7 @@ impl<'b, 'a, 'gcx, 'tcx> Gatherer<'b, 'a, 'gcx, 'tcx> { TerminatorKind::Unreachable => { } TerminatorKind::Return => { - self.gather_move(&Place::Local(RETURN_PLACE)); + self.gather_move(&Place::RETURN_PLACE); } TerminatorKind::Assert { ref cond, .. } => { diff --git a/src/librustc_mir/dataflow/move_paths/mod.rs b/src/librustc_mir/dataflow/move_paths/mod.rs index efd979a7da4f..97f84675f94b 100644 --- a/src/librustc_mir/dataflow/move_paths/mod.rs +++ b/src/librustc_mir/dataflow/move_paths/mod.rs @@ -23,7 +23,7 @@ pub(crate) mod indexes { use rustc_data_structures::indexed_vec::Idx; macro_rules! new_index { - ($Index:ident, $debug_name:expr) => { + ($(#[$attrs:meta])* $Index:ident, $debug_name:expr) => { #[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct $Index(NonZeroUsize); @@ -44,17 +44,29 @@ pub(crate) mod indexes { } } - /// Index into MovePathData.move_paths - new_index!(MovePathIndex, "mp"); + new_index!( + /// Index into MovePathData.move_paths + MovePathIndex, + "mp" + ); - /// Index into MoveData.moves. - new_index!(MoveOutIndex, "mo"); + new_index!( + /// Index into MoveData.moves. + MoveOutIndex, + "mo" + ); - /// Index into MoveData.inits. - new_index!(InitIndex, "in"); + new_index!( + /// Index into MoveData.inits. + InitIndex, + "in" + ); - /// Index into Borrows.locations - new_index!(BorrowIndex, "bw"); + new_index!( + /// Index into Borrows.locations + BorrowIndex, + "bw" + ); } pub use self::indexes::MovePathIndex; @@ -273,9 +285,9 @@ impl<'tcx> MovePathLookup<'tcx> { // parent. pub fn find(&self, place: &Place<'tcx>) -> LookupResult { match *place { - Place::Local(local) => LookupResult::Exact(self.locals[local]), - Place::Promoted(_) | - Place::Static(..) => LookupResult::Parent(None), + Place::Base(PlaceBase::Local(local)) => LookupResult::Exact(self.locals[local]), + Place::Base(PlaceBase::Promoted(_)) | + Place::Base(PlaceBase::Static(..)) => LookupResult::Parent(None), Place::Projection(ref proj) => { match self.find(&proj.base) { LookupResult::Exact(base_path) => { @@ -347,7 +359,7 @@ impl<'a, 'gcx, 'tcx> MoveData<'tcx> { pub fn base_local(&self, mut mpi: MovePathIndex) -> Option { loop { let path = &self.move_paths[mpi]; - if let Place::Local(l) = path.place { return Some(l); } + if let Place::Base(PlaceBase::Local(l)) = path.place { return Some(l); } if let Some(parent) = path.parent { mpi = parent; continue } else { return None } } } diff --git a/src/librustc_mir/hair/cx/block.rs b/src/librustc_mir/hair/cx/block.rs index 4a64ddb73fc2..f58e61915e8c 100644 --- a/src/librustc_mir/hair/cx/block.rs +++ b/src/librustc_mir/hair/cx/block.rs @@ -30,7 +30,7 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Block { hir::BlockCheckMode::DefaultBlock => BlockSafety::Safe, hir::BlockCheckMode::UnsafeBlock(..) => - BlockSafety::ExplicitUnsafe(self.id), + BlockSafety::ExplicitUnsafe(self.hir_id), hir::BlockCheckMode::PushUnsafeBlock(..) => BlockSafety::PushUnsafe, hir::BlockCheckMode::PopUnsafeBlock(..) => @@ -103,7 +103,7 @@ fn mirror_stmts<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, }, pattern, initializer: local.init.to_ref(), - lint_level: cx.lint_level_of(local.id), + lint_level: cx.lint_level_of(local.hir_id), }, opt_destruction_scope: opt_dxn_ext, span: stmt_span, diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs index 3c38f870b04b..ad0a22cc7827 100644 --- a/src/librustc_mir/hair/cx/expr.rs +++ b/src/librustc_mir/hair/cx/expr.rs @@ -5,10 +5,10 @@ use crate::hair::cx::to_ref::ToRef; use crate::hair::util::UserAnnotatedTyHelpers; use rustc_data_structures::indexed_vec::Idx; use rustc::hir::def::{Def, CtorKind}; -use rustc::mir::interpret::{GlobalId, ErrorHandled}; +use rustc::mir::interpret::{GlobalId, ErrorHandled, ConstValue}; use rustc::ty::{self, AdtKind, Ty}; use rustc::ty::adjustment::{Adjustment, Adjust, AutoBorrow, AutoBorrowMutability}; -use rustc::ty::cast::CastKind as TyCastKind; +use rustc::ty::subst::{InternalSubsts, SubstsRef}; use rustc::hir; use rustc::hir::def_id::LocalDefId; use rustc::mir::BorrowKind; @@ -24,7 +24,7 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr { data: region::ScopeData::Node }; - debug!("Expr::make_mirror(): id={}, span={:?}", self.id, self.span); + debug!("Expr::make_mirror(): id={}, span={:?}", self.hir_id, self.span); let mut expr = make_mirror_unadjusted(cx, self); @@ -44,7 +44,7 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr { kind: ExprKind::Scope { region_scope: expr_scope, value: expr.to_ref(), - lint_level: cx.lint_level_of(self.id), + lint_level: cx.lint_level_of(self.hir_id), }, }; @@ -88,7 +88,7 @@ fn apply_adjustment<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, ExprKind::NeverToAny { source: expr.to_ref() } } Adjust::MutToConstPointer => { - ExprKind::Cast { source: expr.to_ref() } + ExprKind::MutToConstPointer { source: expr.to_ref() } } Adjust::Deref(None) => { // Adjust the span from the block, to the last expression of the @@ -529,7 +529,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, span_bug!(expr.span, "closure expr w/o closure type: {:?}", closure_ty); } }; - let upvars = cx.tcx.with_freevars(expr.id, |freevars| { + let upvars = cx.tcx.with_freevars(expr.hir_id, |freevars| { freevars.iter() .zip(substs.upvar_tys(def_id, cx.tcx)) .map(|(fv, ty)| capture_freevar(cx, expr, fv, ty)) @@ -558,8 +558,8 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, // Now comes the rote stuff: hir::ExprKind::Repeat(ref v, ref count) => { - let def_id = cx.tcx.hir().local_def_id(count.id); - let substs = Substs::identity_for_item(cx.tcx.global_tcx(), def_id); + let def_id = cx.tcx.hir().local_def_id_from_hir_id(count.hir_id); + let substs = InternalSubsts::identity_for_item(cx.tcx.global_tcx(), def_id); let instance = ty::Instance::resolve( cx.tcx.global_tcx(), cx.param_env, @@ -590,7 +590,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, match dest.target_id { Ok(target_id) => ExprKind::Break { label: region::Scope { - id: cx.tcx.hir().node_to_hir_id(target_id).local_id, + id: target_id.local_id, data: region::ScopeData::Node }, value: value.to_ref(), @@ -602,7 +602,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, match dest.target_id { Ok(loop_id) => ExprKind::Continue { label: region::Scope { - id: cx.tcx.hir().node_to_hir_id(loop_id).local_id, + id: loop_id.local_id, data: region::ScopeData::Node }, }, @@ -637,7 +637,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, hir::ExprKind::Field(ref source, ..) => { ExprKind::Field { lhs: source.to_ref(), - name: Field::new(cx.tcx.field_index(expr.id, cx.tables)), + name: Field::new(cx.tcx.field_index(expr.hir_id, cx.tables)), } } hir::ExprKind::Cast(ref source, ref cast_ty) => { @@ -654,11 +654,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, // Check to see if this cast is a "coercion cast", where the cast is actually done // using a coercion (or is a no-op). - let cast = if let Some(&TyCastKind::CoercionCast) = - cx.tables() - .cast_kinds() - .get(source.hir_id) - { + let cast = if cx.tables().is_coercion_cast(source.hir_id) { // Convert the lexpr to a vexpr. ExprKind::Use { source: source.to_ref() } } else { @@ -697,7 +693,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, }; let source = if let Some((did, offset, var_ty)) = var { - let mk_const = |literal| Expr { + let mk_lazy_const = |literal| Expr { temp_lifetime, ty: var_ty, span: expr.span, @@ -706,7 +702,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, user_ty: None }, }.to_ref(); - let offset = mk_const(ty::LazyConst::Evaluated(ty::Const::from_bits( + let offset = mk_lazy_const(ty::LazyConst::Evaluated(ty::Const::from_bits( cx.tcx, offset as u128, cx.param_env.and(var_ty), @@ -715,8 +711,8 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, Some(did) => { // in case we are offsetting from a computed discriminant // and not the beginning of discriminants (which is always `0`) - let substs = Substs::identity_for_item(cx.tcx(), did); - let lhs = mk_const(ty::LazyConst::Unevaluated(did, substs)); + let substs = InternalSubsts::identity_for_item(cx.tcx(), did); + let lhs = mk_lazy_const(ty::LazyConst::Unevaluated(did, substs)); let bin = ExprKind::Binary { op: BinOp::Add, lhs, @@ -833,7 +829,7 @@ fn method_callee<'a, 'gcx, 'tcx>( cx: &mut Cx<'a, 'gcx, 'tcx>, expr: &hir::Expr, span: Span, - overloaded_callee: Option<(DefId, &'tcx Substs<'tcx>)>, + overloaded_callee: Option<(DefId, SubstsRef<'tcx>)>, ) -> Expr<'tcx> { let temp_lifetime = cx.region_scope_tree.temporary_scope(expr.hir_id.local_id); let (def_id, substs, user_ty) = match overloaded_callee { @@ -923,7 +919,26 @@ fn convert_path_expr<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, ))), user_ty, } - }, + } + + Def::ConstParam(def_id) => { + let node_id = cx.tcx.hir().as_local_node_id(def_id).unwrap(); + let item_id = cx.tcx.hir().get_parent_node(node_id); + let item_def_id = cx.tcx.hir().local_def_id(item_id); + let generics = cx.tcx.generics_of(item_def_id); + let index = generics.param_def_id_to_index[&cx.tcx.hir().local_def_id(node_id)]; + let name = cx.tcx.hir().name(node_id).as_interned_str(); + let val = ConstValue::Param(ty::ParamConst::new(index, name)); + ExprKind::Literal { + literal: cx.tcx.mk_lazy_const( + ty::LazyConst::Evaluated(ty::Const { + val, + ty: cx.tables().node_type(expr.hir_id), + }) + ), + user_ty: None, + } + } Def::Const(def_id) | Def::AssociatedConst(def_id) => { @@ -972,7 +987,7 @@ fn convert_var<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, let temp_lifetime = cx.region_scope_tree.temporary_scope(expr.hir_id.local_id); match def { - Def::Local(id) => ExprKind::VarRef { id }, + Def::Local(id) => ExprKind::VarRef { id: cx.tcx.hir().node_to_hir_id(id) }, Def::Upvar(var_id, index, closure_expr_id) => { debug!("convert_var(upvar({:?}, {:?}, {:?}))", @@ -1132,7 +1147,7 @@ fn overloaded_place<'a, 'gcx, 'tcx>( cx: &mut Cx<'a, 'gcx, 'tcx>, expr: &'tcx hir::Expr, place_ty: Ty<'tcx>, - overloaded_callee: Option<(DefId, &'tcx Substs<'tcx>)>, + overloaded_callee: Option<(DefId, SubstsRef<'tcx>)>, args: Vec>, ) -> ExprKind<'tcx> { // For an overloaded *x or x[y] expression of type T, the method @@ -1184,7 +1199,7 @@ fn capture_freevar<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, let var_hir_id = cx.tcx.hir().node_to_hir_id(freevar.var_id()); let upvar_id = ty::UpvarId { var_path: ty::UpvarPath { hir_id: var_hir_id }, - closure_expr_id: cx.tcx.hir().local_def_id(closure_expr.id).to_local(), + closure_expr_id: cx.tcx.hir().local_def_id_from_hir_id(closure_expr.hir_id).to_local(), }; let upvar_capture = cx.tables().upvar_capture(upvar_id); let temp_lifetime = cx.region_scope_tree.temporary_scope(closure_expr.hir_id.local_id); @@ -1223,7 +1238,7 @@ fn field_refs<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, fields.iter() .map(|field| { FieldExprRef { - name: Field::new(cx.tcx.field_index(field.id, cx.tables)), + name: Field::new(cx.tcx.field_index(field.hir_id, cx.tables)), expr: field.expr.to_ref(), } }) diff --git a/src/librustc_mir/hair/cx/mod.rs b/src/librustc_mir/hair/cx/mod.rs index cd937d702fd7..8b16eeeea23c 100644 --- a/src/librustc_mir/hair/cx/mod.rs +++ b/src/librustc_mir/hair/cx/mod.rs @@ -12,7 +12,7 @@ use rustc::middle::region; use rustc::infer::InferCtxt; use rustc::ty::subst::Subst; use rustc::ty::{self, Ty, TyCtxt}; -use rustc::ty::subst::{Kind, Substs}; +use rustc::ty::subst::{Kind, InternalSubsts}; use rustc::ty::layout::VariantIdx; use syntax::ast; use syntax::attr; @@ -26,11 +26,11 @@ pub struct Cx<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { tcx: TyCtxt<'a, 'gcx, 'tcx>, infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, - pub root_lint_level: ast::NodeId, + pub root_lint_level: hir::HirId, pub param_env: ty::ParamEnv<'gcx>, - /// Identity `Substs` for use with const-evaluation. - pub identity_substs: &'gcx Substs<'gcx>, + /// Identity `InternalSubsts` for use with const-evaluation. + pub identity_substs: &'gcx InternalSubsts<'gcx>, pub region_scope_tree: Lrc, pub tables: &'a ty::TypeckTables<'gcx>, @@ -51,10 +51,10 @@ pub struct Cx<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { pub fn new(infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, - src_id: ast::NodeId) -> Cx<'a, 'gcx, 'tcx> { + src_id: hir::HirId) -> Cx<'a, 'gcx, 'tcx> { let tcx = infcx.tcx; - let src_def_id = tcx.hir().local_def_id(src_id); - let body_owner_kind = tcx.hir().body_owner_kind(src_id); + let src_def_id = tcx.hir().local_def_id_from_hir_id(src_id); + let body_owner_kind = tcx.hir().body_owner_kind_by_hir_id(src_id); let constness = match body_owner_kind { hir::BodyOwnerKind::Const | @@ -63,7 +63,7 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { hir::BodyOwnerKind::Fn => hir::Constness::NotConst, }; - let attrs = tcx.hir().attrs(src_id); + let attrs = tcx.hir().attrs_by_hir_id(src_id); // Some functions always have overflow checks enabled, // however, they may not get codegen'd, depending on @@ -82,7 +82,7 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { infcx, root_lint_level: lint_level, param_env: tcx.param_env(src_def_id), - identity_substs: Substs::identity_for_item(tcx.global_tcx(), src_def_id), + identity_substs: InternalSubsts::identity_for_item(tcx.global_tcx(), src_def_id), region_scope_tree: tcx.region_scope_tree(src_def_id), tables: tcx.typeck_tables_of(src_def_id), constness, @@ -153,7 +153,7 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { pub fn pattern_from_hir(&mut self, p: &hir::Pat) -> Pattern<'tcx> { let tcx = self.tcx.global_tcx(); - let p = match tcx.hir().get(p.id) { + let p = match tcx.hir().get_by_hir_id(p.hir_id) { Node::Pat(p) | Node::Binding(p) => p, node => bug!("pattern became {:?}", node) }; @@ -197,14 +197,13 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { ty.needs_drop(self.tcx.global_tcx(), param_env) } - fn lint_level_of(&self, node_id: ast::NodeId) -> LintLevel { - let hir_id = self.tcx.hir().definitions().node_to_hir_id(node_id); + fn lint_level_of(&self, hir_id: hir::HirId) -> LintLevel { let has_lint_level = self.tcx.dep_graph.with_ignore(|| { self.tcx.lint_levels(LOCAL_CRATE).lint_level_set(hir_id).is_some() }); if has_lint_level { - LintLevel::Explicit(node_id) + LintLevel::Explicit(hir_id) } else { LintLevel::Inherited } @@ -237,7 +236,7 @@ impl UserAnnotatedTyHelpers<'gcx, 'tcx> for Cx<'_, 'gcx, 'tcx> { } } -fn lint_level_for_hir_id(tcx: TyCtxt<'_, '_, '_>, mut id: ast::NodeId) -> ast::NodeId { +fn lint_level_for_hir_id(tcx: TyCtxt<'_, '_, '_>, mut id: hir::HirId) -> hir::HirId { // Right now we insert a `with_ignore` node in the dep graph here to // ignore the fact that `lint_levels` below depends on the entire crate. // For now this'll prevent false positives of recompiling too much when @@ -249,11 +248,10 @@ fn lint_level_for_hir_id(tcx: TyCtxt<'_, '_, '_>, mut id: ast::NodeId) -> ast::N tcx.dep_graph.with_ignore(|| { let sets = tcx.lint_levels(LOCAL_CRATE); loop { - let hir_id = tcx.hir().definitions().node_to_hir_id(id); - if sets.lint_level_set(hir_id).is_some() { + if sets.lint_level_set(id).is_some() { return id } - let next = tcx.hir().get_parent_node(id); + let next = tcx.hir().get_parent_node_by_hir_id(id); if next == id { bug!("lint traversal reached the root of the crate"); } diff --git a/src/librustc_mir/hair/mod.rs b/src/librustc_mir/hair/mod.rs index bce0a0dd0a8b..385249ec1c13 100644 --- a/src/librustc_mir/hair/mod.rs +++ b/src/librustc_mir/hair/mod.rs @@ -8,11 +8,10 @@ use rustc::mir::{BinOp, BorrowKind, Field, UnOp}; use rustc::hir::def_id::DefId; use rustc::infer::canonical::Canonical; use rustc::middle::region; -use rustc::ty::subst::Substs; +use rustc::ty::subst::SubstsRef; use rustc::ty::{AdtDef, UpvarSubsts, Ty, Const, LazyConst, UserType}; use rustc::ty::layout::VariantIdx; use rustc::hir; -use syntax::ast; use syntax_pos::Span; use self::cx::Cx; @@ -28,7 +27,7 @@ mod util; #[derive(Copy, Clone, Debug)] pub enum LintLevel { Inherited, - Explicit(ast::NodeId) + Explicit(hir::HirId) } impl LintLevel { @@ -54,7 +53,7 @@ pub struct Block<'tcx> { #[derive(Copy, Clone, Debug)] pub enum BlockSafety { Safe, - ExplicitUnsafe(ast::NodeId), + ExplicitUnsafe(hir::HirId), PushUnsafe, PopUnsafe } @@ -190,6 +189,9 @@ pub enum ExprKind<'tcx> { UnsafeFnPointer { source: ExprRef<'tcx>, }, + MutToConstPointer { + source: ExprRef<'tcx>, + }, Unsize { source: ExprRef<'tcx>, }, @@ -227,7 +229,7 @@ pub enum ExprKind<'tcx> { index: ExprRef<'tcx>, }, VarRef { - id: ast::NodeId, + id: hir::HirId, }, /// first argument, used for self in a closure SelfRef, @@ -261,7 +263,7 @@ pub enum ExprKind<'tcx> { Adt { adt_def: &'tcx AdtDef, variant_index: VariantIdx, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, /// Optional user-given substs: for something like `let x = /// Bar:: { ... }`. diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index 10bef53e249c..586a3fdb907e 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -168,7 +168,7 @@ use super::{PatternFoldable, PatternFolder, compare_const_vals}; use rustc::hir::def_id::DefId; use rustc::hir::RangeEnd; -use rustc::ty::{self, Ty, TyCtxt, TypeFoldable, Const}; +use rustc::ty::{self, subst::SubstsRef, Ty, TyCtxt, TypeFoldable, Const}; use rustc::ty::layout::{Integer, IntegerExt, VariantIdx, Size}; use rustc::mir::Field; @@ -402,7 +402,7 @@ impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> { fn is_variant_uninhabited(&self, variant: &'tcx ty::VariantDef, - substs: &'tcx ty::subst::Substs<'tcx>) + substs: SubstsRef<'tcx>) -> bool { if self.tcx.features().exhaustive_patterns { @@ -440,13 +440,7 @@ impl<'tcx> Constructor<'tcx> { assert!(!adt.is_enum()); VariantIdx::new(0) } - &ConstantValue(c) => { - crate::const_eval::const_variant_index( - cx.tcx, - cx.param_env, - c, - ).unwrap() - }, + &ConstantValue(c) => crate::const_eval::const_variant_index(cx.tcx, cx.param_env, c), _ => bug!("bad constructor {:?} for adt {:?}", self, adt) } } @@ -539,7 +533,6 @@ impl<'tcx> Witness<'tcx> { self.apply_constructor(cx, ctor, ty) } - /// Constructs a partial witness for a pattern given a list of /// patterns expanded by the specialization step. /// diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index 7c44d1bf2c93..41babc1ad12e 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -10,8 +10,8 @@ use rustc::middle::expr_use_visitor as euv; use rustc::middle::mem_categorization::cmt_; use rustc::middle::region; use rustc::session::Session; -use rustc::ty::{self, Ty, TyCtxt}; -use rustc::ty::subst::Substs; +use rustc::ty::{self, Ty, TyCtxt, TyKind}; +use rustc::ty::subst::{InternalSubsts, SubstsRef}; use rustc::lint; use rustc_errors::{Applicability, DiagnosticBuilder}; use rustc::util::common::ErrorReported; @@ -24,22 +24,14 @@ use rustc::hir::{self, Pat, PatKind}; use smallvec::smallvec; use std::slice; -use syntax::ast; use syntax::ptr::P; use syntax_pos::{Span, DUMMY_SP, MultiSpan}; -pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - for def_id in tcx.body_owners() { - tcx.ensure().check_match(def_id); - } - tcx.sess.abort_if_errors(); -} - pub(crate) fn check_match<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, ) -> Result<(), ErrorReported> { - let body_id = if let Some(id) = tcx.hir().as_local_node_id(def_id) { + let body_id = if let Some(id) = tcx.hir().as_local_hir_id(def_id) { tcx.hir().body_owned_by(id) } else { return Ok(()); @@ -51,7 +43,7 @@ pub(crate) fn check_match<'a, 'tcx>( tables: tcx.body_tables(body_id), region_scope_tree: &tcx.region_scope_tree(def_id), param_env: tcx.param_env(def_id), - identity_substs: Substs::identity_for_item(tcx, def_id), + identity_substs: InternalSubsts::identity_for_item(tcx, def_id), }.visit_body(tcx.hir().body(body_id)); }) } @@ -64,7 +56,7 @@ struct MatchVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, tables: &'a ty::TypeckTables<'tcx>, param_env: ty::ParamEnv<'tcx>, - identity_substs: &'tcx Substs<'tcx>, + identity_substs: SubstsRef<'tcx>, region_scope_tree: &'a region::ScopeTree, } @@ -171,7 +163,7 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> { } } - let module = self.tcx.hir().get_module_parent(scrut.id); + let module = self.tcx.hir().get_module_parent_by_hir_id(scrut.hir_id); MatchCheckCtxt::create_and_enter(self.tcx, self.param_env, module, |ref mut cx| { let mut have_errors = false; @@ -203,26 +195,52 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> { // Then, if the match has no arms, check whether the scrutinee // is uninhabited. let pat_ty = self.tables.node_type(scrut.hir_id); - let module = self.tcx.hir().get_module_parent(scrut.id); + let module = self.tcx.hir().get_module_parent_by_hir_id(scrut.hir_id); + let mut def_span = None; + let mut missing_variants = vec![]; if inlined_arms.is_empty() { let scrutinee_is_uninhabited = if self.tcx.features().exhaustive_patterns { self.tcx.is_ty_uninhabited_from(module, pat_ty) } else { match pat_ty.sty { ty::Never => true, - ty::Adt(def, _) => def.variants.is_empty(), + ty::Adt(def, _) => { + def_span = self.tcx.hir().span_if_local(def.did); + if def.variants.len() < 4 && !def.variants.is_empty() { + // keep around to point at the definition of non-covered variants + missing_variants = def.variants.iter() + .map(|variant| variant.ident) + .collect(); + } + def.variants.is_empty() + }, _ => false } }; if !scrutinee_is_uninhabited { // We know the type is inhabited, so this must be wrong - let mut err = create_e0004(self.tcx.sess, scrut.span, - format!("non-exhaustive patterns: type `{}` \ - is non-empty", - pat_ty)); - span_help!(&mut err, scrut.span, - "ensure that all possible cases are being handled, \ - possibly by adding wildcards or more match arms"); + let mut err = create_e0004( + self.tcx.sess, + scrut.span, + format!("non-exhaustive patterns: {}", match missing_variants.len() { + 0 => format!("type `{}` is non-empty", pat_ty), + 1 => format!( + "pattern `{}` of type `{}` is not handled", + missing_variants[0].name, + pat_ty, + ), + _ => format!("multiple patterns of type `{}` are not handled", pat_ty), + }), + ); + err.help("ensure that all possible cases are being handled, \ + possibly by adding wildcards or more match arms"); + if let Some(sp) = def_span { + err.span_label(sp, format!("`{}` defined here", pat_ty)); + } + // point at the definition of non-covered enum variants + for variant in &missing_variants { + err.span_label(variant.span, "variant not covered"); + } err.emit(); } // If the type *is* uninhabited, it's vacuously exhaustive @@ -241,7 +259,7 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> { } fn check_irrefutable(&self, pat: &'tcx Pat, origin: &str) { - let module = self.tcx.hir().get_module_parent(pat.id); + let module = self.tcx.hir().get_module_parent_by_hir_id(pat.hir_id); MatchCheckCtxt::create_and_enter(self.tcx, self.param_env, module, |ref mut cx| { let mut patcx = PatternContext::new(self.tcx, self.param_env.and(self.identity_substs), @@ -264,7 +282,7 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> { }; let pattern_string = witness[0].single_pattern().to_string(); - let mut diag = struct_span_err!( + let mut err = struct_span_err!( self.tcx.sess, pat.span, E0005, "refutable pattern in {}: `{}` not covered", origin, pattern_string @@ -277,15 +295,20 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> { } _ => format!("pattern `{}` not covered", pattern_string), }; - diag.span_label(pat.span, label_msg); - diag.emit(); + err.span_label(pat.span, label_msg); + if let ty::Adt(def, _) = pattern_ty.sty { + if let Some(sp) = self.tcx.hir().span_if_local(def.did){ + err.span_label(sp, format!("`{}` defined here", pattern_ty)); + } + } + err.emit(); }); } } fn check_for_bindings_named_same_as_variants(cx: &MatchVisitor<'_, '_>, pat: &Pat) { pat.walk(|p| { - if let PatKind::Binding(_, _, _, ident, None) = p.node { + if let PatKind::Binding(_, _, ident, None) = p.node { if let Some(&bm) = cx.tables.pat_binding_modes().get(p.hir_id) { if bm != ty::BindByValue(hir::MutImmutable) { // Nothing to check. @@ -332,10 +355,11 @@ fn pat_is_catchall(pat: &Pat) -> bool { } // Check for unreachable patterns -fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, - arms: &[(Vec<(&'a Pattern<'tcx>, &hir::Pat)>, Option<&hir::Expr>)], - source: hir::MatchSource) -{ +fn check_arms<'a, 'tcx>( + cx: &mut MatchCheckCtxt<'a, 'tcx>, + arms: &[(Vec<(&'a Pattern<'tcx>, &hir::Pat)>, Option<&hir::Expr>)], + source: hir::MatchSource, +) { let mut seen = Matrix::empty(); let mut catchall = None; for (arm_index, &(ref pats, guard)) in arms.iter().enumerate() { @@ -346,9 +370,9 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, NotUseful => { match source { hir::MatchSource::IfLetDesugar { .. } => { - cx.tcx.lint_node( + cx.tcx.lint_hir( lint::builtin::IRREFUTABLE_LET_PATTERNS, - hir_pat.id, + hir_pat.hir_id, pat.span, "irrefutable if-let pattern", ); @@ -359,16 +383,16 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, match arm_index { // The arm with the user-specified pattern. 0 => { - cx.tcx.lint_node( + cx.tcx.lint_hir( lint::builtin::UNREACHABLE_PATTERNS, - hir_pat.id, pat.span, + hir_pat.hir_id, pat.span, "unreachable pattern"); }, // The arm with the wildcard pattern. 1 => { - cx.tcx.lint_node( + cx.tcx.lint_hir( lint::builtin::IRREFUTABLE_LET_PATTERNS, - hir_pat.id, + hir_pat.hir_id, pat.span, "irrefutable while-let pattern", ); @@ -379,9 +403,9 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, hir::MatchSource::ForLoopDesugar | hir::MatchSource::Normal => { - let mut err = cx.tcx.struct_span_lint_node( + let mut err = cx.tcx.struct_span_lint_hir( lint::builtin::UNREACHABLE_PATTERNS, - hir_pat.id, + hir_pat.hir_id, pat.span, "unreachable pattern", ); @@ -411,10 +435,12 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, } } -fn check_exhaustive<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, - scrut_ty: Ty<'tcx>, - sp: Span, - matrix: &Matrix<'p, 'tcx>) { +fn check_exhaustive<'p, 'a: 'p, 'tcx: 'a>( + cx: &mut MatchCheckCtxt<'a, 'tcx>, + scrut_ty: Ty<'tcx>, + sp: Span, + matrix: &Matrix<'p, 'tcx>, +) { let wild_pattern = Pattern { ty: scrut_ty, span: DUMMY_SP, @@ -448,11 +474,26 @@ fn check_exhaustive<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, 1 => format!("pattern {} not covered", joined_patterns), _ => format!("patterns {} not covered", joined_patterns), }; - create_e0004(cx.tcx.sess, sp, - format!("non-exhaustive patterns: {} not covered", - joined_patterns)) - .span_label(sp, label_text) - .emit(); + let mut err = create_e0004(cx.tcx.sess, sp, format!( + "non-exhaustive patterns: {} not covered", + joined_patterns, + )); + err.span_label(sp, label_text); + // point at the definition of non-covered enum variants + if let ty::Adt(def, _) = scrut_ty.sty { + if let Some(sp) = cx.tcx.hir().span_if_local(def.did){ + err.span_label(sp, format!("`{}` defined here", scrut_ty)); + } + } + let patterns = witnesses.iter().map(|p| (**p).clone()).collect::>>(); + if patterns.len() < 4 { + for sp in maybe_point_at_variant(cx, &scrut_ty.sty, patterns.as_slice()) { + err.span_label(sp, "not covered"); + } + } + err.help("ensure that all possible cases are being handled, \ + possibly by adding wildcards or more match arms"); + err.emit(); } NotUseful => { // This is good, wildcard pattern isn't reachable @@ -461,10 +502,49 @@ fn check_exhaustive<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, } } +fn maybe_point_at_variant( + cx: &mut MatchCheckCtxt<'a, 'tcx>, + sty: &TyKind<'tcx>, + patterns: &[Pattern<'_>], +) -> Vec { + let mut covered = vec![]; + if let ty::Adt(def, _) = sty { + // Don't point at variants that have already been covered due to other patterns to avoid + // visual clutter + for pattern in patterns { + let pk: &PatternKind<'_> = &pattern.kind; + if let PatternKind::Variant { adt_def, variant_index, subpatterns, .. } = pk { + if adt_def.did == def.did { + let sp = def.variants[*variant_index].ident.span; + if covered.contains(&sp) { + continue; + } + covered.push(sp); + let subpatterns = subpatterns.iter() + .map(|field_pattern| field_pattern.pattern.clone()) + .collect::>(); + covered.extend( + maybe_point_at_variant(cx, sty, subpatterns.as_slice()), + ); + } + } + if let PatternKind::Leaf { subpatterns } = pk { + let subpatterns = subpatterns.iter() + .map(|field_pattern| field_pattern.pattern.clone()) + .collect::>(); + covered.extend(maybe_point_at_variant(cx, sty, subpatterns.as_slice())); + } + } + } + covered +} + // Legality of move bindings checking -fn check_legality_of_move_bindings(cx: &MatchVisitor<'_, '_>, - has_guard: bool, - pats: &[P]) { +fn check_legality_of_move_bindings( + cx: &MatchVisitor<'_, '_>, + has_guard: bool, + pats: &[P], +) { let mut by_ref_span = None; for pat in pats { pat.each_binding(|_, hir_id, span, _path| { @@ -503,7 +583,7 @@ fn check_legality_of_move_bindings(cx: &MatchVisitor<'_, '_>, for pat in pats { pat.walk(|p| { - if let PatKind::Binding(_, _, _, _, ref sub) = p.node { + if let PatKind::Binding(_, _, _, ref sub) = p.node { if let Some(&bm) = cx.tables.pat_binding_modes().get(p.hir_id) { match bm { ty::BindByValue(..) => { @@ -561,10 +641,10 @@ struct MutationChecker<'a, 'tcx: 'a> { impl<'a, 'tcx> Delegate<'tcx> for MutationChecker<'a, 'tcx> { fn matched_pat(&mut self, _: &Pat, _: &cmt_<'_>, _: euv::MatchMode) {} - fn consume(&mut self, _: ast::NodeId, _: Span, _: &cmt_<'_>, _: ConsumeMode) {} + fn consume(&mut self, _: hir::HirId, _: Span, _: &cmt_<'_>, _: ConsumeMode) {} fn consume_pat(&mut self, _: &Pat, _: &cmt_<'_>, _: ConsumeMode) {} fn borrow(&mut self, - _: ast::NodeId, + _: hir::HirId, span: Span, _: &cmt_<'_>, _: ty::Region<'tcx>, @@ -586,8 +666,8 @@ impl<'a, 'tcx> Delegate<'tcx> for MutationChecker<'a, 'tcx> { ty::ImmBorrow | ty::UniqueImmBorrow => {} } } - fn decl_without_init(&mut self, _: ast::NodeId, _: Span) {} - fn mutate(&mut self, _: ast::NodeId, span: Span, _: &cmt_<'_>, mode: MutateMode) { + fn decl_without_init(&mut self, _: hir::HirId, _: Span) {} + fn mutate(&mut self, _: hir::HirId, span: Span, _: &cmt_<'_>, mode: MutateMode) { match mode { MutateMode::JustWrite | MutateMode::WriteAndRead => { struct_span_err!(self.cx.tcx.sess, span, E0302, "cannot assign in a pattern guard") diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index 4d571f4f7829..67d40197290f 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -3,7 +3,6 @@ mod _match; mod check_match; -pub use self::check_match::check_crate; pub(crate) use self::check_match::check_match; use crate::const_eval::{const_field, const_variant_index}; @@ -16,7 +15,7 @@ use rustc::mir::{UserTypeProjection}; use rustc::mir::interpret::{Scalar, GlobalId, ConstValue, sign_extend}; use rustc::ty::{self, Region, TyCtxt, AdtDef, Ty, Lift, UserType}; use rustc::ty::{CanonicalUserType, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations}; -use rustc::ty::subst::{Substs, Kind}; +use rustc::ty::subst::{SubstsRef, Kind}; use rustc::ty::layout::VariantIdx; use rustc::hir::{self, PatKind, RangeEnd}; use rustc::hir::def::{Def, CtorKind}; @@ -126,7 +125,7 @@ pub enum PatternKind<'tcx> { mutability: Mutability, name: ast::Name, mode: BindingMode, - var: ast::NodeId, + var: hir::HirId, ty: Ty<'tcx>, subpattern: Option>, }, @@ -135,7 +134,7 @@ pub enum PatternKind<'tcx> { /// multiple variants. Variant { adt_def: &'tcx AdtDef, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, variant_index: VariantIdx, subpatterns: Vec>, }, @@ -330,13 +329,13 @@ pub struct PatternContext<'a, 'tcx: 'a> { pub tcx: TyCtxt<'a, 'tcx, 'tcx>, pub param_env: ty::ParamEnv<'tcx>, pub tables: &'a ty::TypeckTables<'tcx>, - pub substs: &'tcx Substs<'tcx>, + pub substs: SubstsRef<'tcx>, pub errors: Vec, } impl<'a, 'tcx> Pattern<'tcx> { pub fn from_hir(tcx: TyCtxt<'a, 'tcx, 'tcx>, - param_env_and_substs: ty::ParamEnvAnd<'tcx, &'tcx Substs<'tcx>>, + param_env_and_substs: ty::ParamEnvAnd<'tcx, SubstsRef<'tcx>>, tables: &'a ty::TypeckTables<'tcx>, pat: &'tcx hir::Pat) -> Self { let mut pcx = PatternContext::new(tcx, param_env_and_substs, tables); @@ -352,7 +351,7 @@ impl<'a, 'tcx> Pattern<'tcx> { impl<'a, 'tcx> PatternContext<'a, 'tcx> { pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>, - param_env_and_substs: ty::ParamEnvAnd<'tcx, &'tcx Substs<'tcx>>, + param_env_and_substs: ty::ParamEnvAnd<'tcx, SubstsRef<'tcx>>, tables: &'a ty::TypeckTables<'tcx>) -> Self { PatternContext { tcx, @@ -559,7 +558,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { } } - PatKind::Binding(_, id, _, ident, ref sub) => { + PatKind::Binding(_, id, ident, ref sub) => { let var_ty = self.tables.node_type(pat.hir_id); if let ty::Error = var_ty.sty { // Avoid ICE @@ -631,7 +630,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { fields.iter() .map(|field| { FieldPattern { - field: Field::new(self.tcx.field_index(field.node.id, + field: Field::new(self.tcx.field_index(field.node.hir_id, self.tables)), pattern: self.lower_pattern(&field.node.pat), } @@ -937,10 +936,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { debug!("const_to_pat: cv={:#?} id={:?}", cv, id); let adt_subpattern = |i, variant_opt| { let field = Field::new(i); - let val = const_field( - self.tcx, self.param_env, - variant_opt, field, cv, - ).expect("field access failed"); + let val = const_field(self.tcx, self.param_env, variant_opt, field, cv); self.const_to_pat(instance, val, id, span) }; let adt_subpatterns = |n, variant_opt| { @@ -955,8 +951,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { debug!("const_to_pat: cv.ty={:?} span={:?}", cv.ty, span); let kind = match cv.ty.sty { ty::Float(_) => { - let id = self.tcx.hir().hir_to_node_id(id); - self.tcx.lint_node( + self.tcx.lint_hir( ::rustc::lint::builtin::ILLEGAL_FLOATING_POINT_LITERAL_PATTERN, id, span, @@ -980,9 +975,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { PatternKind::Wild } ty::Adt(adt_def, substs) if adt_def.is_enum() => { - let variant_index = const_variant_index( - self.tcx, self.param_env, cv - ).expect("const_variant_index failed"); + let variant_index = const_variant_index(self.tcx, self.param_env, cv); let subpatterns = adt_subpatterns( adt_def.variants[variant_index].fields.len(), Some(variant_index), @@ -1091,9 +1084,9 @@ macro_rules! CloneImpls { } CloneImpls!{ <'tcx> - Span, Field, Mutability, ast::Name, ast::NodeId, usize, ty::Const<'tcx>, + Span, Field, Mutability, ast::Name, hir::HirId, usize, ty::Const<'tcx>, Region<'tcx>, Ty<'tcx>, BindingMode, &'tcx AdtDef, - &'tcx Substs<'tcx>, &'tcx Kind<'tcx>, UserType<'tcx>, + SubstsRef<'tcx>, &'tcx Kind<'tcx>, UserType<'tcx>, UserTypeProjection<'tcx>, PatternTypeProjection<'tcx> } diff --git a/src/librustc_mir/interpret/cast.rs b/src/librustc_mir/interpret/cast.rs index ce62d79e585a..73c73cc23dcf 100644 --- a/src/librustc_mir/interpret/cast.rs +++ b/src/librustc_mir/interpret/cast.rs @@ -33,7 +33,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> self.unsize_into(src, dest)?; } - Misc => { + Misc | MutToConstPointer => { let src = self.read_immediate(src)?; if self.type_is_fat_ptr(src.layout.ty) { diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index 0c1b5d65b8b6..8a32c3b636c7 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -9,7 +9,7 @@ use rustc::mir; use rustc::ty::layout::{ self, Size, Align, HasDataLayout, LayoutOf, TyLayout }; -use rustc::ty::subst::{Subst, Substs}; +use rustc::ty::subst::{Subst, SubstsRef}; use rustc::ty::{self, Ty, TyCtxt, TypeFoldable}; use rustc::ty::query::TyCtxtAt; use rustc_data_structures::indexed_vec::IndexVec; @@ -244,7 +244,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc pub(super) fn resolve( &self, def_id: DefId, - substs: &'tcx Substs<'tcx> + substs: SubstsRef<'tcx> ) -> EvalResult<'tcx, ty::Instance<'tcx>> { trace!("resolve: {:?}, {:#?}", def_id, substs); trace!("param_env: {:#?}", self.param_env); @@ -306,7 +306,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc fn monomorphize_with_substs + Subst<'tcx>>( &self, t: T, - substs: &'tcx Substs<'tcx> + substs: SubstsRef<'tcx> ) -> T { // miri doesn't care about lifetimes, and will choke on some crazy ones // let's simply get rid of them diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs index 474df457f61a..206eaaf1787c 100644 --- a/src/librustc_mir/interpret/operand.rs +++ b/src/librustc_mir/interpret/operand.rs @@ -515,9 +515,10 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> layout: Option>, ) -> EvalResult<'tcx, OpTy<'tcx, M::PointerTag>> { use rustc::mir::Place::*; + use rustc::mir::PlaceBase; let op = match *mir_place { - Local(mir::RETURN_PLACE) => return err!(ReadFromReturnPointer), - Local(local) => self.access_local(self.frame(), local, layout)?, + Base(PlaceBase::Local(mir::RETURN_PLACE)) => return err!(ReadFromReturnPointer), + Base(PlaceBase::Local(local)) => self.access_local(self.frame(), local, layout)?, Projection(ref proj) => { let op = self.eval_place_to_op(&proj.base, None)?; @@ -588,11 +589,12 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> val: ty::Const<'tcx>, layout: Option>, ) -> EvalResult<'tcx, OpTy<'tcx, M::PointerTag>> { + let val = self.monomorphize(val)?; let layout = from_known_layout(layout, || { - let ty = self.monomorphize(val.ty)?; - self.layout_of(ty) + self.layout_of(val.ty) })?; let op = match val.val { + ConstValue::Param(_) | ConstValue::Infer(_) => bug!(), ConstValue::ByRef(ptr, alloc) => { // We rely on mutability being set correctly in that allocation to prevent writes // where none should happen -- and for `static mut`, we copy on demand anyway. diff --git a/src/librustc_mir/interpret/place.rs b/src/librustc_mir/interpret/place.rs index 7b66d11131c1..4df274bc9df9 100644 --- a/src/librustc_mir/interpret/place.rs +++ b/src/librustc_mir/interpret/place.rs @@ -581,8 +581,9 @@ where mir_place: &mir::Place<'tcx> ) -> EvalResult<'tcx, MPlaceTy<'tcx, M::PointerTag>> { use rustc::mir::Place::*; + use rustc::mir::PlaceBase; Ok(match *mir_place { - Promoted(ref promoted) => { + Base(PlaceBase::Promoted(ref promoted)) => { let instance = self.frame().instance; self.const_eval_raw(GlobalId { instance, @@ -590,7 +591,7 @@ where })? } - Static(ref static_) => { + Base(PlaceBase::Static(ref static_)) => { assert!(!static_.ty.needs_subst()); let layout = self.layout_of(static_.ty)?; let instance = ty::Instance::mono(*self.tcx, static_.def_id); @@ -624,8 +625,9 @@ where mir_place: &mir::Place<'tcx> ) -> EvalResult<'tcx, PlaceTy<'tcx, M::PointerTag>> { use rustc::mir::Place::*; + use rustc::mir::PlaceBase; let place = match *mir_place { - Local(mir::RETURN_PLACE) => match self.frame().return_place { + Base(PlaceBase::Local(mir::RETURN_PLACE)) => match self.frame().return_place { Some(return_place) => // We use our layout to verify our assumption; caller will validate // their layout on return. @@ -635,7 +637,7 @@ where }, None => return err!(InvalidNullPointerUsage), }, - Local(local) => PlaceTy { + Base(PlaceBase::Local(local)) => PlaceTy { place: Place::Local { frame: self.cur_frame(), local, diff --git a/src/librustc_mir/interpret/terminator.rs b/src/librustc_mir/interpret/terminator.rs index c2ee3f5715bd..83469d749870 100644 --- a/src/librustc_mir/interpret/terminator.rs +++ b/src/librustc_mir/interpret/terminator.rs @@ -352,7 +352,9 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> // not advance `caller_iter` for ZSTs. let mut locals_iter = mir.args_iter(); while let Some(local) = locals_iter.next() { - let dest = self.eval_place(&mir::Place::Local(local))?; + let dest = self.eval_place( + &mir::Place::Base(mir::PlaceBase::Local(local)) + )?; if Some(local) == mir.spread_arg { // Must be a tuple for i in 0..dest.layout.fields.count() { @@ -371,7 +373,9 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> } // Don't forget to check the return type! if let Some(caller_ret) = dest { - let callee_ret = self.eval_place(&mir::Place::Local(mir::RETURN_PLACE))?; + let callee_ret = self.eval_place( + &mir::Place::RETURN_PLACE + )?; if !Self::check_argument_compat( rust_abi, caller_ret.layout, diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs index e0fee10cd008..0b735b4b39cf 100644 --- a/src/librustc_mir/lib.rs +++ b/src/librustc_mir/lib.rs @@ -23,7 +23,6 @@ Rust MIR: a lowered representation of Rust. Also: an experiment! #![feature(unicode_internals)] #![feature(step_trait)] #![feature(slice_concat_ext)] -#![feature(try_from)] #![feature(reverse_bits)] #![feature(try_blocks)] @@ -55,7 +54,6 @@ pub mod interpret; pub mod monomorphize; pub mod const_eval; -pub use hair::pattern::check_crate as matchck_crate; use rustc::ty::query::Providers; pub fn provide(providers: &mut Providers<'_>) { diff --git a/src/librustc_mir/lints.rs b/src/librustc_mir/lints.rs index 6b6e8fcdc82c..6d6a3f914726 100644 --- a/src/librustc_mir/lints.rs +++ b/src/librustc_mir/lints.rs @@ -5,14 +5,14 @@ use rustc::hir::map::blocks::FnLikeNode; use rustc::lint::builtin::UNCONDITIONAL_RECURSION; use rustc::mir::{self, Mir, TerminatorKind}; use rustc::ty::{AssociatedItem, AssociatedItemContainer, Instance, TyCtxt, TyKind}; -use rustc::ty::subst::Substs; +use rustc::ty::subst::InternalSubsts; pub fn check(tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &Mir<'tcx>, def_id: DefId) { - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); - if let Some(fn_like_node) = FnLikeNode::from_node(tcx.hir().get(node_id)) { + if let Some(fn_like_node) = FnLikeNode::from_node(tcx.hir().get_by_hir_id(hir_id)) { check_fn_for_unconditional_recursion(tcx, fn_like_node.kind(), mir, def_id); } } @@ -69,7 +69,7 @@ fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'a, 'tcx, 'tcx>, }) => tcx.generics_of(trait_def_id).count(), _ => 0 }; - let caller_substs = &Substs::identity_for_item(tcx, def_id)[..trait_substs_count]; + let caller_substs = &InternalSubsts::identity_for_item(tcx, def_id)[..trait_substs_count]; while let Some(bb) = reachable_without_self_call_queue.pop() { if visited.contains(bb) { @@ -129,12 +129,12 @@ fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'a, 'tcx, 'tcx>, // no break */ }`) shouldn't be linted unless it actually // recurs. if !reached_exit_without_self_call && !self_call_locations.is_empty() { - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - let sp = tcx.sess.source_map().def_span(tcx.hir().span(node_id)); - let mut db = tcx.struct_span_lint_node(UNCONDITIONAL_RECURSION, - node_id, - sp, - "function cannot return without recursing"); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); + let sp = tcx.sess.source_map().def_span(tcx.hir().span_by_hir_id(hir_id)); + let mut db = tcx.struct_span_lint_hir(UNCONDITIONAL_RECURSION, + hir_id, + sp, + "function cannot return without recursing"); db.span_label(sp, "cannot return without recursing"); // offer some help to the programmer. for location in &self_call_locations { diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index dd7158897b88..1e245faddf04 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -180,7 +180,7 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::mir::interpret::{AllocId, ConstValue}; use rustc::middle::lang_items::{ExchangeMallocFnLangItem, StartFnLangItem}; -use rustc::ty::subst::Substs; +use rustc::ty::subst::{InternalSubsts, SubstsRef}; use rustc::ty::{self, TypeFoldable, Ty, TyCtxt, GenericParamDefKind}; use rustc::ty::adjustment::CustomCoerceUnsized; use rustc::session::config::EntryFnType; @@ -466,7 +466,16 @@ fn check_type_length_limit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: Instance<'tcx>) { let type_length = instance.substs.types().flat_map(|ty| ty.walk()).count(); - debug!(" => type length={}", type_length); + let const_length = instance.substs.consts() + .flat_map(|ct| { + let ty = match ct { + ty::LazyConst::Evaluated(ct) => ct.ty, + ty::LazyConst::Unevaluated(def_id, _) => tcx.type_of(*def_id), + }; + ty.walk() + }) + .count(); + debug!(" => type length={}, const length={}", type_length, const_length); // Rust code can easily create exponentially-long types using only a // polynomial recursion depth. Even with the default recursion @@ -475,7 +484,9 @@ fn check_type_length_limit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // // Bail out in these cases to avoid that bad user experience. let type_length_limit = *tcx.sess.type_length_limit.get(); - if type_length > type_length_limit { + // We include the const length in the type length, as it's better + // to be overly conservative. + if type_length + const_length > type_length_limit { // The instance name is already known to be too long for rustc. Use // `{:.64}` to avoid blasting the user's terminal with thousands of // lines of type-name. @@ -490,7 +501,7 @@ fn check_type_length_limit<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, diag.note(&format!( "consider adding a `#![type_length_limit=\"{}\"]` attribute to your crate", - type_length_limit*2)); + type_length_limit * 2)); diag.emit(); tcx.sess.abort_if_errors(); } @@ -500,7 +511,7 @@ struct MirNeighborCollector<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &'a mir::Mir<'tcx>, output: &'a mut Vec>, - param_substs: &'tcx Substs<'tcx>, + param_substs: SubstsRef<'tcx>, } impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> { @@ -748,7 +759,7 @@ fn should_monomorphize_locally<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: fn is_available_upstream_generic<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, - substs: &'tcx Substs<'tcx>) + substs: SubstsRef<'tcx>) -> bool { debug_assert!(!def_id.is_local()); @@ -759,10 +770,10 @@ fn should_monomorphize_locally<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: return false } - // If this instance has no type parameters, it cannot be a shared + // If this instance has non-erasable parameters, it cannot be a shared // monomorphization. Non-generic instances are already handled above // by `is_reachable_non_generic()` - if substs.types().next().is_none() { + if substs.non_erasable_generics().next().is_none() { return false } @@ -952,11 +963,11 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> { hir::ItemKind::Union(_, ref generics) => { if generics.params.is_empty() { if self.mode == MonoItemCollectionMode::Eager { - let def_id = self.tcx.hir().local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); debug!("RootCollector: ADT drop-glue for {}", def_id_to_string(self.tcx, def_id)); - let ty = Instance::new(def_id, Substs::empty()).ty(self.tcx); + let ty = Instance::new(def_id, InternalSubsts::empty()).ty(self.tcx); visit_drop_use(self.tcx, ty, true, self.output); } } @@ -964,11 +975,11 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> { hir::ItemKind::GlobalAsm(..) => { debug!("RootCollector: ItemKind::GlobalAsm({})", def_id_to_string(self.tcx, - self.tcx.hir().local_def_id(item.id))); - self.output.push(MonoItem::GlobalAsm(item.id)); + self.tcx.hir().local_def_id_from_hir_id(item.hir_id))); + self.output.push(MonoItem::GlobalAsm(item.hir_id)); } hir::ItemKind::Static(..) => { - let def_id = self.tcx.hir().local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); debug!("RootCollector: ItemKind::Static({})", def_id_to_string(self.tcx, def_id)); self.output.push(MonoItem::Static(def_id)); @@ -978,7 +989,7 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> { // actually used somewhere. Just declaring them is insufficient. // but even just declaring them must collect the items they refer to - let def_id = self.tcx.hir().local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); let instance = Instance::mono(self.tcx, def_id); let cid = GlobalId { @@ -992,7 +1003,7 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> { } } hir::ItemKind::Fn(..) => { - let def_id = self.tcx.hir().local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); self.push_if_root(def_id); } } @@ -1006,7 +1017,7 @@ impl<'b, 'a, 'v> ItemLikeVisitor<'v> for RootCollector<'b, 'a, 'v> { fn visit_impl_item(&mut self, ii: &'v hir::ImplItem) { match ii.node { hir::ImplItemKind::Method(hir::MethodSig { .. }, _) => { - let def_id = self.tcx.hir().local_def_id(ii.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(ii.hir_id); self.push_if_root(def_id); } _ => { /* Nothing to do here */ } @@ -1097,7 +1108,7 @@ fn create_mono_items_for_default_impls<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } - let impl_def_id = tcx.hir().local_def_id(item.id); + let impl_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id); debug!("create_mono_items_for_default_impls(item={})", def_id_to_string(tcx, impl_def_id)); @@ -1112,14 +1123,16 @@ fn create_mono_items_for_default_impls<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, continue; } - if tcx.generics_of(method.def_id).own_counts().types != 0 { + let counts = tcx.generics_of(method.def_id).own_counts(); + if counts.types + counts.consts != 0 { continue; } - let substs = Substs::for_item(tcx, method.def_id, |param, _| { + let substs = InternalSubsts::for_item(tcx, method.def_id, |param, _| { match param.kind { GenericParamDefKind::Lifetime => tcx.types.re_erased.into(), - GenericParamDefKind::Type {..} => { + GenericParamDefKind::Type { .. } | + GenericParamDefKind::Const => { trait_ref.substs[param.index as usize] } } @@ -1218,7 +1231,7 @@ fn def_id_to_string<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, fn collect_lazy_const<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, constant: &ty::LazyConst<'tcx>, - param_substs: &'tcx Substs<'tcx>, + param_substs: SubstsRef<'tcx>, output: &mut Vec>, ) { let (def_id, substs) = match *constant { diff --git a/src/librustc_mir/monomorphize/item.rs b/src/librustc_mir/monomorphize/item.rs index 6e639c3a1179..211f9ad1735c 100644 --- a/src/librustc_mir/monomorphize/item.rs +++ b/src/librustc_mir/monomorphize/item.rs @@ -1,9 +1,10 @@ use crate::monomorphize::Instance; use rustc::hir; use rustc::hir::def_id::{DefId, LOCAL_CRATE}; +use rustc::mir::interpret::ConstValue; use rustc::session::config::OptLevel; -use rustc::ty::{self, Ty, TyCtxt, ClosureSubsts, GeneratorSubsts}; -use rustc::ty::subst::Substs; +use rustc::ty::{self, Ty, TyCtxt, Const, ClosureSubsts, GeneratorSubsts, LazyConst, ParamConst}; +use rustc::ty::subst::{SubstsRef, InternalSubsts}; use syntax::ast; use syntax::attr::InlineAttr; use std::fmt::{self, Write}; @@ -44,7 +45,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { fn is_generic_fn(&self) -> bool { match *self.as_mono_item() { MonoItem::Fn(ref instance) => { - instance.substs.types().next().is_some() + instance.substs.non_erasable_generics().next().is_some() } MonoItem::Static(..) | MonoItem::GlobalAsm(..) => false, @@ -57,8 +58,8 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { MonoItem::Static(def_id) => { tcx.symbol_name(Instance::mono(tcx, def_id)) } - MonoItem::GlobalAsm(node_id) => { - let def_id = tcx.hir().local_def_id(node_id); + MonoItem::GlobalAsm(hir_id) => { + let def_id = tcx.hir().local_def_id_from_hir_id(hir_id); ty::SymbolName { name: Symbol::intern(&format!("global_asm_{:?}", def_id)).as_interned_str() } @@ -151,7 +152,7 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { debug!("is_instantiable({:?})", self); let (def_id, substs) = match *self.as_mono_item() { MonoItem::Fn(ref instance) => (instance.def_id(), instance.substs), - MonoItem::Static(def_id) => (def_id, Substs::empty()), + MonoItem::Static(def_id) => (def_id, InternalSubsts::empty()), // global asm never has predicates MonoItem::GlobalAsm(..) => return true }; @@ -189,15 +190,15 @@ pub trait MonoItemExt<'a, 'tcx>: fmt::Debug { fn local_span(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option { match *self.as_mono_item() { MonoItem::Fn(Instance { def, .. }) => { - tcx.hir().as_local_node_id(def.def_id()) + tcx.hir().as_local_hir_id(def.def_id()) } MonoItem::Static(def_id) => { - tcx.hir().as_local_node_id(def_id) + tcx.hir().as_local_hir_id(def_id) } - MonoItem::GlobalAsm(node_id) => { - Some(node_id) + MonoItem::GlobalAsm(hir_id) => { + Some(hir_id) } - }.map(|node_id| tcx.hir().span(node_id)) + }.map(|hir_id| tcx.hir().span_by_hir_id(hir_id)) } } @@ -267,7 +268,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { ty::Float(ast::FloatTy::F64) => output.push_str("f64"), ty::Adt(adt_def, substs) => { self.push_def_path(adt_def.did, output); - self.push_type_params(substs, iter::empty(), output, debug); + self.push_generic_params(substs, iter::empty(), output, debug); }, ty::Tuple(component_types) => { output.push('('); @@ -312,7 +313,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { ty::Dynamic(ref trait_data, ..) => { if let Some(principal) = trait_data.principal() { self.push_def_path(principal.def_id(), output); - self.push_type_params( + self.push_generic_params( principal.skip_binder().substs, trait_data.projection_bounds(), output, @@ -353,7 +354,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { output.pop(); } - if sig.variadic { + if sig.c_variadic { if !sig.inputs().is_empty() { output.push_str(", ..."); } else { @@ -373,7 +374,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { self.push_def_path(def_id, output); let generics = self.tcx.generics_of(self.tcx.closure_base_def_id(def_id)); let substs = substs.truncate_to(self.tcx, generics); - self.push_type_params(substs, iter::empty(), output, debug); + self.push_generic_params(substs, iter::empty(), output, debug); } ty::Error | ty::Bound(..) | @@ -394,6 +395,24 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { } } + // FIXME(const_generics): handle debug printing. + pub fn push_const_name(&self, c: &LazyConst<'tcx>, output: &mut String, debug: bool) { + match c { + LazyConst::Unevaluated(..) => output.push_str("_: _"), + LazyConst::Evaluated(Const { ty, val }) => { + match val { + ConstValue::Infer(..) => output.push_str("_"), + ConstValue::Param(ParamConst { name, .. }) => { + write!(output, "{}", name).unwrap(); + } + _ => write!(output, "{:?}", c).unwrap(), + } + output.push_str(": "); + self.push_type_name(ty, output, debug); + } + } + } + pub fn push_def_path(&self, def_id: DefId, output: &mut String) { @@ -421,15 +440,15 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { output.pop(); } - fn push_type_params(&self, - substs: &Substs<'tcx>, - projections: I, - output: &mut String, - debug: bool) - where I: Iterator> - { + fn push_generic_params( + &self, + substs: SubstsRef<'tcx>, + projections: I, + output: &mut String, + debug: bool, + ) where I: Iterator> { let mut projections = projections.peekable(); - if substs.types().next().is_none() && projections.peek().is_none() { + if substs.non_erasable_generics().next().is_none() && projections.peek().is_none() { return; } @@ -449,6 +468,11 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { output.push_str(", "); } + for const_parameter in substs.consts() { + self.push_const_name(const_parameter, output, debug); + output.push_str(", "); + } + output.pop(); output.pop(); @@ -460,6 +484,6 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { output: &mut String, debug: bool) { self.push_def_path(instance.def_id(), output); - self.push_type_params(instance.substs, iter::empty(), output, debug); + self.push_generic_params(instance.substs, iter::empty(), output, debug); } } diff --git a/src/librustc_mir/monomorphize/partitioning.rs b/src/librustc_mir/monomorphize/partitioning.rs index f342017603ed..c0e2186d9f34 100644 --- a/src/librustc_mir/monomorphize/partitioning.rs +++ b/src/librustc_mir/monomorphize/partitioning.rs @@ -96,10 +96,9 @@ use std::collections::hash_map::Entry; use std::cmp; use std::sync::Arc; -use syntax::ast::NodeId; use syntax::symbol::InternedString; use rustc::dep_graph::{WorkProductId, WorkProduct, DepNode, DepConstructor}; -use rustc::hir::CodegenFnAttrFlags; +use rustc::hir::{CodegenFnAttrFlags, HirId}; use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE, CRATE_DEF_INDEX}; use rustc::hir::map::DefPathData; use rustc::mir::mono::{Linkage, Visibility, CodegenUnitNameBuilder}; @@ -162,19 +161,19 @@ pub trait CodegenUnitExt<'tcx> { // The codegen tests rely on items being process in the same order as // they appear in the file, so for local items, we sort by node_id first #[derive(PartialEq, Eq, PartialOrd, Ord)] - pub struct ItemSortKey(Option, ty::SymbolName); + pub struct ItemSortKey(Option, ty::SymbolName); fn item_sort_key<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: MonoItem<'tcx>) -> ItemSortKey { ItemSortKey(match item { MonoItem::Fn(ref instance) => { match instance.def { - // We only want to take NodeIds of user-defined + // We only want to take HirIds of user-defined // instances into account. The others don't matter for // the codegen tests and can even make item order // unstable. InstanceDef::Item(def_id) => { - tcx.hir().as_local_node_id(def_id) + tcx.hir().as_local_hir_id(def_id) } InstanceDef::VtableShim(..) | InstanceDef::Intrinsic(..) | @@ -188,10 +187,10 @@ pub trait CodegenUnitExt<'tcx> { } } MonoItem::Static(def_id) => { - tcx.hir().as_local_node_id(def_id) + tcx.hir().as_local_hir_id(def_id) } - MonoItem::GlobalAsm(node_id) => { - Some(node_id) + MonoItem::GlobalAsm(hir_id) => { + Some(hir_id) } }, item.symbol_name(tcx)) } @@ -404,8 +403,8 @@ fn mono_item_visibility( Visibility::Hidden }; } - MonoItem::GlobalAsm(node_id) => { - let def_id = tcx.hir().local_def_id(*node_id); + MonoItem::GlobalAsm(hir_id) => { + let def_id = tcx.hir().local_def_id_from_hir_id(*hir_id); return if tcx.is_reachable_non_generic(def_id) { *can_be_internalized = false; default_visibility(tcx, def_id, false) @@ -448,7 +447,7 @@ fn mono_item_visibility( return Visibility::Hidden } - let is_generic = instance.substs.types().next().is_some(); + let is_generic = instance.substs.non_erasable_generics().next().is_some(); // Upstream `DefId` instances get different handling than local ones if !def_id.is_local() { @@ -789,7 +788,7 @@ fn characteristic_def_id_of_mono_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, Some(def_id) } MonoItem::Static(def_id) => Some(def_id), - MonoItem::GlobalAsm(node_id) => Some(tcx.hir().local_def_id(node_id)), + MonoItem::GlobalAsm(hir_id) => Some(tcx.hir().local_def_id_from_hir_id(hir_id)), } } diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index d4145b8e47ea..1c6b1450be86 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -2,15 +2,14 @@ use rustc::hir; use rustc::hir::def_id::DefId; use rustc::infer; use rustc::mir::*; -use rustc::ty::{self, Ty, TyCtxt, GenericParamDefKind}; +use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::layout::VariantIdx; -use rustc::ty::subst::{Subst, Substs}; +use rustc::ty::subst::{Subst, InternalSubsts}; use rustc::ty::query::Providers; use rustc_data_structures::indexed_vec::{IndexVec, Idx}; use rustc_target::spec::abi::Abi; -use syntax::ast; use syntax_pos::Span; use std::fmt; @@ -183,7 +182,7 @@ fn build_drop_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let substs = if let Some(ty) = ty { tcx.intern_substs(&[ty.into()]) } else { - Substs::identity_for_item(tcx, def_id) + InternalSubsts::identity_for_item(tcx, def_id) }; let sig = tcx.fn_sig(def_id).subst(tcx, substs); let sig = tcx.erase_late_bound_regions(&sig); @@ -221,7 +220,7 @@ fn build_drop_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, if let Some(..) = ty { // The first argument (index 0), but add 1 for the return value. - let dropee_ptr = Place::Local(Local::new(1+0)); + let dropee_ptr = Place::Base(PlaceBase::Local(Local::new(1+0))); if tcx.sess.opts.debugging_opts.mir_emit_retag { // Function arguments should be retagged, and we make this one raw. mir.basic_blocks_mut()[START_BLOCK].statements.insert(0, Statement { @@ -317,8 +316,8 @@ fn build_clone_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let mut builder = CloneShimBuilder::new(tcx, def_id, self_ty); let is_copy = self_ty.is_copy_modulo_regions(tcx, tcx.param_env(def_id), builder.span); - let dest = Place::Local(RETURN_PLACE); - let src = Place::Local(Local::new(1+0)).deref(); + let dest = Place::RETURN_PLACE; + let src = Place::Base(PlaceBase::Local(Local::new(1+0))).deref(); match self_ty.sty { _ if is_copy => builder.copy_shim(), @@ -424,10 +423,10 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { } fn copy_shim(&mut self) { - let rcvr = Place::Local(Local::new(1+0)).deref(); + let rcvr = Place::Base(PlaceBase::Local(Local::new(1+0))).deref(); let ret_statement = self.make_statement( StatementKind::Assign( - Place::Local(RETURN_PLACE), + Place::RETURN_PLACE, box Rvalue::Use(Operand::Copy(rcvr)) ) ); @@ -436,9 +435,9 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { fn make_place(&mut self, mutability: Mutability, ty: Ty<'tcx>) -> Place<'tcx> { let span = self.span; - Place::Local( + Place::Base(PlaceBase::Local( self.local_decls.push(temp_decl(mutability, ty, span)) - ) + )) } fn make_clone_call( @@ -451,12 +450,7 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { ) { let tcx = self.tcx; - let substs = Substs::for_item(tcx, self.def_id, |param, _| { - match param.kind { - GenericParamDefKind::Lifetime => tcx.types.re_erased.into(), - GenericParamDefKind::Type {..} => ty.into(), - } - }); + let substs = tcx.mk_substs_trait(ty, &[]); // `func == Clone::clone(&ty) -> ty` let func_ty = tcx.mk_fn_def(self.def_id, substs); @@ -546,7 +540,7 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { let inits = vec![ self.make_statement( StatementKind::Assign( - Place::Local(beg), + Place::Base(PlaceBase::Local(beg)), box Rvalue::Use(Operand::Constant(self.make_usize(0))) ) ), @@ -564,7 +558,11 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { // BB #3; // } // BB #4; - self.loop_header(Place::Local(beg), end, BasicBlock::new(2), BasicBlock::new(4), false); + self.loop_header(Place::Base(PlaceBase::Local(beg)), + end, + BasicBlock::new(2), + BasicBlock::new(4), + false); // BB #2 // `dest[i] = Clone::clone(src[beg])`; @@ -580,10 +578,10 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { let statements = vec![ self.make_statement( StatementKind::Assign( - Place::Local(beg), + Place::Base(PlaceBase::Local(beg)), box Rvalue::BinaryOp( BinOp::Add, - Operand::Copy(Place::Local(beg)), + Operand::Copy(Place::Base(PlaceBase::Local(beg))), Operand::Constant(self.make_usize(1)) ) ) @@ -603,7 +601,7 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { let beg = self.local_decls.push(temp_decl(Mutability::Mut, tcx.types.usize, span)); let init = self.make_statement( StatementKind::Assign( - Place::Local(beg), + Place::Base(PlaceBase::Local(beg)), box Rvalue::Use(Operand::Constant(self.make_usize(0))) ) ); @@ -614,7 +612,7 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { // BB #8; // } // BB #9; - self.loop_header(Place::Local(beg), Place::Local(end), + self.loop_header(Place::Base(PlaceBase::Local(beg)), Place::Base(PlaceBase::Local(end)), BasicBlock::new(7), BasicBlock::new(9), true); // BB #7 (cleanup) @@ -630,10 +628,10 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { // `goto #6;` let statement = self.make_statement( StatementKind::Assign( - Place::Local(beg), + Place::Base(PlaceBase::Local(beg)), box Rvalue::BinaryOp( BinOp::Add, - Operand::Copy(Place::Local(beg)), + Operand::Copy(Place::Base(PlaceBase::Local(beg))), Operand::Constant(self.make_usize(1)) ) ) @@ -718,7 +716,7 @@ fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let source_info = SourceInfo { span, scope: OUTERMOST_SOURCE_SCOPE }; let rcvr_arg = Local::new(1+0); - let rcvr_l = Place::Local(rcvr_arg); + let rcvr_l = Place::Base(PlaceBase::Local(rcvr_arg)); let mut statements = vec![]; let rcvr = match rcvr_adjustment { @@ -748,11 +746,11 @@ fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, statements.push(Statement { source_info, kind: StatementKind::Assign( - Place::Local(ref_rcvr), + Place::Base(PlaceBase::Local(ref_rcvr)), box Rvalue::Ref(tcx.types.re_erased, borrow_kind, rcvr_l) ) }); - Operand::Move(Place::Local(ref_rcvr)) + Operand::Move(Place::Base(PlaceBase::Local(ref_rcvr))) } }; @@ -774,12 +772,12 @@ fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, if let Some(untuple_args) = untuple_args { args.extend(untuple_args.iter().enumerate().map(|(i, ity)| { - let arg_place = Place::Local(Local::new(1+1)); + let arg_place = Place::Base(PlaceBase::Local(Local::new(1+1))); Operand::Move(arg_place.field(Field::new(i), *ity)) })); } else { args.extend((1..sig.inputs().len()).map(|i| { - Operand::Move(Place::Local(Local::new(1+i))) + Operand::Move(Place::Base(PlaceBase::Local(Local::new(1+i)))) })); } @@ -797,7 +795,7 @@ fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, block(&mut blocks, statements, TerminatorKind::Call { func: callee, args, - destination: Some((Place::Local(RETURN_PLACE), + destination: Some((Place::RETURN_PLACE, BasicBlock::new(1))), cleanup: if let Adjustment::RefMut = rcvr_adjustment { Some(BasicBlock::new(3)) @@ -810,7 +808,7 @@ fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, if let Adjustment::RefMut = rcvr_adjustment { // BB #1 - drop for Self block(&mut blocks, vec![], TerminatorKind::Drop { - location: Place::Local(rcvr_arg), + location: Place::Base(PlaceBase::Local(rcvr_arg)), target: BasicBlock::new(2), unwind: None }, false); @@ -820,7 +818,7 @@ fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, if let Adjustment::RefMut = rcvr_adjustment { // BB #3 - drop if closure panics block(&mut blocks, vec![], TerminatorKind::Drop { - location: Place::Local(rcvr_arg), + location: Place::Base(PlaceBase::Local(rcvr_arg)), target: BasicBlock::new(4), unwind: None }, true); @@ -851,14 +849,14 @@ fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } pub fn build_adt_ctor<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a, 'gcx, 'tcx>, - ctor_id: ast::NodeId, + ctor_id: hir::HirId, fields: &[hir::StructField], span: Span) -> Mir<'tcx> { let tcx = infcx.tcx; let gcx = tcx.global_tcx(); - let def_id = tcx.hir().local_def_id(ctor_id); + let def_id = tcx.hir().local_def_id_from_hir_id(ctor_id); let param_env = gcx.param_env(def_id); // Normalize the sig. @@ -892,11 +890,11 @@ pub fn build_adt_ctor<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a, 'gcx, 'tcx>, statements: vec![Statement { source_info, kind: StatementKind::Assign( - Place::Local(RETURN_PLACE), + Place::RETURN_PLACE, box Rvalue::Aggregate( box AggregateKind::Adt(adt_def, variant_no, substs, None, None), (1..sig.inputs().len()+1).map(|i| { - Operand::Move(Place::Local(Local::new(i))) + Operand::Move(Place::Base(PlaceBase::Local(Local::new(i)))) }).collect() ) ) diff --git a/src/librustc_mir/transform/add_moves_for_packed_drops.rs b/src/librustc_mir/transform/add_moves_for_packed_drops.rs index 4d4c89b8b6a4..e8528eee0bca 100644 --- a/src/librustc_mir/transform/add_moves_for_packed_drops.rs +++ b/src/librustc_mir/transform/add_moves_for_packed_drops.rs @@ -121,10 +121,10 @@ fn add_move_for_packed_drop<'a, 'tcx>( patch.add_statement( loc, StatementKind::StorageLive(temp)); - patch.add_assign(loc, Place::Local(temp), + patch.add_assign(loc, Place::Base(PlaceBase::Local(temp)), Rvalue::Use(Operand::Move(location.clone()))); patch.patch_terminator(loc.block, TerminatorKind::Drop { - location: Place::Local(temp), + location: Place::Base(PlaceBase::Local(temp)), target: storage_dead_block, unwind }); diff --git a/src/librustc_mir/transform/add_retag.rs b/src/librustc_mir/transform/add_retag.rs index e66c11aa36e0..20b75c558679 100644 --- a/src/librustc_mir/transform/add_retag.rs +++ b/src/librustc_mir/transform/add_retag.rs @@ -21,9 +21,9 @@ fn is_stable<'tcx>( match *place { // Locals and statics have stable addresses, for sure - Local { .. } | - Promoted { .. } | - Static { .. } => + Base(PlaceBase::Local { .. }) | + Base(PlaceBase::Promoted { .. }) | + Base(PlaceBase::Static { .. }) => true, // Recurse for projections Projection(ref proj) => { @@ -101,7 +101,7 @@ impl MirPass for AddRetag { }; // Gather all arguments, skip return value. let places = local_decls.iter_enumerated().skip(1).take(arg_count) - .map(|(local, _)| Place::Local(local)) + .map(|(local, _)| Place::Base(PlaceBase::Local(local))) .filter(needs_retag) .collect::>(); // Emit their retags. diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index 66529e579835..b494592c89f4 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -12,7 +12,6 @@ use rustc::lint::builtin::{SAFE_EXTERN_STATICS, SAFE_PACKED_BORROWS, UNUSED_UNSA use rustc::mir::*; use rustc::mir::visit::{PlaceContext, Visitor, MutatingUseContext}; -use syntax::ast; use syntax::symbol::Symbol; use std::ops::Bound; @@ -29,8 +28,8 @@ pub struct UnsafetyChecker<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, /// Mark an `unsafe` block as used, so we don't lint it. - used_unsafe: FxHashSet, - inherited_blocks: Vec<(ast::NodeId, bool)>, + used_unsafe: FxHashSet, + inherited_blocks: Vec<(hir::HirId, bool)>, } impl<'a, 'gcx, 'tcx> UnsafetyChecker<'a, 'tcx> { @@ -242,7 +241,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> { ); } let old_source_info = self.source_info; - if let &Place::Local(local) = base { + if let &Place::Base(PlaceBase::Local(local)) = base { if self.mir.local_decls[local].internal { // Internal locals are used in the `move_val_init` desugaring. // We want to check unsafety against the source info of the @@ -298,13 +297,13 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> { } self.source_info = old_source_info; } - &Place::Local(..) => { + &Place::Base(PlaceBase::Local(..)) => { // locals are safe } - &Place::Promoted(_) => { + &Place::Base(PlaceBase::Promoted(_)) => { bug!("unsafety checking should happen before promotion") } - &Place::Static(box Static { def_id, ty: _ }) => { + &Place::Base(PlaceBase::Static(box Static { def_id, ty: _ })) => { if self.tcx.is_static(def_id) == Some(hir::Mutability::MutMutable) { self.require_unsafe("use of mutable static", "mutable statics can be mutated by multiple threads: aliasing violations \ @@ -349,7 +348,7 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> { fn register_violations(&mut self, violations: &[UnsafetyViolation], - unsafe_blocks: &[(ast::NodeId, bool)]) { + unsafe_blocks: &[(hir::HirId, bool)]) { let safety = self.source_scope_local_data[self.source_info.scope].safety; let within_unsafe = match safety { // `unsafe` blocks are required in safe code @@ -375,10 +374,10 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> { } // `unsafe` function bodies allow unsafe without additional unsafe blocks Safety::BuiltinUnsafe | Safety::FnUnsafe => true, - Safety::ExplicitUnsafe(node_id) => { + Safety::ExplicitUnsafe(hir_id) => { // mark unsafe block as used if there are any unsafe operations inside if !violations.is_empty() { - self.used_unsafe.insert(node_id); + self.used_unsafe.insert(hir_id); } // only some unsafety is allowed in const fn if self.min_const_fn { @@ -405,8 +404,8 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> { true } }; - self.inherited_blocks.extend(unsafe_blocks.iter().map(|&(node_id, is_used)| { - (node_id, is_used && !within_unsafe) + self.inherited_blocks.extend(unsafe_blocks.iter().map(|&(hir_id, is_used)| { + (hir_id, is_used && !within_unsafe) })); } fn check_mut_borrowing_layout_constrained_field( @@ -467,8 +466,8 @@ pub(crate) fn provide(providers: &mut Providers<'_>) { } struct UnusedUnsafeVisitor<'a> { - used_unsafe: &'a FxHashSet, - unsafe_blocks: &'a mut Vec<(ast::NodeId, bool)>, + used_unsafe: &'a FxHashSet, + unsafe_blocks: &'a mut Vec<(hir::HirId, bool)>, } impl<'a, 'tcx> hir::intravisit::Visitor<'tcx> for UnusedUnsafeVisitor<'a> { @@ -482,19 +481,19 @@ impl<'a, 'tcx> hir::intravisit::Visitor<'tcx> for UnusedUnsafeVisitor<'a> { hir::intravisit::walk_block(self, block); if let hir::UnsafeBlock(hir::UserProvided) = block.rules { - self.unsafe_blocks.push((block.id, self.used_unsafe.contains(&block.id))); + self.unsafe_blocks.push((block.hir_id, self.used_unsafe.contains(&block.hir_id))); } } } fn check_unused_unsafe<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, - used_unsafe: &FxHashSet, - unsafe_blocks: &'a mut Vec<(ast::NodeId, bool)>) + used_unsafe: &FxHashSet, + unsafe_blocks: &'a mut Vec<(hir::HirId, bool)>) { let body_id = - tcx.hir().as_local_node_id(def_id).and_then(|node_id| { - tcx.hir().maybe_body_owned_by(node_id) + tcx.hir().as_local_hir_id(def_id).and_then(|hir_id| { + tcx.hir().maybe_body_owned_by_by_hir_id(hir_id) }); let body_id = match body_id { @@ -534,8 +533,8 @@ fn unsafety_check_result<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) let param_env = tcx.param_env(def_id); - let id = tcx.hir().as_local_node_id(def_id).unwrap(); - let (const_context, min_const_fn) = match tcx.hir().body_owner_kind(id) { + let id = tcx.hir().as_local_hir_id(def_id).unwrap(); + let (const_context, min_const_fn) = match tcx.hir().body_owner_kind_by_hir_id(id) { hir::BodyOwnerKind::Closure => (false, false), hir::BodyOwnerKind::Fn => (tcx.is_const_fn(def_id), tcx.is_min_const_fn(def_id)), hir::BodyOwnerKind::Const | @@ -554,38 +553,37 @@ fn unsafety_check_result<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) } fn unsafe_derive_on_repr_packed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { - let lint_node_id = match tcx.hir().as_local_node_id(def_id) { - Some(node_id) => node_id, - None => bug!("checking unsafety for non-local def id {:?}", def_id) - }; + let lint_hir_id = tcx.hir().as_local_hir_id(def_id).unwrap_or_else(|| + bug!("checking unsafety for non-local def id {:?}", def_id)); // FIXME: when we make this a hard error, this should have its // own error code. - let message = if tcx.generics_of(def_id).own_counts().types != 0 { + let counts = tcx.generics_of(def_id).own_counts(); + let message = if counts.types + counts.consts != 0 { "#[derive] can't be used on a #[repr(packed)] struct with \ - type parameters (error E0133)".to_string() + type or const parameters (error E0133)".to_string() } else { "#[derive] can't be used on a #[repr(packed)] struct that \ does not derive Copy (error E0133)".to_string() }; - tcx.lint_node(SAFE_PACKED_BORROWS, - lint_node_id, - tcx.def_span(def_id), - &message); + tcx.lint_hir(SAFE_PACKED_BORROWS, + lint_hir_id, + tcx.def_span(def_id), + &message); } -/// Returns the `NodeId` for an enclosing scope that is also `unsafe`. +/// Returns the `HirId` for an enclosing scope that is also `unsafe`. fn is_enclosed(tcx: TyCtxt<'_, '_, '_>, - used_unsafe: &FxHashSet, - id: ast::NodeId) -> Option<(String, ast::NodeId)> { - let parent_id = tcx.hir().get_parent_node(id); + used_unsafe: &FxHashSet, + id: hir::HirId) -> Option<(String, hir::HirId)> { + let parent_id = tcx.hir().get_parent_node_by_hir_id(id); if parent_id != id { if used_unsafe.contains(&parent_id) { Some(("block".to_string(), parent_id)) } else if let Some(Node::Item(&hir::Item { node: hir::ItemKind::Fn(_, header, _, _), .. - })) = tcx.hir().find(parent_id) { + })) = tcx.hir().find_by_hir_id(parent_id) { match header.unsafety { hir::Unsafety::Unsafe => Some(("fn".to_string(), parent_id)), hir::Unsafety::Normal => None, @@ -599,14 +597,14 @@ fn is_enclosed(tcx: TyCtxt<'_, '_, '_>, } fn report_unused_unsafe(tcx: TyCtxt<'_, '_, '_>, - used_unsafe: &FxHashSet, - id: ast::NodeId) { - let span = tcx.sess.source_map().def_span(tcx.hir().span(id)); + used_unsafe: &FxHashSet, + id: hir::HirId) { + let span = tcx.sess.source_map().def_span(tcx.hir().span_by_hir_id(id)); let msg = "unnecessary `unsafe` block"; - let mut db = tcx.struct_span_lint_node(UNUSED_UNSAFE, id, span, msg); + let mut db = tcx.struct_span_lint_hir(UNUSED_UNSAFE, id, span, msg); db.span_label(span, msg); if let Some((kind, id)) = is_enclosed(tcx, used_unsafe, id) { - db.span_label(tcx.sess.source_map().def_span(tcx.hir().span(id)), + db.span_label(tcx.sess.source_map().def_span(tcx.hir().span_by_hir_id(id)), format!("because it's nested under this `unsafe` {}", kind)); } db.emit(); @@ -655,20 +653,20 @@ pub fn check_unsafety<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { .note(&details.as_str()[..]) .emit(); } - UnsafetyViolationKind::ExternStatic(lint_node_id) => { + UnsafetyViolationKind::ExternStatic(lint_hir_id) => { tcx.lint_node_note(SAFE_EXTERN_STATICS, - lint_node_id, + lint_hir_id, source_info.span, &format!("{} is unsafe and requires unsafe function or block \ (error E0133)", &description.as_str()[..]), &details.as_str()[..]); } - UnsafetyViolationKind::BorrowPacked(lint_node_id) => { + UnsafetyViolationKind::BorrowPacked(lint_hir_id) => { if let Some(impl_def_id) = builtin_derive_def_id(tcx, def_id) { tcx.unsafe_derive_on_repr_packed(impl_def_id); } else { tcx.lint_node_note(SAFE_PACKED_BORROWS, - lint_node_id, + lint_hir_id, source_info.span, &format!("{} is unsafe and requires unsafe function or block \ (error E0133)", &description.as_str()[..]), @@ -679,7 +677,7 @@ pub fn check_unsafety<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { } let mut unsafe_blocks: Vec<_> = unsafe_blocks.into_iter().collect(); - unsafe_blocks.sort(); + unsafe_blocks.sort_by_cached_key(|(hir_id, _)| tcx.hir().hir_to_node_id(*hir_id)); let used_unsafe: FxHashSet<_> = unsafe_blocks.iter() .flat_map(|&&(id, used)| if used { Some(id) } else { None }) .collect(); diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 1acc7b6e0c57..23d8138efcca 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -3,14 +3,14 @@ use rustc::hir::def::Def; -use rustc::mir::{Constant, Location, Place, Mir, Operand, Rvalue, Local}; +use rustc::mir::{Constant, Location, Place, PlaceBase, Mir, Operand, Rvalue, Local}; use rustc::mir::{NullOp, UnOp, StatementKind, Statement, BasicBlock, LocalKind}; use rustc::mir::{TerminatorKind, ClearCrossCrate, SourceInfo, BinOp, ProjectionElem}; use rustc::mir::visit::{Visitor, PlaceContext, MutatingUseContext, NonMutatingUseContext}; use rustc::mir::interpret::{EvalErrorKind, Scalar, GlobalId, EvalResult}; use rustc::ty::{TyCtxt, self, Instance}; use syntax::source_map::{Span, DUMMY_SP}; -use rustc::ty::subst::Substs; +use rustc::ty::subst::InternalSubsts; use rustc_data_structures::indexed_vec::IndexVec; use rustc::ty::ParamEnv; use rustc::ty::layout::{ @@ -37,10 +37,10 @@ impl MirPass for ConstProp { } use rustc::hir::map::blocks::FnLikeNode; - let node_id = tcx.hir().as_local_node_id(source.def_id()) - .expect("Non-local call to local provider is_const_fn"); + let hir_id = tcx.hir().as_local_hir_id(source.def_id()) + .expect("Non-local call to local provider is_const_fn"); - let is_fn_like = FnLikeNode::from_node(tcx.hir().get(node_id)).is_some(); + let is_fn_like = FnLikeNode::from_node(tcx.hir().get_by_hir_id(hir_id)).is_some(); let is_assoc_const = match tcx.describe_def(source.def_id()) { Some(Def::AssociatedConst(_)) => true, _ => false, @@ -267,7 +267,7 @@ impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> { fn eval_place(&mut self, place: &Place<'tcx>, source_info: SourceInfo) -> Option> { match *place { - Place::Local(loc) => self.places[loc].clone(), + Place::Base(PlaceBase::Local(loc)) => self.places[loc].clone(), Place::Projection(ref proj) => match proj.elem { ProjectionElem::Field(field, _) => { trace!("field proj on {:?}", proj.base); @@ -282,13 +282,13 @@ impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> { // an `Index` projection would throw us off-track. _ => None, }, - Place::Promoted(ref promoted) => { + Place::Base(PlaceBase::Promoted(ref promoted)) => { let generics = self.tcx.generics_of(self.source.def_id()); if generics.requires_monomorphization(self.tcx) { // FIXME: can't handle code with generics return None; } - let substs = Substs::identity_for_item(self.tcx, self.source.def_id()); + let substs = InternalSubsts::identity_for_item(self.tcx, self.source.def_id()); let instance = Instance::new(self.source.def_id(), substs); let cid = GlobalId { instance, @@ -430,10 +430,10 @@ impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> { } else { "left" }; - let node_id = source_scope_local_data[source_info.scope].lint_root; - self.tcx.lint_node( + let hir_id = source_scope_local_data[source_info.scope].lint_root; + self.tcx.lint_hir( ::rustc::lint::builtin::EXCEEDING_BITSHIFTS, - node_id, + hir_id, span, &format!("attempt to shift {} with overflow", dir)); return None; @@ -556,7 +556,7 @@ impl<'b, 'a, 'tcx> Visitor<'tcx> for ConstPropagator<'b, 'a, 'tcx> { .to_ty(self.tcx); if let Ok(place_layout) = self.tcx.layout_of(self.param_env.and(place_ty)) { if let Some(value) = self.const_prop(rval, place_layout, statement.source_info) { - if let Place::Local(local) = *place { + if let Place::Base(PlaceBase::Local(local)) = *place { trace!("checking whether {:?} can be stored to {:?}", value, local); if self.can_const_prop[local] { trace!("storing {:?} to {:?}", value, local); @@ -591,7 +591,7 @@ impl<'b, 'a, 'tcx> Visitor<'tcx> for ConstPropagator<'b, 'a, 'tcx> { while let Place::Projection(ref proj) = *place { place = &proj.base; } - if let Place::Local(local) = *place { + if let Place::Base(PlaceBase::Local(local)) = *place { self.places[local] = None; } }, @@ -603,10 +603,10 @@ impl<'b, 'a, 'tcx> Visitor<'tcx> for ConstPropagator<'b, 'a, 'tcx> { .unwrap() .source_info .span; - let node_id = self + let hir_id = self .tcx .hir() - .as_local_node_id(self.source.def_id()) + .as_local_hir_id(self.source.def_id()) .expect("some part of a failing const eval must be local"); use rustc::mir::interpret::EvalErrorKind::*; let msg = match msg { @@ -643,9 +643,9 @@ impl<'b, 'a, 'tcx> Visitor<'tcx> for ConstPropagator<'b, 'a, 'tcx> { // Need proper const propagator for these _ => return, }; - self.tcx.lint_node( + self.tcx.lint_hir( ::rustc::lint::builtin::CONST_ERR, - node_id, + hir_id, span, &msg, ); diff --git a/src/librustc_mir/transform/copy_prop.rs b/src/librustc_mir/transform/copy_prop.rs index 7d907ca3a215..817a2f31c073 100644 --- a/src/librustc_mir/transform/copy_prop.rs +++ b/src/librustc_mir/transform/copy_prop.rs @@ -19,7 +19,9 @@ //! (non-mutating) use of `SRC`. These restrictions are conservative and may be relaxed in the //! future. -use rustc::mir::{Constant, Local, LocalKind, Location, Place, Mir, Operand, Rvalue, StatementKind}; +use rustc::mir::{ + Constant, Local, LocalKind, Location, Place, PlaceBase, Mir, Operand, Rvalue, StatementKind +}; use rustc::mir::visit::MutVisitor; use rustc::ty::TyCtxt; use crate::transform::{MirPass, MirSource}; @@ -94,8 +96,10 @@ impl MirPass for CopyPropagation { // That use of the source must be an assignment. match statement.kind { - StatementKind::Assign(Place::Local(local), box Rvalue::Use(ref operand)) if - local == dest_local => { + StatementKind::Assign( + Place::Base(PlaceBase::Local(local)), + box Rvalue::Use(ref operand) + ) if local == dest_local => { let maybe_action = match *operand { Operand::Copy(ref src_place) | Operand::Move(ref src_place) => { @@ -144,12 +148,12 @@ fn eliminate_self_assignments<'tcx>( if let Some(stmt) = mir[location.block].statements.get(location.statement_index) { match stmt.kind { StatementKind::Assign( - Place::Local(local), - box Rvalue::Use(Operand::Copy(Place::Local(src_local))), + Place::Base(PlaceBase::Local(local)), + box Rvalue::Use(Operand::Copy(Place::Base(PlaceBase::Local(src_local)))), ) | StatementKind::Assign( - Place::Local(local), - box Rvalue::Use(Operand::Move(Place::Local(src_local))), + Place::Base(PlaceBase::Local(local)), + box Rvalue::Use(Operand::Move(Place::Base(PlaceBase::Local(src_local)))), ) if local == dest_local && dest_local == src_local => {} _ => { continue; @@ -176,7 +180,7 @@ impl<'tcx> Action<'tcx> { fn local_copy(mir: &Mir<'tcx>, def_use_analysis: &DefUseAnalysis<'_>, src_place: &Place<'tcx>) -> Option> { // The source must be a local. - let src_local = if let Place::Local(local) = *src_place { + let src_local = if let Place::Base(PlaceBase::Local(local)) = *src_place { local } else { debug!(" Can't copy-propagate local: source is not a local"); @@ -330,8 +334,8 @@ impl<'tcx> MutVisitor<'tcx> for ConstantPropagationVisitor<'tcx> { self.super_operand(operand, location); match *operand { - Operand::Copy(Place::Local(local)) | - Operand::Move(Place::Local(local)) if local == self.dest_local => {} + Operand::Copy(Place::Base(PlaceBase::Local(local))) | + Operand::Move(Place::Base(PlaceBase::Local(local))) if local == self.dest_local => {} _ => return, } diff --git a/src/librustc_mir/transform/elaborate_drops.rs b/src/librustc_mir/transform/elaborate_drops.rs index 0f8db5f7334b..32c027d90a0c 100644 --- a/src/librustc_mir/transform/elaborate_drops.rs +++ b/src/librustc_mir/transform/elaborate_drops.rs @@ -11,11 +11,11 @@ use crate::util::elaborate_drops::{DropFlagState, Unwind, elaborate_drop}; use crate::util::elaborate_drops::{DropElaborator, DropStyle, DropFlagMode}; use rustc::ty::{self, TyCtxt}; use rustc::ty::layout::VariantIdx; +use rustc::hir; use rustc::mir::*; use rustc::util::nodemap::FxHashMap; use rustc_data_structures::bit_set::BitSet; use std::fmt; -use syntax::ast; use syntax_pos::Span; pub struct ElaborateDrops; @@ -28,7 +28,7 @@ impl MirPass for ElaborateDrops { { debug!("elaborate_drops({:?} @ {:?})", src, mir.span); - let id = tcx.hir().as_local_node_id(src.def_id()).unwrap(); + let id = tcx.hir().as_local_hir_id(src.def_id()).unwrap(); let param_env = tcx.param_env(src.def_id()).with_reveal_all(); let move_data = match MoveData::gather_moves(mir, tcx) { Ok(move_data) => move_data, @@ -80,7 +80,7 @@ impl MirPass for ElaborateDrops { fn find_dead_unwinds<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &Mir<'tcx>, - id: ast::NodeId, + id: hir::HirId, env: &MoveDataParamEnv<'tcx, 'tcx>) -> BitSet { @@ -330,7 +330,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> { } fn drop_flag(&mut self, index: MovePathIndex) -> Option> { - self.drop_flags.get(&index).map(|t| Place::Local(*t)) + self.drop_flags.get(&index).map(|t| Place::Base(PlaceBase::Local(*t))) } /// create a patch that elaborates all drops in the input @@ -543,7 +543,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> { if let Some(&flag) = self.drop_flags.get(&path) { let span = self.patch.source_info_for_location(self.mir, loc).span; let val = self.constant_bool(span, val.value()); - self.patch.add_assign(loc, Place::Local(flag), val); + self.patch.add_assign(loc, Place::Base(PlaceBase::Local(flag)), val); } } @@ -552,7 +552,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> { let span = self.patch.source_info_for_location(self.mir, loc).span; let false_ = self.constant_bool(span, false); for flag in self.drop_flags.values() { - self.patch.add_assign(loc, Place::Local(*flag), false_.clone()); + self.patch.add_assign(loc, Place::Base(PlaceBase::Local(*flag)), false_.clone()); } } diff --git a/src/librustc_mir/transform/erase_regions.rs b/src/librustc_mir/transform/erase_regions.rs index 84f209f8776d..9494d4b1f6c3 100644 --- a/src/librustc_mir/transform/erase_regions.rs +++ b/src/librustc_mir/transform/erase_regions.rs @@ -4,7 +4,7 @@ //! N.B., we do _not_ erase regions of statements that are relevant for //! "types-as-contracts"-validation, namely, `AcquireValid` and `ReleaseValid`. -use rustc::ty::subst::Substs; +use rustc::ty::subst::SubstsRef; use rustc::ty::{self, Ty, TyCtxt}; use rustc::mir::*; use rustc::mir::visit::{MutVisitor, TyContext}; @@ -36,7 +36,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for EraseRegionsVisitor<'a, 'tcx> { *constant = self.tcx.erase_regions(constant); } - fn visit_substs(&mut self, substs: &mut &'tcx Substs<'tcx>, _: Location) { + fn visit_substs(&mut self, substs: &mut SubstsRef<'tcx>, _: Location) { *substs = self.tcx.erase_regions(substs); } diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index 0866b87cf17e..1f59802f8c6c 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -55,7 +55,7 @@ use rustc::mir::*; use rustc::mir::visit::{PlaceContext, Visitor, MutVisitor}; use rustc::ty::{self, TyCtxt, AdtDef, Ty}; use rustc::ty::layout::VariantIdx; -use rustc::ty::subst::Substs; +use rustc::ty::subst::SubstsRef; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::indexed_vec::Idx; use rustc_data_structures::bit_set::BitSet; @@ -68,7 +68,7 @@ use crate::transform::no_landing_pads::no_landing_pads; use crate::dataflow::{do_dataflow, DebugFormatted, state_for_location}; use crate::dataflow::{MaybeStorageLive, HaveBeenBorrowedLocals}; use crate::util::dump_mir; -use crate::util::liveness::{self, IdentityMap}; +use crate::util::liveness; pub struct StateTransform; @@ -102,7 +102,7 @@ impl<'tcx> MutVisitor<'tcx> for DerefArgVisitor { place: &mut Place<'tcx>, context: PlaceContext<'tcx>, location: Location) { - if *place == Place::Local(self_arg()) { + if *place == Place::Base(PlaceBase::Local(self_arg())) { *place = Place::Projection(Box::new(Projection { base: place.clone(), elem: ProjectionElem::Deref, @@ -129,7 +129,7 @@ impl<'tcx> MutVisitor<'tcx> for PinArgVisitor<'tcx> { place: &mut Place<'tcx>, context: PlaceContext<'tcx>, location: Location) { - if *place == Place::Local(self_arg()) { + if *place == Place::Base(PlaceBase::Local(self_arg())) { *place = Place::Projection(Box::new(Projection { base: place.clone(), elem: ProjectionElem::Field(Field::new(0), self.ref_gen_ty), @@ -148,13 +148,13 @@ struct SuspensionPoint { state: u32, resume: BasicBlock, drop: Option, - storage_liveness: liveness::LiveVarSet, + storage_liveness: liveness::LiveVarSet, } struct TransformVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, state_adt_ref: &'tcx AdtDef, - state_substs: &'tcx Substs<'tcx>, + state_substs: SubstsRef<'tcx>, // The index of the generator state in the generator struct state_field: usize, @@ -165,7 +165,7 @@ struct TransformVisitor<'a, 'tcx: 'a> { // A map from a suspension point in a block to the locals which have live storage at that point // FIXME(eddyb) This should use `IndexVec>`. - storage_liveness: FxHashMap>, + storage_liveness: FxHashMap, // A list of suspension points, generated during the transform suspension_points: Vec, @@ -183,7 +183,7 @@ impl<'a, 'tcx> TransformVisitor<'a, 'tcx> { // Create a Place referencing a generator struct field fn make_field(&self, idx: usize, ty: Ty<'tcx>) -> Place<'tcx> { - let base = Place::Local(self_arg()); + let base = Place::Base(PlaceBase::Local(self_arg())); let field = Projection { base: base, elem: ProjectionElem::Field(Field::new(idx), ty), @@ -223,7 +223,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for TransformVisitor<'a, 'tcx> { place: &mut Place<'tcx>, context: PlaceContext<'tcx>, location: Location) { - if let Place::Local(l) = *place { + if let Place::Base(PlaceBase::Local(l)) = *place { // Replace an Local in the remap with a generator struct access if let Some(&(ty, idx)) = self.remap.get(&l) { *place = self.make_field(idx, ty); @@ -249,7 +249,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for TransformVisitor<'a, 'tcx> { let ret_val = match data.terminator().kind { TerminatorKind::Return => Some((VariantIdx::new(1), None, - Operand::Move(Place::Local(self.new_ret_local)), + Operand::Move(Place::Base(PlaceBase::Local(self.new_ret_local))), None)), TerminatorKind::Yield { ref value, resume, drop } => Some((VariantIdx::new(0), Some(resume), @@ -263,7 +263,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for TransformVisitor<'a, 'tcx> { // We must assign the value first in case it gets declared dead below data.statements.push(Statement { source_info, - kind: StatementKind::Assign(Place::Local(RETURN_PLACE), + kind: StatementKind::Assign(Place::RETURN_PLACE, box self.make_state(state_idx, v)), }); let state = if let Some(resume) = resume { // Yield @@ -358,7 +358,7 @@ fn replace_result_variable<'tcx>( new_ret_local } -struct StorageIgnored(liveness::LiveVarSet); +struct StorageIgnored(liveness::LiveVarSet); impl<'tcx> Visitor<'tcx> for StorageIgnored { fn visit_statement(&mut self, @@ -379,17 +379,17 @@ fn locals_live_across_suspend_points( source: MirSource<'tcx>, movable: bool, ) -> ( - liveness::LiveVarSet, - FxHashMap>, + liveness::LiveVarSet, + FxHashMap, ) { let dead_unwinds = BitSet::new_empty(mir.basic_blocks().len()); - let node_id = tcx.hir().as_local_node_id(source.def_id()).unwrap(); + let hir_id = tcx.hir().as_local_hir_id(source.def_id()).unwrap(); // Calculate when MIR locals have live storage. This gives us an upper bound of their // lifetimes. let storage_live_analysis = MaybeStorageLive::new(mir); let storage_live = - do_dataflow(tcx, mir, node_id, &[], &dead_unwinds, storage_live_analysis, + do_dataflow(tcx, mir, hir_id, &[], &dead_unwinds, storage_live_analysis, |bd, p| DebugFormatted::new(&bd.mir().local_decls[p])); // Find the MIR locals which do not use StorageLive/StorageDead statements. @@ -403,7 +403,7 @@ fn locals_live_across_suspend_points( let borrowed_locals = if !movable { let analysis = HaveBeenBorrowedLocals::new(mir); let result = - do_dataflow(tcx, mir, node_id, &[], &dead_unwinds, analysis, + do_dataflow(tcx, mir, hir_id, &[], &dead_unwinds, analysis, |bd, p| DebugFormatted::new(&bd.mir().local_decls[p])); Some((analysis, result)) } else { @@ -414,14 +414,12 @@ fn locals_live_across_suspend_points( let mut set = liveness::LiveVarSet::new_empty(mir.local_decls.len()); let mut liveness = liveness::liveness_of_locals( mir, - &IdentityMap::new(mir), ); liveness::dump_mir( tcx, "generator_liveness", source, mir, - &IdentityMap::new(mir), &liveness, ); @@ -491,7 +489,7 @@ fn compute_layout<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &mut Mir<'tcx>) -> (FxHashMap, usize)>, GeneratorLayout<'tcx>, - FxHashMap>) + FxHashMap) { // Use a liveness analysis to compute locals which are live across a suspension point let (live_locals, storage_liveness) = locals_live_across_suspend_points(tcx, @@ -597,7 +595,7 @@ fn elaborate_generator_drops<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, &Terminator { source_info, kind: TerminatorKind::Drop { - location: Place::Local(local), + location: Place::Base(PlaceBase::Local(local)), target, unwind } @@ -619,7 +617,7 @@ fn elaborate_generator_drops<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, elaborate_drop( &mut elaborator, source_info, - &Place::Local(gen), + &Place::Base(PlaceBase::Local(gen)), (), target, unwind, @@ -693,7 +691,7 @@ fn create_generator_drop_shim<'a, 'tcx>( // Alias tracking must know we changed the type mir.basic_blocks_mut()[START_BLOCK].statements.insert(0, Statement { source_info, - kind: StatementKind::Retag(RetagKind::Raw, Place::Local(self_arg())), + kind: StatementKind::Retag(RetagKind::Raw, Place::Base(PlaceBase::Local(self_arg()))), }) } @@ -809,7 +807,7 @@ fn insert_clean_drop<'a, 'tcx>(mir: &mut Mir<'tcx>) -> BasicBlock { // Create a block to destroy an unresumed generators. This can only destroy upvars. let drop_clean = BasicBlock::new(mir.basic_blocks().len()); let term = TerminatorKind::Drop { - location: Place::Local(self_arg()), + location: Place::Base(PlaceBase::Local(self_arg())), target: return_block, unwind: None, }; diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index 07ebbf6d0ebe..234483df13ad 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -9,7 +9,7 @@ use rustc_data_structures::indexed_vec::{Idx, IndexVec}; use rustc::mir::*; use rustc::mir::visit::*; use rustc::ty::{self, Instance, InstanceDef, ParamEnv, Ty, TyCtxt}; -use rustc::ty::subst::{Subst,Substs}; +use rustc::ty::subst::{Subst, SubstsRef}; use std::collections::VecDeque; use std::iter; @@ -32,7 +32,7 @@ pub struct Inline; #[derive(Copy, Clone, Debug)] struct CallSite<'tcx> { callee: DefId, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, bb: BasicBlock, location: SourceInfo, } @@ -72,8 +72,10 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { let param_env = self.tcx.param_env(self.source.def_id()); // Only do inlining into fn bodies. - let id = self.tcx.hir().as_local_node_id(self.source.def_id()).unwrap(); - if self.tcx.hir().body_owner_kind(id).is_fn_or_closure() && self.source.promoted.is_none() { + let id = self.tcx.hir().as_local_hir_id(self.source.def_id()).unwrap(); + if self.tcx.hir().body_owner_kind_by_hir_id(id).is_fn_or_closure() + && self.source.promoted.is_none() + { for (bb, bb_data) in caller_mir.basic_blocks().iter_enumerated() { if let Some(callsite) = self.get_valid_function_call(bb, bb_data, @@ -259,7 +261,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { // inlining. This is to ensure that the final crate doesn't have MIR that // reference unexported symbols if callsite.callee.is_local() { - if callsite.substs.types().count() == 0 && !hinted { + if callsite.substs.non_erasable_generics().count() == 0 && !hinted { debug!(" callee is an exported function - not inlining"); return false; } @@ -449,7 +451,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { } // Static variables need a borrow because the callee // might modify the same static. - Place::Static(_) => true, + Place::Base(PlaceBase::Static(_)) => true, _ => false } } @@ -466,7 +468,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { let temp = LocalDecl::new_temp(ty, callsite.location.span); let tmp = caller_mir.local_decls.push(temp); - let tmp = Place::Local(tmp); + let tmp = Place::Base(PlaceBase::Local(tmp)); let stmt = Statement { source_info: callsite.location, @@ -560,7 +562,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { let tuple = self.create_temp_if_necessary(args.next().unwrap(), callsite, caller_mir); assert!(args.next().is_none()); - let tuple = Place::Local(tuple); + let tuple = Place::Base(PlaceBase::Local(tuple)); let tuple_tys = if let ty::Tuple(s) = tuple.ty(caller_mir, tcx).to_ty(tcx).sty { s } else { @@ -599,7 +601,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { // FIXME: Analysis of the usage of the arguments to avoid // unnecessary temporaries. - if let Operand::Move(Place::Local(local)) = arg { + if let Operand::Move(Place::Base(PlaceBase::Local(local))) = arg { if caller_mir.local_kind(local) == LocalKind::Temp { // Reuse the operand if it's a temporary already return local; @@ -617,7 +619,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { let stmt = Statement { source_info: callsite.location, - kind: StatementKind::Assign(Place::Local(arg_tmp), box arg), + kind: StatementKind::Assign(Place::Base(PlaceBase::Local(arg_tmp)), box arg), }; caller_mir[callsite.bb].statements.push(stmt); arg_tmp @@ -665,7 +667,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Integrator<'a, 'tcx> { _location: Location) { if *local == RETURN_PLACE { match self.destination { - Place::Local(l) => { + Place::Base(PlaceBase::Local(l)) => { *local = l; return; }, @@ -686,11 +688,11 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Integrator<'a, 'tcx> { _location: Location) { match place { - Place::Local(RETURN_PLACE) => { + Place::Base(PlaceBase::Local(RETURN_PLACE)) => { // Return pointer; update the place itself *place = self.destination.clone(); }, - Place::Promoted(ref mut promoted) => { + Place::Base(PlaceBase::Promoted(ref mut promoted)) => { if let Some(p) = self.promoted_map.get(promoted.0).cloned() { promoted.0 = p; } diff --git a/src/librustc_mir/transform/instcombine.rs b/src/librustc_mir/transform/instcombine.rs index 290915763e27..e0e64fd1f9b5 100644 --- a/src/librustc_mir/transform/instcombine.rs +++ b/src/librustc_mir/transform/instcombine.rs @@ -1,6 +1,6 @@ //! Performs various peephole optimizations. -use rustc::mir::{Constant, Location, Place, Mir, Operand, ProjectionElem, Rvalue, Local}; +use rustc::mir::{Constant, Location, Place, PlaceBase, Mir, Operand, ProjectionElem, Rvalue, Local}; use rustc::mir::visit::{MutVisitor, Visitor}; use rustc::ty::{TyCtxt, TyKind}; use rustc::util::nodemap::{FxHashMap, FxHashSet}; @@ -45,7 +45,7 @@ impl<'tcx> MutVisitor<'tcx> for InstCombineVisitor<'tcx> { let new_place = match *rvalue { Rvalue::Ref(_, _, Place::Projection(ref mut projection)) => { // Replace with dummy - mem::replace(&mut projection.base, Place::Local(Local::new(0))) + mem::replace(&mut projection.base, Place::Base(PlaceBase::Local(Local::new(0)))) } _ => bug!("Detected `&*` but didn't find `&*`!"), }; diff --git a/src/librustc_mir/transform/lower_128bit.rs b/src/librustc_mir/transform/lower_128bit.rs index 3d1f55e530e6..ad108587247f 100644 --- a/src/librustc_mir/transform/lower_128bit.rs +++ b/src/librustc_mir/transform/lower_128bit.rs @@ -86,13 +86,13 @@ impl Lower128Bit { block.statements.push(Statement { source_info: source_info, kind: StatementKind::Assign( - Place::Local(local), + Place::Base(PlaceBase::Local(local)), box Rvalue::Cast( CastKind::Misc, rhs, rhs_override_ty.unwrap())), }); - rhs = Operand::Move(Place::Local(local)); + rhs = Operand::Move(Place::Base(PlaceBase::Local(local))); } let call_did = check_lang_item_type( diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index c1bb31a49a4b..0cd2cecf39c0 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -80,8 +80,8 @@ fn mir_keys<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, krate: CrateNum) _: &'tcx hir::Generics, _: hir::HirId, _: Span) { - if let hir::VariantData::Tuple(_, node_id, _) = *v { - self.set.insert(self.tcx.hir().local_def_id(node_id)); + if let hir::VariantData::Tuple(_, hir_id) = *v { + self.set.insert(self.tcx.hir().local_def_id_from_hir_id(hir_id)); } intravisit::walk_struct_def(self, v) } @@ -214,8 +214,8 @@ fn mir_const<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Stea } fn mir_validated<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - if let hir::BodyOwnerKind::Const = tcx.hir().body_owner_kind(node_id) { + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); + if let hir::BodyOwnerKind::Const = tcx.hir().body_owner_kind_by_hir_id(hir_id) { // Ensure that we compute the `mir_const_qualif` for constants at // this point, before we steal the mir-const result. let _ = tcx.mir_const_qualif(def_id); diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index a6726718e2d2..831d8b46a65c 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -178,7 +178,7 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> { span, scope: OUTERMOST_SOURCE_SCOPE }, - kind: StatementKind::Assign(Place::Local(dest), box rvalue) + kind: StatementKind::Assign(Place::Base(PlaceBase::Local(dest)), box rvalue) }); } @@ -268,7 +268,9 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> { func, args, cleanup: None, - destination: Some((Place::Local(new_temp), new_target)), + destination: Some( + (Place::Base(PlaceBase::Local(new_temp)), new_target) + ), from_hir_call, }, ..terminator @@ -292,7 +294,7 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> { promoted.span = span; promoted.local_decls[RETURN_PLACE] = LocalDecl::new_return_place(ty, span); - Place::Promoted(box (promoted_id, ty)) + Place::Base(PlaceBase::Promoted(box (promoted_id, ty))) }; let (blocks, local_decls) = self.source.basic_blocks_and_local_decls_mut(); match candidate { @@ -373,7 +375,7 @@ pub fn promote_candidates<'a, 'tcx>(mir: &mut Mir<'tcx>, match candidate { Candidate::Ref(Location { block, statement_index }) => { match mir[block].statements[statement_index].kind { - StatementKind::Assign(Place::Local(local), _) => { + StatementKind::Assign(Place::Base(PlaceBase::Local(local)), _) => { if temps[local] == TempState::PromotedOut { // Already promoted. continue; @@ -420,7 +422,7 @@ pub fn promote_candidates<'a, 'tcx>(mir: &mut Mir<'tcx>, for block in mir.basic_blocks_mut() { block.statements.retain(|statement| { match statement.kind { - StatementKind::Assign(Place::Local(index), _) | + StatementKind::Assign(Place::Base(PlaceBase::Local(index)), _) | StatementKind::StorageLive(index) | StatementKind::StorageDead(index) => { !promoted(index) @@ -430,7 +432,7 @@ pub fn promote_candidates<'a, 'tcx>(mir: &mut Mir<'tcx>, }); let terminator = block.terminator_mut(); match terminator.kind { - TerminatorKind::Drop { location: Place::Local(index), target, .. } => { + TerminatorKind::Drop { location: Place::Base(PlaceBase::Local(index)), target, .. } => { if promoted(index) { terminator.kind = TerminatorKind::Goto { target, diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index 285c674643f2..97d566e586e8 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -186,9 +186,9 @@ trait Qualif { fn in_place(cx: &ConstCx<'_, 'tcx>, place: &Place<'tcx>) -> bool { match *place { - Place::Local(local) => Self::in_local(cx, local), - Place::Promoted(_) => bug!("qualifying already promoted MIR"), - Place::Static(ref static_) => Self::in_static(cx, static_), + Place::Base(PlaceBase::Local(local)) => Self::in_local(cx, local), + Place::Base(PlaceBase::Promoted(_)) => bug!("qualifying already promoted MIR"), + Place::Base(PlaceBase::Static(ref static_)) => Self::in_static(cx, static_), Place::Projection(ref proj) => Self::in_projection(cx, proj), } } @@ -499,6 +499,8 @@ impl Qualif for IsNotConst { // Refers to temporaries which cannot be promoted as // promote_consts decided they weren't simple enough. +// FIXME(oli-obk,eddyb): Remove this flag entirely and +// solely process this information via `IsNotConst`. struct IsNotPromotable; impl Qualif for IsNotPromotable { @@ -507,7 +509,7 @@ impl Qualif for IsNotPromotable { fn in_call( cx: &ConstCx<'_, 'tcx>, callee: &Operand<'tcx>, - _args: &[Operand<'tcx>], + args: &[Operand<'tcx>], _return_ty: Ty<'tcx>, ) -> bool { if cx.mode == Mode::Fn { @@ -520,10 +522,7 @@ impl Qualif for IsNotPromotable { } } - // FIXME(eddyb) do we need "not promotable" in anything - // other than `Mode::Fn` by any chance? - - false + Self::in_operand(cx, callee) || args.iter().any(|arg| Self::in_operand(cx, arg)) } } @@ -730,7 +729,7 @@ impl<'a, 'tcx> Checker<'a, 'tcx> { place = &proj.base; } debug!("qualify_consts: promotion candidate: place={:?}", place); - if let Place::Local(local) = *place { + if let Place::Base(PlaceBase::Local(local)) = *place { if self.mir.local_kind(local) == LocalKind::Temp { debug!("qualify_consts: promotion candidate: local={:?}", local); // The borrowed place doesn't have `HasMutInterior` @@ -754,7 +753,7 @@ impl<'a, 'tcx> Checker<'a, 'tcx> { let index = loop { match dest { // We treat all locals equal in constants - Place::Local(index) => break *index, + Place::Base(PlaceBase::Local(index)) => break *index, // projections are transparent for assignments // we qualify the entire destination at once, even if just a field would have // stricter qualification @@ -768,8 +767,9 @@ impl<'a, 'tcx> Checker<'a, 'tcx> { ); dest = &proj.base; }, - Place::Promoted(..) => bug!("promoteds don't exist yet during promotion"), - Place::Static(..) => { + Place::Base(PlaceBase::Promoted(..)) => + bug!("promoteds don't exist yet during promotion"), + Place::Base(PlaceBase::Static(..)) => { // Catch more errors in the destination. `visit_place` also checks that we // do not try to access statics from constants or try to mutate statics self.visit_place( @@ -878,7 +878,10 @@ impl<'a, 'tcx> Checker<'a, 'tcx> { match *candidate { Candidate::Ref(Location { block: bb, statement_index: stmt_idx }) => { match self.mir[bb].statements[stmt_idx].kind { - StatementKind::Assign(_, box Rvalue::Ref(_, _, Place::Local(index))) => { + StatementKind::Assign( + _, + box Rvalue::Ref(_, _, Place::Base(PlaceBase::Local(index))) + ) => { promoted_temps.insert(index); } _ => {} @@ -915,9 +918,9 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { debug!("visit_place: place={:?} context={:?} location={:?}", place, context, location); self.super_place(place, context, location); match *place { - Place::Local(_) | - Place::Promoted(_) => {} - Place::Static(ref global) => { + Place::Base(PlaceBase::Local(_)) | + Place::Base(PlaceBase::Promoted(_)) => {} + Place::Base(PlaceBase::Static(ref global)) => { if self.tcx .get_attrs(global.def_id) .iter() @@ -1032,7 +1035,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { match *operand { Operand::Move(ref place) => { // Mark the consumed locals to indicate later drops are noops. - if let Place::Local(local) = *place { + if let Place::Base(PlaceBase::Local(local)) = *place { self.cx.per_local[NeedsDrop].remove(local); } } @@ -1091,6 +1094,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { Rvalue::Cast(CastKind::UnsafeFnPointer, ..) | Rvalue::Cast(CastKind::ClosureFnPointer, ..) | Rvalue::Cast(CastKind::Unsize, ..) | + Rvalue::Cast(CastKind::MutToConstPointer, ..) | Rvalue::Discriminant(..) | Rvalue::Len(_) | Rvalue::Ref(..) | @@ -1335,7 +1339,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> { unleash_miri!(self); // HACK(eddyb): emulate a bit of dataflow analysis, // conservatively, that drop elaboration will do. - let needs_drop = if let Place::Local(local) = *place { + let needs_drop = if let Place::Base(PlaceBase::Local(local)) = *place { if NeedsDrop::in_local(self, local) { Some(self.mir.local_decls[local].source_info.span) } else { @@ -1565,7 +1569,11 @@ impl MirPass for QualifyAndPromoteConstants { }); let terminator = block.terminator_mut(); match terminator.kind { - TerminatorKind::Drop { location: Place::Local(index), target, .. } => { + TerminatorKind::Drop { + location: Place::Base(PlaceBase::Local(index)), + target, + .. + } => { if promoted_temps.contains(index) { terminator.kind = TerminatorKind::Goto { target, diff --git a/src/librustc_mir/transform/qualify_min_const_fn.rs b/src/librustc_mir/transform/qualify_min_const_fn.rs index 34f850fc4aad..f82e536ab254 100644 --- a/src/librustc_mir/transform/qualify_min_const_fn.rs +++ b/src/librustc_mir/transform/qualify_min_const_fn.rs @@ -152,6 +152,9 @@ fn check_rvalue( _ => check_operand(tcx, mir, operand, span), } } + Rvalue::Cast(CastKind::MutToConstPointer, operand, _) => { + check_operand(tcx, mir, operand, span) + } Rvalue::Cast(CastKind::UnsafeFnPointer, _, _) | Rvalue::Cast(CastKind::ClosureFnPointer, _, _) | Rvalue::Cast(CastKind::ReifyFnPointer, _, _) => Err(( @@ -252,10 +255,11 @@ fn check_place( span: Span, ) -> McfResult { match place { - Place::Local(_) => Ok(()), + Place::Base(PlaceBase::Local(_)) => Ok(()), // promoteds are always fine, they are essentially constants - Place::Promoted(_) => Ok(()), - Place::Static(_) => Err((span, "cannot access `static` items in const fn".into())), + Place::Base(PlaceBase::Promoted(_)) => Ok(()), + Place::Base(PlaceBase::Static(_)) => + Err((span, "cannot access `static` items in const fn".into())), Place::Projection(proj) => { match proj.elem { | ProjectionElem::ConstantIndex { .. } | ProjectionElem::Subslice { .. } diff --git a/src/librustc_mir/transform/remove_noop_landing_pads.rs b/src/librustc_mir/transform/remove_noop_landing_pads.rs index 0ad33bff9d6c..b7493b25d465 100644 --- a/src/librustc_mir/transform/remove_noop_landing_pads.rs +++ b/src/librustc_mir/transform/remove_noop_landing_pads.rs @@ -47,7 +47,7 @@ impl RemoveNoopLandingPads { // These are all nops in a landing pad } - StatementKind::Assign(Place::Local(_), box Rvalue::Use(_)) => { + StatementKind::Assign(Place::Base(PlaceBase::Local(_)), box Rvalue::Use(_)) => { // Writing to a local (e.g., a drop flag) does not // turn a landing pad to a non-nop } diff --git a/src/librustc_mir/transform/rustc_peek.rs b/src/librustc_mir/transform/rustc_peek.rs index 40e02e712c15..f078316b97ce 100644 --- a/src/librustc_mir/transform/rustc_peek.rs +++ b/src/librustc_mir/transform/rustc_peek.rs @@ -3,6 +3,7 @@ use syntax::ast; use syntax_pos::Span; use rustc::ty::{self, TyCtxt}; +use rustc::hir; use rustc::mir::{self, Mir, Location}; use rustc_data_structures::bit_set::BitSet; use crate::transform::{MirPass, MirSource}; @@ -26,7 +27,7 @@ impl MirPass for SanityCheck { fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, src: MirSource<'tcx>, mir: &mut Mir<'tcx>) { let def_id = src.def_id(); - let id = tcx.hir().as_local_node_id(def_id).unwrap(); + let id = tcx.hir().as_local_hir_id(def_id).unwrap(); if !tcx.has_attr(def_id, "rustc_mir") { debug!("skipping rustc_peek::SanityCheck on {}", tcx.item_path_str(def_id)); return; @@ -85,7 +86,7 @@ impl MirPass for SanityCheck { /// errors are not intended to be used for unit tests.) pub fn sanity_check_via_rustc_peek<'a, 'tcx, O>(tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &Mir<'tcx>, - id: ast::NodeId, + id: hir::HirId, _attributes: &[ast::Attribute], results: &DataflowResults<'tcx, O>) where O: BitDenotation<'tcx, Idx=MovePathIndex> + HasMoveData<'tcx> @@ -115,8 +116,8 @@ fn each_block<'a, 'tcx, O>(tcx: TyCtxt<'a, 'tcx, 'tcx>, }; assert!(args.len() == 1); let peek_arg_place = match args[0] { - mir::Operand::Copy(ref place @ mir::Place::Local(_)) | - mir::Operand::Move(ref place @ mir::Place::Local(_)) => Some(place), + mir::Operand::Copy(ref place @ mir::Place::Base(mir::PlaceBase::Local(_))) | + mir::Operand::Move(ref place @ mir::Place::Base(mir::PlaceBase::Local(_))) => Some(place), _ => None, }; diff --git a/src/librustc_mir/transform/uniform_array_move_out.rs b/src/librustc_mir/transform/uniform_array_move_out.rs index fd8d68a48226..b1d898bb5b02 100644 --- a/src/librustc_mir/transform/uniform_array_move_out.rs +++ b/src/librustc_mir/transform/uniform_array_move_out.rs @@ -101,7 +101,7 @@ impl<'a, 'tcx> UniformArrayMoveOutVisitor<'a, 'tcx> { let temp = self.patch.new_temp(item_ty, self.mir.source_info(location).span); self.patch.add_statement(location, StatementKind::StorageLive(temp)); self.patch.add_assign(location, - Place::Local(temp), + Place::Base(PlaceBase::Local(temp)), Rvalue::Use( Operand::Move( Place::Projection(box PlaceProjection{ @@ -113,12 +113,16 @@ impl<'a, 'tcx> UniformArrayMoveOutVisitor<'a, 'tcx> { })))); temp }).collect(); - self.patch.add_assign(location, - dst_place.clone(), - Rvalue::Aggregate(box AggregateKind::Array(item_ty), - temps.iter().map( - |x| Operand::Move(Place::Local(*x))).collect() - )); + self.patch.add_assign( + location, + dst_place.clone(), + Rvalue::Aggregate( + box AggregateKind::Array(item_ty), + temps.iter().map( + |x| Operand::Move(Place::Base(PlaceBase::Local(*x))) + ).collect() + ) + ); for temp in temps { self.patch.add_statement(location, StatementKind::StorageDead(temp)); } @@ -176,7 +180,7 @@ impl MirPass for RestoreSubsliceArrayMoveOut { if let StatementKind::Assign(ref dst_place, ref rval) = statement.kind { if let Rvalue::Aggregate(box AggregateKind::Array(_), ref items) = **rval { let items : Vec<_> = items.iter().map(|item| { - if let Operand::Move(Place::Local(local)) = item { + if let Operand::Move(Place::Base(PlaceBase::Local(local))) = item { let local_use = &visitor.locals_use[*local]; let opt_index_and_place = Self::try_get_item_source(local_use, mir); // each local should be used twice: @@ -257,7 +261,7 @@ impl RestoreSubsliceArrayMoveOut { if block.statements.len() > location.statement_index { let statement = &block.statements[location.statement_index]; if let StatementKind::Assign( - Place::Local(_), + Place::Base(PlaceBase::Local(_)), box Rvalue::Use(Operand::Move(Place::Projection(box PlaceProjection{ ref base, elem: ProjectionElem::ConstantIndex{ offset, min_length: _, from_end: false}})))) = statement.kind { diff --git a/src/librustc_mir/util/elaborate_drops.rs b/src/librustc_mir/util/elaborate_drops.rs index e86ece138301..26fa8d6d1f0b 100644 --- a/src/librustc_mir/util/elaborate_drops.rs +++ b/src/librustc_mir/util/elaborate_drops.rs @@ -5,7 +5,7 @@ use rustc::middle::lang_items; use rustc::traits::Reveal; use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::layout::VariantIdx; -use rustc::ty::subst::Substs; +use rustc::ty::subst::SubstsRef; use rustc::ty::util::IntTypeExt; use rustc_data_structures::indexed_vec::Idx; use crate::util::patch::MirPatch; @@ -189,7 +189,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> base_place: &Place<'tcx>, variant_path: D::Path, variant: &'tcx ty::VariantDef, - substs: &'tcx Substs<'tcx>) + substs: SubstsRef<'tcx>) -> Vec<(Place<'tcx>, Option)> { variant.fields.iter().enumerate().map(|(i, f)| { @@ -328,7 +328,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> self.drop_ladder(fields, succ, unwind).0 } - fn open_drop_for_box<'a>(&mut self, adt: &'tcx ty::AdtDef, substs: &'tcx Substs<'tcx>) + fn open_drop_for_box<'a>(&mut self, adt: &'tcx ty::AdtDef, substs: SubstsRef<'tcx>) -> BasicBlock { debug!("open_drop_for_box({:?}, {:?}, {:?})", self, adt, substs); @@ -346,7 +346,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> self.drop_subpath(&interior, interior_path, succ, unwind_succ) } - fn open_drop_for_adt<'a>(&mut self, adt: &'tcx ty::AdtDef, substs: &'tcx Substs<'tcx>) + fn open_drop_for_adt<'a>(&mut self, adt: &'tcx ty::AdtDef, substs: SubstsRef<'tcx>) -> BasicBlock { debug!("open_drop_for_adt({:?}, {:?}, {:?})", self, adt, substs); if adt.variants.len() == 0 { @@ -376,7 +376,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> } fn open_drop_for_adt_contents(&mut self, adt: &'tcx ty::AdtDef, - substs: &'tcx Substs<'tcx>) + substs: SubstsRef<'tcx>) -> (BasicBlock, Unwind) { let (succ, unwind) = self.drop_ladder_bottom(); if !adt.is_enum() { @@ -393,7 +393,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> } fn open_drop_for_multivariant(&mut self, adt: &'tcx ty::AdtDef, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, succ: BasicBlock, unwind: Unwind) -> (BasicBlock, Unwind) { @@ -486,7 +486,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> // discriminant after it is free-ed, because that // way lies only trouble. let discr_ty = adt.repr.discr_type().to_ty(self.tcx()); - let discr = Place::Local(self.new_temp(discr_ty)); + let discr = Place::Base(PlaceBase::Local(self.new_temp(discr_ty))); let discr_rv = Rvalue::Discriminant(self.place.clone()); let switch_block = BasicBlockData { statements: vec![self.assign(&discr, discr_rv)], @@ -520,11 +520,11 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> mutbl: hir::Mutability::MutMutable }); let ref_place = self.new_temp(ref_ty); - let unit_temp = Place::Local(self.new_temp(tcx.mk_unit())); + let unit_temp = Place::Base(PlaceBase::Local(self.new_temp(tcx.mk_unit()))); let result = BasicBlockData { statements: vec![self.assign( - &Place::Local(ref_place), + &Place::Base(PlaceBase::Local(ref_place)), Rvalue::Ref(tcx.types.re_erased, BorrowKind::Mut { allow_two_phase_borrow: false }, self.place.clone()) @@ -533,7 +533,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> kind: TerminatorKind::Call { func: Operand::function_handle(tcx, drop_fn.def_id, substs, self.source_info.span), - args: vec![Operand::Move(Place::Local(ref_place))], + args: vec![Operand::Move(Place::Base(PlaceBase::Local(ref_place)))], destination: Some((unit_temp, succ)), cleanup: unwind.into_option(), from_hir_call: true, @@ -578,8 +578,8 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> ty: ety, mutbl: hir::Mutability::MutMutable }); - let ptr = &Place::Local(self.new_temp(ref_ty)); - let can_go = &Place::Local(self.new_temp(tcx.types.bool)); + let ptr = &Place::Base(PlaceBase::Local(self.new_temp(ref_ty))); + let can_go = &Place::Base(PlaceBase::Local(self.new_temp(tcx.types.bool))); let one = self.constant_usize(1); let (ptr_next, cur_next) = if ptr_based { @@ -587,23 +587,23 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> tcx.types.re_erased, BorrowKind::Mut { allow_two_phase_borrow: false }, Place::Projection(Box::new(Projection { - base: Place::Local(cur), + base: Place::Base(PlaceBase::Local(cur)), elem: ProjectionElem::Deref, })) ), - Rvalue::BinaryOp(BinOp::Offset, copy(&Place::Local(cur)), one)) + Rvalue::BinaryOp(BinOp::Offset, copy(&Place::Base(PlaceBase::Local(cur))), one)) } else { (Rvalue::Ref( tcx.types.re_erased, BorrowKind::Mut { allow_two_phase_borrow: false }, self.place.clone().index(cur)), - Rvalue::BinaryOp(BinOp::Add, copy(&Place::Local(cur)), one)) + Rvalue::BinaryOp(BinOp::Add, copy(&Place::Base(PlaceBase::Local(cur))), one)) }; let drop_block = BasicBlockData { statements: vec![ self.assign(ptr, ptr_next), - self.assign(&Place::Local(cur), cur_next) + self.assign(&Place::Base(PlaceBase::Local(cur)), cur_next) ], is_cleanup: unwind.is_cleanup(), terminator: Some(Terminator { @@ -617,7 +617,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> let loop_block = BasicBlockData { statements: vec![ self.assign(can_go, Rvalue::BinaryOp(BinOp::Eq, - copy(&Place::Local(cur)), + copy(&Place::Base(PlaceBase::Local(cur))), copy(length_or_end))) ], is_cleanup: unwind.is_cleanup(), @@ -667,8 +667,8 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> let move_ = |place: &Place<'tcx>| Operand::Move(place.clone()); let tcx = self.tcx(); - let size = &Place::Local(self.new_temp(tcx.types.usize)); - let size_is_zero = &Place::Local(self.new_temp(tcx.types.bool)); + let size = &Place::Base(PlaceBase::Local(self.new_temp(tcx.types.usize))); + let size_is_zero = &Place::Base(PlaceBase::Local(self.new_temp(tcx.types.bool))); let base_block = BasicBlockData { statements: vec![ self.assign(size, Rvalue::NullaryOp(NullOp::SizeOf, ety)), @@ -703,9 +703,12 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> }; let cur = self.new_temp(iter_ty); - let length = Place::Local(self.new_temp(tcx.types.usize)); + let length = Place::Base(PlaceBase::Local(self.new_temp(tcx.types.usize))); let length_or_end = if ptr_based { - Place::Local(self.new_temp(iter_ty)) + // FIXME check if we want to make it return a `Place` directly + // if all use sites want a `Place::Base` anyway. + let temp = self.new_temp(iter_ty); + Place::Base(PlaceBase::Local(temp)) } else { length.clone() }; @@ -728,13 +731,13 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> unwind, ptr_based); - let cur = Place::Local(cur); + let cur = Place::Base(PlaceBase::Local(cur)); let zero = self.constant_usize(0); let mut drop_block_stmts = vec![]; drop_block_stmts.push(self.assign(&length, Rvalue::Len(self.place.clone()))); if ptr_based { let tmp_ty = tcx.mk_mut_ptr(self.place_ty(self.place)); - let tmp = Place::Local(self.new_temp(tmp_ty)); + let tmp = Place::Base(PlaceBase::Local(self.new_temp(tmp_ty))); // tmp = &mut P; // cur = tmp as *mut T; // end = Offset(cur, len); @@ -867,7 +870,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> fn box_free_block<'a>( &mut self, adt: &'tcx ty::AdtDef, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, target: BasicBlock, unwind: Unwind, ) -> BasicBlock { @@ -878,12 +881,12 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> fn unelaborated_free_block<'a>( &mut self, adt: &'tcx ty::AdtDef, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, target: BasicBlock, unwind: Unwind ) -> BasicBlock { let tcx = self.tcx(); - let unit_temp = Place::Local(self.new_temp(tcx.mk_unit())); + let unit_temp = Place::Base(PlaceBase::Local(self.new_temp(tcx.mk_unit()))); let free_func = tcx.require_lang_item(lang_items::BoxFreeFnLangItem); let args = adt.variants[VariantIdx::new(0)].fields.iter().enumerate().map(|(i, f)| { let field = Field::new(i); diff --git a/src/librustc_mir/util/graphviz.rs b/src/librustc_mir/util/graphviz.rs index e93b96c12161..61b1a5a850d2 100644 --- a/src/librustc_mir/util/graphviz.rs +++ b/src/librustc_mir/util/graphviz.rs @@ -27,7 +27,7 @@ pub fn write_mir_fn_graphviz<'tcx, W>(tcx: TyCtxt<'_, '_, 'tcx>, w: &mut W) -> io::Result<()> where W: Write { - writeln!(w, "digraph Mir_{} {{", tcx.hir().as_local_node_id(def_id).unwrap())?; + writeln!(w, "digraph Mir_{} {{", tcx.hir().as_local_hir_id(def_id).unwrap())?; // Global graph properties writeln!(w, r#" graph [fontname="monospace"];"#)?; @@ -134,7 +134,11 @@ fn write_graph_label<'a, 'gcx, 'tcx, W: Write>(tcx: TyCtxt<'a, 'gcx, 'tcx>, if i > 0 { write!(w, ", ")?; } - write!(w, "{:?}: {}", Place::Local(arg), escape(&mir.local_decls[arg].ty))?; + write!(w, + "{:?}: {}", + Place::Base(PlaceBase::Local(arg)), + escape(&mir.local_decls[arg].ty) + )?; } write!(w, ") -> {}", escape(mir.return_ty()))?; @@ -150,10 +154,10 @@ fn write_graph_label<'a, 'gcx, 'tcx, W: Write>(tcx: TyCtxt<'a, 'gcx, 'tcx>, if let Some(name) = decl.name { write!(w, r#"{:?}: {}; // {}
"#, - Place::Local(local), escape(&decl.ty), name)?; + Place::Base(PlaceBase::Local(local)), escape(&decl.ty), name)?; } else { write!(w, r#"let mut {:?}: {};
"#, - Place::Local(local), escape(&decl.ty))?; + Place::Base(PlaceBase::Local(local)), escape(&decl.ty))?; } } diff --git a/src/librustc_mir/util/liveness.rs b/src/librustc_mir/util/liveness.rs index dcbd9aa9af22..d08fb40966c4 100644 --- a/src/librustc_mir/util/liveness.rs +++ b/src/librustc_mir/util/liveness.rs @@ -39,7 +39,7 @@ use std::path::{Path, PathBuf}; use crate::transform::MirSource; use crate::util::pretty::{dump_enabled, write_basic_block, write_mir_intro}; -pub type LiveVarSet = BitSet; +pub type LiveVarSet = BitSet; /// This gives the result of the liveness analysis at the boundary of /// basic blocks. @@ -48,66 +48,27 @@ pub type LiveVarSet = BitSet; /// liveness for. This is often `Local`, in which case we computed /// liveness for all variables -- but it can also be some other type, /// which indicates a subset of the variables within the graph. -pub struct LivenessResult { +pub struct LivenessResult { /// Live variables on exit to each basic block. This is equal to /// the union of the `ins` for each successor. - pub outs: IndexVec>, -} - -/// Defines the mapping to/from the MIR local variables (`Local`) to -/// the "live variable indices" we are using in a particular -/// computation. -pub trait LiveVariableMap { - type LiveVar; - - fn from_local(&self, local: Local) -> Option; - fn from_live_var(&self, local: Self::LiveVar) -> Local; - fn num_variables(&self) -> usize; -} - -#[derive(Debug)] -pub struct IdentityMap<'a, 'tcx: 'a> { - mir: &'a Mir<'tcx>, -} - -impl<'a, 'tcx> IdentityMap<'a, 'tcx> { - pub fn new(mir: &'a Mir<'tcx>) -> Self { - Self { mir } - } -} - -impl<'a, 'tcx> LiveVariableMap for IdentityMap<'a, 'tcx> { - type LiveVar = Local; - - fn from_local(&self, local: Local) -> Option { - Some(local) - } - - fn from_live_var(&self, local: Self::LiveVar) -> Local { - local - } - - fn num_variables(&self) -> usize { - self.mir.local_decls.len() - } + pub outs: IndexVec, } /// Computes which local variables are live within the given function /// `mir`. The liveness mode `mode` determines what sorts of uses are /// considered to make a variable live (e.g., do drops count?). -pub fn liveness_of_locals<'tcx, V: Idx>( +pub fn liveness_of_locals<'tcx>( mir: &Mir<'tcx>, - map: &impl LiveVariableMap, -) -> LivenessResult { - let num_live_vars = map.num_variables(); +) -> LivenessResult { + let num_live_vars = mir.local_decls.len(); - let def_use: IndexVec<_, DefsUses> = mir + let def_use: IndexVec<_, DefsUses> = mir .basic_blocks() .iter() - .map(|b| block(map, b, num_live_vars)) + .map(|b| block(b, num_live_vars)) .collect(); - let mut outs: IndexVec<_, LiveVarSet> = mir + let mut outs: IndexVec<_, LiveVarSet> = mir .basic_blocks() .indices() .map(|_| LiveVarSet::new_empty(num_live_vars)) @@ -211,27 +172,23 @@ pub fn categorize<'tcx>(context: PlaceContext<'tcx>) -> Option { } } -struct DefsUsesVisitor<'lv, V, M> -where - V: Idx, - M: LiveVariableMap + 'lv, +struct DefsUsesVisitor { - map: &'lv M, - defs_uses: DefsUses, + defs_uses: DefsUses, } #[derive(Eq, PartialEq, Clone)] -struct DefsUses { - defs: LiveVarSet, - uses: LiveVarSet, +struct DefsUses { + defs: LiveVarSet, + uses: LiveVarSet, } -impl DefsUses { - fn apply(&self, bits: &mut LiveVarSet) -> bool { +impl DefsUses { + fn apply(&self, bits: &mut LiveVarSet) -> bool { bits.subtract(&self.defs) | bits.union(&self.uses) } - fn add_def(&mut self, index: V) { + fn add_def(&mut self, index: Local) { // If it was used already in the block, remove that use // now that we found a definition. // @@ -245,7 +202,7 @@ impl DefsUses { self.defs.insert(index); } - fn add_use(&mut self, index: V) { + fn add_use(&mut self, index: Local) { // Inverse of above. // // Example: @@ -261,29 +218,22 @@ impl DefsUses { } } -impl<'tcx, 'lv, V, M> Visitor<'tcx> for DefsUsesVisitor<'lv, V, M> -where - V: Idx, - M: LiveVariableMap, +impl<'tcx> Visitor<'tcx> for DefsUsesVisitor { fn visit_local(&mut self, &local: &Local, context: PlaceContext<'tcx>, _: Location) { - if let Some(v_index) = self.map.from_local(local) { - match categorize(context) { - Some(DefUse::Def) => self.defs_uses.add_def(v_index), - Some(DefUse::Use) | Some(DefUse::Drop) => self.defs_uses.add_use(v_index), - _ => (), - } + match categorize(context) { + Some(DefUse::Def) => self.defs_uses.add_def(local), + Some(DefUse::Use) | Some(DefUse::Drop) => self.defs_uses.add_use(local), + _ => (), } } } -fn block<'tcx, V: Idx>( - map: &impl LiveVariableMap, +fn block<'tcx>( b: &BasicBlockData<'tcx>, locals: usize, -) -> DefsUses { +) -> DefsUses { let mut visitor = DefsUsesVisitor { - map, defs_uses: DefsUses { defs: LiveVarSet::new_empty(locals), uses: LiveVarSet::new_empty(locals), @@ -305,13 +255,12 @@ fn block<'tcx, V: Idx>( visitor.defs_uses } -pub fn dump_mir<'a, 'tcx, V: Idx>( +pub fn dump_mir<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, pass_name: &str, source: MirSource<'tcx>, mir: &Mir<'tcx>, - map: &impl LiveVariableMap, - result: &LivenessResult, + result: &LivenessResult, ) { if !dump_enabled(tcx, pass_name, source) { return; @@ -320,21 +269,20 @@ pub fn dump_mir<'a, 'tcx, V: Idx>( // see notes on #41697 below tcx.item_path_str(source.def_id()) }); - dump_matched_mir_node(tcx, pass_name, &node_path, source, mir, map, result); + dump_matched_mir_node(tcx, pass_name, &node_path, source, mir, result); } -fn dump_matched_mir_node<'a, 'tcx, V: Idx>( +fn dump_matched_mir_node<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, pass_name: &str, node_path: &str, source: MirSource<'tcx>, mir: &Mir<'tcx>, - map: &dyn LiveVariableMap, - result: &LivenessResult, + result: &LivenessResult, ) { let mut file_path = PathBuf::new(); file_path.push(Path::new(&tcx.sess.opts.debugging_opts.dump_mir_dir)); - let item_id = tcx.hir().as_local_node_id(source.def_id()).unwrap(); + let item_id = tcx.hir().as_local_hir_id(source.def_id()).unwrap(); let file_name = format!("rustc.node{}{}-liveness.mir", item_id, pass_name); file_path.push(&file_name); let _ = fs::File::create(&file_path).and_then(|mut file| { @@ -342,25 +290,23 @@ fn dump_matched_mir_node<'a, 'tcx, V: Idx>( writeln!(file, "// source = {:?}", source)?; writeln!(file, "// pass_name = {}", pass_name)?; writeln!(file, "")?; - write_mir_fn(tcx, source, mir, map, &mut file, result)?; + write_mir_fn(tcx, source, mir, &mut file, result)?; Ok(()) }); } -pub fn write_mir_fn<'a, 'tcx, V: Idx>( +pub fn write_mir_fn<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, src: MirSource<'tcx>, mir: &Mir<'tcx>, - map: &dyn LiveVariableMap, w: &mut dyn Write, - result: &LivenessResult, + result: &LivenessResult, ) -> io::Result<()> { write_mir_intro(tcx, src, mir, w)?; for block in mir.basic_blocks().indices() { - let print = |w: &mut dyn Write, prefix, result: &IndexVec>| { + let print = |w: &mut dyn Write, prefix, result: &IndexVec| { let live: Vec = result[block] .iter() - .map(|v| map.from_live_var(v)) .map(|local| format!("{:?}", local)) .collect(); writeln!(w, "{} {{{}}}", prefix, live.join(", ")) diff --git a/src/librustc_mir/util/pretty.rs b/src/librustc_mir/util/pretty.rs index 8177de50776d..c3fbee3a2a6e 100644 --- a/src/librustc_mir/util/pretty.rs +++ b/src/librustc_mir/util/pretty.rs @@ -625,7 +625,7 @@ fn write_mir_sig( if i != 0 { write!(w, ", ")?; } - write!(w, "{:?}: {}", Place::Local(arg), mir.local_decls[arg].ty)?; + write!(w, "{:?}: {}", Place::Base(PlaceBase::Local(arg)), mir.local_decls[arg].ty)?; } write!(w, ") -> {}", mir.return_ty())?; diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs index 606ae2741283..b85429cd3cfd 100644 --- a/src/librustc_passes/ast_validation.rs +++ b/src/librustc_passes/ast_validation.rs @@ -9,6 +9,7 @@ use std::mem; use syntax::print::pprust; use rustc::lint; +use rustc::lint::builtin::{BuiltinLintDiagnostics, NESTED_IMPL_TRAIT}; use rustc::session::Session; use rustc_data_structures::fx::FxHashMap; use syntax::ast::*; @@ -23,6 +24,31 @@ use syntax_pos::Span; use errors::Applicability; use log::debug; +#[derive(Copy, Clone, Debug)] +struct OuterImplTrait { + span: Span, + + /// rust-lang/rust#57979: a bug in original implementation caused + /// us to fail sometimes to record an outer `impl Trait`. + /// Therefore, in order to reliably issue a warning (rather than + /// an error) in the *precise* places where we are newly injecting + /// the diagnostic, we have to distinguish between the places + /// where the outer `impl Trait` has always been recorded, versus + /// the places where it has only recently started being recorded. + only_recorded_since_pull_request_57730: bool, +} + +impl OuterImplTrait { + /// This controls whether we should downgrade the nested impl + /// trait diagnostic to a warning rather than an error, based on + /// whether the outer impl trait had been improperly skipped in + /// earlier implementations of the analysis on the stable + /// compiler. + fn should_warn_instead_of_error(&self) -> bool { + self.only_recorded_since_pull_request_57730 + } +} + struct AstValidator<'a> { session: &'a Session, has_proc_macro_decls: bool, @@ -31,31 +57,83 @@ struct AstValidator<'a> { // Used to ban nested `impl Trait`, e.g., `impl Into`. // Nested `impl Trait` _is_ allowed in associated type position, // e.g `impl Iterator` - outer_impl_trait: Option, + outer_impl_trait: Option, // Used to ban `impl Trait` in path projections like `::Item` // or `Foo::Bar` is_impl_trait_banned: bool, + + // rust-lang/rust#57979: the ban of nested `impl Trait` was buggy + // until PRs #57730 and #57981 landed: it would jump directly to + // walk_ty rather than visit_ty (or skip recurring entirely for + // impl trait in projections), and thus miss some cases. We track + // whether we should downgrade to a warning for short-term via + // these booleans. + warning_period_57979_didnt_record_next_impl_trait: bool, + warning_period_57979_impl_trait_in_proj: bool, } impl<'a> AstValidator<'a> { + fn with_impl_trait_in_proj_warning(&mut self, v: bool, f: impl FnOnce(&mut Self) -> T) -> T { + let old = mem::replace(&mut self.warning_period_57979_impl_trait_in_proj, v); + let ret = f(self); + self.warning_period_57979_impl_trait_in_proj = old; + ret + } + fn with_banned_impl_trait(&mut self, f: impl FnOnce(&mut Self)) { let old = mem::replace(&mut self.is_impl_trait_banned, true); f(self); self.is_impl_trait_banned = old; } - fn with_impl_trait(&mut self, outer_impl_trait: Option, f: impl FnOnce(&mut Self)) { - let old = mem::replace(&mut self.outer_impl_trait, outer_impl_trait); + fn with_impl_trait(&mut self, outer: Option, f: impl FnOnce(&mut Self)) { + let old = mem::replace(&mut self.outer_impl_trait, outer); f(self); self.outer_impl_trait = old; } + fn visit_assoc_type_binding_from_generic_args(&mut self, type_binding: &'a TypeBinding) { + // rust-lang/rust#57979: bug in old visit_generic_args called + // walk_ty rather than visit_ty, skipping outer `impl Trait` + // if it happened to occur at `type_binding.ty` + if let TyKind::ImplTrait(..) = type_binding.ty.node { + self.warning_period_57979_didnt_record_next_impl_trait = true; + } + self.visit_assoc_type_binding(type_binding); + } + + fn visit_ty_from_generic_args(&mut self, ty: &'a Ty) { + // rust-lang/rust#57979: bug in old visit_generic_args called + // walk_ty rather than visit_ty, skippping outer `impl Trait` + // if it happened to occur at `ty` + if let TyKind::ImplTrait(..) = ty.node { + self.warning_period_57979_didnt_record_next_impl_trait = true; + } + self.visit_ty(ty); + } + + fn outer_impl_trait(&mut self, span: Span) -> OuterImplTrait { + let only_recorded_since_pull_request_57730 = + self.warning_period_57979_didnt_record_next_impl_trait; + + // (this flag is designed to be set to true and then only + // reach the construction point for the outer impl trait once, + // so its safe and easiest to unconditionally reset it to + // false) + self.warning_period_57979_didnt_record_next_impl_trait = false; + + OuterImplTrait { + span, only_recorded_since_pull_request_57730, + } + } + // Mirrors visit::walk_ty, but tracks relevant state fn walk_ty(&mut self, t: &'a Ty) { match t.node { TyKind::ImplTrait(..) => { - self.with_impl_trait(Some(t.span), |this| visit::walk_ty(this, t)) + let outer_impl_trait = self.outer_impl_trait(t.span); + self.with_impl_trait(Some(outer_impl_trait), |this| visit::walk_ty(this, t)) } TyKind::Path(ref qself, ref path) => { // We allow these: @@ -406,22 +484,41 @@ impl<'a> Visitor<'a> for AstValidator<'a> { } TyKind::ImplTrait(_, ref bounds) => { if self.is_impl_trait_banned { - struct_span_err!(self.session, ty.span, E0667, - "`impl Trait` is not allowed in path parameters").emit(); + if self.warning_period_57979_impl_trait_in_proj { + self.session.buffer_lint( + NESTED_IMPL_TRAIT, ty.id, ty.span, + "`impl Trait` is not allowed in path parameters"); + } else { + struct_span_err!(self.session, ty.span, E0667, + "`impl Trait` is not allowed in path parameters").emit(); + } } if let Some(outer_impl_trait) = self.outer_impl_trait { - struct_span_err!(self.session, ty.span, E0666, - "nested `impl Trait` is not allowed") - .span_label(outer_impl_trait, "outer `impl Trait`") - .span_label(ty.span, "nested `impl Trait` here") - .emit(); - + if outer_impl_trait.should_warn_instead_of_error() { + self.session.buffer_lint_with_diagnostic( + NESTED_IMPL_TRAIT, ty.id, ty.span, + "nested `impl Trait` is not allowed", + BuiltinLintDiagnostics::NestedImplTrait { + outer_impl_trait_span: outer_impl_trait.span, + inner_impl_trait_span: ty.span, + }); + } else { + struct_span_err!(self.session, ty.span, E0666, + "nested `impl Trait` is not allowed") + .span_label(outer_impl_trait.span, "outer `impl Trait`") + .span_label(ty.span, "nested `impl Trait` here") + .emit(); + } } + if !bounds.iter() .any(|b| if let GenericBound::Trait(..) = *b { true } else { false }) { self.err_handler().span_err(ty.span, "at least one trait must be specified"); } + + self.with_impl_trait_in_proj_warning(true, |this| this.walk_ty(ty)); + return; } _ => {} } @@ -463,7 +560,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> { self.invalid_visibility(&impl_item.vis, None); if let ImplItemKind::Method(ref sig, _) = impl_item.node { self.check_trait_fn_not_const(sig.header.constness); - self.check_trait_fn_not_async(impl_item.span, sig.header.asyncness); + self.check_trait_fn_not_async(impl_item.span, sig.header.asyncness.node); } } } @@ -482,9 +579,10 @@ impl<'a> Visitor<'a> for AstValidator<'a> { .note("only trait implementations may be annotated with default").emit(); } } - ItemKind::Fn(_, header, ref generics, _) => { + ItemKind::Fn(_, ref header, ref generics, _) => { // We currently do not permit const generics in `const fn`, as // this is tantamount to allowing compile-time dependent typing. + self.visit_fn_header(header); if header.constness.node == Constness::Const { // Look for const generics and error if we find any. for param in &generics.params { @@ -535,7 +633,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> { self.no_questions_in_bounds(bounds, "supertraits", true); for trait_item in trait_items { if let TraitItemKind::Method(ref sig, ref block) = trait_item.node { - self.check_trait_fn_not_async(trait_item.span, sig.header.asyncness); + self.check_trait_fn_not_async(trait_item.span, sig.header.asyncness.node); self.check_trait_fn_not_const(sig.header.constness); if block.is_none() { self.check_decl_no_pat(&sig.decl, |span, mut_ident| { @@ -605,10 +703,11 @@ impl<'a> Visitor<'a> for AstValidator<'a> { GenericArg::Const(..) => ParamKindOrd::Const, }, arg.span(), None) }), GenericPosition::Arg, generic_args.span()); + // Type bindings such as `Item=impl Debug` in `Iterator` // are allowed to contain nested `impl Trait`. self.with_impl_trait(None, |this| { - walk_list!(this, visit_assoc_type_binding, &data.bindings); + walk_list!(this, visit_assoc_type_binding_from_generic_args, &data.bindings); }); } GenericArgs::Parenthesized(ref data) => { @@ -616,7 +715,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> { if let Some(ref type_) = data.output { // `-> Foo` syntax is essentially an associated type binding, // so it is also allowed to contain nested `impl Trait`. - self.with_impl_trait(None, |this| this.visit_ty(type_)); + self.with_impl_trait(None, |this| this.visit_ty_from_generic_args(type_)); } } } @@ -702,6 +801,13 @@ impl<'a> Visitor<'a> for AstValidator<'a> { .span_bug(mac.span, "macro invocation missed in expansion; did you forget to override \ the relevant `fold_*()` method in `PlaceholderExpander`?"); } + + fn visit_fn_header(&mut self, header: &'a FnHeader) { + if header.asyncness.node.is_async() && self.session.rust_2015() { + struct_span_err!(self.session, header.asyncness.span, E0670, + "`async fn` is not permitted in the 2015 edition").emit(); + } + } } pub fn check_crate(session: &Session, krate: &Crate) -> (bool, bool) { @@ -711,6 +817,8 @@ pub fn check_crate(session: &Session, krate: &Crate) -> (bool, bool) { has_global_allocator: false, outer_impl_trait: None, is_impl_trait_banned: false, + warning_period_57979_didnt_record_next_impl_trait: false, + warning_period_57979_impl_trait_in_proj: false, }; visit::walk_crate(&mut validator, krate); diff --git a/src/librustc_passes/diagnostics.rs b/src/librustc_passes/diagnostics.rs index 19d4d3aeb0f6..e3c6b16703a4 100644 --- a/src/librustc_passes/diagnostics.rs +++ b/src/librustc_passes/diagnostics.rs @@ -310,6 +310,18 @@ loop { break; } ``` +"##, + +E0670: r##" +Rust 2015 does not permit the use of `async fn`. + +Example of erroneous code: + +```compile_fail,E0670 +async fn foo() {} +``` + +Switch to the Rust 2018 edition to use `async fn`. "## } diff --git a/src/librustc_passes/hir_stats.rs b/src/librustc_passes/hir_stats.rs index 4071b5902b03..c74314ce0c4b 100644 --- a/src/librustc_passes/hir_stats.rs +++ b/src/librustc_passes/hir_stats.rs @@ -2,7 +2,7 @@ // pieces of AST and HIR. The resulting numbers are good approximations but not // completely accurate (some things might be counted twice, others missed). -use rustc::hir; +use rustc::hir::{self, HirId}; use rustc::hir::intravisit as hir_visit; use rustc::util::common::to_readable_str; use rustc::util::nodemap::{FxHashMap, FxHashSet}; @@ -12,7 +12,7 @@ use syntax_pos::Span; #[derive(Copy, Clone, PartialEq, Eq, Hash)] enum Id { - Node(NodeId), + Node(HirId), Attr(AttrId), None, } @@ -119,7 +119,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> { } fn visit_item(&mut self, i: &'v hir::Item) { - self.record("Item", Id::Node(i.id), i); + self.record("Item", Id::Node(i.hir_id), i); hir_visit::walk_item(self, i) } @@ -129,22 +129,22 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> { } fn visit_foreign_item(&mut self, i: &'v hir::ForeignItem) { - self.record("ForeignItem", Id::Node(i.id), i); + self.record("ForeignItem", Id::Node(i.hir_id), i); hir_visit::walk_foreign_item(self, i) } fn visit_local(&mut self, l: &'v hir::Local) { - self.record("Local", Id::Node(l.id), l); + self.record("Local", Id::Node(l.hir_id), l); hir_visit::walk_local(self, l) } fn visit_block(&mut self, b: &'v hir::Block) { - self.record("Block", Id::Node(b.id), b); + self.record("Block", Id::Node(b.hir_id), b); hir_visit::walk_block(self, b) } fn visit_stmt(&mut self, s: &'v hir::Stmt) { - self.record("Stmt", Id::Node(s.id), s); + self.record("Stmt", Id::Node(s.hir_id), s); hir_visit::walk_stmt(self, s) } @@ -154,17 +154,17 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> { } fn visit_pat(&mut self, p: &'v hir::Pat) { - self.record("Pat", Id::Node(p.id), p); + self.record("Pat", Id::Node(p.hir_id), p); hir_visit::walk_pat(self, p) } fn visit_expr(&mut self, ex: &'v hir::Expr) { - self.record("Expr", Id::Node(ex.id), ex); + self.record("Expr", Id::Node(ex.hir_id), ex); hir_visit::walk_expr(self, ex) } fn visit_ty(&mut self, t: &'v hir::Ty) { - self.record("Ty", Id::Node(t.id), t); + self.record("Ty", Id::Node(t.hir_id), t); hir_visit::walk_ty(self, t) } @@ -184,12 +184,12 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> { } fn visit_trait_item(&mut self, ti: &'v hir::TraitItem) { - self.record("TraitItem", Id::Node(ti.id), ti); + self.record("TraitItem", Id::Node(ti.hir_id), ti); hir_visit::walk_trait_item(self, ti) } fn visit_impl_item(&mut self, ii: &'v hir::ImplItem) { - self.record("ImplItem", Id::Node(ii.id), ii); + self.record("ImplItem", Id::Node(ii.hir_id), ii); hir_visit::walk_impl_item(self, ii) } @@ -199,7 +199,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> { } fn visit_struct_field(&mut self, s: &'v hir::StructField) { - self.record("StructField", Id::Node(s.id), s); + self.record("StructField", Id::Node(s.hir_id), s); hir_visit::walk_struct_field(self, s) } @@ -212,7 +212,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> { } fn visit_lifetime(&mut self, lifetime: &'v hir::Lifetime) { - self.record("Lifetime", Id::Node(lifetime.id), lifetime); + self.record("Lifetime", Id::Node(lifetime.hir_id), lifetime); hir_visit::walk_lifetime(self, lifetime) } @@ -234,7 +234,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> { } fn visit_assoc_type_binding(&mut self, type_binding: &'v hir::TypeBinding) { - self.record("TypeBinding", Id::Node(type_binding.id), type_binding); + self.record("TypeBinding", Id::Node(type_binding.hir_id), type_binding); hir_visit::walk_assoc_type_binding(self, type_binding) } @@ -243,7 +243,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> { } fn visit_macro_def(&mut self, macro_def: &'v hir::MacroDef) { - self.record("MacroDef", Id::Node(macro_def.id), macro_def); + self.record("MacroDef", Id::Node(macro_def.hir_id), macro_def); hir_visit::walk_macro_def(self, macro_def) } } diff --git a/src/librustc_passes/layout_test.rs b/src/librustc_passes/layout_test.rs index d21707c578b2..7fe3f5a36d85 100644 --- a/src/librustc_passes/layout_test.rs +++ b/src/librustc_passes/layout_test.rs @@ -27,7 +27,7 @@ struct VarianceTest<'a, 'tcx: 'a> { impl<'a, 'tcx> ItemLikeVisitor<'tcx> for VarianceTest<'a, 'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item) { - let item_def_id = self.tcx.hir().local_def_id(item.id); + let item_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); if let ItemKind::Ty(..) = item.node { for attr in self.tcx.get_attrs(item_def_id).iter() { diff --git a/src/librustc_passes/loops.rs b/src/librustc_passes/loops.rs index 533e043efa9d..97bbb0adb2d7 100644 --- a/src/librustc_passes/loops.rs +++ b/src/librustc_passes/loops.rs @@ -8,7 +8,6 @@ use rustc::hir::def_id::DefId; use rustc::hir::map::Map; use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap}; use rustc::hir::{self, Node, Destination}; -use syntax::ast; use syntax::struct_span_err; use syntax_pos::Span; use errors::Applicability; @@ -46,12 +45,6 @@ struct CheckLoopVisitor<'a, 'hir: 'a> { cx: Context, } -pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - for &module in tcx.hir().krate().modules.keys() { - tcx.ensure().check_mod_loops(tcx.hir().local_def_id(module)); - } -} - fn check_mod_loops<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module(module_def_id, &mut CheckLoopVisitor { sess: &tcx.sess, @@ -105,25 +98,25 @@ impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> { let loop_id = match label.target_id.into() { Ok(loop_id) => loop_id, - Err(hir::LoopIdError::OutsideLoopScope) => ast::DUMMY_NODE_ID, + Err(hir::LoopIdError::OutsideLoopScope) => hir::DUMMY_HIR_ID, Err(hir::LoopIdError::UnlabeledCfInWhileCondition) => { self.emit_unlabled_cf_in_while_condition(e.span, "break"); - ast::DUMMY_NODE_ID + hir::DUMMY_HIR_ID }, - Err(hir::LoopIdError::UnresolvedLabel) => ast::DUMMY_NODE_ID, + Err(hir::LoopIdError::UnresolvedLabel) => hir::DUMMY_HIR_ID, }; - if loop_id != ast::DUMMY_NODE_ID { - if let Node::Block(_) = self.hir_map.find(loop_id).unwrap() { + if loop_id != hir::DUMMY_HIR_ID { + if let Node::Block(_) = self.hir_map.find_by_hir_id(loop_id).unwrap() { return } } if opt_expr.is_some() { - let loop_kind = if loop_id == ast::DUMMY_NODE_ID { + let loop_kind = if loop_id == hir::DUMMY_HIR_ID { None } else { - Some(match self.hir_map.expect_expr(loop_id).node { + Some(match self.hir_map.expect_expr_by_hir_id(loop_id).node { hir::ExprKind::While(..) => LoopKind::WhileLoop, hir::ExprKind::Loop(_, _, source) => LoopKind::Loop(source), ref r => span_bug!(e.span, @@ -162,7 +155,7 @@ impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> { match destination.target_id { Ok(loop_id) => { - if let Node::Block(block) = self.hir_map.find(loop_id).unwrap() { + if let Node::Block(block) = self.hir_map.find_by_hir_id(loop_id).unwrap() { struct_span_err!(self.sess, e.span, E0696, "`continue` pointing to a labeled block") .span_label(e.span, diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs index 20f31b3ebc17..6de98675a3dc 100644 --- a/src/librustc_passes/rvalue_promotion.rs +++ b/src/librustc_passes/rvalue_promotion.rs @@ -14,7 +14,7 @@ // - It's not possible to take the address of a static item with unsafe interior. This is enforced // by borrowck::gather_loans -use rustc::ty::cast::CastKind; +use rustc::ty::cast::CastTy; use rustc::hir::def::{Def, CtorKind}; use rustc::hir::def_id::DefId; use rustc::middle::expr_use_visitor as euv; @@ -22,11 +22,10 @@ use rustc::middle::mem_categorization as mc; use rustc::middle::mem_categorization::Categorization; use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::query::Providers; -use rustc::ty::subst::Substs; -use rustc::util::nodemap::{ItemLocalSet, NodeSet}; +use rustc::ty::subst::{InternalSubsts, SubstsRef}; +use rustc::util::nodemap::{ItemLocalSet, HirIdSet}; use rustc::hir; use rustc_data_structures::sync::Lrc; -use syntax::ast; use syntax_pos::{Span, DUMMY_SP}; use log::debug; use Promotability::*; @@ -40,22 +39,15 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - for &body_id in &tcx.hir().krate().body_ids { - let def_id = tcx.hir().body_owner_def_id(body_id); - tcx.const_is_rvalue_promotable_to_static(def_id); - } -} - fn const_is_rvalue_promotable_to_static<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> bool { assert!(def_id.is_local()); - let node_id = tcx.hir().as_local_node_id(def_id) + let hir_id = tcx.hir().as_local_hir_id(def_id) .expect("rvalue_promotable_map invoked with non-local def-id"); - let body_id = tcx.hir().body_owned_by(node_id); + let body_id = tcx.hir().body_owned_by(hir_id); tcx.rvalue_promotable_map(def_id).contains(&body_id.hir_id.local_id) } @@ -75,14 +67,14 @@ fn rvalue_promotable_map<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, in_static: false, mut_rvalue_borrows: Default::default(), param_env: ty::ParamEnv::empty(), - identity_substs: Substs::empty(), + identity_substs: InternalSubsts::empty(), result: ItemLocalSet::default(), }; // `def_id` should be a `Body` owner - let node_id = tcx.hir().as_local_node_id(def_id) + let hir_id = tcx.hir().as_local_hir_id(def_id) .expect("rvalue_promotable_map invoked with non-local def-id"); - let body_id = tcx.hir().body_owned_by(node_id); + let body_id = tcx.hir().body_owned_by(hir_id); let _ = visitor.check_nested_body(body_id); Lrc::new(visitor.result) @@ -92,9 +84,9 @@ struct CheckCrateVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, in_fn: bool, in_static: bool, - mut_rvalue_borrows: NodeSet, + mut_rvalue_borrows: HirIdSet, param_env: ty::ParamEnv<'tcx>, - identity_substs: &'tcx Substs<'tcx>, + identity_substs: SubstsRef<'tcx>, tables: &'a ty::TypeckTables<'tcx>, result: ItemLocalSet, } @@ -169,7 +161,7 @@ impl<'a, 'gcx> CheckCrateVisitor<'a, 'gcx> { fn remove_mut_rvalue_borrow(&mut self, pat: &hir::Pat) -> bool { let mut any_removed = false; pat.walk(|p| { - any_removed |= self.mut_rvalue_borrows.remove(&p.id); + any_removed |= self.mut_rvalue_borrows.remove(&p.hir_id); true }); any_removed @@ -199,7 +191,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> { self.tables = self.tcx.typeck_tables_of(item_def_id); self.param_env = self.tcx.param_env(item_def_id); - self.identity_substs = Substs::identity_for_item(self.tcx, item_def_id); + self.identity_substs = InternalSubsts::identity_for_item(self.tcx, item_def_id); let body = self.tcx.hir().body(body_id); @@ -223,7 +215,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> { hir::StmtKind::Local(ref local) => { if self.remove_mut_rvalue_borrow(&local.pat) { if let Some(init) = &local.init { - self.mut_rvalue_borrows.insert(init.id); + self.mut_rvalue_borrows.insert(init.hir_id); } } @@ -248,7 +240,7 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> { outer &= check_adjustments(self, ex); // Handle borrows on (or inside the autorefs of) this expression. - if self.mut_rvalue_borrows.remove(&ex.id) { + if self.mut_rvalue_borrows.remove(&ex.hir_id) { outer = NotPromotable } @@ -318,16 +310,13 @@ fn check_expr_kind<'a, 'tcx>( } hir::ExprKind::Cast(ref from, _) => { let expr_promotability = v.check_expr(from); - debug!("Checking const cast(id={})", from.id); - match v.tables.cast_kinds().get(from.hir_id) { - None => { - v.tcx.sess.delay_span_bug(e.span, "no kind for cast"); - NotPromotable - }, - Some(&CastKind::PtrAddrCast) | Some(&CastKind::FnPtrAddrCast) => { - NotPromotable - } - _ => expr_promotability + debug!("Checking const cast(id={})", from.hir_id); + let cast_in = CastTy::from_ty(v.tables.expr_ty(from)); + let cast_out = CastTy::from_ty(v.tables.expr_ty(e)); + match (cast_in, cast_out) { + (Some(CastTy::FnPtr), Some(CastTy::Int(_))) | + (Some(CastTy::Ptr(_)), Some(CastTy::Int(_))) => NotPromotable, + (_, _) => expr_promotability } } hir::ExprKind::Path(ref qpath) => { @@ -458,7 +447,7 @@ fn check_expr_kind<'a, 'tcx>( let nested_body_promotable = v.check_nested_body(body_id); // Paths in constant contexts cannot refer to local variables, // as there are none, and thus closures can't have upvars there. - if v.tcx.with_freevars(e.id, |fv| !fv.is_empty()) { + if v.tcx.with_freevars(e.hir_id, |fv| !fv.is_empty()) { NotPromotable } else { nested_body_promotable @@ -518,7 +507,7 @@ fn check_expr_kind<'a, 'tcx>( mut_borrow = v.remove_mut_rvalue_borrow(pat); } if mut_borrow { - v.mut_rvalue_borrows.insert(expr.id); + v.mut_rvalue_borrows.insert(expr.hir_id); } let _ = v.check_expr(expr); @@ -619,13 +608,13 @@ fn check_adjustments<'a, 'tcx>( impl<'a, 'gcx, 'tcx> euv::Delegate<'tcx> for CheckCrateVisitor<'a, 'gcx> { fn consume(&mut self, - _consume_id: ast::NodeId, + _consume_id: hir::HirId, _consume_span: Span, _cmt: &mc::cmt_<'_>, _mode: euv::ConsumeMode) {} fn borrow(&mut self, - borrow_id: ast::NodeId, + borrow_id: hir::HirId, _borrow_span: Span, cmt: &mc::cmt_<'tcx>, _loan_region: ty::Region<'tcx>, @@ -676,9 +665,9 @@ impl<'a, 'gcx, 'tcx> euv::Delegate<'tcx> for CheckCrateVisitor<'a, 'gcx> { } } - fn decl_without_init(&mut self, _id: ast::NodeId, _span: Span) {} + fn decl_without_init(&mut self, _id: hir::HirId, _span: Span) {} fn mutate(&mut self, - _assignment_id: ast::NodeId, + _assignment_id: hir::HirId, _assignment_span: Span, _assignee_cmt: &mc::cmt_<'_>, _mode: euv::MutateMode) { diff --git a/src/librustc_plugin/build.rs b/src/librustc_plugin/build.rs index c1ba4d7b3d86..31018a7cd7a3 100644 --- a/src/librustc_plugin/build.rs +++ b/src/librustc_plugin/build.rs @@ -1,6 +1,5 @@ //! Used by `rustc` when compiling a plugin crate. -use syntax::ast; use syntax::attr; use syntax_pos::Span; use rustc::hir::itemlikevisit::ItemLikeVisitor; @@ -10,7 +9,7 @@ use rustc::ty::TyCtxt; use rustc::ty::query::Providers; struct RegistrarFinder { - registrars: Vec<(ast::NodeId, Span)> , + registrars: Vec<(hir::HirId, Span)> , } impl<'v> ItemLikeVisitor<'v> for RegistrarFinder { @@ -18,7 +17,7 @@ impl<'v> ItemLikeVisitor<'v> for RegistrarFinder { if let hir::ItemKind::Fn(..) = item.node { if attr::contains_name(&item.attrs, "plugin_registrar") { - self.registrars.push((item.id, item.span)); + self.registrars.push((item.hir_id, item.span)); } } } @@ -47,8 +46,8 @@ fn plugin_registrar_fn<'tcx>( match finder.registrars.len() { 0 => None, 1 => { - let (node_id, _) = finder.registrars.pop().unwrap(); - Some(tcx.hir().local_def_id(node_id)) + let (hir_id, _) = finder.registrars.pop().unwrap(); + Some(tcx.hir().local_def_id_from_hir_id(hir_id)) }, _ => { let diagnostic = tcx.sess.diagnostic(); diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 894cb4cf11b2..52514a3ca97d 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -20,11 +20,11 @@ use rustc::middle::privacy::{AccessLevel, AccessLevels}; use rustc::ty::{self, TyCtxt, Ty, TraitRef, TypeFoldable, GenericParamDefKind}; use rustc::ty::fold::TypeVisitor; use rustc::ty::query::Providers; -use rustc::ty::subst::Substs; -use rustc::util::nodemap::NodeSet; +use rustc::ty::subst::InternalSubsts; +use rustc::util::nodemap::HirIdSet; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::sync::Lrc; -use syntax::ast::{self, DUMMY_NODE_ID, Ident}; +use syntax::ast::Ident; use syntax::attr; use syntax::symbol::keywords; use syntax_pos::Span; @@ -127,7 +127,7 @@ impl<'a, 'tcx, V> TypeVisitor<'tcx> for DefIdVisitorSkeleton<'_, 'a, 'tcx, V> { fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool { let tcx = self.def_id_visitor.tcx(); - // Substs are not visited here because they are visited below in `super_visit_with`. + // InternalSubsts are not visited here because they are visited below in `super_visit_with`. match ty.sty { ty::Adt(&ty::AdtDef { did: def_id, .. }, ..) | ty::Foreign(def_id) | @@ -180,7 +180,7 @@ impl<'a, 'tcx, V> TypeVisitor<'tcx> for DefIdVisitorSkeleton<'_, 'a, 'tcx, V> ty::ExistentialPredicate::Trait(trait_ref) => trait_ref, ty::ExistentialPredicate::Projection(proj) => proj.trait_ref(tcx), ty::ExistentialPredicate::AutoTrait(def_id) => - ty::ExistentialTraitRef { def_id, substs: Substs::empty() }, + ty::ExistentialTraitRef { def_id, substs: InternalSubsts::empty() }, }; let ty::ExistentialTraitRef { def_id, substs: _ } = trait_ref; if self.def_id_visitor.visit_def_id(def_id, "trait", &trait_ref) { @@ -220,16 +220,16 @@ impl<'a, 'tcx, V> TypeVisitor<'tcx> for DefIdVisitorSkeleton<'_, 'a, 'tcx, V> fn def_id_visibility<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> (ty::Visibility, Span, &'static str) { - match tcx.hir().as_local_node_id(def_id) { - Some(node_id) => { - let vis = match tcx.hir().get(node_id) { + match tcx.hir().as_local_hir_id(def_id) { + Some(hir_id) => { + let vis = match tcx.hir().get_by_hir_id(hir_id) { Node::Item(item) => &item.vis, Node::ForeignItem(foreign_item) => &foreign_item.vis, Node::TraitItem(..) | Node::Variant(..) => { - return def_id_visibility(tcx, tcx.hir().get_parent_did(node_id)); + return def_id_visibility(tcx, tcx.hir().get_parent_did_by_hir_id(hir_id)); } Node::ImplItem(impl_item) => { - match tcx.hir().get(tcx.hir().get_parent(node_id)) { + match tcx.hir().get_by_hir_id(tcx.hir().get_parent_item(hir_id)) { Node::Item(item) => match &item.node { hir::ItemKind::Impl(.., None, _, _) => &impl_item.vis, hir::ItemKind::Impl(.., Some(trait_ref), _, _) @@ -240,16 +240,16 @@ fn def_id_visibility<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) } } Node::StructCtor(vdata) => { - let struct_node_id = tcx.hir().get_parent(node_id); - let item = match tcx.hir().get(struct_node_id) { + let struct_hir_id = tcx.hir().get_parent_item(hir_id); + let item = match tcx.hir().get_by_hir_id(struct_hir_id) { Node::Item(item) => item, node => bug!("unexpected node kind: {:?}", node), }; let (mut ctor_vis, mut span, mut descr) = - (ty::Visibility::from_hir(&item.vis, struct_node_id, tcx), + (ty::Visibility::from_hir(&item.vis, struct_hir_id, tcx), item.vis.span, item.vis.node.descr()); for field in vdata.fields() { - let field_vis = ty::Visibility::from_hir(&field.vis, node_id, tcx); + let field_vis = ty::Visibility::from_hir(&field.vis, hir_id, tcx); if ctor_vis.is_at_least(field_vis, tcx) { ctor_vis = field_vis; span = field.vis.span; @@ -260,7 +260,7 @@ fn def_id_visibility<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) // If the structure is marked as non_exhaustive then lower the // visibility to within the crate. if ctor_vis == ty::Visibility::Public { - let adt_def = tcx.adt_def(tcx.hir().get_parent_did(node_id)); + let adt_def = tcx.adt_def(tcx.hir().get_parent_did_by_hir_id(hir_id)); if adt_def.non_enum_variant().is_field_list_non_exhaustive() { ctor_vis = ty::Visibility::Restricted(DefId::local(CRATE_DEF_INDEX)); span = attr::find_by_name(&item.attrs, "non_exhaustive").unwrap().span; @@ -271,12 +271,13 @@ fn def_id_visibility<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) return (ctor_vis, span, descr); } Node::Expr(expr) => { - return (ty::Visibility::Restricted(tcx.hir().get_module_parent(expr.id)), + return (ty::Visibility::Restricted( + tcx.hir().get_module_parent_by_hir_id(expr.hir_id)), expr.span, "private") } node => bug!("unexpected node kind: {:?}", node) }; - (ty::Visibility::from_hir(vis, node_id, tcx), vis.span, vis.node.descr()) + (ty::Visibility::from_hir(vis, hir_id, tcx), vis.span, vis.node.descr()) } None => { let vis = tcx.visibility(def_id); @@ -289,10 +290,10 @@ fn def_id_visibility<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) // Set the correct `TypeckTables` for the given `item_id` (or an empty table if // there is no `TypeckTables` for the item). fn item_tables<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - node_id: ast::NodeId, + hir_id: hir::HirId, empty_tables: &'a ty::TypeckTables<'tcx>) -> &'a ty::TypeckTables<'tcx> { - let def_id = tcx.hir().local_def_id(node_id); + let def_id = tcx.hir().local_def_id_from_hir_id(hir_id); if tcx.has_typeck_tables(def_id) { tcx.typeck_tables_of(def_id) } else { empty_tables } } @@ -348,10 +349,10 @@ trait VisibilityLike: Sized { // Returns an over-approximation (`skip_assoc_tys` = true) of visibility due to // associated types for which we can't determine visibility precisely. - fn of_impl<'a, 'tcx>(node_id: ast::NodeId, tcx: TyCtxt<'a, 'tcx, 'tcx>, + fn of_impl<'a, 'tcx>(hir_id: hir::HirId, tcx: TyCtxt<'a, 'tcx, 'tcx>, access_levels: &'a AccessLevels) -> Self { let mut find = FindMin { tcx, access_levels, min: Self::MAX }; - let def_id = tcx.hir().local_def_id(node_id); + let def_id = tcx.hir().local_def_id_from_hir_id(hir_id); find.visit(tcx.type_of(def_id)); if let Some(trait_ref) = tcx.impl_trait_ref(def_id) { find.visit_trait(trait_ref); @@ -408,16 +409,18 @@ struct ReachEverythingInTheInterfaceVisitor<'b, 'a: 'b, 'tcx: 'a> { } impl<'a, 'tcx> EmbargoVisitor<'a, 'tcx> { - fn get(&self, id: ast::NodeId) -> Option { - self.access_levels.map.get(&id).cloned() + fn get(&self, id: hir::HirId) -> Option { + let node_id = self.tcx.hir().hir_to_node_id(id); + self.access_levels.map.get(&node_id).cloned() } // Updates node level and returns the updated level. - fn update(&mut self, id: ast::NodeId, level: Option) -> Option { + fn update(&mut self, id: hir::HirId, level: Option) -> Option { let old_level = self.get(id); // Accessibility levels can only grow. if level > old_level { - self.access_levels.map.insert(id, level.unwrap()); + let node_id = self.tcx.hir().hir_to_node_id(id); + self.access_levels.map.insert(node_id, level.unwrap()); self.changed = true; level } else { @@ -425,11 +428,11 @@ impl<'a, 'tcx> EmbargoVisitor<'a, 'tcx> { } } - fn reach(&mut self, item_id: ast::NodeId, access_level: Option) + fn reach(&mut self, item_id: hir::HirId, access_level: Option) -> ReachEverythingInTheInterfaceVisitor<'_, 'a, 'tcx> { ReachEverythingInTheInterfaceVisitor { access_level: cmp::min(access_level, Some(AccessLevel::Reachable)), - item_def_id: self.tcx.hir().local_def_id(item_id), + item_def_id: self.tcx.hir().local_def_id_from_hir_id(item_id), ev: self, } } @@ -463,7 +466,7 @@ impl<'a, 'tcx> EmbargoVisitor<'a, 'tcx> { let def_id = self.tcx.hir().local_def_id(item_id.id); if !self.tcx.hygienic_eq(segment.ident, item.ident, def_id) { continue; } if let hir::ItemKind::Use(..) = item.node { - self.update(item.id, Some(AccessLevel::Exported)); + self.update(item.hir_id, Some(AccessLevel::Exported)); } } } @@ -482,7 +485,7 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item) { let inherited_item_level = match item.node { hir::ItemKind::Impl(..) => - Option::::of_impl(item.id, self.tcx, &self.access_levels), + Option::::of_impl(item.hir_id, self.tcx, &self.access_levels), // Foreign modules inherit level from parents. hir::ItemKind::ForeignMod(..) => self.prev_level, // Other `pub` items inherit levels from parents. @@ -497,44 +500,44 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { }; // Update level of the item itself. - let item_level = self.update(item.id, inherited_item_level); + let item_level = self.update(item.hir_id, inherited_item_level); // Update levels of nested things. match item.node { hir::ItemKind::Enum(ref def, _) => { for variant in &def.variants { - let variant_level = self.update(variant.node.data.id(), item_level); + let variant_level = self.update(variant.node.data.hir_id(), item_level); for field in variant.node.data.fields() { - self.update(field.id, variant_level); + self.update(field.hir_id, variant_level); } } } hir::ItemKind::Impl(.., ref trait_ref, _, ref impl_item_refs) => { for impl_item_ref in impl_item_refs { if trait_ref.is_some() || impl_item_ref.vis.node.is_pub() { - self.update(impl_item_ref.id.node_id, item_level); + self.update(impl_item_ref.id.hir_id, item_level); } } } hir::ItemKind::Trait(.., ref trait_item_refs) => { for trait_item_ref in trait_item_refs { - self.update(trait_item_ref.id.node_id, item_level); + self.update(trait_item_ref.id.hir_id, item_level); } } hir::ItemKind::Struct(ref def, _) | hir::ItemKind::Union(ref def, _) => { if !def.is_struct() { - self.update(def.id(), item_level); + self.update(def.hir_id(), item_level); } for field in def.fields() { if field.vis.node.is_pub() { - self.update(field.id, item_level); + self.update(field.hir_id, item_level); } } } hir::ItemKind::ForeignMod(ref foreign_mod) => { for foreign_item in &foreign_mod.items { if foreign_item.vis.node.is_pub() { - self.update(foreign_item.id, item_level); + self.update(foreign_item.hir_id, item_level); } } } @@ -571,21 +574,21 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { // in the reachability pass (`middle/reachable.rs`). Types are marked as link-time // reachable if they are returned via `impl Trait`, even from private functions. let exist_level = cmp::max(item_level, Some(AccessLevel::ReachableFromImplTrait)); - self.reach(item.id, exist_level).generics().predicates().ty(); + self.reach(item.hir_id, exist_level).generics().predicates().ty(); } // Visit everything. hir::ItemKind::Const(..) | hir::ItemKind::Static(..) | hir::ItemKind::Fn(..) | hir::ItemKind::Ty(..) => { if item_level.is_some() { - self.reach(item.id, item_level).generics().predicates().ty(); + self.reach(item.hir_id, item_level).generics().predicates().ty(); } } hir::ItemKind::Trait(.., ref trait_item_refs) => { if item_level.is_some() { - self.reach(item.id, item_level).generics().predicates(); + self.reach(item.hir_id, item_level).generics().predicates(); for trait_item_ref in trait_item_refs { - let mut reach = self.reach(trait_item_ref.id.node_id, item_level); + let mut reach = self.reach(trait_item_ref.id.hir_id, item_level); reach.generics().predicates(); if trait_item_ref.kind == AssociatedItemKind::Type && @@ -599,18 +602,18 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { } hir::ItemKind::TraitAlias(..) => { if item_level.is_some() { - self.reach(item.id, item_level).generics().predicates(); + self.reach(item.hir_id, item_level).generics().predicates(); } } // Visit everything except for private impl items. hir::ItemKind::Impl(.., ref impl_item_refs) => { if item_level.is_some() { - self.reach(item.id, item_level).generics().predicates().ty().trait_ref(); + self.reach(item.hir_id, item_level).generics().predicates().ty().trait_ref(); for impl_item_ref in impl_item_refs { - let impl_item_level = self.get(impl_item_ref.id.node_id); + let impl_item_level = self.get(impl_item_ref.id.hir_id); if impl_item_level.is_some() { - self.reach(impl_item_ref.id.node_id, impl_item_level) + self.reach(impl_item_ref.id.hir_id, impl_item_level) .generics().predicates().ty(); } } @@ -620,26 +623,26 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { // Visit everything, but enum variants have their own levels. hir::ItemKind::Enum(ref def, _) => { if item_level.is_some() { - self.reach(item.id, item_level).generics().predicates(); + self.reach(item.hir_id, item_level).generics().predicates(); } for variant in &def.variants { - let variant_level = self.get(variant.node.data.id()); + let variant_level = self.get(variant.node.data.hir_id()); if variant_level.is_some() { for field in variant.node.data.fields() { - self.reach(field.id, variant_level).ty(); + self.reach(field.hir_id, variant_level).ty(); } // Corner case: if the variant is reachable, but its // enum is not, make the enum reachable as well. - self.update(item.id, variant_level); + self.update(item.hir_id, variant_level); } } } // Visit everything, but foreign items have their own levels. hir::ItemKind::ForeignMod(ref foreign_mod) => { for foreign_item in &foreign_mod.items { - let foreign_item_level = self.get(foreign_item.id); + let foreign_item_level = self.get(foreign_item.hir_id); if foreign_item_level.is_some() { - self.reach(foreign_item.id, foreign_item_level) + self.reach(foreign_item.hir_id, foreign_item_level) .generics().predicates().ty(); } } @@ -648,11 +651,11 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { hir::ItemKind::Struct(ref struct_def, _) | hir::ItemKind::Union(ref struct_def, _) => { if item_level.is_some() { - self.reach(item.id, item_level).generics().predicates(); + self.reach(item.hir_id, item_level).generics().predicates(); for field in struct_def.fields() { - let field_level = self.get(field.id); + let field_level = self.get(field.hir_id); if field_level.is_some() { - self.reach(field.id, field_level).ty(); + self.reach(field.hir_id, field_level).ty(); } } } @@ -682,8 +685,8 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { for export in exports.iter() { if export.vis == ty::Visibility::Public { if let Some(def_id) = export.def.opt_def_id() { - if let Some(node_id) = self.tcx.hir().as_local_node_id(def_id) { - self.update(node_id, Some(AccessLevel::Exported)); + if let Some(hir_id) = self.tcx.hir().as_local_hir_id(def_id) { + self.update(hir_id, Some(AccessLevel::Exported)); } } } @@ -696,46 +699,47 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { fn visit_macro_def(&mut self, md: &'tcx hir::MacroDef) { if md.legacy { - self.update(md.id, Some(AccessLevel::Public)); + self.update(md.hir_id, Some(AccessLevel::Public)); return } let module_did = ty::DefIdTree::parent( self.tcx, - self.tcx.hir().local_def_id(md.id) + self.tcx.hir().local_def_id_from_hir_id(md.hir_id) ).unwrap(); - let mut module_id = self.tcx.hir().as_local_node_id(module_did).unwrap(); + let mut module_id = self.tcx.hir().as_local_hir_id(module_did).unwrap(); let level = if md.vis.node.is_pub() { self.get(module_id) } else { None }; - let level = self.update(md.id, level); + let level = self.update(md.hir_id, level); if level.is_none() { return } loop { - let module = if module_id == ast::CRATE_NODE_ID { + let module = if module_id == hir::CRATE_HIR_ID { &self.tcx.hir().krate().module } else if let hir::ItemKind::Mod(ref module) = - self.tcx.hir().expect_item(module_id).node { + self.tcx.hir().expect_item_by_hir_id(module_id).node { module } else { unreachable!() }; for id in &module.item_ids { - self.update(id.id, level); + let hir_id = self.tcx.hir().node_to_hir_id(id.id); + self.update(hir_id, level); } - let def_id = self.tcx.hir().local_def_id(module_id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(module_id); if let Some(exports) = self.tcx.module_exports(def_id) { for export in exports.iter() { - if let Some(node_id) = self.tcx.hir().as_local_node_id(export.def.def_id()) { - self.update(node_id, level); + if let Some(hir_id) = self.tcx.hir().as_local_hir_id(export.def.def_id()) { + self.update(hir_id, level); } } } - if module_id == ast::CRATE_NODE_ID { + if module_id == hir::CRATE_HIR_ID { break } - module_id = self.tcx.hir().get_parent_node(module_id); + module_id = self.tcx.hir().get_parent_node_by_hir_id(module_id); } } } @@ -744,12 +748,15 @@ impl<'a, 'tcx> ReachEverythingInTheInterfaceVisitor<'_, 'a, 'tcx> { fn generics(&mut self) -> &mut Self { for param in &self.ev.tcx.generics_of(self.item_def_id).params { match param.kind { + GenericParamDefKind::Lifetime => {} GenericParamDefKind::Type { has_default, .. } => { if has_default { self.visit(self.ev.tcx.type_of(param.def_id)); } } - GenericParamDefKind::Lifetime => {} + GenericParamDefKind::Const => { + self.visit(self.ev.tcx.type_of(param.def_id)); + } } } self @@ -776,8 +783,8 @@ impl<'a, 'tcx> ReachEverythingInTheInterfaceVisitor<'_, 'a, 'tcx> { impl<'a, 'tcx> DefIdVisitor<'a, 'tcx> for ReachEverythingInTheInterfaceVisitor<'_, 'a, 'tcx> { fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { self.ev.tcx } fn visit_def_id(&mut self, def_id: DefId, _kind: &str, _descr: &dyn fmt::Display) -> bool { - if let Some(node_id) = self.ev.tcx.hir().as_local_node_id(def_id) { - self.ev.update(node_id, self.access_level); + if let Some(hir_id) = self.ev.tcx.hir().as_local_hir_id(def_id) { + self.ev.update(hir_id, self.access_level); } false } @@ -793,7 +800,7 @@ impl<'a, 'tcx> DefIdVisitor<'a, 'tcx> for ReachEverythingInTheInterfaceVisitor<' struct NamePrivacyVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, tables: &'a ty::TypeckTables<'tcx>, - current_item: ast::NodeId, + current_item: hir::HirId, empty_tables: &'a ty::TypeckTables<'tcx>, } @@ -805,7 +812,7 @@ impl<'a, 'tcx> NamePrivacyVisitor<'a, 'tcx> { def: &'tcx ty::AdtDef, // definition of the struct or enum field: &'tcx ty::FieldDef) { // definition of the field let ident = Ident::new(keywords::Invalid.name(), use_ctxt); - let current_hir = self.tcx.hir().node_to_hir_id(self.current_item); + let current_hir = self.current_item; let def_id = self.tcx.adjust_ident(ident, def.did, current_hir).1; if !def.is_enum() && !field.vis.is_accessible_from(def_id, self.tcx) { struct_span_err!(self.tcx.sess, span, E0451, "field `{}` of {} `{}` is private", @@ -836,9 +843,9 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> { } fn visit_item(&mut self, item: &'tcx hir::Item) { - let orig_current_item = mem::replace(&mut self.current_item, item.id); + let orig_current_item = mem::replace(&mut self.current_item, item.hir_id); let orig_tables = - mem::replace(&mut self.tables, item_tables(self.tcx, item.id, self.empty_tables)); + mem::replace(&mut self.tables, item_tables(self.tcx, item.hir_id, self.empty_tables)); intravisit::walk_item(self, item); self.current_item = orig_current_item; self.tables = orig_tables; @@ -846,14 +853,14 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> { fn visit_trait_item(&mut self, ti: &'tcx hir::TraitItem) { let orig_tables = - mem::replace(&mut self.tables, item_tables(self.tcx, ti.id, self.empty_tables)); + mem::replace(&mut self.tables, item_tables(self.tcx, ti.hir_id, self.empty_tables)); intravisit::walk_trait_item(self, ti); self.tables = orig_tables; } fn visit_impl_item(&mut self, ii: &'tcx hir::ImplItem) { let orig_tables = - mem::replace(&mut self.tables, item_tables(self.tcx, ii.id, self.empty_tables)); + mem::replace(&mut self.tables, item_tables(self.tcx, ii.hir_id, self.empty_tables)); intravisit::walk_impl_item(self, ii); self.tables = orig_tables; } @@ -870,7 +877,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> { // unmentioned fields, just check them all. for (vf_index, variant_field) in variant.fields.iter().enumerate() { let field = fields.iter().find(|f| { - self.tcx.field_index(f.id, self.tables) == vf_index + self.tcx.field_index(f.hir_id, self.tables) == vf_index }); let (use_ctxt, span) = match field { Some(field) => (field.ident.span, field.span), @@ -881,7 +888,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> { } else { for field in fields { let use_ctxt = field.ident.span; - let index = self.tcx.field_index(field.id, self.tables); + let index = self.tcx.field_index(field.hir_id, self.tables); self.check_field(use_ctxt, field.span, adt, &variant.fields[index]); } } @@ -900,7 +907,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> { let variant = adt.variant_of_def(def); for field in fields { let use_ctxt = field.node.ident.span; - let index = self.tcx.field_index(field.node.id, self.tables); + let index = self.tcx.field_index(field.node.hir_id, self.tables); self.check_field(use_ctxt, field.span, adt, &variant.fields[index]); } } @@ -1107,11 +1114,11 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { // Check types in item interfaces. fn visit_item(&mut self, item: &'tcx hir::Item) { - let orig_current_item = - mem::replace(&mut self.current_item, self.tcx.hir().local_def_id(item.id)); + let orig_current_item = mem::replace(&mut self.current_item, + self.tcx.hir().local_def_id_from_hir_id(item.hir_id)); let orig_in_body = mem::replace(&mut self.in_body, false); let orig_tables = - mem::replace(&mut self.tables, item_tables(self.tcx, item.id, self.empty_tables)); + mem::replace(&mut self.tables, item_tables(self.tcx, item.hir_id, self.empty_tables)); intravisit::walk_item(self, item); self.tables = orig_tables; self.in_body = orig_in_body; @@ -1120,14 +1127,14 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { fn visit_trait_item(&mut self, ti: &'tcx hir::TraitItem) { let orig_tables = - mem::replace(&mut self.tables, item_tables(self.tcx, ti.id, self.empty_tables)); + mem::replace(&mut self.tables, item_tables(self.tcx, ti.hir_id, self.empty_tables)); intravisit::walk_trait_item(self, ti); self.tables = orig_tables; } fn visit_impl_item(&mut self, ii: &'tcx hir::ImplItem) { let orig_tables = - mem::replace(&mut self.tables, item_tables(self.tcx, ii.id, self.empty_tables)); + mem::replace(&mut self.tables, item_tables(self.tcx, ii.hir_id, self.empty_tables)); intravisit::walk_impl_item(self, ii); self.tables = orig_tables; } @@ -1152,7 +1159,7 @@ struct ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx: 'a> { access_levels: &'a AccessLevels, in_variant: bool, // Set of errors produced by this obsolete visitor. - old_error_set: NodeSet, + old_error_set: HirIdSet, } struct ObsoleteCheckTypeForPrivatenessVisitor<'a, 'b: 'a, 'tcx: 'b> { @@ -1175,10 +1182,10 @@ impl<'a, 'tcx> ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { // A path can only be private if: // it's in this crate... - if let Some(node_id) = self.tcx.hir().as_local_node_id(did) { + if let Some(hir_id) = self.tcx.hir().as_local_hir_id(did) { // .. and it corresponds to a private type in the AST (this returns // `None` for type parameters). - match self.tcx.hir().find(node_id) { + match self.tcx.hir().find_by_hir_id(hir_id) { Some(Node::Item(ref item)) => !item.vis.node.is_pub(), Some(_) | None => false, } @@ -1187,22 +1194,24 @@ impl<'a, 'tcx> ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { } } - fn trait_is_public(&self, trait_id: ast::NodeId) -> bool { + fn trait_is_public(&self, trait_id: hir::HirId) -> bool { // FIXME: this would preferably be using `exported_items`, but all // traits are exported currently (see `EmbargoVisitor.exported_trait`). - self.access_levels.is_public(trait_id) + let node_id = self.tcx.hir().hir_to_node_id(trait_id); + self.access_levels.is_public(node_id) } fn check_generic_bound(&mut self, bound: &hir::GenericBound) { if let hir::GenericBound::Trait(ref trait_ref, _) = *bound { if self.path_is_private_type(&trait_ref.trait_ref.path) { - self.old_error_set.insert(trait_ref.trait_ref.ref_id); + self.old_error_set.insert(trait_ref.trait_ref.hir_ref_id); } } } - fn item_is_public(&self, id: &ast::NodeId, vis: &hir::Visibility) -> bool { - self.access_levels.is_reachable(*id) || vis.node.is_pub() + fn item_is_public(&self, id: &hir::HirId, vis: &hir::Visibility) -> bool { + let node_id = self.tcx.hir().hir_to_node_id(*id); + self.access_levels.is_reachable(node_id) || vis.node.is_pub() } } @@ -1250,7 +1259,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { hir::ItemKind::ForeignMod(_) => {} hir::ItemKind::Trait(.., ref bounds, _) => { - if !self.trait_is_public(item.id) { + if !self.trait_is_public(item.hir_id) { return } @@ -1292,8 +1301,8 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { |tr| { let did = tr.path.def.def_id(); - if let Some(node_id) = self.tcx.hir().as_local_node_id(did) { - self.trait_is_public(node_id) + if let Some(hir_id) = self.tcx.hir().as_local_hir_id(did) { + self.trait_is_public(hir_id) } else { true // external traits must be public } @@ -1315,7 +1324,9 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { match impl_item.node { hir::ImplItemKind::Const(..) | hir::ImplItemKind::Method(..) => { - self.access_levels.is_reachable(impl_item.id) + self.access_levels.is_reachable( + self.tcx.hir().hir_to_node_id( + impl_item_ref.id.hir_id)) } hir::ImplItemKind::Existential(..) | hir::ImplItemKind::Type(_) => false, @@ -1340,7 +1351,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { match impl_item.node { hir::ImplItemKind::Const(..) | hir::ImplItemKind::Method(..) - if self.item_is_public(&impl_item.id, &impl_item.vis) => + if self.item_is_public(&impl_item.hir_id, &impl_item.vis) => { intravisit::walk_impl_item(self, impl_item) } @@ -1381,7 +1392,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { // methods will be visible as `Public::foo`. let mut found_pub_static = false; for impl_item_ref in impl_item_refs { - if self.item_is_public(&impl_item_ref.id.node_id, &impl_item_ref.vis) { + if self.item_is_public(&impl_item_ref.id.hir_id, &impl_item_ref.vis) { let impl_item = self.tcx.hir().impl_item(impl_item_ref.id); match impl_item_ref.kind { AssociatedItemKind::Const => { @@ -1408,7 +1419,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { hir::ItemKind::Ty(..) => return, // Not at all public, so we don't care. - _ if !self.item_is_public(&item.id, &item.vis) => { + _ if !self.item_is_public(&item.hir_id, &item.vis) => { return; } @@ -1444,7 +1455,8 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { } fn visit_foreign_item(&mut self, item: &'tcx hir::ForeignItem) { - if self.access_levels.is_reachable(item.id) { + let node_id = self.tcx.hir().hir_to_node_id(item.hir_id); + if self.access_levels.is_reachable(node_id) { intravisit::walk_foreign_item(self, item) } } @@ -1452,7 +1464,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { fn visit_ty(&mut self, t: &'tcx hir::Ty) { if let hir::TyKind::Path(hir::QPath::Resolved(_, ref path)) = t.node { if self.path_is_private_type(path) { - self.old_error_set.insert(t.id); + self.old_error_set.insert(t.hir_id); } } intravisit::walk_ty(self, t) @@ -1462,7 +1474,8 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { v: &'tcx hir::Variant, g: &'tcx hir::Generics, item_id: hir::HirId) { - if self.access_levels.is_reachable(v.node.data.id()) { + let node_id = self.tcx.hir().hir_to_node_id(v.node.data.hir_id()); + if self.access_levels.is_reachable(node_id) { self.in_variant = true; intravisit::walk_variant(self, v, g, item_id); self.in_variant = false; @@ -1492,7 +1505,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { struct SearchInterfaceForPrivateItemsVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, - item_id: ast::NodeId, + item_id: hir::HirId, item_def_id: DefId, span: Span, /// The visitor checks that each component type is at least this visible. @@ -1507,12 +1520,15 @@ impl<'a, 'tcx: 'a> SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { fn generics(&mut self) -> &mut Self { for param in &self.tcx.generics_of(self.item_def_id).params { match param.kind { + GenericParamDefKind::Lifetime => {} GenericParamDefKind::Type { has_default, .. } => { if has_default { self.visit(self.tcx.type_of(param.def_id)); } } - GenericParamDefKind::Lifetime => {} + GenericParamDefKind::Const => { + self.visit(self.tcx.type_of(param.def_id)); + } } } self @@ -1536,17 +1552,17 @@ impl<'a, 'tcx: 'a> SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { fn check_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool { if self.leaks_private_dep(def_id) { - self.tcx.lint_node(lint::builtin::EXPORTED_PRIVATE_DEPENDENCIES, - self.item_id, - self.span, - &format!("{} `{}` from private dependency '{}' in public \ - interface", kind, descr, - self.tcx.crate_name(def_id.krate))); + self.tcx.lint_hir(lint::builtin::EXPORTED_PRIVATE_DEPENDENCIES, + self.item_id, + self.span, + &format!("{} `{}` from private dependency '{}' in public \ + interface", kind, descr, + self.tcx.crate_name(def_id.krate))); } - let node_id = match self.tcx.hir().as_local_node_id(def_id) { - Some(node_id) => node_id, + let hir_id = match self.tcx.hir().as_local_hir_id(def_id) { + Some(hir_id) => hir_id, None => return false, }; @@ -1564,8 +1580,8 @@ impl<'a, 'tcx: 'a> SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { err.emit(); } else { let err_code = if kind == "trait" { "E0445" } else { "E0446" }; - self.tcx.lint_node(lint::builtin::PRIVATE_IN_PUBLIC, node_id, self.span, - &format!("{} (error {})", msg, err_code)); + self.tcx.lint_hir(lint::builtin::PRIVATE_IN_PUBLIC, hir_id, self.span, + &format!("{} (error {})", msg, err_code)); } } @@ -1596,12 +1612,12 @@ impl<'a, 'tcx> DefIdVisitor<'a, 'tcx> for SearchInterfaceForPrivateItemsVisitor< struct PrivateItemsInPublicInterfacesVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, has_pub_restricted: bool, - old_error_set: &'a NodeSet, + old_error_set: &'a HirIdSet, private_crates: FxHashSet } impl<'a, 'tcx> PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> { - fn check(&self, item_id: ast::NodeId, required_visibility: ty::Visibility) + fn check(&self, item_id: hir::HirId, required_visibility: ty::Visibility) -> SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { let mut has_old_errors = false; @@ -1614,7 +1630,7 @@ impl<'a, 'tcx> PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> { has_old_errors = true; break; } - let parent = self.tcx.hir().get_parent_node(id); + let parent = self.tcx.hir().get_parent_node_by_hir_id(id); if parent == id { break; } @@ -1629,8 +1645,8 @@ impl<'a, 'tcx> PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> { SearchInterfaceForPrivateItemsVisitor { tcx: self.tcx, item_id, - item_def_id: self.tcx.hir().local_def_id(item_id), - span: self.tcx.hir().span(item_id), + item_def_id: self.tcx.hir().local_def_id_from_hir_id(item_id), + span: self.tcx.hir().span_by_hir_id(item_id), required_visibility, has_pub_restricted: self.has_pub_restricted, has_old_errors, @@ -1639,9 +1655,9 @@ impl<'a, 'tcx> PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> { } } - fn check_trait_or_impl_item(&self, node_id: ast::NodeId, assoc_item_kind: AssociatedItemKind, + fn check_trait_or_impl_item(&self, hir_id: hir::HirId, assoc_item_kind: AssociatedItemKind, defaultness: hir::Defaultness, vis: ty::Visibility) { - let mut check = self.check(node_id, vis); + let mut check = self.check(hir_id, vis); let (check_ty, is_assoc_ty) = match assoc_item_kind { AssociatedItemKind::Const | AssociatedItemKind::Method { .. } => (true, false), @@ -1665,7 +1681,7 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> fn visit_item(&mut self, item: &'tcx hir::Item) { let tcx = self.tcx; - let item_visibility = ty::Visibility::from_hir(&item.vis, item.id, tcx); + let item_visibility = ty::Visibility::from_hir(&item.vis, item.hir_id, tcx); match item.node { // Crates are always public. @@ -1679,48 +1695,48 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> // Subitems of these items have inherited publicity. hir::ItemKind::Const(..) | hir::ItemKind::Static(..) | hir::ItemKind::Fn(..) | hir::ItemKind::Ty(..) => { - self.check(item.id, item_visibility).generics().predicates().ty(); + self.check(item.hir_id, item_visibility).generics().predicates().ty(); } hir::ItemKind::Existential(..) => { // `ty()` for existential types is the underlying type, // it's not a part of interface, so we skip it. - self.check(item.id, item_visibility).generics().predicates(); + self.check(item.hir_id, item_visibility).generics().predicates(); } hir::ItemKind::Trait(.., ref trait_item_refs) => { - self.check(item.id, item_visibility).generics().predicates(); + self.check(item.hir_id, item_visibility).generics().predicates(); for trait_item_ref in trait_item_refs { - self.check_trait_or_impl_item(trait_item_ref.id.node_id, trait_item_ref.kind, + self.check_trait_or_impl_item(trait_item_ref.id.hir_id, trait_item_ref.kind, trait_item_ref.defaultness, item_visibility); } } hir::ItemKind::TraitAlias(..) => { - self.check(item.id, item_visibility).generics().predicates(); + self.check(item.hir_id, item_visibility).generics().predicates(); } hir::ItemKind::Enum(ref def, _) => { - self.check(item.id, item_visibility).generics().predicates(); + self.check(item.hir_id, item_visibility).generics().predicates(); for variant in &def.variants { for field in variant.node.data.fields() { - self.check(field.id, item_visibility).ty(); + self.check(field.hir_id, item_visibility).ty(); } } } // Subitems of foreign modules have their own publicity. hir::ItemKind::ForeignMod(ref foreign_mod) => { for foreign_item in &foreign_mod.items { - let vis = ty::Visibility::from_hir(&foreign_item.vis, item.id, tcx); - self.check(foreign_item.id, vis).generics().predicates().ty(); + let vis = ty::Visibility::from_hir(&foreign_item.vis, item.hir_id, tcx); + self.check(foreign_item.hir_id, vis).generics().predicates().ty(); } } // Subitems of structs and unions have their own publicity. hir::ItemKind::Struct(ref struct_def, _) | hir::ItemKind::Union(ref struct_def, _) => { - self.check(item.id, item_visibility).generics().predicates(); + self.check(item.hir_id, item_visibility).generics().predicates(); for field in struct_def.fields() { - let field_visibility = ty::Visibility::from_hir(&field.vis, item.id, tcx); - self.check(field.id, min(item_visibility, field_visibility, tcx)).ty(); + let field_visibility = ty::Visibility::from_hir(&field.vis, item.hir_id, tcx); + self.check(field.hir_id, min(item_visibility, field_visibility, tcx)).ty(); } } // An inherent impl is public when its type is public @@ -1728,16 +1744,18 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> // A trait impl is public when both its type and its trait are public // Subitems of trait impls have inherited publicity. hir::ItemKind::Impl(.., ref trait_ref, _, ref impl_item_refs) => { - let impl_vis = ty::Visibility::of_impl(item.id, tcx, &Default::default()); - self.check(item.id, impl_vis).generics().predicates(); + let impl_vis = ty::Visibility::of_impl(item.hir_id, tcx, &Default::default()); + self.check(item.hir_id, impl_vis).generics().predicates(); for impl_item_ref in impl_item_refs { let impl_item = tcx.hir().impl_item(impl_item_ref.id); let impl_item_vis = if trait_ref.is_none() { - min(ty::Visibility::from_hir(&impl_item.vis, item.id, tcx), impl_vis, tcx) + min(ty::Visibility::from_hir(&impl_item.vis, item.hir_id, tcx), + impl_vis, + tcx) } else { impl_vis }; - self.check_trait_or_impl_item(impl_item_ref.id.node_id, impl_item_ref.kind, + self.check_trait_or_impl_item(impl_item_ref.id.hir_id, impl_item_ref.kind, impl_item_ref.defaultness, impl_item_vis); } } @@ -1748,24 +1766,20 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> pub fn provide(providers: &mut Providers<'_>) { *providers = Providers { privacy_access_levels, + check_private_in_public, check_mod_privacy, ..*providers }; } -pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Lrc { - tcx.privacy_access_levels(LOCAL_CRATE) -} - fn check_mod_privacy<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { let empty_tables = ty::TypeckTables::empty(None); - // Check privacy of names not checked in previous compilation stages. let mut visitor = NamePrivacyVisitor { tcx, tables: &empty_tables, - current_item: DUMMY_NODE_ID, + current_item: hir::DUMMY_HIR_ID, empty_tables: &empty_tables, }; let (module, span, node_id) = tcx.hir().get_module(module_def_id); @@ -1791,18 +1805,6 @@ fn privacy_access_levels<'tcx>( ) -> Lrc { assert_eq!(krate, LOCAL_CRATE); - let krate = tcx.hir().krate(); - - for &module in krate.modules.keys() { - tcx.ensure().check_mod_privacy(tcx.hir().local_def_id(module)); - } - - let private_crates: FxHashSet = tcx.sess.opts.extern_private.iter() - .flat_map(|c| { - tcx.crates().iter().find(|&&krate| &tcx.crate_name(krate) == c).cloned() - }).collect(); - - // Build up a set of all exported items in the AST. This is a set of all // items which are reachable from external crates based on visibility. let mut visitor = EmbargoVisitor { @@ -1812,45 +1814,55 @@ fn privacy_access_levels<'tcx>( changed: false, }; loop { - intravisit::walk_crate(&mut visitor, krate); + intravisit::walk_crate(&mut visitor, tcx.hir().krate()); if visitor.changed { visitor.changed = false; } else { break } } - visitor.update(ast::CRATE_NODE_ID, Some(AccessLevel::Public)); - - { - let mut visitor = ObsoleteVisiblePrivateTypesVisitor { - tcx, - access_levels: &visitor.access_levels, - in_variant: false, - old_error_set: Default::default(), - }; - intravisit::walk_crate(&mut visitor, krate); - - - let has_pub_restricted = { - let mut pub_restricted_visitor = PubRestrictedVisitor { - tcx, - has_pub_restricted: false - }; - intravisit::walk_crate(&mut pub_restricted_visitor, krate); - pub_restricted_visitor.has_pub_restricted - }; - - // Check for private types and traits in public interfaces. - let mut visitor = PrivateItemsInPublicInterfacesVisitor { - tcx, - has_pub_restricted, - old_error_set: &visitor.old_error_set, - private_crates - }; - krate.visit_all_item_likes(&mut DeepVisitor::new(&mut visitor)); - } + visitor.update(hir::CRATE_HIR_ID, Some(AccessLevel::Public)); Lrc::new(visitor.access_levels) } +fn check_private_in_public<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, krate: CrateNum) { + assert_eq!(krate, LOCAL_CRATE); + + let access_levels = tcx.privacy_access_levels(LOCAL_CRATE); + + let krate = tcx.hir().krate(); + + let mut visitor = ObsoleteVisiblePrivateTypesVisitor { + tcx, + access_levels: &access_levels, + in_variant: false, + old_error_set: Default::default(), + }; + intravisit::walk_crate(&mut visitor, krate); + + let has_pub_restricted = { + let mut pub_restricted_visitor = PubRestrictedVisitor { + tcx, + has_pub_restricted: false + }; + intravisit::walk_crate(&mut pub_restricted_visitor, krate); + pub_restricted_visitor.has_pub_restricted + }; + + let private_crates: FxHashSet = tcx.sess.opts.extern_private.iter() + .flat_map(|c| { + tcx.crates().iter().find(|&&krate| &tcx.crate_name(krate) == c).cloned() + }).collect(); + + // Check for private types and traits in public interfaces. + let mut visitor = PrivateItemsInPublicInterfacesVisitor { + tcx, + has_pub_restricted, + old_error_set: &visitor.old_error_set, + private_crates + }; + krate.visit_all_item_likes(&mut DeepVisitor::new(&mut visitor)); +} + __build_diagnostic_array! { librustc_privacy, DIAGNOSTICS } diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index 29de5308a3cd..5c9927011a70 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -131,12 +131,9 @@ impl<'a> Resolver<'a> { // so prefixes are prepended with crate root segment if necessary. // The root is prepended lazily, when the first non-empty prefix or terminating glob // appears, so imports in braced groups can have roots prepended independently. - // 2015 identifiers used on global 2018 edition enter special "virtual 2015 mode", don't - // get crate root prepended, but get special treatment during in-scope resolution instead. let is_glob = if let ast::UseTreeKind::Glob = use_tree.kind { true } else { false }; let crate_root = match prefix_iter.peek() { - Some(seg) if !seg.ident.is_path_segment_keyword() && - seg.ident.span.rust_2015() && self.session.rust_2015() => { + Some(seg) if !seg.ident.is_path_segment_keyword() && seg.ident.span.rust_2015() => { Some(seg.ident.span.ctxt()) } None if is_glob && use_tree.span.rust_2015() => { diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 1a7744786d80..ac149be4b2a8 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -137,6 +137,9 @@ impl Ord for BindingError { } } +/// A span, message, replacement text, and applicability. +type Suggestion = (Span, String, String, Applicability); + enum ResolutionError<'a> { /// Error E0401: can't use type or const parameters from outer function. GenericParamsFromOuterFunction(Def), @@ -166,7 +169,7 @@ enum ResolutionError<'a> { /// Error E0431: `self` import can only appear in an import list with a non-empty prefix. SelfImportOnlyInImportListWithNonEmptyPrefix, /// Error E0433: failed to resolve. - FailedToResolve(&'a str), + FailedToResolve { label: String, suggestion: Option }, /// Error E0434: can't capture dynamic environment in a fn item. CannotCaptureDynamicEnvironmentInFnItem, /// Error E0435: attempt to use a non-constant value in a constant. @@ -380,10 +383,15 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver<'_>, err.span_label(span, "can only appear in an import list with a non-empty prefix"); err } - ResolutionError::FailedToResolve(msg) => { + ResolutionError::FailedToResolve { label, suggestion } => { let mut err = struct_span_err!(resolver.session, span, E0433, - "failed to resolve: {}", msg); - err.span_label(span, msg); + "failed to resolve: {}", &label); + err.span_label(span, label); + + if let Some((span, msg, suggestion, applicability)) = suggestion { + err.span_suggestion(span, &msg, suggestion, applicability); + } + err } ResolutionError::CannotCaptureDynamicEnvironmentInFnItem => { @@ -806,9 +814,9 @@ impl<'a, 'tcx> Visitor<'tcx> for Resolver<'a> { debug!("(resolving function) entering function"); let (rib_kind, asyncness) = match function_kind { FnKind::ItemFn(_, ref header, ..) => - (ItemRibKind, header.asyncness), + (ItemRibKind, header.asyncness.node), FnKind::Method(_, ref sig, _, _) => - (TraitOrImplItemRibKind, sig.header.asyncness), + (TraitOrImplItemRibKind, sig.header.asyncness.node), FnKind::Closure(_) => // Async closures aren't resolved through `visit_fn`-- they're // processed separately @@ -863,7 +871,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Resolver<'a> { fn visit_generics(&mut self, generics: &'tcx Generics) { // For type parameter defaults, we have to ban access - // to following type parameters, as the Substs can only + // to following type parameters, as the InternalSubsts can only // provide previous type parameters as they're built. We // put all the parameters on the ban list and then remove // them one by one as they are processed and become available. @@ -1050,7 +1058,12 @@ enum PathResult<'a> { Module(ModuleOrUniformRoot<'a>), NonModule(PathResolution), Indeterminate, - Failed(Span, String, bool /* is the error from the last segment? */), + Failed { + span: Span, + label: String, + suggestion: Option, + is_error_from_last_segment: bool, + }, } enum ModuleKind { @@ -1260,7 +1273,6 @@ struct UseError<'a> { #[derive(Clone, Copy, PartialEq, Debug)] enum AmbiguityKind { Import, - AbsolutePath, BuiltinAttr, DeriveHelper, LegacyHelperVsPrelude, @@ -1276,8 +1288,6 @@ impl AmbiguityKind { match self { AmbiguityKind::Import => "name vs any other name during import resolution", - AmbiguityKind::AbsolutePath => - "name in the crate root vs extern crate during absolute path resolution", AmbiguityKind::BuiltinAttr => "built-in attribute vs any other name", AmbiguityKind::DeriveHelper => @@ -1775,13 +1785,18 @@ impl<'a> Resolver<'a> { PathResult::NonModule(path_res) if path_res.unresolved_segments() == 0 => path_res.base_def(), PathResult::NonModule(..) => { - let msg = "type-relative paths are not supported in this context"; - error_callback(self, span, ResolutionError::FailedToResolve(msg)); + error_callback(self, span, ResolutionError::FailedToResolve { + label: String::from("type-relative paths are not supported in this context"), + suggestion: None, + }); Def::Err } PathResult::Module(..) | PathResult::Indeterminate => unreachable!(), - PathResult::Failed(span, msg, _) => { - error_callback(self, span, ResolutionError::FailedToResolve(&msg)); + PathResult::Failed { span, label, suggestion, .. } => { + error_callback(self, span, ResolutionError::FailedToResolve { + label, + suggestion, + }); Def::Err } }; @@ -3429,7 +3444,7 @@ impl<'a> Resolver<'a> { // Such behavior is required for backward compatibility. // The same fallback is used when `a` resolves to nothing. PathResult::Module(ModuleOrUniformRoot::Module(_)) | - PathResult::Failed(..) + PathResult::Failed { .. } if (ns == TypeNS || path.len() > 1) && self.primitive_type_table.primitive_types .contains_key(&path[0].ident.name) => { @@ -3438,11 +3453,11 @@ impl<'a> Resolver<'a> { } PathResult::Module(ModuleOrUniformRoot::Module(module)) => PathResolution::new(module.def().unwrap()), - PathResult::Failed(span, msg, false) => { - resolve_error(self, span, ResolutionError::FailedToResolve(&msg)); + PathResult::Failed { is_error_from_last_segment: false, span, label, suggestion } => { + resolve_error(self, span, ResolutionError::FailedToResolve { label, suggestion }); err_path_resolution() } - PathResult::Module(..) | PathResult::Failed(..) => return None, + PathResult::Module(..) | PathResult::Failed { .. } => return None, PathResult::Indeterminate => bug!("indetermined path result in resolve_qpath"), }; @@ -3550,7 +3565,12 @@ impl<'a> Resolver<'a> { } } let msg = "there are too many initial `super`s.".to_string(); - return PathResult::Failed(ident.span, msg, false); + return PathResult::Failed { + span: ident.span, + label: msg, + suggestion: None, + is_error_from_last_segment: false, + }; } if i == 0 { if name == keywords::SelfLower.name() { @@ -3587,12 +3607,17 @@ impl<'a> Resolver<'a> { } else { format!("`{}`", name) }; - let msg = if i == 1 && path[0].ident.name == keywords::PathRoot.name() { + let label = if i == 1 && path[0].ident.name == keywords::PathRoot.name() { format!("global paths cannot start with {}", name_str) } else { format!("{} in paths can only be used in start position", name_str) }; - return PathResult::Failed(ident.span, msg, false); + return PathResult::Failed { + span: ident.span, + label, + suggestion: None, + is_error_from_last_segment: false, + }; } let binding = if let Some(module) = module { @@ -3653,9 +3678,12 @@ impl<'a> Resolver<'a> { def, path.len() - i - 1 )); } else { - return PathResult::Failed(ident.span, - format!("not a module `{}`", ident), - is_last); + return PathResult::Failed { + span: ident.span, + label: format!("not a module `{}`", ident), + suggestion: None, + is_error_from_last_segment: is_last, + }; } } Err(Undetermined) => return PathResult::Indeterminate, @@ -3671,7 +3699,7 @@ impl<'a> Resolver<'a> { Some(ModuleOrUniformRoot::Module(module)) => module.def(), _ => None, }; - let msg = if module_def == self.graph_root.def() { + let (label, suggestion) = if module_def == self.graph_root.def() { let is_mod = |def| match def { Def::Mod(..) => true, _ => false }; let mut candidates = self.lookup_import_candidates(ident, TypeNS, is_mod); @@ -3679,19 +3707,32 @@ impl<'a> Resolver<'a> { (c.path.segments.len(), c.path.to_string()) }); if let Some(candidate) = candidates.get(0) { - format!("did you mean `{}`?", candidate.path) + ( + String::from("unresolved import"), + Some(( + ident.span, + String::from("a similar path exists"), + candidate.path.to_string(), + Applicability::MaybeIncorrect, + )), + ) } else if !ident.is_reserved() { - format!("maybe a missing `extern crate {};`?", ident) + (format!("maybe a missing `extern crate {};`?", ident), None) } else { // the parser will already have complained about the keyword being used return PathResult::NonModule(err_path_resolution()); } } else if i == 0 { - format!("use of undeclared type or module `{}`", ident) + (format!("use of undeclared type or module `{}`", ident), None) } else { - format!("could not find `{}` in `{}`", ident, path[i - 1].ident) + (format!("could not find `{}` in `{}`", ident, path[i - 1].ident), None) + }; + return PathResult::Failed { + span: ident.span, + label, + suggestion, + is_error_from_last_segment: is_last, }; - return PathResult::Failed(ident.span, msg, is_last); } } } diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index 63f752ac9c94..21ca8ea369fd 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -426,9 +426,9 @@ impl<'a> Resolver<'a> { Ok(path_res.base_def()) } PathResult::Indeterminate if !force => return Err(Determinacy::Undetermined), - PathResult::NonModule(..) | PathResult::Indeterminate | PathResult::Failed(..) => { - Err(Determinacy::Determined) - } + PathResult::NonModule(..) + | PathResult::Indeterminate + | PathResult::Failed { .. } => Err(Determinacy::Determined), PathResult::Module(..) => unreachable!(), }; @@ -572,7 +572,7 @@ impl<'a> Resolver<'a> { ScopeSet::Module => (TypeNS, None, false, false), }; let mut where_to_resolve = match ns { - _ if is_absolute_path || is_import && rust_2015 => WhereToResolve::CrateRoot, + _ if is_absolute_path => WhereToResolve::CrateRoot, TypeNS | ValueNS => WhereToResolve::Module(parent_scope.module), MacroNS => WhereToResolve::DeriveHelpers, }; @@ -770,8 +770,6 @@ impl<'a> Resolver<'a> { let ambiguity_error_kind = if is_import { Some(AmbiguityKind::Import) - } else if is_absolute_path { - Some(AmbiguityKind::AbsolutePath) } else if innermost_def == builtin || def == builtin { Some(AmbiguityKind::BuiltinAttr) } else if innermost_def == derive_helper || def == derive_helper { @@ -841,18 +839,13 @@ impl<'a> Resolver<'a> { LegacyScope::Empty => WhereToResolve::Module(parent_scope.module), LegacyScope::Uninitialized => unreachable!(), } - WhereToResolve::CrateRoot if is_import => match ns { - TypeNS | ValueNS => WhereToResolve::Module(parent_scope.module), - MacroNS => WhereToResolve::DeriveHelpers, - } - WhereToResolve::CrateRoot if is_absolute_path => match ns { + WhereToResolve::CrateRoot => match ns { TypeNS => { ident.span.adjust(Mark::root()); WhereToResolve::ExternPrelude } ValueNS | MacroNS => break, } - WhereToResolve::CrateRoot => unreachable!(), WhereToResolve::Module(module) => { match self.hygienic_lexical_parent(module, &mut ident.span) { Some(parent_module) => WhereToResolve::Module(parent_module), @@ -885,44 +878,7 @@ impl<'a> Resolver<'a> { } // The first found solution was the only one, return it. - if let Some((binding, flags)) = innermost_result { - // We get to here only if there's no ambiguity, in ambiguous cases an error will - // be reported anyway, so there's no reason to report an additional feature error. - // The `binding` can actually be introduced by something other than `--extern`, - // but its `Def` should coincide with a crate passed with `--extern` - // (otherwise there would be ambiguity) and we can skip feature error in this case. - 'ok: { - if !is_import || !rust_2015 { - break 'ok; - } - if ns == TypeNS && use_prelude && self.extern_prelude_get(ident, true).is_some() { - break 'ok; - } - let root_ident = Ident::new(keywords::PathRoot.name(), orig_ident.span); - let root_module = self.resolve_crate_root(root_ident); - if self.resolve_ident_in_module_ext(ModuleOrUniformRoot::Module(root_module), - orig_ident, ns, None, false, path_span) - .is_ok() { - break 'ok; - } - - let msg = "imports can only refer to extern crate names passed with \ - `--extern` in macros originating from 2015 edition"; - let mut err = self.session.struct_span_err(ident.span, msg); - let what = self.binding_description(binding, ident, - flags.contains(Flags::MISC_FROM_PRELUDE)); - let note_msg = format!("this import refers to {what}", what = what); - let label_span = if binding.span.is_dummy() { - err.note(¬e_msg); - ident.span - } else { - err.span_note(binding.span, ¬e_msg); - binding.span - }; - err.span_label(label_span, "not an extern crate passed with `--extern`"); - err.emit(); - } - + if let Some((binding, _)) = innermost_result { return Ok(binding); } @@ -990,14 +946,17 @@ impl<'a> Resolver<'a> { let def = path_res.base_def(); check_consistency(self, &path, path_span, kind, initial_def, def); } - path_res @ PathResult::NonModule(..) | path_res @ PathResult::Failed(..) => { - let (span, msg) = if let PathResult::Failed(span, msg, ..) = path_res { - (span, msg) + path_res @ PathResult::NonModule(..) | path_res @ PathResult::Failed { .. } => { + let (span, label) = if let PathResult::Failed { span, label, .. } = path_res { + (span, label) } else { (path_span, format!("partially resolved path in {} {}", kind.article(), kind.descr())) }; - resolve_error(self, span, ResolutionError::FailedToResolve(&msg)); + resolve_error(self, span, ResolutionError::FailedToResolve { + label, + suggestion: None + }); } PathResult::Module(..) | PathResult::Indeterminate => unreachable!(), } diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index b930c30c5119..9daffd522bf2 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -6,9 +6,11 @@ use crate::Namespace::{self, TypeNS, MacroNS}; use crate::{NameBinding, NameBindingKind, ToNameBinding, PathResult, PrivacyError}; use crate::{Resolver, Segment}; use crate::{names_to_string, module_to_string}; -use crate::{resolve_error, ResolutionError}; +use crate::{resolve_error, ResolutionError, Suggestion}; use crate::macros::ParentScope; +use errors::Applicability; + use rustc_data_structures::ptr_key::PtrKey; use rustc::ty; use rustc::lint::builtin::BuiltinLintDiagnostics; @@ -27,7 +29,7 @@ use syntax::util::lev_distance::find_best_match_for_name; use syntax::{struct_span_err, unwrap_or}; use syntax_pos::{MultiSpan, Span}; -use log::debug; +use log::*; use std::cell::{Cell, RefCell}; use std::{mem, ptr}; @@ -623,6 +625,16 @@ impl<'a> Resolver<'a> { } } +/// An error that may be transformed into a diagnostic later. Used to combine multiple unresolved +/// import errors within the same use tree into a single diagnostic. +#[derive(Debug, Clone)] +struct UnresolvedImportError { + span: Span, + label: Option, + note: Option, + suggestion: Option, +} + pub struct ImportResolver<'a, 'b: 'a> { pub resolver: &'a mut Resolver<'b>, } @@ -675,14 +687,14 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { self.finalize_resolutions_in(module); } - let mut errors = false; + let mut has_errors = false; let mut seen_spans = FxHashSet::default(); - let mut error_vec = Vec::new(); + let mut errors = vec![]; let mut prev_root_id: NodeId = NodeId::from_u32(0); for i in 0 .. self.determined_imports.len() { let import = self.determined_imports[i]; - if let Some((span, err, note)) = self.finalize_import(import) { - errors = true; + if let Some(err) = self.finalize_import(import) { + has_errors = true; if let SingleImport { source, ref source_bindings, .. } = import.subclass { if source.name == "self" { @@ -696,37 +708,36 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { // If the error is a single failed import then create a "fake" import // resolution for it so that later resolve stages won't complain. self.import_dummy_binding(import); - if prev_root_id.as_u32() != 0 && - prev_root_id.as_u32() != import.root_id.as_u32() && - !error_vec.is_empty(){ - // in case of new import line, throw diagnostic message - // for previous line. - let mut empty_vec = vec![]; - mem::swap(&mut empty_vec, &mut error_vec); - self.throw_unresolved_import_error(empty_vec, None); + if prev_root_id.as_u32() != 0 + && prev_root_id.as_u32() != import.root_id.as_u32() + && !errors.is_empty() { + // In the case of a new import line, throw a diagnostic message + // for the previous line. + self.throw_unresolved_import_error(errors, None); + errors = vec![]; } - if !seen_spans.contains(&span) { + if !seen_spans.contains(&err.span) { let path = import_path_to_string( &import.module_path.iter().map(|seg| seg.ident).collect::>(), &import.subclass, - span, + err.span, ); - error_vec.push((span, path, err, note)); - seen_spans.insert(span); + seen_spans.insert(err.span); + errors.push((path, err)); prev_root_id = import.root_id; } } } - if !error_vec.is_empty() { - self.throw_unresolved_import_error(error_vec.clone(), None); + if !errors.is_empty() { + self.throw_unresolved_import_error(errors.clone(), None); } // Report unresolved imports only if no hard error was already reported // to avoid generating multiple errors on the same import. - if !errors { + if !has_errors { for import in &self.indeterminate_imports { - self.throw_unresolved_import_error(error_vec, Some(MultiSpan::from(import.span))); + self.throw_unresolved_import_error(errors, Some(MultiSpan::from(import.span))); break; } } @@ -734,44 +745,58 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { fn throw_unresolved_import_error( &self, - error_vec: Vec<(Span, String, String, Option)>, + errors: Vec<(String, UnresolvedImportError)>, span: Option, ) { - let max_span_label_msg_count = 10; // upper limit on number of span_label message. - let (span, msg, note) = if error_vec.is_empty() { + /// Upper limit on the number of `span_label` messages. + const MAX_LABEL_COUNT: usize = 10; + + let (span, msg, note) = if errors.is_empty() { (span.unwrap(), "unresolved import".to_string(), None) } else { let span = MultiSpan::from_spans( - error_vec.clone().into_iter() - .map(|elem: (Span, String, String, Option)| elem.0) - .collect() + errors + .iter() + .map(|(_, err)| err.span) + .collect(), ); - let note: Option = error_vec.clone().into_iter() - .filter_map(|elem: (Span, String, String, Option)| elem.3) + let note = errors + .iter() + .filter_map(|(_, err)| err.note.as_ref()) .last(); - let path_vec: Vec = error_vec.clone().into_iter() - .map(|elem: (Span, String, String, Option)| format!("`{}`", elem.1)) - .collect(); - let path = path_vec.join(", "); + let paths = errors + .iter() + .map(|(path, _)| format!("`{}`", path)) + .collect::>(); + let msg = format!( "unresolved import{} {}", - if path_vec.len() > 1 { "s" } else { "" }, - path + if paths.len() > 1 { "s" } else { "" }, + paths.join(", "), ); (span, msg, note) }; - let mut err = struct_span_err!(self.resolver.session, span, E0432, "{}", &msg); - for span_error in error_vec.into_iter().take(max_span_label_msg_count) { - err.span_label(span_error.0, span_error.2); + let mut diag = struct_span_err!(self.resolver.session, span, E0432, "{}", &msg); + + if let Some(note) = ¬e { + diag.note(note); } - if let Some(note) = note { - err.note(¬e); + + for (_, err) in errors.into_iter().take(MAX_LABEL_COUNT) { + if let Some(label) = err.label { + diag.span_label(err.span, label); + } + + if let Some((span, msg, suggestion, applicability)) = err.suggestion { + diag.span_suggestion(span, &msg, suggestion, applicability); + } } - err.emit(); + + diag.emit(); } /// Attempts to resolve the given import, returning true if its resolution is determined. @@ -802,7 +827,7 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { match path_res { PathResult::Module(module) => module, PathResult::Indeterminate => return false, - PathResult::NonModule(..) | PathResult::Failed(..) => return true, + PathResult::NonModule(..) | PathResult::Failed { .. } => return true, } }; @@ -866,11 +891,14 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { !indeterminate } - // If appropriate, returns an error to report. + /// Performs final import resolution, consistency checks and error reporting. + /// + /// Optionally returns an unresolved import error. This error is buffered and used to + /// consolidate multiple unresolved import errors into a single diagnostic. fn finalize_import( &mut self, directive: &'b ImportDirective<'b> - ) -> Option<(Span, String, Option)> { + ) -> Option { self.current_module = directive.parent_scope.module; let orig_vis = directive.vis.replace(ty::Visibility::Invisible); @@ -896,25 +924,48 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { module } - PathResult::Failed(span, msg, false) => { + PathResult::Failed { is_error_from_last_segment: false, span, label, suggestion } => { if no_ambiguity { assert!(directive.imported_module.get().is_none()); - resolve_error(self, span, ResolutionError::FailedToResolve(&msg)); + resolve_error(self, span, ResolutionError::FailedToResolve { + label, + suggestion, + }); } return None; } - PathResult::Failed(span, msg, true) => { + PathResult::Failed { is_error_from_last_segment: true, span, label, suggestion } => { if no_ambiguity { assert!(directive.imported_module.get().is_none()); - return Some(match self.make_path_suggestion(span, directive.module_path.clone(), - &directive.parent_scope) { - Some((suggestion, note)) => ( - span, - format!("did you mean `{}`?", Segment::names_to_string(&suggestion)), - note, - ), - None => (span, msg, None), - }); + let err = match self.make_path_suggestion( + span, + directive.module_path.clone(), + &directive.parent_scope, + ) { + Some((suggestion, note)) => { + UnresolvedImportError { + span, + label: None, + note, + suggestion: Some(( + span, + String::from("a similar path exists"), + Segment::names_to_string(&suggestion), + Applicability::MaybeIncorrect, + )), + } + } + None => { + UnresolvedImportError { + span, + label: Some(label), + note: None, + suggestion, + } + } + }; + + return Some(err); } return None; } @@ -950,11 +1001,12 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { if let ModuleOrUniformRoot::Module(module) = module { if module.def_id() == directive.parent_scope.module.def_id() { // Importing a module into itself is not allowed. - return Some(( - directive.span, - "Cannot glob-import a module into itself.".to_string(), - None, - )); + return Some(UnresolvedImportError { + span: directive.span, + label: Some(String::from("cannot glob-import a module into itself")), + note: None, + suggestion: None, + }); } } if !is_prelude && @@ -1059,31 +1111,42 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { _ => Some(&i.name), } }); + let lev_suggestion = - match find_best_match_for_name(names, &ident.as_str(), None) { - Some(name) => format!(". Did you mean to use `{}`?", name), - None => String::new(), - }; - let msg = match module { + find_best_match_for_name(names, &ident.as_str(), None).map(|suggestion| { + ( + ident.span, + String::from("a similar name exists in the module"), + suggestion.to_string(), + Applicability::MaybeIncorrect, + ) + }); + + let label = match module { ModuleOrUniformRoot::Module(module) => { let module_str = module_to_string(module); if let Some(module_str) = module_str { - format!("no `{}` in `{}`{}", ident, module_str, lev_suggestion) + format!("no `{}` in `{}`", ident, module_str) } else { - format!("no `{}` in the root{}", ident, lev_suggestion) + format!("no `{}` in the root", ident) } } _ => { if !ident.is_path_segment_keyword() { - format!("no `{}` external crate{}", ident, lev_suggestion) + format!("no `{}` external crate", ident) } else { // HACK(eddyb) this shows up for `self` & `super`, which // should work instead - for now keep the same error message. - format!("no `{}` in the root{}", ident, lev_suggestion) + format!("no `{}` in the root", ident) } } }; - Some((directive.span, msg, None)) + Some(UnresolvedImportError { + span: directive.span, + label: Some(label), + note: None, + suggestion: lev_suggestion, + }) } else { // `resolve_ident_in_module` reported a privacy error. self.import_dummy_binding(directive); diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index 187ebf0bc430..b82aee7c96ad 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -1517,7 +1517,8 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tc return; } }; - let def = self.save_ctxt.get_path_def(hir_expr.id); + let node_id = self.save_ctxt.tcx.hir().hir_to_node_id(hir_expr.hir_id); + let def = self.save_ctxt.get_path_def(node_id); self.process_struct_lit(ex, path, fields, adt.variant_of_def(def), base) } ast::ExprKind::MethodCall(ref seg, ref args) => self.process_method_call(ex, seg, args), diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index 8ab9a8e8dda8..d80f3e5ce759 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -397,7 +397,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { Some(Node::Item(item)) => match item.node { hir::ItemKind::Impl(.., ref ty, _) => { let mut qualname = String::from("<"); - qualname.push_str(&self.tcx.hir().node_to_pretty_string(ty.id)); + qualname.push_str(&self.tcx.hir().hir_to_pretty_string(ty.hir_id)); let trait_id = self.tcx.trait_id_of_impl(impl_id); let mut decl_id = None; @@ -647,7 +647,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { Node::Binding(&hir::Pat { node: hir::PatKind::Binding(_, canonical_id, ..), .. - }) => HirDef::Local(canonical_id), + }) => HirDef::Local(self.tcx.hir().hir_to_node_id(canonical_id)), Node::Ty(ty) => if let hir::Ty { node: hir::TyKind::Path(ref qpath), diff --git a/src/librustc_save_analysis/sig.rs b/src/librustc_save_analysis/sig.rs index 50a335bf9087..64a2c92d04db 100644 --- a/src/librustc_save_analysis/sig.rs +++ b/src/librustc_save_analysis/sig.rs @@ -190,6 +190,7 @@ impl Sig for ast::Ty { Ok(replace_text(nested, text)) } ast::TyKind::Never => Ok(text_sig("!".to_owned())), + ast::TyKind::CVarArgs => Ok(text_sig("...".to_owned())), ast::TyKind::Tup(ref ts) => { let mut text = "(".to_owned(); let mut defs = vec![]; @@ -378,7 +379,7 @@ impl Sig for ast::Item { if header.constness.node == ast::Constness::Const { text.push_str("const "); } - if header.asyncness.is_async() { + if header.asyncness.node.is_async() { text.push_str("async "); } if header.unsafety == ast::Unsafety::Unsafe { @@ -936,7 +937,7 @@ fn make_method_signature( if m.header.constness.node == ast::Constness::Const { text.push_str("const "); } - if m.header.asyncness.is_async() { + if m.header.asyncness.node.is_async() { text.push_str("async "); } if m.header.unsafety == ast::Unsafety::Unsafe { diff --git a/src/librustc_target/abi/call/arm.rs b/src/librustc_target/abi/call/arm.rs index 52d7f3ac3dcb..e3fee8e5700c 100644 --- a/src/librustc_target/abi/call/arm.rs +++ b/src/librustc_target/abi/call/arm.rs @@ -99,7 +99,7 @@ pub fn compute_abi_info<'a, Ty, C>(cx: &C, fty: &mut FnType<'a, Ty>) // `extern "aapcs"`, then we must use the VFP registers for homogeneous aggregates. let vfp = cx.target_spec().llvm_target.ends_with("hf") && fty.conv != Conv::ArmAapcs - && !fty.variadic; + && !fty.c_variadic; if !fty.ret.is_ignore() { classify_ret_ty(cx, &mut fty.ret, vfp); diff --git a/src/librustc_target/abi/call/mod.rs b/src/librustc_target/abi/call/mod.rs index 411eb192d902..fbbd120f934b 100644 --- a/src/librustc_target/abi/call/mod.rs +++ b/src/librustc_target/abi/call/mod.rs @@ -23,10 +23,18 @@ mod x86_64; mod x86_win64; mod wasm32; +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +pub enum IgnoreMode { + /// C-variadic arguments. + CVarArgs, + /// A zero-sized type. + Zst, +} + #[derive(Clone, Copy, PartialEq, Eq, Debug)] pub enum PassMode { - /// Ignore the argument (useful for empty struct). - Ignore, + /// Ignore the argument (useful for empty structs and C-variadic args). + Ignore(IgnoreMode), /// Pass the argument directly. Direct(ArgAttributes), /// Pass a pair's elements directly in two arguments. @@ -481,7 +489,10 @@ impl<'a, Ty> ArgType<'a, Ty> { } pub fn is_ignore(&self) -> bool { - self.mode == PassMode::Ignore + match self.mode { + PassMode::Ignore(_) => true, + _ => false + } } } @@ -520,7 +531,7 @@ pub struct FnType<'a, Ty> { /// LLVM return type. pub ret: ArgType<'a, Ty>, - pub variadic: bool, + pub c_variadic: bool, pub conv: Conv, } diff --git a/src/librustc_target/abi/call/x86.rs b/src/librustc_target/abi/call/x86.rs index 2e809571ab18..6ca3ce88bd6e 100644 --- a/src/librustc_target/abi/call/x86.rs +++ b/src/librustc_target/abi/call/x86.rs @@ -88,7 +88,7 @@ pub fn compute_abi_info<'a, Ty, C>(cx: &C, fty: &mut FnType<'a, Ty>, flavor: Fla for arg in &mut fty.args { let attrs = match arg.mode { - PassMode::Ignore | + PassMode::Ignore(_) | PassMode::Indirect(_, None) => continue, PassMode::Direct(ref mut attrs) => attrs, PassMode::Pair(..) | diff --git a/src/librustc_target/spec/armv6_unknown_freebsd.rs b/src/librustc_target/spec/armv6_unknown_freebsd.rs new file mode 100644 index 000000000000..39886a16a740 --- /dev/null +++ b/src/librustc_target/spec/armv6_unknown_freebsd.rs @@ -0,0 +1,24 @@ +use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; + +pub fn target() -> TargetResult { + let base = super::freebsd_base::opts(); + Ok(Target { + llvm_target: "armv6-unknown-freebsd-gnueabihf".to_string(), + target_endian: "little".to_string(), + target_pointer_width: "32".to_string(), + target_c_int_width: "32".to_string(), + data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + arch: "arm".to_string(), + target_os: "freebsd".to_string(), + target_env: "gnueabihf".to_string(), + target_vendor: "unknown".to_string(), + linker_flavor: LinkerFlavor::Gcc, + + options: TargetOptions { + features: "+v6,+vfp2".to_string(), + max_atomic_width: Some(64), + abi_blacklist: super::arm_base::abi_blacklist(), + .. base + } + }) +} diff --git a/src/librustc_target/spec/armv7_unknown_freebsd.rs b/src/librustc_target/spec/armv7_unknown_freebsd.rs new file mode 100644 index 000000000000..ba63fd2bf053 --- /dev/null +++ b/src/librustc_target/spec/armv7_unknown_freebsd.rs @@ -0,0 +1,24 @@ +use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; + +pub fn target() -> TargetResult { + let base = super::freebsd_base::opts(); + Ok(Target { + llvm_target: "armv7-unknown-freebsd-gnueabihf".to_string(), + target_endian: "little".to_string(), + target_pointer_width: "32".to_string(), + target_c_int_width: "32".to_string(), + data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + arch: "arm".to_string(), + target_os: "freebsd".to_string(), + target_env: "gnueabihf".to_string(), + target_vendor: "unknown".to_string(), + linker_flavor: LinkerFlavor::Gcc, + + options: TargetOptions { + features: "+v7,+vfp3,+d16,+thumb2,-neon".to_string(), + max_atomic_width: Some(64), + abi_blacklist: super::arm_base::abi_blacklist(), + .. base + } + }) +} diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs index bef2afc7b629..2824d9cb6c3b 100644 --- a/src/librustc_target/spec/mod.rs +++ b/src/librustc_target/spec/mod.rs @@ -376,6 +376,8 @@ supported_targets! { ("aarch64-linux-android", aarch64_linux_android), ("aarch64-unknown-freebsd", aarch64_unknown_freebsd), + ("armv6-unknown-freebsd", armv6_unknown_freebsd), + ("armv7-unknown-freebsd", armv7_unknown_freebsd), ("i686-unknown-freebsd", i686_unknown_freebsd), ("powerpc64-unknown-freebsd", powerpc64_unknown_freebsd), ("x86_64-unknown-freebsd", x86_64_unknown_freebsd), diff --git a/src/librustc_traits/chalk_context/mod.rs b/src/librustc_traits/chalk_context/mod.rs index a326d84725ab..6420f20a3ea2 100644 --- a/src/librustc_traits/chalk_context/mod.rs +++ b/src/librustc_traits/chalk_context/mod.rs @@ -32,11 +32,12 @@ use rustc::traits::{ InEnvironment, ChalkCanonicalGoal, }; -use rustc::ty::{self, TyCtxt}; +use rustc::ty::{self, TyCtxt, InferConst}; use rustc::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor}; use rustc::ty::query::Providers; use rustc::ty::subst::{Kind, UnpackedKind}; use rustc_data_structures::sync::Lrc; +use rustc::mir::interpret::ConstValue; use syntax_pos::DUMMY_SP; use std::fmt::{self, Debug}; @@ -287,6 +288,16 @@ impl context::ContextOps> for ChalkContext<'cx, 'gcx> { } _ => false, }, + UnpackedKind::Const(ct) => match ct { + ty::LazyConst::Evaluated(ty::Const { + val: ConstValue::Infer(InferConst::Canonical(debruijn, bound_ct)), + .. + }) => { + debug_assert_eq!(*debruijn, ty::INNERMOST); + cvar == *bound_ct + } + _ => false, + } }) } diff --git a/src/librustc_traits/chalk_context/program_clauses.rs b/src/librustc_traits/chalk_context/program_clauses.rs index adfd26814db1..3f88d0e08b46 100644 --- a/src/librustc_traits/chalk_context/program_clauses.rs +++ b/src/librustc_traits/chalk_context/program_clauses.rs @@ -10,7 +10,7 @@ use rustc::traits::{ Environment, }; use rustc::ty; -use rustc::ty::subst::{Substs, Subst}; +use rustc::ty::subst::{InternalSubsts, Subst}; use rustc::hir; use rustc::hir::def_id::DefId; use rustc_target::spec::abi; @@ -105,7 +105,7 @@ fn assemble_builtin_sized_impls<'tcx>( let fn_ptr = generic_types::fn_ptr( tcx, fn_ptr.inputs_and_output.len(), - fn_ptr.variadic, + fn_ptr.c_variadic, fn_ptr.unsafety, fn_ptr.abi ); @@ -129,7 +129,7 @@ fn assemble_builtin_sized_impls<'tcx>( // Struct def ty::Adt(adt_def, _) => { - let substs = Substs::bound_vars_for_item(tcx, adt_def.did); + let substs = InternalSubsts::bound_vars_for_item(tcx, adt_def.did); let adt = tcx.mk_ty(ty::Adt(adt_def, substs)); let sized_constraint = adt_def.sized_constraint(tcx) .iter() @@ -190,11 +190,11 @@ fn wf_clause_for_raw_ptr<'tcx>( fn wf_clause_for_fn_ptr<'tcx>( tcx: ty::TyCtxt<'_, '_, 'tcx>, arity_and_output: usize, - variadic: bool, + c_variadic: bool, unsafety: hir::Unsafety, abi: abi::Abi ) -> Clauses<'tcx> { - let fn_ptr = generic_types::fn_ptr(tcx, arity_and_output, variadic, unsafety, abi); + let fn_ptr = generic_types::fn_ptr(tcx, arity_and_output, c_variadic, unsafety, abi); let wf_clause = ProgramClause { goal: DomainGoal::WellFormed(WellFormed::Ty(fn_ptr)), @@ -503,7 +503,7 @@ impl ChalkInferenceContext<'cx, 'gcx, 'tcx> { wf_clause_for_fn_ptr( self.infcx.tcx, fn_ptr.inputs_and_output.len(), - fn_ptr.variadic, + fn_ptr.c_variadic, fn_ptr.unsafety, fn_ptr.abi ) diff --git a/src/librustc_traits/dropck_outlives.rs b/src/librustc_traits/dropck_outlives.rs index 7185c4ce4464..49fcb7cd8335 100644 --- a/src/librustc_traits/dropck_outlives.rs +++ b/src/librustc_traits/dropck_outlives.rs @@ -4,7 +4,7 @@ use rustc::traits::query::dropck_outlives::{DropckOutlivesResult, DtorckConstrai use rustc::traits::query::{CanonicalTyGoal, NoSolution}; use rustc::traits::{TraitEngine, Normalized, ObligationCause, TraitEngineExt}; use rustc::ty::query::Providers; -use rustc::ty::subst::{Subst, Substs}; +use rustc::ty::subst::{Subst, InternalSubsts}; use rustc::ty::{self, ParamEnvAnd, Ty, TyCtxt}; use rustc::util::nodemap::FxHashSet; use rustc_data_structures::sync::Lrc; @@ -291,7 +291,7 @@ crate fn adt_dtorck_constraint<'a, 'tcx>( if def.is_phantom_data() { // The first generic parameter here is guaranteed to be a type because it's // `PhantomData`. - let substs = Substs::identity_for_item(tcx, def_id); + let substs = InternalSubsts::identity_for_item(tcx, def_id); assert_eq!(substs.len(), 1); let result = DtorckConstraint { outlives: vec![], diff --git a/src/librustc_traits/generic_types.rs b/src/librustc_traits/generic_types.rs index 03511e1d76d0..f2ce9631f35a 100644 --- a/src/librustc_traits/generic_types.rs +++ b/src/librustc_traits/generic_types.rs @@ -1,7 +1,7 @@ //! Utilities for creating generic types with bound vars in place of parameter values. use rustc::ty::{self, Ty, TyCtxt}; -use rustc::ty::subst::Substs; +use rustc::ty::subst::InternalSubsts; use rustc::hir; use rustc::hir::def_id::DefId; use rustc_target::spec::abi; @@ -24,7 +24,7 @@ crate fn raw_ptr(tcx: TyCtxt<'_, '_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx> crate fn fn_ptr( tcx: ty::TyCtxt<'_, '_, 'tcx>, arity_and_output: usize, - variadic: bool, + c_variadic: bool, unsafety: hir::Unsafety, abi: abi::Abi ) -> Ty<'tcx> { @@ -37,7 +37,7 @@ crate fn fn_ptr( let fn_sig = ty::Binder::bind(ty::FnSig { inputs_and_output, - variadic, + c_variadic, unsafety, abi, }); @@ -64,17 +64,17 @@ crate fn ref_ty(tcx: ty::TyCtxt<'_, '_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tc } crate fn fn_def(tcx: ty::TyCtxt<'_, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> { - tcx.mk_ty(ty::FnDef(def_id, Substs::bound_vars_for_item(tcx, def_id))) + tcx.mk_ty(ty::FnDef(def_id, InternalSubsts::bound_vars_for_item(tcx, def_id))) } crate fn closure(tcx: ty::TyCtxt<'_, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> { tcx.mk_closure(def_id, ty::ClosureSubsts { - substs: Substs::bound_vars_for_item(tcx, def_id), + substs: InternalSubsts::bound_vars_for_item(tcx, def_id), }) } crate fn generator(tcx: ty::TyCtxt<'_, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> { tcx.mk_generator(def_id, ty::GeneratorSubsts { - substs: Substs::bound_vars_for_item(tcx, def_id), + substs: InternalSubsts::bound_vars_for_item(tcx, def_id), }, hir::GeneratorMovability::Movable) } diff --git a/src/librustc_traits/lowering/environment.rs b/src/librustc_traits/lowering/environment.rs index 962a145814c8..c908c6993e19 100644 --- a/src/librustc_traits/lowering/environment.rs +++ b/src/librustc_traits/lowering/environment.rs @@ -213,8 +213,8 @@ crate fn environment<'a, 'tcx>( // could bound lifetimes. .map(Clause::ForAll); - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - let node = tcx.hir().get(node_id); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); + let node = tcx.hir().get_by_hir_id(hir_id); enum NodeKind { TraitImpl, diff --git a/src/librustc_traits/lowering/mod.rs b/src/librustc_traits/lowering/mod.rs index 908fdcfe7430..44883d438a1e 100644 --- a/src/librustc_traits/lowering/mod.rs +++ b/src/librustc_traits/lowering/mod.rs @@ -18,7 +18,7 @@ use rustc::traits::{ }; use rustc::ty::query::Providers; use rustc::ty::{self, List, TyCtxt}; -use rustc::ty::subst::{Subst, Substs}; +use rustc::ty::subst::{Subst, InternalSubsts}; use syntax::ast; use std::iter; @@ -182,7 +182,7 @@ fn program_clauses_for_trait<'a, 'tcx>( // } // ``` - let bound_vars = Substs::bound_vars_for_item(tcx, def_id); + let bound_vars = InternalSubsts::bound_vars_for_item(tcx, def_id); // `Self: Trait` let trait_pred = ty::TraitPredicate { @@ -294,7 +294,7 @@ fn program_clauses_for_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId // } // ``` - let bound_vars = Substs::bound_vars_for_item(tcx, def_id); + let bound_vars = InternalSubsts::bound_vars_for_item(tcx, def_id); let trait_ref = tcx.impl_trait_ref(def_id) .expect("not an impl") @@ -336,7 +336,7 @@ pub fn program_clauses_for_type_def<'a, 'tcx>( // } // ``` - let bound_vars = Substs::bound_vars_for_item(tcx, def_id); + let bound_vars = InternalSubsts::bound_vars_for_item(tcx, def_id); // `Ty<...>` let ty = tcx.type_of(def_id).subst(tcx, bound_vars); @@ -426,7 +426,7 @@ pub fn program_clauses_for_associated_type_def<'a, 'tcx>( _ => bug!("not an trait container"), }; - let trait_bound_vars = Substs::bound_vars_for_item(tcx, trait_id); + let trait_bound_vars = InternalSubsts::bound_vars_for_item(tcx, trait_id); let trait_ref = ty::TraitRef { def_id: trait_id, substs: trait_bound_vars, @@ -564,7 +564,7 @@ pub fn program_clauses_for_associated_type_value<'a, 'tcx>( _ => bug!("not an impl container"), }; - let impl_bound_vars = Substs::bound_vars_for_item(tcx, impl_id); + let impl_bound_vars = InternalSubsts::bound_vars_for_item(tcx, impl_id); // `A0 as Trait` let trait_ref = tcx.impl_trait_ref(impl_id) @@ -612,8 +612,8 @@ struct ClauseDumper<'a, 'tcx: 'a> { } impl<'a, 'tcx> ClauseDumper<'a, 'tcx> { - fn process_attrs(&mut self, node_id: ast::NodeId, attrs: &[ast::Attribute]) { - let def_id = self.tcx.hir().local_def_id(node_id); + fn process_attrs(&mut self, hir_id: hir::HirId, attrs: &[ast::Attribute]) { + let def_id = self.tcx.hir().local_def_id_from_hir_id(hir_id); for attr in attrs { let mut clauses = None; @@ -655,22 +655,22 @@ impl<'a, 'tcx> Visitor<'tcx> for ClauseDumper<'a, 'tcx> { } fn visit_item(&mut self, item: &'tcx hir::Item) { - self.process_attrs(item.id, &item.attrs); + self.process_attrs(item.hir_id, &item.attrs); intravisit::walk_item(self, item); } fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem) { - self.process_attrs(trait_item.id, &trait_item.attrs); + self.process_attrs(trait_item.hir_id, &trait_item.attrs); intravisit::walk_trait_item(self, trait_item); } fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem) { - self.process_attrs(impl_item.id, &impl_item.attrs); + self.process_attrs(impl_item.hir_id, &impl_item.attrs); intravisit::walk_impl_item(self, impl_item); } fn visit_struct_field(&mut self, s: &'tcx hir::StructField) { - self.process_attrs(s.id, &s.attrs); + self.process_attrs(s.hir_id, &s.attrs); intravisit::walk_struct_field(self, s); } } diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 71368927a801..89ec92a65216 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -3,7 +3,7 @@ //! instance of `AstConv`. use errors::{Applicability, DiagnosticId}; -use crate::hir::{self, GenericArg, GenericArgs}; +use crate::hir::{self, GenericArg, GenericArgs, ExprKind}; use crate::hir::def::Def; use crate::hir::def_id::DefId; use crate::hir::HirVec; @@ -14,11 +14,12 @@ use rustc::lint::builtin::AMBIGUOUS_ASSOCIATED_ITEMS; use rustc::traits; use rustc::ty::{self, Ty, TyCtxt, ToPredicate, TypeFoldable}; use rustc::ty::{GenericParamDef, GenericParamDefKind}; -use rustc::ty::subst::{Kind, Subst, Substs}; +use rustc::ty::subst::{Kind, Subst, InternalSubsts, SubstsRef}; use rustc::ty::wf::object_region_bounds; +use rustc::mir::interpret::ConstValue; use rustc_data_structures::sync::Lrc; use rustc_target::spec::abi; -use crate::require_c_abi_if_variadic; +use crate::require_c_abi_if_c_variadic; use smallvec::SmallVec; use syntax::ast; use syntax::feature_gate::{GateIssue, emit_feature_err}; @@ -177,7 +178,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { span: Span, def_id: DefId, item_segment: &hir::PathSegment) - -> &'tcx Substs<'tcx> + -> SubstsRef<'tcx> { let (substs, assoc_bindings, _) = item_segment.with_generic_args(|generic_args| { self.create_substs_for_ast_path( @@ -273,6 +274,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { let param_counts = def.own_counts(); let arg_counts = args.own_counts(); let infer_lifetimes = position != GenericArgPosition::Type && arg_counts.lifetimes == 0; + let infer_consts = position != GenericArgPosition::Type && arg_counts.consts == 0; let mut defaults: ty::GenericParamCount = Default::default(); for param in &def.params { @@ -281,6 +283,9 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { GenericParamDefKind::Type { has_default, .. } => { defaults.types += has_default as usize } + GenericParamDefKind::Const => { + // FIXME(const_generics:defaults) + } }; } @@ -304,18 +309,22 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { } else { let mut multispan = MultiSpan::from_span(span); multispan.push_span_label(span_late, note.to_string()); - tcx.lint_node(lint::builtin::LATE_BOUND_LIFETIME_ARGUMENTS, - args.args[0].id(), multispan, msg); + tcx.lint_hir(lint::builtin::LATE_BOUND_LIFETIME_ARGUMENTS, + args.args[0].id(), multispan, msg); return (false, None); } } } - let check_kind_count = |kind, - required, - permitted, - provided, - offset| { + let check_kind_count = |kind, required, permitted, provided, offset| { + debug!( + "check_kind_count: kind: {} required: {} permitted: {} provided: {} offset: {}", + kind, + required, + permitted, + provided, + offset + ); // We enforce the following: `required` <= `provided` <= `permitted`. // For kinds without defaults (i.e., lifetimes), `required == permitted`. // For other kinds (i.e., types), `permitted` may be greater than `required`. @@ -384,6 +393,17 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { 0, ); } + // FIXME(const_generics:defaults) + if !infer_consts || arg_counts.consts > param_counts.consts { + check_kind_count( + "const", + param_counts.consts, + param_counts.consts, + arg_counts.consts, + arg_counts.lifetimes + arg_counts.types, + ); + } + // Note that type errors are currently be emitted *after* const errors. if !infer_types || arg_counts.types > param_counts.types - defaults.types - has_self as usize { check_kind_count( @@ -436,7 +456,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { args_for_def_id: impl Fn(DefId) -> (Option<&'b GenericArgs>, bool), provided_kind: impl Fn(&GenericParamDef, &GenericArg) -> Kind<'tcx>, inferred_kind: impl Fn(Option<&[Kind<'tcx>]>, &GenericParamDef, bool) -> Kind<'tcx>, - ) -> &'tcx Substs<'tcx> { + ) -> SubstsRef<'tcx> { // Collect the segments of the path; we need to substitute arguments // for parameters throughout the entire path (wherever there are // generic parameters). @@ -495,7 +515,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { (Some(&arg), Some(¶m)) => { match (arg, ¶m.kind) { (GenericArg::Lifetime(_), GenericParamDefKind::Lifetime) - | (GenericArg::Type(_), GenericParamDefKind::Type { .. }) => { + | (GenericArg::Type(_), GenericParamDefKind::Type { .. }) + | (GenericArg::Const(_), GenericParamDefKind::Const) => { substs.push(provided_kind(param, arg)); args.next(); params.next(); @@ -548,7 +569,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { generic_args: &hir::GenericArgs, infer_types: bool, self_ty: Option>) - -> (&'tcx Substs<'tcx>, Vec>, Option>) + -> (SubstsRef<'tcx>, Vec>, Option>) { // If the type is parameterized by this region, then replace this // region with the current anon region binding (in other words, @@ -606,6 +627,9 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { (GenericParamDefKind::Type { .. }, GenericArg::Type(ty)) => { self.ast_ty_to_ty(&ty).into() } + (GenericParamDefKind::Const, GenericArg::Const(ct)) => { + self.ast_const_to_const(&ct.value, tcx.type_of(param.def_id)).into() + } _ => unreachable!(), } }, @@ -654,6 +678,11 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { tcx.types.err.into() } } + GenericParamDefKind::Const => { + // FIXME(const_generics:defaults) + // We've already errored above about the mismatch. + tcx.types.err.into() + } } }, ); @@ -718,7 +747,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { // specify type to assert that error was already reported in Err case: let predicate: Result<_, ErrorReported> = self.ast_type_binding_to_poly_projection_predicate( - trait_ref.ref_id, poly_trait_ref, binding, speculative, &mut dup_bindings); + trait_ref.hir_ref_id, poly_trait_ref, binding, speculative, &mut dup_bindings); // okay to ignore Err because of ErrorReported (see above) Some((predicate.ok()?, binding.span)) })); @@ -760,7 +789,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { trait_def_id: DefId, self_ty: Ty<'tcx>, trait_segment: &hir::PathSegment, - ) -> (&'tcx Substs<'tcx>, Vec>, Option>) { + ) -> (SubstsRef<'tcx>, Vec>, Option>) { debug!("create_substs_for_ast_trait_ref(trait_segment={:?})", trait_segment); @@ -802,7 +831,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { fn ast_type_binding_to_poly_projection_predicate( &self, - ref_id: ast::NodeId, + hir_ref_id: hir::HirId, trait_ref: ty::PolyTraitRef<'tcx>, binding: &ConvertedBinding<'tcx>, speculative: bool, @@ -874,7 +903,6 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { binding.item_name, binding.span) }?; - let hir_ref_id = self.tcx().hir().node_to_hir_id(ref_id); let (assoc_ident, def_scope) = tcx.adjust_ident(binding.item_name, candidate.def_id(), hir_ref_id); let assoc_ty = tcx.associated_items(candidate.def_id()).find(|i| { @@ -885,7 +913,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { let msg = format!("associated type `{}` is private", binding.item_name); tcx.sess.span_err(binding.span, &msg); } - tcx.check_stability(assoc_ty.def_id, Some(ref_id), binding.span); + tcx.check_stability(assoc_ty.def_id, Some(hir_ref_id), binding.span); if !speculative { dup_bindings.entry(assoc_ty.def_id) @@ -1195,8 +1223,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { let suitable_bounds = traits::transitive_bounds(tcx, bounds) .filter(|b| self.trait_defines_associated_type_named(b.def_id(), assoc_name)); - let param_node_id = tcx.hir().as_local_node_id(ty_param_def_id).unwrap(); - let param_name = tcx.hir().ty_param_name(param_node_id); + let param_hir_id = tcx.hir().as_local_hir_id(ty_param_def_id).unwrap(); + let param_name = tcx.hir().ty_param_name(param_hir_id); self.one_bound_for_assoc_type(suitable_bounds, ¶m_name.as_str(), assoc_name, @@ -1267,7 +1295,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { // parameter or `Self`. pub fn associated_path_to_ty( &self, - ref_id: ast::NodeId, + hir_ref_id: hir::HirId, span: Span, qself_ty: Ty<'tcx>, qself_def: Def, @@ -1292,7 +1320,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { let def = Def::Variant(variant_def.did); if permit_variants { check_type_alias_enum_variants_enabled(tcx, span); - tcx.check_stability(variant_def.did, Some(ref_id), span); + tcx.check_stability(variant_def.did, Some(hir_ref_id), span); return (qself_ty, def); } else { variant_resolution = Some(def); @@ -1370,7 +1398,6 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { }; let trait_did = bound.def_id(); - let hir_ref_id = self.tcx().hir().node_to_hir_id(ref_id); let (assoc_ident, def_scope) = tcx.adjust_ident(assoc_ident, trait_did, hir_ref_id); let item = tcx.associated_items(trait_did).find(|i| { Namespace::from(i.kind) == Namespace::Type && @@ -1385,12 +1412,12 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { let msg = format!("{} `{}` is private", def.kind_name(), assoc_ident); tcx.sess.span_err(span, &msg); } - tcx.check_stability(item.def_id, Some(ref_id), span); + tcx.check_stability(item.def_id, Some(hir_ref_id), span); if let Some(variant_def) = variant_resolution { - let mut err = tcx.struct_span_lint_node( + let mut err = tcx.struct_span_lint_hir( AMBIGUOUS_ASSOCIATED_ITEMS, - ref_id, + hir_ref_id, span, "ambiguous associated item", ); @@ -1611,6 +1638,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { // Case 3. Reference to a top-level value. Def::Fn(def_id) | Def::Const(def_id) | + Def::ConstParam(def_id) | Def::Static(def_id, _) => { path_segs.push(PathSeg(def_id, last)); } @@ -1701,7 +1729,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { // `Self` in impl (we know the concrete type). assert_eq!(opt_self_ty, None); self.prohibit_generics(&path.segments); - tcx.at(span).type_of(def_id) + // Try to evaluate any array length constants + self.normalize_ty(span, tcx.at(span).type_of(def_id)) } Def::SelfTy(Some(_), None) => { // `Self` in trait. @@ -1742,7 +1771,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { /// internal notion of a type. pub fn ast_ty_to_ty(&self, ast_ty: &hir::Ty) -> Ty<'tcx> { debug!("ast_ty_to_ty(id={:?}, ast_ty={:?} ty_ty={:?})", - ast_ty.id, ast_ty, ast_ty.node); + ast_ty.hir_id, ast_ty, ast_ty.node); let tcx = self.tcx(); @@ -1769,7 +1798,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { tcx.mk_tup(fields.iter().map(|t| self.ast_ty_to_ty(&t))) } hir::TyKind::BareFn(ref bf) => { - require_c_abi_if_variadic(tcx, &bf.decl, bf.abi, ast_ty.span); + require_c_abi_if_c_variadic(tcx, &bf.decl, bf.abi, ast_ty.span); tcx.mk_fn_ptr(self.ty_of_fn(bf.unsafety, bf.abi, &bf.decl)) } hir::TyKind::TraitObject(ref bounds, ref lifetime) => { @@ -1795,13 +1824,10 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { } else { Def::Err }; - self.associated_path_to_ty(ast_ty.id, ast_ty.span, ty, def, segment, false).0 + self.associated_path_to_ty(ast_ty.hir_id, ast_ty.span, ty, def, segment, false).0 } hir::TyKind::Array(ref ty, ref length) => { - let length_def_id = tcx.hir().local_def_id(length.id); - let substs = Substs::identity_for_item(tcx, length_def_id); - let length = ty::LazyConst::Unevaluated(length_def_id, substs); - let length = tcx.mk_lazy_const(length); + let length = self.ast_const_to_const(length, tcx.types.usize); let array_ty = tcx.mk_ty(ty::Array(self.ast_ty_to_ty(&ty), length)); self.normalize_ty(ast_ty.span, array_ty) } @@ -1823,12 +1849,57 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { hir::TyKind::Err => { tcx.types.err } + hir::TyKind::CVarArgs(lt) => { + let va_list_did = match tcx.lang_items().va_list() { + Some(did) => did, + None => span_bug!(ast_ty.span, + "`va_list` lang item required for variadics"), + }; + let region = self.ast_region_to_region(<, None); + tcx.type_of(va_list_did).subst(tcx, &[region.into()]) + } }; self.record_ty(ast_ty.hir_id, result_ty, ast_ty.span); result_ty } + pub fn ast_const_to_const( + &self, + ast_const: &hir::AnonConst, + ty: Ty<'tcx> + ) -> &'tcx ty::LazyConst<'tcx> { + debug!("ast_const_to_const(id={:?}, ast_const={:?})", ast_const.hir_id, ast_const); + + let tcx = self.tcx(); + let def_id = tcx.hir().local_def_id_from_hir_id(ast_const.hir_id); + + let mut lazy_const = ty::LazyConst::Unevaluated( + def_id, + InternalSubsts::identity_for_item(tcx, def_id), + ); + + let expr = &tcx.hir().body(ast_const.body).value; + if let ExprKind::Path(ref qpath) = expr.node { + if let hir::QPath::Resolved(_, ref path) = qpath { + if let Def::ConstParam(def_id) = path.def { + let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let item_id = tcx.hir().get_parent_node(node_id); + let item_def_id = tcx.hir().local_def_id(item_id); + let generics = tcx.generics_of(item_def_id); + let index = generics.param_def_id_to_index[&tcx.hir().local_def_id(node_id)]; + let name = tcx.hir().name(node_id).as_interned_str(); + lazy_const = ty::LazyConst::Evaluated(ty::Const { + val: ConstValue::Param(ty::ParamConst::new(index, name)), + ty, + }) + } + } + }; + + tcx.mk_lazy_const(lazy_const) + } + pub fn impl_trait_ty_to_ty( &self, def_id: DefId, @@ -1840,7 +1911,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { let generics = tcx.generics_of(def_id); debug!("impl_trait_ty_to_ty: generics={:?}", generics); - let substs = Substs::for_item(tcx, def_id, |param, _| { + let substs = InternalSubsts::for_item(tcx, def_id, |param, _| { if let Some(i) = (param.index as usize).checked_sub(generics.parent_count) { // Our own parameters are the resolved lifetimes. match param.kind { @@ -1905,7 +1976,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { let bare_fn_ty = ty::Binder::bind(tcx.mk_fn_sig( input_tys, output_ty, - decl.variadic, + decl.c_variadic, unsafety, abi )); diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index 13469f169663..1a3ade7f8baf 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -64,7 +64,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } PatKind::Path(ref qpath) => { - let (def, _, _) = self.resolve_ty_and_def_ufcs(qpath, pat.id, pat.span); + let (def, _, _) = self.resolve_ty_and_def_ufcs(qpath, pat.hir_id, pat.span); match def { Def::Const(..) | Def::AssociatedConst(..) => false, _ => true, @@ -227,7 +227,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.demand_eqtype_pat(pat.span, expected, rhs_ty, match_discrim_span); common_type } - PatKind::Binding(ba, var_id, _, _, ref sub) => { + PatKind::Binding(ba, var_id, _, ref sub) => { let bm = if ba == hir::BindingAnnotation::Unannotated { def_bm } else { @@ -239,7 +239,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { .pat_binding_modes_mut() .insert(pat.hir_id, bm); debug!("check_pat_walk: pat.hir_id={:?} bm={:?}", pat.hir_id, bm); - let local_ty = self.local_ty(pat.span, pat.id).decl_ty; + let local_ty = self.local_ty(pat.span, pat.hir_id).decl_ty; match bm { ty::BindByReference(mutbl) => { // if the binding is like @@ -265,7 +265,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // if there are multiple arms, make sure they all agree on // what the type of the binding `x` ought to be - if var_id != pat.id { + if var_id != pat.hir_id { let vt = self.local_ty(pat.span, var_id).decl_ty; self.demand_eqtype_pat(pat.span, vt, local_ty, match_discrim_span); } @@ -630,7 +630,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); if self.diverges.get().always() { for arm in arms { - self.warn_if_unreachable(arm.body.id, arm.body.span, "arm"); + self.warn_if_unreachable(arm.body.hir_id, arm.body.span, "arm"); } } @@ -725,7 +725,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); let cause = if i == 0 { // The reason for the first arm to fail is not that the match arms diverge, // but rather that there's a prior obligation that doesn't hold. - self.cause(arm_span, ObligationCauseCode::BlockTailExpression(arm.body.id)) + self.cause(arm_span, ObligationCauseCode::BlockTailExpression(arm.body.hir_id)) } else { self.cause(expr.span, ObligationCauseCode::MatchExpressionArm { arm_span, @@ -761,7 +761,8 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); ) -> Ty<'tcx> { // Resolve the path and check the definition for errors. - let (variant, pat_ty) = if let Some(variant_ty) = self.check_struct_path(qpath, pat.id) { + let (variant, pat_ty) = if let Some(variant_ty) = self.check_struct_path(qpath, pat.hir_id) + { variant_ty } else { for field in fields { @@ -779,7 +780,8 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); self.demand_eqtype_pat(pat.span, expected, pat_ty, match_discrim_span); // Type-check subpatterns. - if self.check_struct_pat_fields(pat_ty, pat.id, pat.span, variant, fields, etc, def_bm) { + if self.check_struct_pat_fields(pat_ty, pat.hir_id, pat.span, variant, fields, etc, def_bm) + { pat_ty } else { self.tcx.types.err @@ -795,7 +797,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); let tcx = self.tcx; // Resolve the path and check the definition for errors. - let (def, opt_ty, segments) = self.resolve_ty_and_def_ufcs(qpath, pat.id, pat.span); + let (def, opt_ty, segments) = self.resolve_ty_and_def_ufcs(qpath, pat.hir_id, pat.span); match def { Def::Err => { self.set_tainted_by_errors(); @@ -818,7 +820,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); } // Type-check the path. - let pat_ty = self.instantiate_value_path(segments, opt_ty, def, pat.span, pat.id).0; + let pat_ty = self.instantiate_value_path(segments, opt_ty, def, pat.span, pat.hir_id).0; self.demand_suptype(pat.span, expected, pat_ty); pat_ty } @@ -849,7 +851,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); }; // Resolve the path and check the definition for errors. - let (def, opt_ty, segments) = self.resolve_ty_and_def_ufcs(qpath, pat.id, pat.span); + let (def, opt_ty, segments) = self.resolve_ty_and_def_ufcs(qpath, pat.hir_id, pat.span); if def == Def::Err { self.set_tainted_by_errors(); on_error(); @@ -857,7 +859,8 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); } // Type-check the path. - let (pat_ty, def) = self.instantiate_value_path(segments, opt_ty, def, pat.span, pat.id); + let (pat_ty, def) = self.instantiate_value_path(segments, opt_ty, def, pat.span, + pat.hir_id); if !pat_ty.is_fn() { report_unexpected_def(def); return self.tcx.types.err; @@ -897,7 +900,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); let field_ty = self.field_ty(subpat.span, &variant.fields[i], substs); self.check_pat_walk(&subpat, field_ty, def_bm, match_arm_pat_span); - self.tcx.check_stability(variant.fields[i].did, Some(pat.id), subpat.span); + self.tcx.check_stability(variant.fields[i].did, Some(pat.hir_id), subpat.span); } } else { let subpats_ending = if subpats.len() == 1 { "" } else { "s" }; @@ -917,7 +920,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); fn check_struct_pat_fields(&self, adt_ty: Ty<'tcx>, - pat_id: ast::NodeId, + pat_id: hir::HirId, span: Span, variant: &'tcx ty::VariantDef, fields: &'gcx [Spanned], @@ -963,7 +966,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); vacant.insert(span); field_map.get(&ident) .map(|(i, f)| { - self.write_field_index(field.id, *i); + self.write_field_index(field.hir_id, *i); self.tcx.check_stability(f.did, Some(pat_id), span); self.field_ty(span, f, substs) }) diff --git a/src/librustc_typeck/check/callee.rs b/src/librustc_typeck/check/callee.rs index 84d3c203afbe..0a4c0eb3aff7 100644 --- a/src/librustc_typeck/check/callee.rs +++ b/src/librustc_typeck/check/callee.rs @@ -250,7 +250,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if let &ty::Adt(adt_def, ..) = t { if adt_def.is_enum() { if let hir::ExprKind::Call(ref expr, _) = call_expr.node { - unit_variant = Some(self.tcx.hir().node_to_pretty_string(expr.id)) + unit_variant = Some(self.tcx.hir().hir_to_pretty_string(expr.hir_id)) } } } @@ -368,20 +368,30 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { .0; let fn_sig = self.normalize_associated_types_in(call_expr.span, &fn_sig); + let inputs = if fn_sig.c_variadic { + if fn_sig.inputs().len() > 1 { + &fn_sig.inputs()[..fn_sig.inputs().len() - 1] + } else { + span_bug!(call_expr.span, + "C-variadic functions are only valid with one or more fixed arguments"); + } + } else { + &fn_sig.inputs()[..] + }; // Call the generic checker. let expected_arg_tys = self.expected_inputs_for_expected_output( call_expr.span, expected, fn_sig.output(), - fn_sig.inputs(), + inputs, ); self.check_argument_types( call_expr.span, call_expr.span, - fn_sig.inputs(), + inputs, &expected_arg_tys[..], arg_exprs, - fn_sig.variadic, + fn_sig.c_variadic, TupleArgumentsFlag::DontTupleArguments, def_span, ); @@ -414,7 +424,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fn_sig.inputs(), &expected_arg_tys, arg_exprs, - fn_sig.variadic, + fn_sig.c_variadic, TupleArgumentsFlag::TupleArguments, None, ); diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs index 317d6bbd7859..cad9e73bd2ac 100644 --- a/src/librustc_typeck/check/cast.rs +++ b/src/librustc_typeck/check/cast.rs @@ -37,9 +37,9 @@ use rustc::hir; use rustc::session::Session; use rustc::traits; use rustc::ty::{self, Ty, TypeFoldable, TypeAndMut}; +use rustc::ty::subst::SubstsRef; use rustc::ty::adjustment::AllowTwoPhase; use rustc::ty::cast::{CastKind, CastTy}; -use rustc::ty::subst::Substs; use rustc::middle::lang_items; use syntax::ast; use syntax_pos::Span; @@ -69,7 +69,7 @@ enum PointerKind<'tcx> { /// The unsize info of this projection OfProjection(&'tcx ty::ProjectionTy<'tcx>), /// The unsize info of this opaque ty - OfOpaque(DefId, &'tcx Substs<'tcx>), + OfOpaque(DefId, SubstsRef<'tcx>), /// The unsize info of this parameter OfParam(&'tcx ty::ParamTy), } @@ -399,9 +399,9 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { } else { ("", lint::builtin::TRIVIAL_CASTS) }; - let mut err = fcx.tcx.struct_span_lint_node( + let mut err = fcx.tcx.struct_span_lint_hir( lint, - self.expr.id, + self.expr.hir_id, self.span, &format!("trivial {}cast: `{}` as `{}`", adjective, @@ -417,7 +417,7 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { self.cast_ty = fcx.structurally_resolved_type(self.span, self.cast_ty); debug!("check_cast({}, {:?} as {:?})", - self.expr.id, + self.expr.hir_id, self.expr_ty, self.cast_ty); @@ -428,13 +428,12 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { } else if self.try_coercion_cast(fcx) { self.trivial_cast_lint(fcx); debug!(" -> CoercionCast"); - fcx.tables.borrow_mut().cast_kinds_mut().insert(self.expr.hir_id, - CastKind::CoercionCast); + fcx.tables.borrow_mut().set_coercion_cast(self.expr.hir_id.local_id); + } else { match self.do_check(fcx) { Ok(k) => { debug!(" -> {:?}", k); - fcx.tables.borrow_mut().cast_kinds_mut().insert(self.expr.hir_id, k); } Err(e) => self.report_cast_error(fcx, e), }; diff --git a/src/librustc_typeck/check/closure.rs b/src/librustc_typeck/check/closure.rs index 5f7652451839..f7396cbd42f2 100644 --- a/src/librustc_typeck/check/closure.rs +++ b/src/librustc_typeck/check/closure.rs @@ -12,7 +12,7 @@ use rustc::traits::Obligation; use rustc::traits::error_reporting::ArgKind; use rustc::ty::{self, Ty, GenericParamDefKind}; use rustc::ty::fold::TypeFoldable; -use rustc::ty::subst::Substs; +use rustc::ty::subst::InternalSubsts; use std::cmp; use std::iter; use rustc_target::spec::abi::Abi; @@ -72,7 +72,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { opt_kind, expected_sig ); - let expr_def_id = self.tcx.hir().local_def_id(expr.id); + let expr_def_id = self.tcx.hir().local_def_id_from_hir_id(expr.hir_id); let ClosureSignatures { bound_sig, @@ -86,7 +86,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.param_env, liberated_sig, decl, - expr.id, + expr.hir_id, body, gen, ).1; @@ -95,15 +95,17 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // types of upvars. These will be unified during the upvar // inference phase (`upvar.rs`). let base_substs = - Substs::identity_for_item(self.tcx, self.tcx.closure_base_def_id(expr_def_id)); + InternalSubsts::identity_for_item(self.tcx, self.tcx.closure_base_def_id(expr_def_id)); let substs = base_substs.extend_to(self.tcx,expr_def_id, |param, _| { match param.kind { GenericParamDefKind::Lifetime => { - span_bug!(expr.span, "closure has region param") + span_bug!(expr.span, "closure has lifetime param") } - GenericParamDefKind::Type {..} => { - self.infcx - .next_ty_var(TypeVariableOrigin::ClosureSynthetic(expr.span)).into() + GenericParamDefKind::Type { .. } => { + self.infcx.next_ty_var(TypeVariableOrigin::ClosureSynthetic(expr.span)).into() + } + GenericParamDefKind::Const => { + span_bug!(expr.span, "closure has const param") } } }); @@ -131,8 +133,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let closure_type = self.tcx.mk_closure(expr_def_id, substs); debug!( - "check_closure: expr.id={:?} closure_type={:?}", - expr.id, closure_type + "check_closure: expr.hir_id={:?} closure_type={:?}", + expr.hir_id, closure_type ); // Tuple up the arguments and insert the resulting function type into @@ -141,7 +143,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.tcx.mk_fn_sig( iter::once(self.tcx.intern_tup(sig.inputs())), sig.output(), - sig.variadic, + sig.c_variadic, sig.unsafety, sig.abi, ) @@ -386,7 +388,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // Watch out for some surprises and just ignore the // expectation if things don't see to match up with what we // expect. - if expected_sig.sig.variadic != decl.variadic { + if expected_sig.sig.c_variadic != decl.c_variadic { return self.sig_of_closure_no_expectation(expr_def_id, decl, body); } else if expected_sig.sig.inputs_and_output.len() != decl.inputs.len() + 1 { return self.sig_of_closure_with_mismatched_number_of_arguments( @@ -404,7 +406,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let bound_sig = ty::Binder::bind(self.tcx.mk_fn_sig( expected_sig.sig.inputs().iter().cloned(), expected_sig.sig.output(), - decl.variadic, + decl.c_variadic, hir::Unsafety::Normal, Abi::RustCall, )); @@ -586,7 +588,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let result = ty::Binder::bind(self.tcx.mk_fn_sig( supplied_arguments, supplied_return, - decl.variadic, + decl.c_variadic, hir::Unsafety::Normal, Abi::RustCall, )); @@ -621,7 +623,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let result = ty::Binder::bind(self.tcx.mk_fn_sig( supplied_arguments, self.tcx.types.err, - decl.variadic, + decl.c_variadic, hir::Unsafety::Normal, Abi::RustCall, )); diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index 8841f6b26841..6f3cd56c7bf5 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -712,9 +712,9 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { let b = self.shallow_resolve(b); - let node_id_a = self.tcx.hir().as_local_node_id(def_id_a).unwrap(); + let hir_id_a = self.tcx.hir().as_local_hir_id(def_id_a).unwrap(); match b.sty { - ty::FnPtr(_) if self.tcx.with_freevars(node_id_a, |v| v.is_empty()) => { + ty::FnPtr(_) if self.tcx.with_freevars(hir_id_a, |v| v.is_empty()) => { // We coerce the closure, which has fn type // `extern "rust-call" fn((arg0,arg1,...)) -> _` // to @@ -823,7 +823,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { debug!("coercion::try_find_coercion_lub({:?}, {:?})", prev_ty, new_ty); // Special-case that coercion alone cannot handle: - // Two function item types of differing IDs or Substs. + // Two function item types of differing IDs or InternalSubsts. if let (&ty::FnDef(..), &ty::FnDef(..)) = (&prev_ty.sty, &new_ty.sty) { // Don't reify if the function types have a LUB, i.e., they // are the same function and their parameters have a LUB. @@ -1177,7 +1177,8 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E> Expressions::UpFront(coercion_sites) => { // if the user gave us an array to validate, check that we got // the next expression in the list, as expected - assert_eq!(coercion_sites[self.pushed].as_coercion_site().id, e.id); + assert_eq!(coercion_sites[self.pushed].as_coercion_site().hir_id, + e.hir_id); } } self.pushed += 1; @@ -1208,7 +1209,7 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E> db.span_label(cause.span, "return type is not `()`"); } ObligationCauseCode::BlockTailExpression(blk_id) => { - let parent_id = fcx.tcx.hir().get_parent_node(blk_id); + let parent_id = fcx.tcx.hir().get_parent_node_by_hir_id(blk_id); db = self.report_return_mismatched_types( cause, expected, @@ -1246,8 +1247,8 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E> found: Ty<'tcx>, err: TypeError<'tcx>, fcx: &FnCtxt<'a, 'gcx, 'tcx>, - id: syntax::ast::NodeId, - expression: Option<(&'gcx hir::Expr, syntax::ast::NodeId)>, + id: hir::HirId, + expression: Option<(&'gcx hir::Expr, hir::HirId)>, ) -> DiagnosticBuilder<'a> { let mut db = fcx.report_mismatched_types(cause, expected, found, err); @@ -1257,7 +1258,7 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E> // Verify that this is a tail expression of a function, otherwise the // label pointing out the cause for the type coercion will be wrong // as prior return coercions would not be relevant (#57664). - let parent_id = fcx.tcx.hir().get_parent_node(id); + let parent_id = fcx.tcx.hir().get_parent_node_by_hir_id(id); let fn_decl = if let Some((expr, blk_id)) = expression { pointing_at_return_type = fcx.suggest_mismatched_types_on_tail( &mut db, @@ -1267,7 +1268,7 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E> cause.span, blk_id, ); - let parent = fcx.tcx.hir().get(parent_id); + let parent = fcx.tcx.hir().get_by_hir_id(parent_id); fcx.get_node_fn_decl(parent).map(|(fn_decl, _, is_main)| (fn_decl, is_main)) } else { fcx.get_fn_decl(parent_id) diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index c6b34672e6b4..f79bf4e999d5 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -4,9 +4,9 @@ use rustc::ty::{self, TyCtxt, GenericParamDefKind}; use rustc::ty::util::ExplicitSelf; use rustc::traits::{self, ObligationCause, ObligationCauseCode, Reveal}; use rustc::ty::error::{ExpectedFound, TypeError}; -use rustc::ty::subst::{Subst, Substs}; +use rustc::ty::subst::{Subst, InternalSubsts, SubstsRef}; use rustc::util::common::ErrorReported; -use errors::Applicability; +use errors::{Applicability, DiagnosticId}; use syntax_pos::Span; @@ -83,8 +83,7 @@ fn compare_predicate_entailment<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // This node-id should be used for the `body_id` field on each // `ObligationCause` (and the `FnCtxt`). This is what // `regionck_item` expects. - let impl_m_node_id = tcx.hir().as_local_node_id(impl_m.def_id).unwrap(); - let impl_m_hir_id = tcx.hir().node_to_hir_id(impl_m_node_id); + let impl_m_hir_id = tcx.hir().as_local_hir_id(impl_m.def_id).unwrap(); let cause = ObligationCause { span: impl_m_span, @@ -160,7 +159,7 @@ fn compare_predicate_entailment<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // a fresh FulfillmentCtxt, and invoke select_all_or_error. // Create mapping from impl to placeholder. - let impl_to_skol_substs = Substs::identity_for_item(tcx, impl_m.def_id); + let impl_to_skol_substs = InternalSubsts::identity_for_item(tcx, impl_m.def_id); // Create mapping from trait to placeholder. let trait_to_skol_substs = impl_to_skol_substs.rebase_onto(tcx, @@ -361,7 +360,7 @@ fn check_region_bounds_on_impl_method<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_m: &ty::AssociatedItem, trait_generics: &ty::Generics, impl_generics: &ty::Generics, - trait_to_skol_substs: &Substs<'tcx>) + trait_to_skol_substs: SubstsRef<'tcx>) -> Result<(), ErrorReported> { let trait_params = trait_generics.own_counts().lifetimes; let impl_params = impl_generics.own_counts().lifetimes; @@ -416,8 +415,10 @@ fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a trait_sig: ty::FnSig<'tcx>) -> (Span, Option) { let tcx = infcx.tcx; - let impl_m_node_id = tcx.hir().as_local_node_id(impl_m.def_id).unwrap(); - let (impl_m_output, impl_m_iter) = match tcx.hir().expect_impl_item(impl_m_node_id).node { + let impl_m_hir_id = tcx.hir().as_local_hir_id(impl_m.def_id).unwrap(); + let (impl_m_output, impl_m_iter) = match tcx.hir() + .expect_impl_item(impl_m_hir_id) + .node { ImplItemKind::Method(ref impl_m_sig, _) => { (&impl_m_sig.decl.output, impl_m_sig.decl.inputs.iter()) } @@ -426,8 +427,10 @@ fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a match *terr { TypeError::Mutability => { - if let Some(trait_m_node_id) = tcx.hir().as_local_node_id(trait_m.def_id) { - let trait_m_iter = match tcx.hir().expect_trait_item(trait_m_node_id).node { + if let Some(trait_m_hir_id) = tcx.hir().as_local_hir_id(trait_m.def_id) { + let trait_m_iter = match tcx.hir() + .expect_trait_item(trait_m_hir_id) + .node { TraitItemKind::Method(ref trait_m_sig, _) => { trait_m_sig.decl.inputs.iter() } @@ -451,9 +454,9 @@ fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a } } TypeError::Sorts(ExpectedFound { .. }) => { - if let Some(trait_m_node_id) = tcx.hir().as_local_node_id(trait_m.def_id) { + if let Some(trait_m_hir_id) = tcx.hir().as_local_hir_id(trait_m.def_id) { let (trait_m_output, trait_m_iter) = - match tcx.hir().expect_trait_item(trait_m_node_id).node { + match tcx.hir().expect_trait_item(trait_m_hir_id).node { TraitItemKind::Method(ref trait_m_sig, _) => { (&trait_m_sig.decl.output, trait_m_sig.decl.inputs.iter()) } @@ -576,55 +579,78 @@ fn compare_self_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, Ok(()) } -fn compare_number_of_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - impl_m: &ty::AssociatedItem, - impl_m_span: Span, - trait_m: &ty::AssociatedItem, - trait_item_span: Option) - -> Result<(), ErrorReported> { - let impl_m_generics = tcx.generics_of(impl_m.def_id); - let trait_m_generics = tcx.generics_of(trait_m.def_id); - let num_impl_m_type_params = impl_m_generics.own_counts().types; - let num_trait_m_type_params = trait_m_generics.own_counts().types; +fn compare_number_of_generics<'a, 'tcx>( + tcx: TyCtxt<'a, 'tcx, 'tcx>, + impl_: &ty::AssociatedItem, + impl_span: Span, + trait_: &ty::AssociatedItem, + trait_span: Option, +) -> Result<(), ErrorReported> { + let trait_own_counts = tcx.generics_of(trait_.def_id).own_counts(); + let impl_own_counts = tcx.generics_of(impl_.def_id).own_counts(); - if num_impl_m_type_params != num_trait_m_type_params { - let impl_m_node_id = tcx.hir().as_local_node_id(impl_m.def_id).unwrap(); - let impl_m_item = tcx.hir().expect_impl_item(impl_m_node_id); - let span = if impl_m_item.generics.params.is_empty() - || impl_m_item.generics.span.is_dummy() // impl Trait in argument position (#55374) - { - impl_m_span - } else { - impl_m_item.generics.span - }; + let matchings = [ + ("type", trait_own_counts.types, impl_own_counts.types), + ("const", trait_own_counts.consts, impl_own_counts.consts), + ]; - let mut err = struct_span_err!(tcx.sess, span, E0049, - "method `{}` has {} but its trait declaration has {}", - trait_m.ident, - potentially_plural_count(num_impl_m_type_params, "type parameter"), - potentially_plural_count(num_trait_m_type_params, "type parameter") - ); + let mut err_occurred = false; + for &(kind, trait_count, impl_count) in &matchings { + if impl_count != trait_count { + err_occurred = true; - let mut suffix = None; + let impl_hir_id = tcx.hir().as_local_hir_id(impl_.def_id).unwrap(); + let impl_item = tcx.hir().expect_impl_item(impl_hir_id); + let span = if impl_item.generics.params.is_empty() + || impl_item.generics.span.is_dummy() { // argument position impl Trait (#55374) + impl_span + } else { + impl_item.generics.span + }; - if let Some(span) = trait_item_span { - err.span_label(span, format!("expected {}", - potentially_plural_count(num_trait_m_type_params, "type parameter"))); - } else { - suffix = Some(format!(", expected {}", num_trait_m_type_params)); + let mut err = tcx.sess.struct_span_err_with_code( + span, + &format!( + "method `{}` has {} {kind} parameter{} but its trait \ + declaration has {} {kind} parameter{}", + trait_.ident, + impl_count, + if impl_count != 1 { "s" } else { "" }, + trait_count, + if trait_count != 1 { "s" } else { "" }, + kind = kind, + ), + DiagnosticId::Error("E0049".into()), + ); + + let mut suffix = None; + + if let Some(span) = trait_span { + err.span_label( + span, + format!("expected {} {} parameter{}", trait_count, kind, + if trait_count != 1 { "s" } else { "" }) + ); + } else { + suffix = Some(format!(", expected {}", trait_count)); + } + + err.span_label( + span, + format!("found {} {} parameter{}{}", impl_count, kind, + if impl_count != 1 { "s" } else { "" }, + suffix.unwrap_or_else(|| String::new())), + ); + + err.emit(); } - - err.span_label(span, - format!("found {}{}", - potentially_plural_count(num_impl_m_type_params, "type parameter"), - suffix.as_ref().map(|s| &s[..]).unwrap_or(""))); - - err.emit(); - - return Err(ErrorReported); } - Ok(()) + if err_occurred { + Err(ErrorReported) + } else { + Ok(()) + } } fn compare_number_of_method_arguments<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, @@ -638,8 +664,8 @@ fn compare_number_of_method_arguments<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let trait_number_args = trait_m_fty.inputs().skip_binder().len(); let impl_number_args = impl_m_fty.inputs().skip_binder().len(); if trait_number_args != impl_number_args { - let trait_m_node_id = tcx.hir().as_local_node_id(trait_m.def_id); - let trait_span = if let Some(trait_id) = trait_m_node_id { + let trait_m_hir_id = tcx.hir().as_local_hir_id(trait_m.def_id); + let trait_span = if let Some(trait_id) = trait_m_hir_id { match tcx.hir().expect_trait_item(trait_id).node { TraitItemKind::Method(ref trait_m_sig, _) => { let pos = if trait_number_args > 0 { @@ -664,8 +690,8 @@ fn compare_number_of_method_arguments<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } else { trait_item_span }; - let impl_m_node_id = tcx.hir().as_local_node_id(impl_m.def_id).unwrap(); - let impl_span = match tcx.hir().expect_impl_item(impl_m_node_id).node { + let impl_m_hir_id = tcx.hir().as_local_hir_id(impl_m.def_id).unwrap(); + let impl_span = match tcx.hir().expect_impl_item(impl_m_hir_id).node { ImplItemKind::Method(ref impl_m_sig, _) => { let pos = if impl_number_args > 0 { impl_number_args - 1 @@ -725,12 +751,12 @@ fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let trait_m_generics = tcx.generics_of(trait_m.def_id); let impl_m_type_params = impl_m_generics.params.iter().filter_map(|param| match param.kind { GenericParamDefKind::Type { synthetic, .. } => Some((param.def_id, synthetic)), - GenericParamDefKind::Lifetime => None, + GenericParamDefKind::Lifetime | GenericParamDefKind::Const => None, }); let trait_m_type_params = trait_m_generics.params.iter().filter_map(|param| { match param.kind { GenericParamDefKind::Type { synthetic, .. } => Some((param.def_id, synthetic)), - GenericParamDefKind::Lifetime => None, + GenericParamDefKind::Lifetime | GenericParamDefKind::Const => None, } }); for ((impl_def_id, impl_synthetic), (trait_def_id, trait_synthetic)) @@ -760,11 +786,11 @@ fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, .source_map() .span_to_snippet(trait_span) .ok()?; - let trait_m = tcx.hir().as_local_node_id(trait_m.def_id)?; - let trait_m = tcx.hir().trait_item(hir::TraitItemId { node_id: trait_m }); + let trait_m = tcx.hir().as_local_hir_id(trait_m.def_id)?; + let trait_m = tcx.hir().trait_item(hir::TraitItemId { hir_id: trait_m }); - let impl_m = tcx.hir().as_local_node_id(impl_m.def_id)?; - let impl_m = tcx.hir().impl_item(hir::ImplItemId { node_id: impl_m }); + let impl_m = tcx.hir().as_local_hir_id(impl_m.def_id)?; + let impl_m = tcx.hir().impl_item(hir::ImplItemId { hir_id: impl_m }); // in case there are no generics, take the spot between the function name // and the opening paren of the argument list @@ -805,8 +831,8 @@ fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, (None, Some(hir::SyntheticTyParamKind::ImplTrait)) => { err.span_label(impl_span, "expected `impl Trait`, found generic parameter"); (|| { - let impl_m = tcx.hir().as_local_node_id(impl_m.def_id)?; - let impl_m = tcx.hir().impl_item(hir::ImplItemId { node_id: impl_m }); + let impl_m = tcx.hir().as_local_hir_id(impl_m.def_id)?; + let impl_m = tcx.hir().impl_item(hir::ImplItemId { hir_id: impl_m }); let input_tys = match impl_m.node { hir::ImplItemKind::Method(ref sig, _) => &sig.decl.inputs, _ => unreachable!(), @@ -891,7 +917,7 @@ pub fn compare_const_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, debug!("compare_const_impl(impl_trait_ref={:?})", impl_trait_ref); tcx.infer_ctxt().enter(|infcx| { - let param_env = ty::ParamEnv::empty(); + let param_env = tcx.param_env(impl_c.def_id); let inh = Inherited::new(infcx, impl_c.def_id); let infcx = &inh.infcx; @@ -904,8 +930,7 @@ pub fn compare_const_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Create a parameter environment that represents the implementation's // method. - let impl_c_node_id = tcx.hir().as_local_node_id(impl_c.def_id).unwrap(); - let impl_c_hir_id = tcx.hir().node_to_hir_id(impl_c_node_id); + let impl_c_hir_id = tcx.hir().as_local_hir_id(impl_c.def_id).unwrap(); // Compute placeholder form of impl and trait const tys. let impl_ty = tcx.type_of(impl_c.def_id); @@ -937,7 +962,7 @@ pub fn compare_const_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_ty); // Locate the Span containing just the type of the offending impl - match tcx.hir().expect_impl_item(impl_c_node_id).node { + match tcx.hir().expect_impl_item(impl_c_hir_id).node { ImplItemKind::Const(ref ty, _) => cause.span = ty.span, _ => bug!("{:?} is not a impl const", impl_c), } @@ -949,10 +974,10 @@ pub fn compare_const_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait", trait_c.ident); - let trait_c_node_id = tcx.hir().as_local_node_id(trait_c.def_id); - let trait_c_span = trait_c_node_id.map(|trait_c_node_id| { + let trait_c_hir_id = tcx.hir().as_local_hir_id(trait_c.def_id); + let trait_c_span = trait_c_hir_id.map(|trait_c_hir_id| { // Add a label to the Span containing just the type of the const - match tcx.hir().expect_trait_item(trait_c_node_id).node { + match tcx.hir().expect_trait_item(trait_c_hir_id).node { TraitItemKind::Const(ref ty, _) => ty.span, _ => bug!("{:?} is not a trait const", trait_c), } diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index adff5f2f9b9c..32ca854b2774 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -2,7 +2,6 @@ use crate::check::FnCtxt; use rustc::infer::InferOk; use rustc::traits::{ObligationCause, ObligationCauseCode}; -use syntax::ast; use syntax::util::parser::PREC_POSTFIX; use syntax_pos::Span; use rustc::hir; @@ -164,7 +163,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { probe::Mode::MethodCall, expected, checked_ty, - ast::DUMMY_NODE_ID); + hir::DUMMY_HIR_ID); methods.retain(|m| { self.has_no_input_arg(m) && self.tcx.get_attrs(m.def_id).iter() @@ -218,15 +217,15 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if let hir::def::Def::Local(id) = path.def { let parent = self.tcx.hir().get_parent_node(id); if let Some(Node::Expr(hir::Expr { - id, + hir_id, node: hir::ExprKind::Closure(_, decl, ..), .. })) = self.tcx.hir().find(parent) { - let parent = self.tcx.hir().get_parent_node(*id); + let parent = self.tcx.hir().get_parent_node_by_hir_id(*hir_id); if let (Some(Node::Expr(hir::Expr { node: hir::ExprKind::MethodCall(path, span, expr), .. - })), 1) = (self.tcx.hir().find(parent), decl.inputs.len()) { + })), 1) = (self.tcx.hir().find_by_hir_id(parent), decl.inputs.len()) { let self_ty = self.tables.borrow().node_type(expr[0].hir_id); let self_ty = format!("{:?}", self_ty); let name = path.ident.as_str(); @@ -368,6 +367,15 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // Maybe remove `&`? hir::ExprKind::AddrOf(_, ref expr) => { if !cm.span_to_filename(expr.span).is_real() { + if let Ok(code) = cm.span_to_snippet(sp) { + if code.chars().next() == Some('&') { + return Some(( + sp, + "consider removing the borrow", + code[1..].to_string()), + ); + } + } return None; } if let Ok(code) = cm.span_to_snippet(expr.span) { @@ -470,8 +478,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { checked_ty: Ty<'tcx>, expected_ty: Ty<'tcx>, ) -> bool { - let parent_id = self.tcx.hir().get_parent_node(expr.id); - if let Some(parent) = self.tcx.hir().find(parent_id) { + let parent_id = self.tcx.hir().get_parent_node_by_hir_id(expr.hir_id); + if let Some(parent) = self.tcx.hir().find_by_hir_id(parent_id) { // Shouldn't suggest `.into()` on `const`s. if let Node::Item(Item { node: ItemKind::Const(_, _), .. }) = parent { // FIXME(estebank): modify once we decide to suggest `as` casts @@ -501,10 +509,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if let Some(hir::Node::Expr(hir::Expr { node: hir::ExprKind::Struct(_, fields, _), .. - })) = self.tcx.hir().find(self.tcx.hir().get_parent_node(expr.id)) { + })) = self.tcx.hir().find_by_hir_id(self.tcx.hir().get_parent_node_by_hir_id(expr.hir_id)) { // `expr` is a literal field for a struct, only suggest if appropriate for field in fields { - if field.expr.id == expr.id && field.is_shorthand { + if field.expr.hir_id == expr.hir_id && field.is_shorthand { // This is a field literal prefix = format!("{}: ", field.ident); break; diff --git a/src/librustc_typeck/check/dropck.rs b/src/librustc_typeck/check/dropck.rs index ad74e78fecdc..2184555a07d3 100644 --- a/src/librustc_typeck/check/dropck.rs +++ b/src/librustc_typeck/check/dropck.rs @@ -6,7 +6,7 @@ use rustc::infer::outlives::env::OutlivesEnvironment; use rustc::infer::{self, InferOk, SuppressRegionErrors}; use rustc::middle::region; use rustc::traits::{ObligationCause, TraitEngine, TraitEngineExt}; -use rustc::ty::subst::{Subst, Substs, UnpackedKind}; +use rustc::ty::subst::{Subst, SubstsRef, UnpackedKind}; use rustc::ty::{self, Ty, TyCtxt}; use crate::util::common::ErrorReported; @@ -145,7 +145,7 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'a, 'tcx>( drop_impl_did: DefId, dtor_predicates: &ty::GenericPredicates<'tcx>, self_type_did: DefId, - self_to_impl_substs: &Substs<'tcx>, + self_to_impl_substs: SubstsRef<'tcx>, ) -> Result<(), ErrorReported> { let mut result = Ok(()); @@ -313,6 +313,9 @@ pub fn check_safety_of_destructor_if_necessary<'a, 'gcx, 'tcx>( match kind.unpack() { UnpackedKind::Lifetime(r) => rcx.sub_regions(origin(), parent_scope, r), UnpackedKind::Type(ty) => rcx.type_must_outlive(origin(), ty, parent_scope), + UnpackedKind::Const(_) => { + // Generic consts don't add constraints. + } } } Ok(()) diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index 3b174b55f2ba..40c60caffa42 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -22,7 +22,7 @@ fn equate_intrinsic_type<'a, 'tcx>( inputs: Vec>, output: Ty<'tcx>, ) { - let def_id = tcx.hir().local_def_id(it.id); + let def_id = tcx.hir().local_def_id_from_hir_id(it.hir_id); match it.node { hir::ForeignItemKind::Fn(..) => {} @@ -337,7 +337,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, "va_start" | "va_end" => { match mk_va_list_ty() { Some(va_list_ty) => (0, vec![va_list_ty], tcx.mk_unit()), - None => bug!("va_list lang_item must be defined to use va_list intrinsics") + None => bug!("`va_list` language item needed for C-variadic intrinsics") } } @@ -364,14 +364,14 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, }; (0, vec![tcx.mk_imm_ref(tcx.mk_region(env_region), va_list_ty)], ret_ty) } - None => bug!("va_list lang_item must be defined to use va_list intrinsics") + None => bug!("`va_list` language item needed for C-variadic intrinsics") } } "va_arg" => { match mk_va_list_ty() { Some(va_list_ty) => (1, vec![va_list_ty], param(0)), - None => bug!("va_list lang_item must be defined to use va_list intrinsics") + None => bug!("`va_list` language item needed for C-variadic intrinsics") } } diff --git a/src/librustc_typeck/check/method/confirm.rs b/src/librustc_typeck/check/method/confirm.rs index 1eaa8b17d09f..e0b96ae884f3 100644 --- a/src/librustc_typeck/check/method/confirm.rs +++ b/src/librustc_typeck/check/method/confirm.rs @@ -4,10 +4,9 @@ use crate::astconv::AstConv; use crate::check::{FnCtxt, PlaceOp, callee, Needs}; use crate::hir::GenericArg; use crate::hir::def_id::DefId; -use rustc::ty::subst::Substs; +use rustc::ty::subst::{Subst, SubstsRef}; use rustc::traits; use rustc::ty::{self, Ty, GenericParamDefKind}; -use rustc::ty::subst::Subst; use rustc::ty::adjustment::{Adjustment, Adjust, OverloadedDeref}; use rustc::ty::adjustment::{AllowTwoPhase, AutoBorrow, AutoBorrowMutability}; use rustc::ty::fold::TypeFoldable; @@ -209,7 +208,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> { fn fresh_receiver_substs(&mut self, self_ty: Ty<'tcx>, pick: &probe::Pick<'tcx>) - -> &'tcx Substs<'tcx> { + -> SubstsRef<'tcx> { match pick.kind { probe::InherentImplPick => { let impl_def_id = pick.item.container.id(); @@ -300,8 +299,8 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> { &mut self, pick: &probe::Pick<'tcx>, seg: &hir::PathSegment, - parent_substs: &Substs<'tcx>, - ) -> &'tcx Substs<'tcx> { + parent_substs: SubstsRef<'tcx>, + ) -> SubstsRef<'tcx> { // Determine the values for the generic parameters of the method. // If they were not explicitly supplied, just construct fresh // variables. @@ -342,6 +341,9 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> { (GenericParamDefKind::Type { .. }, GenericArg::Type(ty)) => { self.to_ty(ty).into() } + (GenericParamDefKind::Const, GenericArg::Const(ct)) => { + self.to_const(&ct.value, self.tcx.type_of(param.def_id)).into() + } _ => unreachable!(), } }, @@ -369,7 +371,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> { // until we unify the `Self` type. fn instantiate_method_sig(&mut self, pick: &probe::Pick<'tcx>, - all_substs: &'tcx Substs<'tcx>) + all_substs: SubstsRef<'tcx>) -> (ty::FnSig<'tcx>, ty::InstantiatedPredicates<'tcx>) { debug!("instantiate_method_sig(pick={:?}, all_substs={:?})", pick, @@ -404,7 +406,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> { fn add_obligations(&mut self, fty: Ty<'tcx>, - all_substs: &Substs<'tcx>, + all_substs: SubstsRef<'tcx>, method_predicates: &ty::InstantiatedPredicates<'tcx>) { debug!("add_obligations: fty={:?} all_substs={:?} method_predicates={:?}", fty, diff --git a/src/librustc_typeck/check/method/mod.rs b/src/librustc_typeck/check/method/mod.rs index 259a28645815..8f27b5b7dc81 100644 --- a/src/librustc_typeck/check/method/mod.rs +++ b/src/librustc_typeck/check/method/mod.rs @@ -18,7 +18,7 @@ use rustc::hir; use rustc::hir::def::Def; use rustc::hir::def_id::DefId; use rustc::traits; -use rustc::ty::subst::Substs; +use rustc::ty::subst::{InternalSubsts, SubstsRef}; use rustc::ty::{self, Ty, ToPredicate, ToPolyTraitRef, TraitRef, TypeFoldable}; use rustc::ty::GenericParamDefKind; use rustc::ty::subst::Subst; @@ -38,7 +38,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) { pub struct MethodCallee<'tcx> { /// Impl method ID, for inherent methods, or trait method ID, otherwise. pub def_id: DefId, - pub substs: &'tcx Substs<'tcx>, + pub substs: SubstsRef<'tcx>, /// Instantiated method signature, i.e., it has been /// substituted, normalized, and has had late-bound @@ -105,7 +105,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { pub fn method_exists(&self, method_name: ast::Ident, self_ty: Ty<'tcx>, - call_expr_id: ast::NodeId, + call_expr_id: hir::HirId, allow_private: bool) -> bool { let mode = probe::Mode::MethodCall; @@ -131,7 +131,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { msg: &str, method_name: ast::Ident, self_ty: Ty<'tcx>, - call_expr_id: ast::NodeId, + call_expr_id: hir::HirId, ) { let has_params = self .probe_for_name( @@ -202,7 +202,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { .unwrap().insert(import_def_id); } - self.tcx.check_stability(pick.item.def_id, Some(call_expr.id), span); + self.tcx.check_stability(pick.item.def_id, Some(call_expr.hir_id), span); let result = self.confirm_method( span, @@ -255,7 +255,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let mode = probe::Mode::MethodCall; let self_ty = self.resolve_type_vars_if_possible(&self_ty); self.probe_for_name(span, mode, method_name, IsSuggestion(false), - self_ty, call_expr.id, scope) + self_ty, call_expr.hir_id, scope) } /// `lookup_method_in_trait` is used for overloaded operators. @@ -281,10 +281,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { trait_def_id); // Construct a trait-reference `self_ty : Trait` - let substs = Substs::for_item(self.tcx, trait_def_id, |param, _| { + let substs = InternalSubsts::for_item(self.tcx, trait_def_id, |param, _| { match param.kind { - GenericParamDefKind::Lifetime => {} - GenericParamDefKind::Type {..} => { + GenericParamDefKind::Lifetime | GenericParamDefKind::Const => {} + GenericParamDefKind::Type { .. } => { if param.index == 0 { return self_ty.into(); } else if let Some(ref input_types) = opt_input_types { @@ -399,7 +399,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { span: Span, method_name: ast::Ident, self_ty: Ty<'tcx>, - expr_id: ast::NodeId + expr_id: hir::HirId ) -> Result> { debug!( "resolve_ufcs: method_name={:?} self_ty={:?} expr_id={:?}", diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 04352626190f..efae870c3c3a 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -13,7 +13,7 @@ use rustc_data_structures::sync::Lrc; use rustc::hir; use rustc::lint; use rustc::session::config::nightly_options; -use rustc::ty::subst::{Subst, Substs}; +use rustc::ty::subst::{Subst, InternalSubsts, SubstsRef}; use rustc::traits::{self, ObligationCause}; use rustc::traits::query::{CanonicalTyGoal}; use rustc::traits::query::method_autoderef::{CandidateStep, MethodAutoderefStepsResult}; @@ -125,7 +125,7 @@ struct Candidate<'tcx> { #[derive(Debug)] enum CandidateKind<'tcx> { - InherentImplCandidate(&'tcx Substs<'tcx>, + InherentImplCandidate(SubstsRef<'tcx>, // Normalize obligations Vec>), ObjectCandidate, @@ -209,7 +209,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { mode: Mode, return_type: Ty<'tcx>, self_ty: Ty<'tcx>, - scope_expr_id: ast::NodeId) + scope_expr_id: hir::HirId) -> Vec { debug!("probe(self_ty={:?}, return_type={}, scope_expr_id={})", self_ty, @@ -238,7 +238,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { item_name: ast::Ident, is_suggestion: IsSuggestion, self_ty: Ty<'tcx>, - scope_expr_id: ast::NodeId, + scope_expr_id: hir::HirId, scope: ProbeScope) -> PickResult<'tcx> { debug!("probe(self_ty={:?}, item_name={}, scope_expr_id={})", @@ -263,7 +263,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { return_type: Option>, is_suggestion: IsSuggestion, self_ty: Ty<'tcx>, - scope_expr_id: ast::NodeId, + scope_expr_id: hir::HirId, scope: ProbeScope, op: OP) -> Result> @@ -340,7 +340,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { "the type of this value must be known \ to call a method on a raw pointer on it"); } else { - self.tcx.lint_node( + self.tcx.lint_hir( lint::builtin::TYVAR_BEHIND_RAW_POINTER, scope_expr_id, span, @@ -825,13 +825,12 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { } fn assemble_extension_candidates_for_traits_in_scope(&mut self, - expr_id: ast::NodeId) + expr_hir_id: hir::HirId) -> Result<(), MethodError<'tcx>> { - if expr_id == ast::DUMMY_NODE_ID { + if expr_hir_id == hir::DUMMY_HIR_ID { return Ok(()) } let mut duplicates = FxHashSet::default(); - let expr_hir_id = self.tcx.hir().node_to_hir_id(expr_id); let opt_applicable_traits = self.tcx.in_scope_traits(expr_hir_id); if let Some(applicable_traits) = opt_applicable_traits { for trait_candidate in applicable_traits.iter() { @@ -1415,7 +1414,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { steps, IsSuggestion(true)); pcx.allow_similar_names = true; pcx.assemble_inherent_candidates(); - pcx.assemble_extension_candidates_for_traits_in_scope(ast::DUMMY_NODE_ID)?; + pcx.assemble_extension_candidates_for_traits_in_scope(hir::DUMMY_HIR_ID)?; let method_names = pcx.candidate_method_names(); pcx.allow_similar_names = false; @@ -1425,7 +1424,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { pcx.reset(); pcx.method_name = Some(method_name); pcx.assemble_inherent_candidates(); - pcx.assemble_extension_candidates_for_traits_in_scope(ast::DUMMY_NODE_ID) + pcx.assemble_extension_candidates_for_traits_in_scope(hir::DUMMY_HIR_ID) .ok().map_or(None, |_| { pcx.pick_core() .and_then(|pick| pick.ok()) @@ -1481,7 +1480,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { fn xform_self_ty(&self, item: &ty::AssociatedItem, impl_ty: Ty<'tcx>, - substs: &Substs<'tcx>) + substs: SubstsRef<'tcx>) -> (Ty<'tcx>, Option>) { if item.kind == ty::AssociatedKind::Method && self.mode == Mode::MethodCall { let sig = self.xform_method_sig(item.def_id, substs); @@ -1493,7 +1492,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { fn xform_method_sig(&self, method: DefId, - substs: &Substs<'tcx>) + substs: SubstsRef<'tcx>) -> ty::FnSig<'tcx> { let fn_sig = self.tcx.fn_sig(method); @@ -1518,7 +1517,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { if generics.params.is_empty() { xform_fn_sig.subst(self.tcx, substs) } else { - let substs = Substs::for_item(self.tcx, method, |param, _| { + let substs = InternalSubsts::for_item(self.tcx, method, |param, _| { let i = param.index as usize; if i < substs.len() { substs[i] @@ -1529,7 +1528,10 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { // `impl_self_ty()` for an explanation. self.tcx.types.re_erased.into() } - GenericParamDefKind::Type {..} => self.var_for_def(self.span, param), + GenericParamDefKind::Type { .. } + | GenericParamDefKind::Const => { + self.var_for_def(self.span, param) + } } } }); @@ -1538,18 +1540,21 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { } /// Gets the type of an impl and generate substitutions with placeholders. - fn impl_ty_and_substs(&self, impl_def_id: DefId) -> (Ty<'tcx>, &'tcx Substs<'tcx>) { + fn impl_ty_and_substs(&self, impl_def_id: DefId) -> (Ty<'tcx>, SubstsRef<'tcx>) { (self.tcx.type_of(impl_def_id), self.fresh_item_substs(impl_def_id)) } - fn fresh_item_substs(&self, def_id: DefId) -> &'tcx Substs<'tcx> { - Substs::for_item(self.tcx, def_id, |param, _| { + fn fresh_item_substs(&self, def_id: DefId) -> SubstsRef<'tcx> { + InternalSubsts::for_item(self.tcx, def_id, |param, _| { match param.kind { GenericParamDefKind::Lifetime => self.tcx.types.re_erased.into(), - GenericParamDefKind::Type {..} => { + GenericParamDefKind::Type { .. } => { self.next_ty_var(TypeVariableOrigin::SubstitutionPlaceholder( self.tcx.def_span(def_id))).into() } + GenericParamDefKind::Const { .. } => { + unimplemented!() // FIXME(const_generics) + } } }) } diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index c15cb1e5bb15..4bf6471a6293 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -732,7 +732,7 @@ fn compute_all_traits<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Vec impl<'v, 'a, 'tcx> itemlikevisit::ItemLikeVisitor<'v> for Visitor<'a, 'tcx> { fn visit_item(&mut self, i: &'v hir::Item) { if let hir::ItemKind::Trait(..) = i.node { - let def_id = self.map.local_def_id(i.id); + let def_id = self.map.local_def_id_from_hir_id(i.hir_id); self.traits.push(def_id); } } diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 212846651512..28c79ce0c74e 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -109,7 +109,7 @@ use rustc::ty::{ use rustc::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability}; use rustc::ty::fold::TypeFoldable; use rustc::ty::query::Providers; -use rustc::ty::subst::{UnpackedKind, Subst, Substs, UserSelfTy, UserSubsts}; +use rustc::ty::subst::{UnpackedKind, Subst, InternalSubsts, SubstsRef, UserSelfTy, UserSubsts}; use rustc::ty::util::{Representability, IntTypeExt, Discr}; use rustc::ty::layout::VariantIdx; use syntax_pos::{self, BytePos, Span, MultiSpan}; @@ -130,14 +130,14 @@ use std::mem::replace; use std::ops::{self, Deref}; use std::slice; -use crate::require_c_abi_if_variadic; -use crate::session::{CompileIncomplete, Session}; +use crate::require_c_abi_if_c_variadic; +use crate::session::Session; use crate::session::config::EntryFnType; use crate::TypeAndSubsts; use crate::lint; use crate::util::captures::Captures; use crate::util::common::{ErrorReported, indenter}; -use crate::util::nodemap::{DefIdMap, DefIdSet, FxHashMap, FxHashSet, NodeMap}; +use crate::util::nodemap::{DefIdMap, DefIdSet, FxHashMap, FxHashSet, HirIdMap}; pub use self::Expectation::*; use self::autoderef::Autoderef; @@ -194,7 +194,7 @@ pub struct Inherited<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { tables: MaybeInProgressTables<'a, 'tcx>, - locals: RefCell>>, + locals: RefCell>>, fulfillment_cx: RefCell>>, @@ -388,14 +388,14 @@ impl Needs { #[derive(Copy, Clone)] pub struct UnsafetyState { - pub def: ast::NodeId, + pub def: hir::HirId, pub unsafety: hir::Unsafety, pub unsafe_push_count: u32, from_fn: bool } impl UnsafetyState { - pub fn function(unsafety: hir::Unsafety, def: ast::NodeId) -> UnsafetyState { + pub fn function(unsafety: hir::Unsafety, def: hir::HirId) -> UnsafetyState { UnsafetyState { def: def, unsafety: unsafety, unsafe_push_count: 0, from_fn: true } } @@ -410,11 +410,11 @@ impl UnsafetyState { unsafety => { let (unsafety, def, count) = match blk.rules { hir::PushUnsafeBlock(..) => - (unsafety, blk.id, self.unsafe_push_count.checked_add(1).unwrap()), + (unsafety, blk.hir_id, self.unsafe_push_count.checked_add(1).unwrap()), hir::PopUnsafeBlock(..) => - (unsafety, blk.id, self.unsafe_push_count.checked_sub(1).unwrap()), + (unsafety, blk.hir_id, self.unsafe_push_count.checked_sub(1).unwrap()), hir::UnsafeBlock(..) => - (hir::Unsafety::Unsafe, blk.id, self.unsafe_push_count), + (hir::Unsafety::Unsafe, blk.hir_id, self.unsafe_push_count), hir::DefaultBlock => (unsafety, self.def, self.unsafe_push_count), }; @@ -497,11 +497,11 @@ pub struct BreakableCtxt<'gcx: 'tcx, 'tcx> { pub struct EnclosingBreakables<'gcx: 'tcx, 'tcx> { stack: Vec>, - by_id: NodeMap, + by_id: HirIdMap, } impl<'gcx, 'tcx> EnclosingBreakables<'gcx, 'tcx> { - fn find_breakable(&mut self, target_id: ast::NodeId) -> &mut BreakableCtxt<'gcx, 'tcx> { + fn find_breakable(&mut self, target_id: hir::HirId) -> &mut BreakableCtxt<'gcx, 'tcx> { let ix = *self.by_id.get(&target_id).unwrap_or_else(|| { bug!("could not find enclosing breakable with id {}", target_id); }); @@ -593,8 +593,7 @@ impl<'a, 'gcx, 'tcx> Inherited<'a, 'gcx, 'tcx> { pub fn build(tcx: TyCtxt<'a, 'gcx, 'gcx>, def_id: DefId) -> InheritedBuilder<'a, 'gcx, 'tcx> { let hir_id_root = if def_id.is_local() { - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - let hir_id = tcx.hir().definitions().node_to_hir_id(node_id); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); DefId::local(hir_id.owner) } else { def_id @@ -619,8 +618,8 @@ impl<'a, 'gcx, 'tcx> InheritedBuilder<'a, 'gcx, 'tcx> { impl<'a, 'gcx, 'tcx> Inherited<'a, 'gcx, 'tcx> { fn new(infcx: InferCtxt<'a, 'gcx, 'tcx>, def_id: DefId) -> Self { let tcx = infcx.tcx; - let item_id = tcx.hir().as_local_node_id(def_id); - let body_id = item_id.and_then(|id| tcx.hir().maybe_body_owned_by(id)); + let item_id = tcx.hir().as_local_hir_id(def_id); + let body_id = item_id.and_then(|id| tcx.hir().maybe_body_owned_by_by_hir_id(id)); let implicit_region_bound = body_id.map(|body_id| { let body = tcx.hir().body(body_id); tcx.mk_region(ty::ReScope(region::Scope { @@ -695,15 +694,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for CheckItemTypesVisitor<'a, 'tcx> { pub fn check_wf_new<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Result<(), ErrorReported> { tcx.sess.track_errors(|| { let mut visit = wfcheck::CheckTypeWellFormedVisitor::new(tcx); - tcx.hir().krate().visit_all_item_likes(&mut visit); - }) -} - -pub fn check_item_types<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Result<(), ErrorReported> { - tcx.sess.track_errors(|| { - for &module in tcx.hir().krate().modules.keys() { - tcx.ensure().check_mod_item_types(tcx.hir().local_def_id(module)); - } + tcx.hir().krate().par_visit_all_item_likes(&mut visit); }) } @@ -711,12 +702,8 @@ fn check_mod_item_types<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) tcx.hir().visit_item_likes_in_module(module_def_id, &mut CheckItemTypesVisitor { tcx }); } -pub fn check_item_bodies<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Result<(), CompileIncomplete> { - tcx.typeck_item_bodies(LOCAL_CRATE) -} - fn typeck_item_bodies<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) - -> Result<(), CompileIncomplete> + -> Result<(), ErrorReported> { debug_assert!(crate_num == LOCAL_CRATE); Ok(tcx.sess.track_errors(|| { @@ -770,10 +757,10 @@ fn adt_destructor<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, /// (notably closures), `typeck_tables(def_id)` would wind up /// redirecting to the owning function. fn primary_body_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - id: ast::NodeId) + id: hir::HirId) -> Option<(hir::BodyId, Option<&'tcx hir::FnDecl>)> { - match tcx.hir().get(id) { + match tcx.hir().get_by_hir_id(id) { Node::Item(item) => { match item.node { hir::ItemKind::Const(_, body) | @@ -820,7 +807,7 @@ fn has_typeck_tables<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, return tcx.has_typeck_tables(outer_def_id); } - let id = tcx.hir().as_local_node_id(def_id).unwrap(); + let id = tcx.hir().as_local_hir_id(def_id).unwrap(); primary_body_of(tcx, id).is_some() } @@ -840,8 +827,8 @@ fn typeck_tables_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, return tcx.typeck_tables_of(outer_def_id); } - let id = tcx.hir().as_local_node_id(def_id).unwrap(); - let span = tcx.hir().span(id); + let id = tcx.hir().as_local_hir_id(def_id).unwrap(); + let span = tcx.hir().span_by_hir_id(id); // Figure out what primary body this item has. let (body_id, fn_decl) = primary_body_of(tcx, id).unwrap_or_else(|| { @@ -925,8 +912,8 @@ fn typeck_tables_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Consistency check our TypeckTables instance can hold all ItemLocalIds // it will need to hold. - assert_eq!(tables.local_id_root, - Some(DefId::local(tcx.hir().definitions().node_to_hir_id(id).owner))); + assert_eq!(tables.local_id_root, Some(DefId::local(id.owner))); + tables } @@ -939,11 +926,11 @@ fn check_abi<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, span: Span, abi: Abi) { struct GatherLocalsVisitor<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { fcx: &'a FnCtxt<'a, 'gcx, 'tcx>, - parent_id: ast::NodeId, + parent_id: hir::HirId, } impl<'a, 'gcx, 'tcx> GatherLocalsVisitor<'a, 'gcx, 'tcx> { - fn assign(&mut self, span: Span, nid: ast::NodeId, ty_opt: Option>) -> Ty<'tcx> { + fn assign(&mut self, span: Span, nid: hir::HirId, ty_opt: Option>) -> Ty<'tcx> { match ty_opt { None => { // infer the variable's type @@ -994,29 +981,30 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for GatherLocalsVisitor<'a, 'gcx, 'tcx> { }, None => None, }; - self.assign(local.span, local.id, local_ty); + self.assign(local.span, local.hir_id, local_ty); debug!("Local variable {:?} is assigned type {}", local.pat, self.fcx.ty_to_string( - self.fcx.locals.borrow().get(&local.id).unwrap().clone().decl_ty)); + self.fcx.locals.borrow().get(&local.hir_id).unwrap().clone().decl_ty)); intravisit::walk_local(self, local); } // Add pattern bindings. fn visit_pat(&mut self, p: &'gcx hir::Pat) { - if let PatKind::Binding(_, _, _, ident, _) = p.node { - let var_ty = self.assign(p.span, p.id, None); + if let PatKind::Binding(_, _, ident, _) = p.node { + let var_ty = self.assign(p.span, p.hir_id, None); + let node_id = self.fcx.tcx.hir().hir_to_node_id(p.hir_id); if !self.fcx.tcx.features().unsized_locals { self.fcx.require_type_is_sized(var_ty, p.span, - traits::VariableType(p.id)); + traits::VariableType(node_id)); } debug!("Pattern binding {} is assigned to {} with type {:?}", ident, self.fcx.ty_to_string( - self.fcx.locals.borrow().get(&p.id).unwrap().clone().decl_ty), + self.fcx.locals.borrow().get(&p.hir_id).unwrap().clone().decl_ty), var_ty); } intravisit::walk_pat(self, p); @@ -1051,7 +1039,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, fn_sig: ty::FnSig<'tcx>, decl: &'gcx hir::FnDecl, - fn_id: ast::NodeId, + fn_id: hir::HirId, body: &'gcx hir::Body, can_be_generator: Option) -> (FnCtxt<'a, 'gcx, 'tcx>, Option>) @@ -1072,7 +1060,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, fn_sig = fcx.tcx.mk_fn_sig( fn_sig.inputs().iter().cloned(), revealed_ret_ty, - fn_sig.variadic, + fn_sig.c_variadic, fn_sig.unsafety, fn_sig.abi ); @@ -1085,9 +1073,9 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, fcx.yield_ty = Some(yield_ty); } - let outer_def_id = fcx.tcx.closure_base_def_id(fcx.tcx.hir().local_def_id(fn_id)); - let outer_node_id = fcx.tcx.hir().as_local_node_id(outer_def_id).unwrap(); - GatherLocalsVisitor { fcx: &fcx, parent_id: outer_node_id, }.visit_body(body); + let outer_def_id = fcx.tcx.closure_base_def_id(fcx.tcx.hir().local_def_id_from_hir_id(fn_id)); + let outer_hir_id = fcx.tcx.hir().as_local_hir_id(outer_def_id).unwrap(); + GatherLocalsVisitor { fcx: &fcx, parent_id: outer_hir_id, }.visit_body(body); // Add formal parameters. for (arg_ty, arg) in fn_sig.inputs().iter().zip(&body.arguments) { @@ -1110,8 +1098,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, fcx.write_ty(arg.hir_id, arg_ty); } - let fn_hir_id = fcx.tcx.hir().node_to_hir_id(fn_id); - inherited.tables.borrow_mut().liberated_fn_sigs_mut().insert(fn_hir_id, fn_sig); + inherited.tables.borrow_mut().liberated_fn_sigs_mut().insert(fn_id, fn_sig); fcx.check_return_expr(&body.value); @@ -1164,14 +1151,13 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, // Check that the main return type implements the termination trait. if let Some(term_id) = fcx.tcx.lang_items().termination() { if let Some((def_id, EntryFnType::Main)) = fcx.tcx.entry_fn(LOCAL_CRATE) { - let main_id = fcx.tcx.hir().as_local_node_id(def_id).unwrap(); + let main_id = fcx.tcx.hir().as_local_hir_id(def_id).unwrap(); if main_id == fn_id { let substs = fcx.tcx.mk_substs_trait(declared_ret_ty, &[]); let trait_ref = ty::TraitRef::new(term_id, substs); let return_ty_span = decl.output.span(); - let fn_hir_id = fcx.tcx.hir().node_to_hir_id(fn_id); let cause = traits::ObligationCause::new( - return_ty_span, fn_hir_id, ObligationCauseCode::MainFunctionType); + return_ty_span, fn_id, ObligationCauseCode::MainFunctionType); inherited.register_predicate( traits::Obligation::new( @@ -1182,7 +1168,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, // Check that a function marked as `#[panic_handler]` has signature `fn(&PanicInfo) -> !` if let Some(panic_impl_did) = fcx.tcx.lang_items().panic_impl() { - if panic_impl_did == fcx.tcx.hir().local_def_id(fn_id) { + if panic_impl_did == fcx.tcx.hir().local_def_id_from_hir_id(fn_id) { if let Some(panic_info_did) = fcx.tcx.lang_items().panic_info() { // at this point we don't care if there are duplicate handlers or if the handler has // the wrong signature as this value we'll be used when writing metadata and that @@ -1197,7 +1183,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, } let inputs = fn_sig.inputs(); - let span = fcx.tcx.hir().span(fn_id); + let span = fcx.tcx.hir().span_by_hir_id(fn_id); if inputs.len() == 1 { let arg_is_panic_info = match inputs[0].sty { ty::Ref(region, ty, mutbl) => match ty.sty { @@ -1218,7 +1204,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, ); } - if let Node::Item(item) = fcx.tcx.hir().get(fn_id) { + if let Node::Item(item) = fcx.tcx.hir().get_by_hir_id(fn_id) { if let ItemKind::Fn(_, _, ref generics, _) = item.node { if !generics.params.is_empty() { fcx.tcx.sess.span_err( @@ -1240,7 +1226,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, // Check that a function marked as `#[alloc_error_handler]` has signature `fn(Layout) -> !` if let Some(alloc_error_handler_did) = fcx.tcx.lang_items().oom() { - if alloc_error_handler_did == fcx.tcx.hir().local_def_id(fn_id) { + if alloc_error_handler_did == fcx.tcx.hir().local_def_id_from_hir_id(fn_id) { if let Some(alloc_layout_did) = fcx.tcx.lang_items().alloc_layout() { if declared_ret_ty.sty != ty::Never { fcx.tcx.sess.span_err( @@ -1250,7 +1236,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, } let inputs = fn_sig.inputs(); - let span = fcx.tcx.hir().span(fn_id); + let span = fcx.tcx.hir().span_by_hir_id(fn_id); if inputs.len() == 1 { let arg_is_alloc_layout = match inputs[0].sty { ty::Adt(ref adt, _) => { @@ -1266,7 +1252,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, ); } - if let Node::Item(item) = fcx.tcx.hir().get(fn_id) { + if let Node::Item(item) = fcx.tcx.hir().get_by_hir_id(fn_id) { if let ItemKind::Fn(_, _, ref generics, _) = item.node { if !generics.params.is_empty() { fcx.tcx.sess.span_err( @@ -1291,9 +1277,9 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, } fn check_struct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - id: ast::NodeId, + id: hir::HirId, span: Span) { - let def_id = tcx.hir().local_def_id(id); + let def_id = tcx.hir().local_def_id_from_hir_id(id); let def = tcx.adt_def(def_id); def.destructor(tcx); // force the destructor to be evaluated check_representable(tcx, span, def_id); @@ -1307,9 +1293,9 @@ fn check_struct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } fn check_union<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - id: ast::NodeId, + id: hir::HirId, span: Span) { - let def_id = tcx.hir().local_def_id(id); + let def_id = tcx.hir().local_def_id_from_hir_id(id); let def = tcx.adt_def(def_id); def.destructor(tcx); // force the destructor to be evaluated check_representable(tcx, span, def_id); @@ -1320,7 +1306,7 @@ fn check_union<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, fn check_opaque<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, span: Span, ) { if let Err(partially_expanded_type) = tcx.try_expand_impl_trait_type(def_id, substs) { @@ -1340,28 +1326,28 @@ fn check_opaque<'a, 'tcx>( pub fn check_item_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, it: &'tcx hir::Item) { debug!( - "check_item_type(it.id={}, it.name={})", - it.id, - tcx.item_path_str(tcx.hir().local_def_id(it.id)) + "check_item_type(it.hir_id={}, it.name={})", + it.hir_id, + tcx.item_path_str(tcx.hir().local_def_id_from_hir_id(it.hir_id)) ); let _indenter = indenter(); match it.node { // Consts can play a role in type-checking, so they are included here. hir::ItemKind::Static(..) => { - let def_id = tcx.hir().local_def_id(it.id); + let def_id = tcx.hir().local_def_id_from_hir_id(it.hir_id); tcx.typeck_tables_of(def_id); maybe_check_static_with_link_section(tcx, def_id, it.span); } hir::ItemKind::Const(..) => { - tcx.typeck_tables_of(tcx.hir().local_def_id(it.id)); + tcx.typeck_tables_of(tcx.hir().local_def_id_from_hir_id(it.hir_id)); } hir::ItemKind::Enum(ref enum_definition, _) => { - check_enum(tcx, it.span, &enum_definition.variants, it.id); + check_enum(tcx, it.span, &enum_definition.variants, it.hir_id); } hir::ItemKind::Fn(..) => {} // entirely within check_item_body hir::ItemKind::Impl(.., ref impl_item_refs) => { - debug!("ItemKind::Impl {} with id {}", it.ident, it.id); - let impl_def_id = tcx.hir().local_def_id(it.id); + debug!("ItemKind::Impl {} with id {}", it.ident, it.hir_id); + let impl_def_id = tcx.hir().local_def_id_from_hir_id(it.hir_id); if let Some(impl_trait_ref) = tcx.impl_trait_ref(impl_def_id) { check_impl_items_against_trait( tcx, @@ -1375,23 +1361,23 @@ pub fn check_item_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, it: &'tcx hir::Ite } } hir::ItemKind::Trait(..) => { - let def_id = tcx.hir().local_def_id(it.id); + let def_id = tcx.hir().local_def_id_from_hir_id(it.hir_id); check_on_unimplemented(tcx, def_id, it); } hir::ItemKind::Struct(..) => { - check_struct(tcx, it.id, it.span); + check_struct(tcx, it.hir_id, it.span); } hir::ItemKind::Union(..) => { - check_union(tcx, it.id, it.span); + check_union(tcx, it.hir_id, it.span); } hir::ItemKind::Existential(..) => { - let def_id = tcx.hir().local_def_id(it.id); + let def_id = tcx.hir().local_def_id_from_hir_id(it.hir_id); - let substs = Substs::identity_for_item(tcx, def_id); + let substs = InternalSubsts::identity_for_item(tcx, def_id); check_opaque(tcx, def_id, substs, it.span); } hir::ItemKind::Ty(..) => { - let def_id = tcx.hir().local_def_id(it.id); + let def_id = tcx.hir().local_def_id_from_hir_id(it.hir_id); let pty_ty = tcx.type_of(def_id); let generics = tcx.generics_of(def_id); check_bounds_are_used(tcx, &generics, pty_ty); @@ -1409,7 +1395,7 @@ pub fn check_item_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, it: &'tcx hir::Ite } } else { for item in &m.items { - let generics = tcx.generics_of(tcx.hir().local_def_id(item.id)); + let generics = tcx.generics_of(tcx.hir().local_def_id_from_hir_id(item.hir_id)); if generics.params.len() - generics.own_counts().lifetimes != 0 { let mut err = struct_span_err!( tcx.sess, @@ -1428,7 +1414,7 @@ pub fn check_item_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, it: &'tcx hir::Ite } if let hir::ForeignItemKind::Fn(ref fn_decl, _, _) = item.node { - require_c_abi_if_variadic(tcx, fn_decl, m.abi, item.span); + require_c_abi_if_c_variadic(tcx, fn_decl, m.abi, item.span); } } } @@ -1478,7 +1464,7 @@ fn maybe_check_static_with_link_section(tcx: TyCtxt<'_, '_, '_>, id: DefId, span fn check_on_unimplemented<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_def_id: DefId, item: &hir::Item) { - let item_def_id = tcx.hir().local_def_id(item.id); + let item_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id); // an error would be reported if this fails. let _ = traits::OnUnimplementedDirective::of_item(tcx, trait_def_id, item_def_id); } @@ -1556,7 +1542,8 @@ fn check_impl_items_against_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Check existing impl methods to see if they are both present in trait // and compatible with trait signature for impl_item in impl_items() { - let ty_impl_item = tcx.associated_item(tcx.hir().local_def_id(impl_item.id)); + let ty_impl_item = tcx.associated_item( + tcx.hir().local_def_id_from_hir_id(impl_item.hir_id)); let ty_trait_item = tcx.associated_items(impl_trait_ref.def_id) .find(|ac| Namespace::from(&impl_item.node) == Namespace::from(ac.kind) && tcx.hygienic_eq(ty_impl_item.ident, ac.ident, impl_trait_ref.def_id)) @@ -1811,7 +1798,7 @@ fn check_transparent<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span, def_id: De // For each field, figure out if it's known to be a ZST and align(1) let field_infos = adt.non_enum_variant().fields.iter().map(|field| { - let ty = field.ty(tcx, Substs::identity_for_item(tcx, field.did)); + let ty = field.ty(tcx, InternalSubsts::identity_for_item(tcx, field.did)); let param_env = tcx.param_env(field.did); let layout = tcx.layout_of(param_env.and(ty)); // We are currently checking the type this field came from, so it must be local @@ -1843,8 +1830,8 @@ fn check_transparent<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span, def_id: De pub fn check_enum<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span, vs: &'tcx [hir::Variant], - id: ast::NodeId) { - let def_id = tcx.hir().local_def_id(id); + id: hir::HirId) { + let def_id = tcx.hir().local_def_id_from_hir_id(id); let def = tcx.adt_def(def_id); def.destructor(tcx); // force the destructor to be evaluated @@ -1872,7 +1859,7 @@ pub fn check_enum<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, for v in vs { if let Some(ref e) = v.node.disr_expr { - tcx.typeck_tables_of(tcx.hir().local_def_id(e.id)); + tcx.typeck_tables_of(tcx.hir().local_def_id_from_hir_id(e.hir_id)); } } @@ -1920,9 +1907,9 @@ impl<'a, 'gcx, 'tcx> AstConv<'gcx, 'tcx> for FnCtxt<'a, 'gcx, 'tcx> { -> Lrc> { let tcx = self.tcx; - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - let item_id = tcx.hir().ty_param_owner(node_id); - let item_def_id = tcx.hir().local_def_id(item_id); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); + let item_id = tcx.hir().ty_param_owner(hir_id); + let item_def_id = tcx.hir().local_def_id_from_hir_id(item_id); let generics = tcx.generics_of(item_def_id); let index = generics.param_def_id_to_index[&def_id]; Lrc::new(ty::GenericPredicates { @@ -2030,7 +2017,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ret_coercion_span: RefCell::new(None), yield_ty: None, ps: RefCell::new(UnsafetyState::function(hir::Unsafety::Normal, - ast::CRATE_NODE_ID)), + hir::CRATE_HIR_ID)), diverges: Cell::new(Diverges::Maybe), has_errors: Cell::new(false), enclosing_breakables: RefCell::new(EnclosingBreakables { @@ -2051,13 +2038,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// Produces warning on the given node, if the current point in the /// function is unreachable, and there hasn't been another warning. - fn warn_if_unreachable(&self, id: ast::NodeId, span: Span, kind: &str) { + fn warn_if_unreachable(&self, id: hir::HirId, span: Span, kind: &str) { if self.diverges.get() == Diverges::Always { self.diverges.set(Diverges::WarnedAlways); debug!("warn_if_unreachable: id={:?} span={:?} kind={}", id, span, kind); - self.tcx().lint_node( + self.tcx().lint_hir( lint::builtin::UNREACHABLE_CODE, id, span, &format!("unreachable {}", kind)); @@ -2126,10 +2113,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { format!("{:?}", self_ptr) } - pub fn local_ty(&self, span: Span, nid: ast::NodeId) -> LocalTy<'tcx> { + pub fn local_ty(&self, span: Span, nid: hir::HirId) -> LocalTy<'tcx> { self.locals.borrow().get(&nid).cloned().unwrap_or_else(|| span_bug!(span, "no type for local variable {}", - self.tcx.hir().node_to_string(nid)) + self.tcx.hir().hir_to_string(nid)) ) } @@ -2145,8 +2132,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } - pub fn write_field_index(&self, node_id: ast::NodeId, index: usize) { - let hir_id = self.tcx.hir().node_to_hir_id(node_id); + pub fn write_field_index(&self, hir_id: hir::HirId, index: usize) { self.tables.borrow_mut().field_indices_mut().insert(hir_id, index); } @@ -2180,7 +2166,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if !method_generics.params.is_empty() { let user_type_annotation = self.infcx.probe(|_| { let user_substs = UserSubsts { - substs: Substs::for_item(self.tcx, method.def_id, |param, _| { + substs: InternalSubsts::for_item(self.tcx, method.def_id, |param, _| { let i = param.index as usize; if i < method_generics.parent_count { self.infcx.var_for_def(DUMMY_SP, param) @@ -2203,7 +2189,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } - pub fn write_substs(&self, node_id: hir::HirId, substs: &'tcx Substs<'tcx>) { + pub fn write_substs(&self, node_id: hir::HirId, substs: SubstsRef<'tcx>) { if !substs.is_noop() { debug!("write_substs({:?}, {:?}) in fcx {}", node_id, @@ -2225,7 +2211,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { &self, hir_id: hir::HirId, def_id: DefId, - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, user_self_ty: Option>, ) { debug!( @@ -2306,7 +2292,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// types as well. This function combines the two. fn instantiate_type_scheme(&self, span: Span, - substs: &Substs<'tcx>, + substs: SubstsRef<'tcx>, value: &T) -> T where T : TypeFoldable<'tcx> @@ -2322,7 +2308,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// As `instantiate_type_scheme`, but for the bounds found in a /// generic type scheme. - fn instantiate_bounds(&self, span: Span, def_id: DefId, substs: &Substs<'tcx>) + fn instantiate_bounds(&self, span: Span, def_id: DefId, substs: SubstsRef<'tcx>) -> ty::InstantiatedPredicates<'tcx> { let bounds = self.tcx.predicates_of(def_id); let result = bounds.instantiate(self.tcx, substs); @@ -2339,10 +2325,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// `InferCtxt::instantiate_opaque_types` for more details. fn instantiate_opaque_types_from_value>( &self, - parent_id: ast::NodeId, + parent_id: hir::HirId, value: &T, ) -> T { - let parent_def_id = self.tcx.hir().local_def_id(parent_id); + let parent_def_id = self.tcx.hir().local_def_id_from_hir_id(parent_id); debug!("instantiate_opaque_types_from_value(parent_def_id={:?}, value={:?})", parent_def_id, value); @@ -2438,6 +2424,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ty } + pub fn to_const(&self, ast_c: &hir::AnonConst, ty: Ty<'tcx>) -> &'tcx ty::LazyConst<'tcx> { + AstConv::ast_const_to_const(self, ast_c, ty) + } + // If the type given by the user has free regions, save it for later, since // NLL would like to enforce those. Also pass in types that involve // projections, since those can resolve to `'static` bounds (modulo #54940, @@ -2480,7 +2470,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } /// Registers obligations that all types appearing in `substs` are well-formed. - pub fn add_wf_bounds(&self, substs: &Substs<'tcx>, expr: &hir::Expr) { + pub fn add_wf_bounds(&self, substs: SubstsRef<'tcx>, expr: &hir::Expr) { for ty in substs.types() { self.register_wf_obligation(ty, expr.span, traits::MiscObligation); } @@ -2524,7 +2514,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { pub fn field_ty(&self, span: Span, field: &'tcx ty::FieldDef, - substs: &Substs<'tcx>) + substs: SubstsRef<'tcx>) -> Ty<'tcx> { self.normalize_associated_types_in(span, &field.ty(self.tcx, substs)) @@ -2786,7 +2776,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { &method.sig.inputs()[1..] ); self.check_argument_types(sp, expr_sp, &method.sig.inputs()[1..], &expected_arg_tys[..], - args_no_rcvr, method.sig.variadic, tuple_arguments, + args_no_rcvr, method.sig.c_variadic, tuple_arguments, self.tcx.hir().span_if_local(method.def_id)); method.sig.output() } @@ -2865,7 +2855,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fn_inputs: &[Ty<'tcx>], mut expected_arg_tys: &[Ty<'tcx>], args: &'gcx [hir::Expr], - variadic: bool, + c_variadic: bool, tuple_arguments: TupleArgumentsFlag, def_span: Option) { let tcx = self.tcx; @@ -2889,11 +2879,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let param_count_error = |expected_count: usize, arg_count: usize, error_code: &str, - variadic: bool, + c_variadic: bool, sugg_unit: bool| { let mut err = tcx.sess.struct_span_err_with_code(sp, &format!("this function takes {}{} but {} {} supplied", - if variadic {"at least "} else {""}, + if c_variadic { "at least " } else { "" }, potentially_plural_count(expected_count, "parameter"), potentially_plural_count(arg_count, "parameter"), if arg_count == 1 {"was"} else {"were"}), @@ -2913,7 +2903,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { Applicability::MachineApplicable); } else { err.span_label(sp, format!("expected {}{}", - if variadic {"at least "} else {""}, + if c_variadic { "at least " } else { "" }, potentially_plural_count(expected_count, "parameter"))); } err.emit(); @@ -2947,7 +2937,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } else if expected_arg_count == supplied_arg_count { fn_inputs.to_vec() - } else if variadic { + } else if c_variadic { if supplied_arg_count >= expected_arg_count { fn_inputs.to_vec() } else { @@ -2994,10 +2984,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.select_obligations_where_possible(false); } - // For variadic functions, we don't have a declared type for all of + // For C-variadic functions, we don't have a declared type for all of // the arguments hence we only do our usual type checking with // the arguments who's types we do know. - let t = if variadic { + let t = if c_variadic { expected_arg_count } else if tuple_arguments == TupleArguments { args.len() @@ -3009,7 +2999,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // Closure arguments themselves can't be diverging, but // a previous argument can, e.g., `foo(panic!(), || {})`. if !check_closures { - self.warn_if_unreachable(arg.id, arg.span, "expression"); + self.warn_if_unreachable(arg.hir_id, arg.span, "expression"); } let is_closure = match arg.node { @@ -3046,7 +3036,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // We also need to make sure we at least write the ty of the other // arguments which we skipped above. - if variadic { + if c_variadic { fn variadic_error<'tcx>(s: &Session, span: Span, t: Ty<'tcx>, cast_ty: &str) { use crate::structured_errors::{VariadicError, StructuredDiagnostic}; VariadicError::new(s, span, t, cast_ty).diagnostic().emit(); @@ -3340,7 +3330,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ret_coercion.borrow_mut() .coerce(self, &self.cause(return_expr.span, - ObligationCauseCode::ReturnType(return_expr.id)), + ObligationCauseCode::ReturnType(return_expr.hir_id)), return_expr, return_expr_ty); } @@ -3511,13 +3501,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let field_ty = self.field_ty(expr.span, field, substs); // Save the index of all fields regardless of their visibility in case // of error recovery. - self.write_field_index(expr.id, index); + self.write_field_index(expr.hir_id, index); if field.vis.is_accessible_from(def_scope, self.tcx) { let adjustments = autoderef.adjust_steps(self, needs); self.apply_adjustments(base, adjustments); autoderef.finalize(self); - self.tcx.check_stability(field.did, Some(expr.id), expr.span); + self.tcx.check_stability(field.did, Some(expr.hir_id), expr.span); return field_ty; } private_candidate = Some((base_def.did, field_ty)); @@ -3532,7 +3522,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.apply_adjustments(base, adjustments); autoderef.finalize(self); - self.write_field_index(expr.id, index); + self.write_field_index(expr.hir_id, index); return field_ty; } } @@ -3549,31 +3539,33 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { "field `{}` of struct `{}` is private", field, struct_path); // Also check if an accessible method exists, which is often what is meant. - if self.method_exists(field, expr_t, expr.id, false) && !self.expr_in_place(expr.id) { + if self.method_exists(field, expr_t, expr.hir_id, false) + && !self.expr_in_place(expr.hir_id) + { self.suggest_method_call( &mut err, &format!("a method `{}` also exists, call it with parentheses", field), field, expr_t, - expr.id, + expr.hir_id, ); } err.emit(); field_ty } else if field.name == keywords::Invalid.name() { self.tcx().types.err - } else if self.method_exists(field, expr_t, expr.id, true) { + } else if self.method_exists(field, expr_t, expr.hir_id, true) { let mut err = type_error_struct!(self.tcx().sess, field.span, expr_t, E0615, "attempted to take value of method `{}` on type `{}`", field, expr_t); - if !self.expr_in_place(expr.id) { + if !self.expr_in_place(expr.hir_id) { self.suggest_method_call( &mut err, "use parentheses to call the method", field, expr_t, - expr.id + expr.hir_id ); } else { err.help("methods are immutable and cannot be assigned to"); @@ -3613,7 +3605,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ) { let base = self.tcx.sess.source_map() .span_to_snippet(base.span) - .unwrap_or_else(|_| self.tcx.hir().node_to_pretty_string(base.id)); + .unwrap_or_else(|_| + self.tcx.hir().hir_to_pretty_string(base.hir_id)); let help = "instead of using tuple indexing, use array indexing"; let suggestion = format!("{}[{}]", base, field); let applicability = if len < user_index { @@ -3629,7 +3622,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ty::RawPtr(..) => { let base = self.tcx.sess.source_map() .span_to_snippet(base.span) - .unwrap_or_else(|_| self.tcx.hir().node_to_pretty_string(base.id)); + .unwrap_or_else(|_| self.tcx.hir().hir_to_pretty_string(base.hir_id)); let msg = format!("`{}` is a raw pointer; try dereferencing it", base); let suggestion = format!("(*{}).{}", base, field); err.span_suggestion( @@ -3754,7 +3747,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fn check_expr_struct_fields(&self, adt_ty: Ty<'tcx>, expected: Expectation<'tcx>, - expr_id: ast::NodeId, + expr_id: hir::HirId, span: Span, variant: &'tcx ty::VariantDef, ast_fields: &'gcx [hir::Field], @@ -3787,7 +3780,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let ident = tcx.adjust_ident(field.ident, variant.did, self.body_id).0; let field_type = if let Some((i, v_field)) = remaining_fields.remove(&ident) { seen_fields.insert(ident, field.span); - self.write_field_index(field.id, i); + self.write_field_index(field.hir_id, i); // We don't look at stability attributes on // struct-like enums (yet...), but it's definitely not @@ -3875,13 +3868,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { pub fn check_struct_path(&self, qpath: &QPath, - node_id: ast::NodeId) + hir_id: hir::HirId) -> Option<(&'tcx ty::VariantDef, Ty<'tcx>)> { let path_span = match *qpath { QPath::Resolved(_, ref path) => path.span, QPath::TypeRelative(ref qself, _) => qself.span }; - let (def, ty) = self.finish_resolving_struct_path(qpath, path_span, node_id); + let (def, ty) = self.finish_resolving_struct_path(qpath, path_span, hir_id); let variant = match def { Def::Err => { self.set_tainted_by_errors(); @@ -3909,7 +3902,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if let Some((variant, did, substs)) = variant { debug!("check_struct_path: did={:?} substs={:?}", did, substs); - let hir_id = self.tcx.hir().node_to_hir_id(node_id); self.write_user_type_annotation_from_substs(hir_id, did, substs, None); // Check bounds on type arguments used in the path. @@ -3938,7 +3930,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { { // Find the relevant variant let (variant, adt_ty) = - if let Some(variant_ty) = self.check_struct_path(qpath, expr.id) { + if let Some(variant_ty) = self.check_struct_path(qpath, expr.hir_id) { variant_ty } else { self.check_struct_fields_on_error(fields, base_expr); @@ -3958,7 +3950,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { adt.variant_descr()); } - let error_happened = self.check_expr_struct_fields(adt_ty, expected, expr.id, path_span, + let error_happened = self.check_expr_struct_fields(adt_ty, expected, expr.hir_id, path_span, variant, fields, base_expr.is_none()); if let &Some(ref base_expr) = base_expr { // If check_expr_struct_fields hit an error, do not attempt to populate @@ -4007,7 +3999,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { expr, expected); // Warn for expressions after diverging siblings. - self.warn_if_unreachable(expr.id, expr.span, "expression"); + self.warn_if_unreachable(expr.hir_id, expr.span, "expression"); // Hide the outer diverging and has_errors flags. let old_diverges = self.diverges.get(); @@ -4023,7 +4015,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ExprKind::Loop(..) | ExprKind::While(..) | ExprKind::If(..) | ExprKind::Match(..) => {} - _ => self.warn_if_unreachable(expr.id, expr.span, "expression") + _ => self.warn_if_unreachable(expr.hir_id, expr.span, "expression") } // Any expression that produces a value of type `!` must have diverged @@ -4040,7 +4032,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.diverges.set(self.diverges.get() | old_diverges); self.has_errors.set(self.has_errors.get() | old_has_errors); - debug!("type of {} is...", self.tcx.hir().node_to_string(expr.id)); + debug!("type of {} is...", self.tcx.hir().hir_to_string(expr.hir_id)); debug!("... {:?}, expected is {:?}", ty, expected); ty @@ -4060,7 +4052,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ); let tcx = self.tcx; - let id = expr.id; + let id = expr.hir_id; match expr.node { ExprKind::Box(ref subexpr) => { let expected_inner = expected.to_option(self).map_or(NoExpectation, |ty| { @@ -4192,7 +4184,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } ExprKind::Path(ref qpath) => { - let (def, opt_ty, segs) = self.resolve_ty_and_def_ufcs(qpath, expr.id, expr.span); + let (def, opt_ty, segs) = self.resolve_ty_and_def_ufcs(qpath, expr.hir_id, + expr.span); let ty = match def { Def::Err => { self.set_tainted_by_errors(); @@ -4362,7 +4355,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { *self.ret_coercion_span.borrow_mut() = Some(expr.span); } let cause = self.cause(expr.span, ObligationCauseCode::ReturnNoExpression); - if let Some((fn_decl, _)) = self.get_fn_decl(expr.id) { + if let Some((fn_decl, _)) = self.get_fn_decl(expr.hir_id) { coercion.coerce_forced_unit( self, &cause, @@ -4424,7 +4417,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { may_break: false, // Will get updated if/when we find a `break`. }; - let (ctxt, ()) = self.with_breakable_ctxt(expr.id, ctxt, || { + let (ctxt, ()) = self.with_breakable_ctxt(expr.hir_id, ctxt, || { self.check_expr_has_type_or_error(&cond, tcx.types.bool); let cond_diverging = self.diverges.get(); self.check_block_no_value(&body); @@ -4460,7 +4453,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { may_break: false, // Will get updated if/when we find a `break`. }; - let (ctxt, ()) = self.with_breakable_ctxt(expr.id, ctxt, || { + let (ctxt, ()) = self.with_breakable_ctxt(expr.hir_id, ctxt, || { self.check_block_no_value(&body); }); @@ -4551,9 +4544,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { tcx.mk_array(element_ty, args.len() as u64) } ExprKind::Repeat(ref element, ref count) => { - let count_def_id = tcx.hir().local_def_id(count.id); + let count_def_id = tcx.hir().local_def_id_from_hir_id(count.hir_id); let param_env = ty::ParamEnv::empty(); - let substs = Substs::identity_for_item(tcx.global_tcx(), count_def_id); + let substs = InternalSubsts::identity_for_item(tcx.global_tcx(), count_def_id); let instance = ty::Instance::resolve( tcx.global_tcx(), param_env, @@ -4717,7 +4710,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fn finish_resolving_struct_path(&self, qpath: &QPath, path_span: Span, - node_id: ast::NodeId) + hir_id: hir::HirId) -> (Def, Ty<'tcx>) { match *qpath { @@ -4734,11 +4727,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } else { Def::Err }; - let (ty, def) = AstConv::associated_path_to_ty(self, node_id, path_span, + let (ty, def) = AstConv::associated_path_to_ty(self, hir_id, path_span, ty, def, segment, true); // Write back the new resolution. - let hir_id = self.tcx.hir().node_to_hir_id(node_id); self.tables.borrow_mut().type_dependent_defs_mut().insert(hir_id, def); (def, ty) @@ -4750,11 +4742,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// definition. The newly resolved definition is written into `type_dependent_defs`. pub fn resolve_ty_and_def_ufcs<'b>(&self, qpath: &'b QPath, - node_id: ast::NodeId, + hir_id: hir::HirId, span: Span) -> (Def, Option>, &'b [hir::PathSegment]) { - debug!("resolve_ty_and_def_ufcs: qpath={:?} node_id={:?} span={:?}", qpath, node_id, span); + debug!("resolve_ty_and_def_ufcs: qpath={:?} hir_id={:?} span={:?}", qpath, hir_id, span); let (ty, qself, item_segment) = match *qpath { QPath::Resolved(ref opt_qself, ref path) => { return (path.def, @@ -4765,14 +4757,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { (self.to_ty(qself), qself, segment) } }; - let hir_id = self.tcx.hir().node_to_hir_id(node_id); if let Some(cached_def) = self.tables.borrow().type_dependent_defs().get(hir_id) { // Return directly on cache hit. This is useful to avoid doubly reporting // errors with default match binding modes. See #44614. return (*cached_def, Some(ty), slice::from_ref(&**item_segment)) } let item_name = item_segment.ident; - let def = match self.resolve_ufcs(span, item_name, ty, node_id) { + let def = match self.resolve_ufcs(span, item_name, ty, hir_id) { Ok(def) => def, Err(error) => { let def = match error { @@ -4806,7 +4797,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // See #44848. let ref_bindings = local.pat.contains_explicit_ref_binding(); - let local_ty = self.local_ty(init.span, local.id).revealed_ty; + let local_ty = self.local_ty(init.span, local.hir_id).revealed_ty; if let Some(m) = ref_bindings { // Somewhat subtle: if we have a `ref` binding in the pattern, // we want to avoid introducing coercions for the RHS. This is @@ -4825,7 +4816,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } pub fn check_decl_local(&self, local: &'gcx hir::Local) { - let t = self.local_ty(local.span, local.id).decl_ty; + let t = self.local_ty(local.span, local.hir_id).decl_ty; self.write_ty(local.hir_id, t); if let Some(ref init) = local.init { @@ -4854,7 +4845,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { hir::StmtKind::Local(..) | hir::StmtKind::Expr(..) | hir::StmtKind::Semi(..) => {} } - self.warn_if_unreachable(stmt.id, stmt.span, "statement"); + self.warn_if_unreachable(stmt.hir_id, stmt.span, "statement"); // Hide the outer diverging and `has_errors` flags. let old_diverges = self.diverges.get(); @@ -4936,7 +4927,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { may_break: false, }; - let (ctxt, ()) = self.with_breakable_ctxt(blk.id, ctxt, || { + let (ctxt, ()) = self.with_breakable_ctxt(blk.hir_id, ctxt, || { for s in &blk.stmts { self.check_stmt(s); } @@ -4946,12 +4937,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let tail_expr_ty = tail_expr.map(|t| self.check_expr_with_expectation(t, expected)); let mut enclosing_breakables = self.enclosing_breakables.borrow_mut(); - let ctxt = enclosing_breakables.find_breakable(blk.id); + let ctxt = enclosing_breakables.find_breakable(blk.hir_id); let coerce = ctxt.coerce.as_mut().unwrap(); if let Some(tail_expr_ty) = tail_expr_ty { let tail_expr = tail_expr.unwrap(); let cause = self.cause(tail_expr.span, - ObligationCauseCode::BlockTailExpression(blk.id)); + ObligationCauseCode::BlockTailExpression(blk.hir_id)); coerce.coerce(self, &cause, tail_expr, @@ -4975,9 +4966,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // that highlight errors inline. let mut sp = blk.span; let mut fn_span = None; - if let Some((decl, ident)) = self.get_parent_fn_decl(blk.id) { + let blk_node_id = self.tcx.hir().hir_to_node_id(blk.hir_id); + if let Some((decl, ident)) = self.get_parent_fn_decl(blk_node_id) { let ret_sp = decl.output.span(); - if let Some(block_sp) = self.parent_item_span(blk.id) { + if let Some(block_sp) = self.parent_item_span(blk_node_id) { // HACK: on some cases (`ui/liveness/liveness-issue-2163.rs`) the // output would otherwise be incorrect and even misleading. Make sure // the span we're aiming at correspond to a `fn` body. @@ -5067,13 +5059,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } - /// Given a `NodeId`, return the `FnDecl` of the method it is enclosed by and whether a + /// Given a `HirId`, return the `FnDecl` of the method it is enclosed by and whether a /// suggestion can be made, `None` otherwise. - pub fn get_fn_decl(&self, blk_id: ast::NodeId) -> Option<(hir::FnDecl, bool)> { + pub fn get_fn_decl(&self, blk_id: hir::HirId) -> Option<(hir::FnDecl, bool)> { // Get enclosing Fn, if it is a function or a trait method, unless there's a `loop` or // `while` before reaching it, as block tail returns are not available in them. self.tcx.hir().get_return_block(blk_id).and_then(|blk_id| { - let parent = self.tcx.hir().get(blk_id); + let parent = self.tcx.hir().get_by_hir_id(blk_id); self.get_node_fn_decl(parent).map(|(fn_decl, _, is_main)| (fn_decl, is_main)) }) } @@ -5090,7 +5082,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { expected: Ty<'tcx>, found: Ty<'tcx>, cause_span: Span, - blk_id: ast::NodeId, + blk_id: hir::HirId, ) -> bool { self.suggest_missing_semicolon(err, expression, expected, cause_span); let mut pointing_at_return_type = false; @@ -5303,14 +5295,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self_ty: Option>, def: Def, span: Span, - node_id: ast::NodeId) + hir_id: hir::HirId) -> (Ty<'tcx>, Def) { debug!( - "instantiate_value_path(segments={:?}, self_ty={:?}, def={:?}, node_id={})", + "instantiate_value_path(segments={:?}, self_ty={:?}, def={:?}, hir_id={})", segments, self_ty, def, - node_id, + hir_id, ); let tcx = self.tcx; @@ -5378,9 +5370,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { match def { Def::Local(nid) | Def::Upvar(nid, ..) => { - let ty = self.local_ty(span, nid).decl_ty; + let hid = self.tcx.hir().node_to_hir_id(nid); + let ty = self.local_ty(span, hid).decl_ty; let ty = self.normalize_associated_types_in(span, &ty); - self.write_ty(tcx.hir().node_to_hir_id(node_id), ty); + self.write_ty(hir_id, ty); return (ty, def); } _ => {} @@ -5498,6 +5491,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { (GenericParamDefKind::Type { .. }, GenericArg::Type(ty)) => { self.to_ty(ty).into() } + (GenericParamDefKind::Const, GenericArg::Const(ct)) => { + self.to_const(&ct.value, self.tcx.type_of(param.def_id)).into() + } _ => unreachable!(), } }, @@ -5525,6 +5521,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.var_for_def(span, param) } } + GenericParamDefKind::Const => { + // FIXME(const_generics:defaults) + // No const parameters were provided, we have to infer them. + self.var_for_def(span, param) + } } }, ); @@ -5532,7 +5533,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { assert!(!ty.has_escaping_bound_vars()); // First, store the "user substs" for later. - let hir_id = tcx.hir().node_to_hir_id(node_id); self.write_user_type_annotation_from_substs(hir_id, def_id, substs, user_self_ty); // Add all the obligations that are required, substituting and @@ -5566,10 +5566,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } - self.check_rustc_args_require_const(def_id, node_id, span); + self.check_rustc_args_require_const(def_id, hir_id, span); debug!("instantiate_value_path: type of {:?} is {:?}", - node_id, + hir_id, ty_substituted); self.write_substs(hir_id, substs); @@ -5578,7 +5578,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fn check_rustc_args_require_const(&self, def_id: DefId, - node_id: ast::NodeId, + hir_id: hir::HirId, span: Span) { // We're only interested in functions tagged with // #[rustc_args_required_const], so ignore anything that's not. @@ -5588,9 +5588,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // If our calling expression is indeed the function itself, we're good! // If not, generate an error that this can only be called directly. - if let Node::Expr(expr) = self.tcx.hir().get(self.tcx.hir().get_parent_node(node_id)) { + if let Node::Expr(expr) = self.tcx.hir().get_by_hir_id( + self.tcx.hir().get_parent_node_by_hir_id(hir_id)) + { if let ExprKind::Call(ref callee, ..) = expr.node { - if callee.id == node_id { + if callee.hir_id == hir_id { return } } @@ -5618,7 +5620,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } - fn with_breakable_ctxt R, R>(&self, id: ast::NodeId, + fn with_breakable_ctxt R, R>(&self, id: hir::HirId, ctxt: BreakableCtxt<'gcx, 'tcx>, f: F) -> (BreakableCtxt<'gcx, 'tcx>, R) { let index; @@ -5655,22 +5657,22 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } /// Returns `true` if an expression is contained inside the LHS of an assignment expression. - fn expr_in_place(&self, mut expr_id: ast::NodeId) -> bool { + fn expr_in_place(&self, mut expr_id: hir::HirId) -> bool { let mut contained_in_place = false; while let hir::Node::Expr(parent_expr) = - self.tcx.hir().get(self.tcx.hir().get_parent_node(expr_id)) + self.tcx.hir().get_by_hir_id(self.tcx.hir().get_parent_node_by_hir_id(expr_id)) { match &parent_expr.node { hir::ExprKind::Assign(lhs, ..) | hir::ExprKind::AssignOp(_, lhs, ..) => { - if lhs.id == expr_id { + if lhs.hir_id == expr_id { contained_in_place = true; break; } } _ => (), } - expr_id = parent_expr.id; + expr_id = parent_expr.hir_id; } contained_in_place @@ -5681,11 +5683,19 @@ pub fn check_bounds_are_used<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, generics: &ty::Generics, ty: Ty<'tcx>) { let own_counts = generics.own_counts(); - debug!("check_bounds_are_used(n_tps={}, ty={:?})", own_counts.types, ty); + debug!( + "check_bounds_are_used(n_tys={}, n_cts={}, ty={:?})", + own_counts.types, + own_counts.consts, + ty + ); + + // FIXME(const_generics): we probably want to check the bounds for const parameters too. if own_counts.types == 0 { return; } + // Make a vector of booleans initially false, set to true when used. let mut types_used = vec![false; own_counts.types]; diff --git a/src/librustc_typeck/check/op.rs b/src/librustc_typeck/check/op.rs index e6b4523f9e7c..9d883b22214f 100644 --- a/src/librustc_typeck/check/op.rs +++ b/src/librustc_typeck/check/op.rs @@ -51,8 +51,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { { let tcx = self.tcx; - debug!("check_binop(expr.id={}, expr={:?}, op={:?}, lhs_expr={:?}, rhs_expr={:?})", - expr.id, + debug!("check_binop(expr.hir_id={}, expr={:?}, op={:?}, lhs_expr={:?}, rhs_expr={:?})", + expr.hir_id, expr, op, lhs_expr, @@ -150,8 +150,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { is_assign: IsAssign) -> (Ty<'tcx>, Ty<'tcx>, Ty<'tcx>) { - debug!("check_overloaded_binop(expr.id={}, op={:?}, is_assign={:?})", - expr.id, + debug!("check_overloaded_binop(expr.hir_id={}, op={:?}, is_assign={:?})", + expr.hir_id, op, is_assign); diff --git a/src/librustc_typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs index 08bc861766b8..a03d33a3ef5b 100644 --- a/src/librustc_typeck/check/regionck.rs +++ b/src/librustc_typeck/check/regionck.rs @@ -81,7 +81,7 @@ use rustc::hir::def_id::DefId; use rustc::infer::outlives::env::OutlivesEnvironment; use rustc::infer::{self, RegionObligation, SuppressRegionErrors}; use rustc::ty::adjustment; -use rustc::ty::subst::Substs; +use rustc::ty::subst::{SubstsRef, UnpackedKind}; use rustc::ty::{self, Ty}; use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; @@ -90,7 +90,6 @@ use rustc_data_structures::sync::Lrc; use std::mem; use std::ops::Deref; use std::rc::Rc; -use syntax::ast; use syntax_pos::Span; // a variation on try that just returns unit @@ -163,7 +162,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// rest of type check and because sometimes we need type /// inference to have completed before we can determine which /// constraints to add. - pub fn regionck_fn(&self, fn_id: ast::NodeId, body: &'gcx hir::Body) { + pub fn regionck_fn(&self, fn_id: hir::HirId, body: &'gcx hir::Body) { debug!("regionck_fn(id={})", fn_id); let subject = self.tcx.hir().body_owner_def_id(body.id()); let hir_id = body.value.hir_id; @@ -176,9 +175,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ); if self.err_count_since_creation() == 0 { - let fn_hir_id = self.tcx.hir().node_to_hir_id(fn_id); // regionck assumes typeck succeeded - rcx.visit_fn_body(fn_hir_id, body, self.tcx.hir().span_by_hir_id(fn_hir_id)); + rcx.visit_fn_body(fn_id, body, self.tcx.hir().span_by_hir_id(fn_id)); } rcx.resolve_regions_and_report_errors(SuppressRegionErrors::when_nll_is_enabled(self.tcx)); @@ -696,8 +694,8 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for RegionCtxt<'a, 'gcx, 'tcx> { hir::ExprKind::Ret(Some(ref ret_expr)) => { let call_site_scope = self.call_site_scope; debug!( - "visit_expr ExprKind::Ret ret_expr.id {} call_site_scope: {:?}", - ret_expr.id, call_site_scope + "visit_expr ExprKind::Ret ret_expr.hir_id {} call_site_scope: {:?}", + ret_expr.hir_id, call_site_scope ); let call_site_region = self.tcx.mk_region(ty::ReScope(call_site_scope.unwrap())); self.type_of_node_must_outlive( @@ -1395,7 +1393,7 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> { fn substs_wf_in_scope( &mut self, origin: infer::ParameterOrigin, - substs: &Substs<'tcx>, + substs: SubstsRef<'tcx>, expr_span: Span, expr_region: ty::Region<'tcx>, ) { @@ -1409,13 +1407,19 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> { let origin = infer::ParameterInScope(origin, expr_span); - for region in substs.regions() { - self.sub_regions(origin.clone(), expr_region, region); - } - - for ty in substs.types() { - let ty = self.resolve_type(ty); - self.type_must_outlive(origin.clone(), ty, expr_region); + for kind in substs { + match kind.unpack() { + UnpackedKind::Lifetime(lt) => { + self.sub_regions(origin.clone(), expr_region, lt); + } + UnpackedKind::Type(ty) => { + let ty = self.resolve_type(ty); + self.type_must_outlive(origin.clone(), ty, expr_region); + } + UnpackedKind::Const(_) => { + // Const parameters don't impose constraints. + } + } } } } diff --git a/src/librustc_typeck/check/upvar.rs b/src/librustc_typeck/check/upvar.rs index 1a165e6ff1eb..3e6e6576b63b 100644 --- a/src/librustc_typeck/check/upvar.rs +++ b/src/librustc_typeck/check/upvar.rs @@ -67,7 +67,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for InferBorrowKindVisitor<'a, 'gcx, 'tcx> { let body = self.fcx.tcx.hir().body(body_id); self.visit_body(body); self.fcx - .analyze_closure(expr.id, expr.hir_id, expr.span, body, cc); + .analyze_closure(expr.hir_id, expr.span, body, cc); } intravisit::walk_expr(self, expr); @@ -77,7 +77,6 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for InferBorrowKindVisitor<'a, 'gcx, 'tcx> { impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fn analyze_closure( &self, - closure_node_id: ast::NodeId, closure_hir_id: hir::HirId, span: Span, body: &hir::Body, @@ -89,7 +88,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { debug!( "analyze_closure(id={:?}, body.id={:?})", - closure_node_id, + closure_hir_id, body.id() ); @@ -105,7 +104,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { span_bug!( span, "type of closure expr {:?} is not a closure {:?}", - closure_node_id, + closure_hir_id, t ); } @@ -121,7 +120,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { None }; - self.tcx.with_freevars(closure_node_id, |freevars| { + self.tcx.with_freevars(closure_hir_id, |freevars| { let mut freevar_list: Vec = Vec::with_capacity(freevars.len()); for freevar in freevars { let upvar_id = ty::UpvarId { @@ -216,10 +215,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // inference algorithm will reject it). // Equate the type variables for the upvars with the actual types. - let final_upvar_tys = self.final_upvar_tys(closure_node_id); + let final_upvar_tys = self.final_upvar_tys(closure_hir_id); debug!( "analyze_closure: id={:?} substs={:?} final_upvar_tys={:?}", - closure_node_id, substs, final_upvar_tys + closure_hir_id, substs, final_upvar_tys ); for (upvar_ty, final_upvar_ty) in substs .upvar_tys(closure_def_id, self.tcx) @@ -237,14 +236,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } // Returns a list of `ClosureUpvar`s for each upvar. - fn final_upvar_tys(&self, closure_id: ast::NodeId) -> Vec> { + fn final_upvar_tys(&self, closure_id: hir::HirId) -> Vec> { // Presently an unboxed closure type cannot "escape" out of a // function, so we will only encounter ones that originated in the // local crate or were inlined into it along with some function. // This may change if abstract return types of some sort are // implemented. let tcx = self.tcx; - let closure_def_index = tcx.hir().local_def_id(closure_id); + let closure_def_index = tcx.hir().local_def_id_from_hir_id(closure_id); tcx.with_freevars(closure_id, |freevars| { freevars @@ -582,7 +581,7 @@ impl<'a, 'gcx, 'tcx> InferBorrowKind<'a, 'gcx, 'tcx> { impl<'a, 'gcx, 'tcx> euv::Delegate<'tcx> for InferBorrowKind<'a, 'gcx, 'tcx> { fn consume( &mut self, - _consume_id: ast::NodeId, + _consume_id: hir::HirId, _consume_span: Span, cmt: &mc::cmt_<'tcx>, mode: euv::ConsumeMode, @@ -611,7 +610,7 @@ impl<'a, 'gcx, 'tcx> euv::Delegate<'tcx> for InferBorrowKind<'a, 'gcx, 'tcx> { fn borrow( &mut self, - borrow_id: ast::NodeId, + borrow_id: hir::HirId, _borrow_span: Span, cmt: &mc::cmt_<'tcx>, _loan_region: ty::Region<'tcx>, @@ -634,11 +633,11 @@ impl<'a, 'gcx, 'tcx> euv::Delegate<'tcx> for InferBorrowKind<'a, 'gcx, 'tcx> { } } - fn decl_without_init(&mut self, _id: ast::NodeId, _span: Span) {} + fn decl_without_init(&mut self, _id: hir::HirId, _span: Span) {} fn mutate( &mut self, - _assignment_id: ast::NodeId, + _assignment_id: hir::HirId, _assignment_span: Span, assignee_cmt: &mc::cmt_<'tcx>, _mode: euv::MutateMode, diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 9217484f3a7a..fde940eb2c11 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -4,8 +4,9 @@ use crate::constrained_type_params::{identify_constrained_type_params, Parameter use crate::hir::def_id::DefId; use rustc::traits::{self, ObligationCauseCode}; use rustc::ty::{self, Lift, Ty, TyCtxt, TyKind, GenericParamDefKind, TypeFoldable, ToPredicate}; -use rustc::ty::subst::{Subst, Substs}; +use rustc::ty::subst::{Subst, InternalSubsts}; use rustc::util::nodemap::{FxHashSet, FxHashMap}; +use rustc::mir::interpret::ConstValue; use rustc::middle::lang_items; use rustc::infer::opaque_types::may_define_existential_type; @@ -14,7 +15,7 @@ use syntax::feature_gate::{self, GateIssue}; use syntax_pos::Span; use errors::{DiagnosticBuilder, DiagnosticId}; -use rustc::hir::itemlikevisit::ItemLikeVisitor; +use rustc::hir::itemlikevisit::ParItemLikeVisitor; use rustc::hir; /// Helper type of a temporary returned by `.for_item(...)`. @@ -108,14 +109,14 @@ pub fn check_item_well_formed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: Def check_item_fn(tcx, item); } hir::ItemKind::Static(ref ty, ..) => { - check_item_type(tcx, item.id, ty.span, false); + check_item_type(tcx, item.hir_id, ty.span, false); } hir::ItemKind::Const(ref ty, ..) => { - check_item_type(tcx, item.id, ty.span, false); + check_item_type(tcx, item.hir_id, ty.span, false); } hir::ItemKind::ForeignMod(ref module) => for it in module.items.iter() { if let hir::ForeignItemKind::Static(ref ty, ..) = it.node { - check_item_type(tcx, it.id, ty.span, true); + check_item_type(tcx, it.hir_id, ty.span, true); } }, hir::ItemKind::Struct(ref struct_def, ref ast_generics) => { @@ -150,36 +151,36 @@ pub fn check_item_well_formed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: Def } pub fn check_trait_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - let trait_item = tcx.hir().expect_trait_item(node_id); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); + let trait_item = tcx.hir().expect_trait_item(hir_id); let method_sig = match trait_item.node { hir::TraitItemKind::Method(ref sig, _) => Some(sig), _ => None }; - check_associated_item(tcx, trait_item.id, trait_item.span, method_sig); + check_associated_item(tcx, trait_item.hir_id, trait_item.span, method_sig); } pub fn check_impl_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - let impl_item = tcx.hir().expect_impl_item(node_id); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); + let impl_item = tcx.hir().expect_impl_item(hir_id); let method_sig = match impl_item.node { hir::ImplItemKind::Method(ref sig, _) => Some(sig), _ => None }; - check_associated_item(tcx, impl_item.id, impl_item.span, method_sig); + check_associated_item(tcx, impl_item.hir_id, impl_item.span, method_sig); } fn check_associated_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - item_id: ast::NodeId, + item_id: hir::HirId, span: Span, sig_if_method: Option<&hir::MethodSig>) { debug!("check_associated_item: {:?}", item_id); let code = ObligationCauseCode::MiscObligation; for_id(tcx, item_id, span).with_fcx(|fcx, tcx| { - let item = fcx.tcx.associated_item(fcx.tcx.hir().local_def_id(item_id)); + let item = fcx.tcx.associated_item(fcx.tcx.hir().local_def_id_from_hir_id(item_id)); let (mut implied_bounds, self_ty) = match item.container { ty::TraitContainer(_) => (vec![], fcx.tcx.mk_self_type()), @@ -220,16 +221,15 @@ fn check_associated_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, fn for_item<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'gcx>, item: &hir::Item) -> CheckWfFcxBuilder<'a, 'gcx, 'tcx> { - for_id(tcx, item.id, item.span) + for_id(tcx, item.hir_id, item.span) } -fn for_id<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'gcx>, id: ast::NodeId, span: Span) +fn for_id<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'gcx>, id: hir::HirId, span: Span) -> CheckWfFcxBuilder<'a, 'gcx, 'tcx> { - let def_id = tcx.hir().local_def_id(id); - let hir_id = tcx.hir().node_to_hir_id(id); + let def_id = tcx.hir().local_def_id_from_hir_id(id); CheckWfFcxBuilder { inherited: Inherited::build(tcx, def_id), - id: hir_id, + id, span, param_env: tcx.param_env(def_id), } @@ -242,7 +242,7 @@ fn check_type_defn<'a, 'tcx, F>(tcx: TyCtxt<'a, 'tcx, 'tcx>, { for_item(tcx, item).with_fcx(|fcx, fcx_tcx| { let variants = lookup_fields(fcx); - let def_id = fcx.tcx.hir().local_def_id(item.id); + let def_id = fcx.tcx.hir().local_def_id_from_hir_id(item.hir_id); let packed = fcx.tcx.adt_def(def_id).repr.packed(); for variant in &variants { @@ -251,11 +251,14 @@ fn check_type_defn<'a, 'tcx, F>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let needs_drop_copy = || { packed && { let ty = variant.fields.last().unwrap().ty; - let ty = fcx.tcx.erase_regions(&ty).lift_to_tcx(fcx_tcx) + fcx.tcx.erase_regions(&ty).lift_to_tcx(fcx_tcx) + .map(|ty| ty.needs_drop(fcx_tcx, fcx_tcx.param_env(def_id))) .unwrap_or_else(|| { - span_bug!(item.span, "inference variables in {:?}", ty) - }); - ty.needs_drop(fcx_tcx, fcx_tcx.param_env(def_id)) + fcx_tcx.sess.delay_span_bug( + item.span, &format!("inference variables in {:?}", ty)); + // Just treat unresolved type expression as if it needs drop. + true + }) } }; let all_sized = @@ -303,9 +306,9 @@ fn check_type_defn<'a, 'tcx, F>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } fn check_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: &hir::Item) { - debug!("check_trait: {:?}", item.id); + debug!("check_trait: {:?}", item.hir_id); - let trait_def_id = tcx.hir().local_def_id(item.id); + let trait_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id); let trait_def = tcx.trait_def(trait_def_id); if trait_def.is_marker { @@ -327,7 +330,7 @@ fn check_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: &hir::Item) { fn check_item_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: &hir::Item) { for_item(tcx, item).with_fcx(|fcx, tcx| { - let def_id = fcx.tcx.hir().local_def_id(item.id); + let def_id = fcx.tcx.hir().local_def_id_from_hir_id(item.hir_id); let sig = fcx.tcx.fn_sig(def_id); let sig = fcx.normalize_associated_types_in(item.span, &sig); let mut implied_bounds = vec![]; @@ -339,14 +342,14 @@ fn check_item_fn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: &hir::Item) { fn check_item_type<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, - item_id: ast::NodeId, + item_id: hir::HirId, ty_span: Span, allow_foreign_ty: bool, ) { debug!("check_item_type: {:?}", item_id); for_id(tcx, item_id, ty_span).with_fcx(|fcx, gcx| { - let ty = gcx.type_of(gcx.hir().local_def_id(item_id)); + let ty = gcx.type_of(gcx.hir().local_def_id_from_hir_id(item_id)); let item_ty = fcx.normalize_associated_types_in(ty_span, &ty); let mut forbid_unsized = true; @@ -377,7 +380,7 @@ fn check_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, debug!("check_impl: {:?}", item); for_item(tcx, item).with_fcx(|fcx, tcx| { - let item_def_id = fcx.tcx.hir().local_def_id(item.id); + let item_def_id = fcx.tcx.hir().local_def_id_from_hir_id(item.hir_id); match *ast_trait_ref { Some(ref ast_trait_ref) => { @@ -437,7 +440,7 @@ fn check_where_clauses<'a, 'gcx, 'fcx, 'tcx>( // struct Foo> { .. } // Here the default `Vec<[u32]>` is not WF because `[u32]: Sized` does not hold. for param in &generics.params { - if let GenericParamDefKind::Type {..} = param.kind { + if let GenericParamDefKind::Type { .. } = param.kind { if is_our_default(¶m) { let ty = fcx.tcx.type_of(param.def_id); // ignore dependent defaults -- that is, where the default of one type @@ -459,13 +462,13 @@ fn check_where_clauses<'a, 'gcx, 'fcx, 'tcx>( // For more examples see tests `defaults-well-formedness.rs` and `type-check-defaults.rs`. // // First we build the defaulted substitution. - let substs = Substs::for_item(fcx.tcx, def_id, |param, _| { + let substs = InternalSubsts::for_item(fcx.tcx, def_id, |param, _| { match param.kind { GenericParamDefKind::Lifetime => { // All regions are identity. fcx.tcx.mk_param_from_def(param) } - GenericParamDefKind::Type {..} => { + GenericParamDefKind::Type { .. } => { // If the param has a default, if is_our_default(param) { let default_ty = fcx.tcx.type_of(param.def_id); @@ -478,6 +481,10 @@ fn check_where_clauses<'a, 'gcx, 'fcx, 'tcx>( // Mark unwanted params as err. fcx.tcx.types.err.into() } + GenericParamDefKind::Const => { + // FIXME(const_generics:defaults) + fcx.tcx.types.err.into() + } } }); // Now we build the substituted predicates. @@ -498,6 +505,16 @@ fn check_where_clauses<'a, 'gcx, 'fcx, 'tcx>( fn visit_region(&mut self, _: ty::Region<'tcx>) -> bool { true } + + fn visit_const(&mut self, c: &'tcx ty::LazyConst<'tcx>) -> bool { + if let ty::LazyConst::Evaluated(ty::Const { + val: ConstValue::Param(param), + .. + }) = c { + self.params.insert(param.index); + } + c.super_visit_with(self) + } } let mut param_count = CountParams::default(); let has_region = pred.visit_with(&mut param_count); @@ -611,18 +628,17 @@ fn check_existential_types<'a, 'fcx, 'gcx, 'tcx>( let generics = tcx.generics_of(def_id); // only check named existential types defined in this crate if generics.parent.is_none() && def_id.is_local() { - let opaque_node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - if may_define_existential_type(tcx, fn_def_id, opaque_node_id) { + let opaque_hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); + if may_define_existential_type(tcx, fn_def_id, opaque_hir_id) { trace!("check_existential_types may define. Generics: {:#?}", generics); let mut seen: FxHashMap<_, Vec<_>> = FxHashMap::default(); for (subst, param) in substs.iter().zip(&generics.params) { match subst.unpack() { ty::subst::UnpackedKind::Type(ty) => match ty.sty { - ty::Param(..) => {}, + ty::Param(..) => {} // prevent `fn foo() -> Foo` from being defining _ => { - tcx - .sess + tcx.sess .struct_span_err( span, "non-defining existential type use \ @@ -637,8 +653,9 @@ fn check_existential_types<'a, 'fcx, 'gcx, 'tcx>( ), ) .emit(); - }, - }, // match ty + } + } + ty::subst::UnpackedKind::Lifetime(region) => { let param_span = tcx.def_span(param.def_id); if let ty::ReStatic = region { @@ -659,7 +676,31 @@ fn check_existential_types<'a, 'fcx, 'gcx, 'tcx>( } else { seen.entry(region).or_default().push(param_span); } - }, + } + + ty::subst::UnpackedKind::Const(ct) => match ct { + ty::LazyConst::Evaluated(ty::Const { + val: ConstValue::Param(_), + .. + }) => {} + _ => { + tcx.sess + .struct_span_err( + span, + "non-defining existential type use \ + in defining scope", + ) + .span_note( + tcx.def_span(param.def_id), + &format!( + "used non-generic const {} for \ + generic parameter", + ty, + ), + ) + .emit(); + } + } } // match subst } // for (subst, param) for (_, spans) in seen { @@ -843,7 +884,9 @@ fn receiver_is_valid<'fcx, 'tcx, 'gcx>( } else { debug!("receiver_is_valid: type `{:?}` does not deref to `{:?}`", receiver_ty, self_ty); - return false + // If he receiver already has errors reported due to it, consider it valid to avoid + // unecessary errors (#58712). + return receiver_ty.references_error(); } // without the `arbitrary_self_types` feature, `receiver_ty` must directly deref to @@ -888,7 +931,7 @@ fn check_variances_for_type_defn<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item: &hir::Item, hir_generics: &hir::Generics) { - let item_def_id = tcx.hir().local_def_id(item.id); + let item_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id); let ty = tcx.type_of(item_def_id); if tcx.has_error_field(ty) { return; @@ -943,7 +986,9 @@ fn reject_shadowing_parameters(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) { let parent = tcx.generics_of(generics.parent.unwrap()); let impl_params: FxHashMap<_, _> = parent.params.iter().flat_map(|param| match param.kind { GenericParamDefKind::Lifetime => None, - GenericParamDefKind::Type {..} => Some((param.name, param.def_id)), + GenericParamDefKind::Type { .. } | GenericParamDefKind::Const => { + Some((param.name, param.def_id)) + } }).collect(); for method_param in &generics.params { @@ -1016,22 +1061,22 @@ impl<'a, 'gcx> CheckTypeWellFormedVisitor<'a, 'gcx> { } } -impl<'a, 'tcx> ItemLikeVisitor<'tcx> for CheckTypeWellFormedVisitor<'a, 'tcx> { - fn visit_item(&mut self, i: &'tcx hir::Item) { +impl<'a, 'tcx> ParItemLikeVisitor<'tcx> for CheckTypeWellFormedVisitor<'a, 'tcx> { + fn visit_item(&self, i: &'tcx hir::Item) { debug!("visit_item: {:?}", i); - let def_id = self.tcx.hir().local_def_id(i.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(i.hir_id); self.tcx.ensure().check_item_well_formed(def_id); } - fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem) { + fn visit_trait_item(&self, trait_item: &'tcx hir::TraitItem) { debug!("visit_trait_item: {:?}", trait_item); - let def_id = self.tcx.hir().local_def_id(trait_item.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(trait_item.hir_id); self.tcx.ensure().check_trait_item_well_formed(def_id); } - fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem) { + fn visit_impl_item(&self, impl_item: &'tcx hir::ImplItem) { debug!("visit_impl_item: {:?}", impl_item); - let def_id = self.tcx.hir().local_def_id(impl_item.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(impl_item.hir_id); self.tcx.ensure().check_impl_item_well_formed(def_id); } } @@ -1051,7 +1096,7 @@ struct AdtField<'tcx> { impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fn non_enum_variant(&self, struct_def: &hir::VariantData) -> AdtVariant<'tcx> { let fields = struct_def.fields().iter().map(|field| { - let field_ty = self.tcx.type_of(self.tcx.hir().local_def_id(field.id)); + let field_ty = self.tcx.type_of(self.tcx.hir().local_def_id_from_hir_id(field.hir_id)); let field_ty = self.normalize_associated_types_in(field.span, &field_ty); AdtField { ty: field_ty, span: field.span } diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index c4575e6b01ee..d001545d1d91 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -50,7 +50,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { wbcx.visit_liberated_fn_sigs(); wbcx.visit_fru_field_types(); wbcx.visit_opaque_types(body.value.span); - wbcx.visit_cast_types(); + wbcx.visit_coercion_casts(); wbcx.visit_free_region_map(); wbcx.visit_user_provided_tys(); wbcx.visit_user_provided_sigs(); @@ -243,11 +243,11 @@ impl<'cx, 'gcx, 'tcx> Visitor<'gcx> for WritebackCx<'cx, 'gcx, 'tcx> { } hir::ExprKind::Struct(_, ref fields, _) => { for field in fields { - self.visit_field_id(field.id); + self.visit_field_id(field.hir_id); } } hir::ExprKind::Field(..) => { - self.visit_field_id(e.id); + self.visit_field_id(e.hir_id); } _ => {} } @@ -273,7 +273,7 @@ impl<'cx, 'gcx, 'tcx> Visitor<'gcx> for WritebackCx<'cx, 'gcx, 'tcx> { } hir::PatKind::Struct(_, ref fields, _) => { for field in fields { - self.visit_field_id(field.node.id); + self.visit_field_id(field.node.hir_id); } } _ => {} @@ -287,7 +287,7 @@ impl<'cx, 'gcx, 'tcx> Visitor<'gcx> for WritebackCx<'cx, 'gcx, 'tcx> { fn visit_local(&mut self, l: &'gcx hir::Local) { intravisit::walk_local(self, l); - let var_ty = self.fcx.local_ty(l.span, l.id).decl_ty; + let var_ty = self.fcx.local_ty(l.span, l.hir_id).decl_ty; let var_ty = self.resolve(&var_ty, &l.span); self.write_ty_to_tables(l.hir_id, var_ty); } @@ -355,19 +355,13 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> { } } - fn visit_cast_types(&mut self) { + fn visit_coercion_casts(&mut self) { let fcx_tables = self.fcx.tables.borrow(); - let fcx_cast_kinds = fcx_tables.cast_kinds(); + let fcx_coercion_casts = fcx_tables.coercion_casts(); debug_assert_eq!(fcx_tables.local_id_root, self.tables.local_id_root); - let mut self_cast_kinds = self.tables.cast_kinds_mut(); - let common_local_id_root = fcx_tables.local_id_root.unwrap(); - for (&local_id, &cast_kind) in fcx_cast_kinds.iter() { - let hir_id = hir::HirId { - owner: common_local_id_root.index, - local_id, - }; - self_cast_kinds.insert(hir_id, cast_kind); + for local_id in fcx_coercion_casts { + self.tables.set_coercion_cast(*local_id); } } @@ -590,8 +584,7 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> { } } - fn visit_field_id(&mut self, node_id: ast::NodeId) { - let hir_id = self.tcx().hir().node_to_hir_id(node_id); + fn visit_field_id(&mut self, hir_id: hir::HirId) { if let Some(index) = self.fcx .tables .borrow_mut() diff --git a/src/librustc_typeck/check_unused.rs b/src/librustc_typeck/check_unused.rs index 70f7c30f7ecb..cbb6d9b29f59 100644 --- a/src/librustc_typeck/check_unused.rs +++ b/src/librustc_typeck/check_unused.rs @@ -34,7 +34,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for CheckVisitor<'a, 'tcx> { return; } if let hir::ItemKind::Use(ref path, _) = item.node { - self.check_import(item.id, path.span); + self.check_import(item.hir_id, path.span); } } @@ -51,14 +51,13 @@ struct CheckVisitor<'a, 'tcx: 'a> { } impl<'a, 'tcx> CheckVisitor<'a, 'tcx> { - fn check_import(&self, id: ast::NodeId, span: Span) { - let def_id = self.tcx.hir().local_def_id(id); + fn check_import(&self, id: hir::HirId, span: Span) { + let def_id = self.tcx.hir().local_def_id_from_hir_id(id); if !self.tcx.maybe_unused_trait_import(def_id) { return; } - let import_def_id = self.tcx.hir().local_def_id(id); - if self.used_trait_imports.contains(&import_def_id) { + if self.used_trait_imports.contains(&def_id) { return; } @@ -67,7 +66,7 @@ impl<'a, 'tcx> CheckVisitor<'a, 'tcx> { } else { "unused import".to_owned() }; - self.tcx.lint_node(lint::builtin::UNUSED_IMPORTS, id, span, &msg); + self.tcx.lint_hir(lint::builtin::UNUSED_IMPORTS, id, span, &msg); } } @@ -95,8 +94,8 @@ fn unused_crates_lint<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) { // Note that if we carry through to the `extern_mod_stmt_cnum` query // below it'll cause a panic because `def_id` is actually bogus at this // point in time otherwise. - if let Some(id) = tcx.hir().as_local_node_id(def_id) { - if tcx.hir().find(id).is_none() { + if let Some(id) = tcx.hir().as_local_hir_id(def_id) { + if tcx.hir().find_by_hir_id(id).is_none() { return false; } } @@ -121,8 +120,8 @@ fn unused_crates_lint<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) { }); for extern_crate in &crates_to_lint { - let id = tcx.hir().as_local_node_id(extern_crate.def_id).unwrap(); - let item = tcx.hir().expect_item(id); + let id = tcx.hir().as_local_hir_id(extern_crate.def_id).unwrap(); + let item = tcx.hir().expect_item_by_hir_id(id); // If the crate is fully unused, we suggest removing it altogether. // We do this in any edition. @@ -135,7 +134,7 @@ fn unused_crates_lint<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) { .map(|attr| attr.span) .fold(span, |acc, attr_span| acc.to(attr_span)); - tcx.struct_span_lint_node(lint, id, span, msg) + tcx.struct_span_lint_hir(lint, id, span, msg) .span_suggestion_short( span_with_attrs, "remove it", @@ -177,7 +176,7 @@ fn unused_crates_lint<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) { None => format!("use {};", item.ident.name), }; let replacement = visibility_qualified(&item.vis, base_replacement); - tcx.struct_span_lint_node(lint, id, extern_crate.span, msg) + tcx.struct_span_lint_hir(lint, id, extern_crate.span, msg) .span_suggestion_short( extern_crate.span, &help, @@ -213,7 +212,7 @@ struct ExternCrateToLint { impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for CollectExternCrateVisitor<'a, 'tcx> { fn visit_item(&mut self, item: &hir::Item) { if let hir::ItemKind::ExternCrate(orig_name) = item.node { - let extern_crate_def_id = self.tcx.hir().local_def_id(item.id); + let extern_crate_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); self.crates_to_lint.push( ExternCrateToLint { def_id: extern_crate_def_id, diff --git a/src/librustc_typeck/coherence/builtin.rs b/src/librustc_typeck/coherence/builtin.rs index 0996d1ff3b99..5d86bc540953 100644 --- a/src/librustc_typeck/coherence/builtin.rs +++ b/src/librustc_typeck/coherence/builtin.rs @@ -50,8 +50,8 @@ fn visit_implementation_of_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: /* do nothing */ } else { // Destructors only work on nominal types. - if let Some(impl_node_id) = tcx.hir().as_local_node_id(impl_did) { - if let Some(Node::Item(item)) = tcx.hir().find(impl_node_id) { + if let Some(impl_hir_id) = tcx.hir().as_local_hir_id(impl_did) { + if let Some(Node::Item(item)) = tcx.hir().find_by_hir_id(impl_hir_id) { let span = match item.node { ItemKind::Impl(.., ref ty, _) => ty.span, _ => item.span, diff --git a/src/librustc_typeck/coherence/inherent_impls.rs b/src/librustc_typeck/coherence/inherent_impls.rs index 93cc86423ace..d167c7fcafbe 100644 --- a/src/librustc_typeck/coherence/inherent_impls.rs +++ b/src/librustc_typeck/coherence/inherent_impls.rs @@ -85,7 +85,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for InherentCollect<'a, 'tcx> { _ => return }; - let def_id = self.tcx.hir().local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); let self_ty = self.tcx.type_of(def_id); let lang_items = self.tcx.lang_items(); match self_ty.sty { @@ -288,7 +288,7 @@ impl<'a, 'tcx> InherentCollect<'a, 'tcx> { // Add the implementation to the mapping from implementation to base // type def ID, if there is a base type for this implementation and // the implementation does not have any associated traits. - let impl_def_id = self.tcx.hir().local_def_id(item.id); + let impl_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); let mut rc_vec = self.impls_map.inherent_impls .entry(def_id) .or_default(); diff --git a/src/librustc_typeck/coherence/inherent_impls_overlap.rs b/src/librustc_typeck/coherence/inherent_impls_overlap.rs index 282f1bad172d..832c172e97c1 100644 --- a/src/librustc_typeck/coherence/inherent_impls_overlap.rs +++ b/src/librustc_typeck/coherence/inherent_impls_overlap.rs @@ -36,11 +36,11 @@ impl<'a, 'tcx> InherentOverlapChecker<'a, 'tcx> { for &item2 in &impl_items2[..] { if (name, namespace) == name_and_namespace(item2) { - let node_id = self.tcx.hir().as_local_node_id(impl1); - let mut err = if used_to_be_allowed && node_id.is_some() { - self.tcx.struct_span_lint_node( + let hir_id = self.tcx.hir().as_local_hir_id(impl1); + let mut err = if used_to_be_allowed && hir_id.is_some() { + self.tcx.struct_span_lint_hir( lint::builtin::INCOHERENT_FUNDAMENTAL_IMPLS, - node_id.unwrap(), + hir_id.unwrap(), self.tcx.span_of_impl(item1).unwrap(), &format!("duplicate definitions with name `{}` (E0592)", name) ) @@ -120,7 +120,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for InherentOverlapChecker<'a, 'tcx> { hir::ItemKind::Struct(..) | hir::ItemKind::Trait(..) | hir::ItemKind::Union(..) => { - let type_def_id = self.tcx.hir().local_def_id(item.id); + let type_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); self.check_for_overlapping_inherent_impls(type_def_id); } _ => {} diff --git a/src/librustc_typeck/coherence/mod.rs b/src/librustc_typeck/coherence/mod.rs index 01aba658850b..39a2f5d37bd7 100644 --- a/src/librustc_typeck/coherence/mod.rs +++ b/src/librustc_typeck/coherence/mod.rs @@ -141,9 +141,7 @@ fn coherent_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { for &impl_id in impls { check_impl_overlap(tcx, impl_id); } - use rustc::util::common::time; - time(tcx.sess, "builtin::check_trait checking", || - builtin::check_trait(tcx, def_id)); + builtin::check_trait(tcx, def_id); } pub fn check_coherence<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs index b776a980b7c9..c875b856f3a4 100644 --- a/src/librustc_typeck/coherence/orphan.rs +++ b/src/librustc_typeck/coherence/orphan.rs @@ -22,11 +22,11 @@ impl<'cx, 'tcx, 'v> ItemLikeVisitor<'v> for OrphanChecker<'cx, 'tcx> { /// to prevent inundating the user with a bunch of similar error /// reports. fn visit_item(&mut self, item: &hir::Item) { - let def_id = self.tcx.hir().local_def_id(item.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); // "Trait" impl if let hir::ItemKind::Impl(.., Some(_), _, _) = item.node { debug!("coherence2::orphan check: trait impl {}", - self.tcx.hir().node_to_string(item.id)); + self.tcx.hir().hir_to_string(item.hir_id)); let trait_ref = self.tcx.impl_trait_ref(def_id).unwrap(); let trait_def_id = trait_ref.def_id; let cm = self.tcx.sess.source_map(); diff --git a/src/librustc_typeck/coherence/unsafety.rs b/src/librustc_typeck/coherence/unsafety.rs index 81ef4de3d80e..0b1de510aa4b 100644 --- a/src/librustc_typeck/coherence/unsafety.rs +++ b/src/librustc_typeck/coherence/unsafety.rs @@ -21,7 +21,8 @@ impl<'cx, 'tcx, 'v> UnsafetyChecker<'cx, 'tcx> { unsafety: hir::Unsafety, polarity: hir::ImplPolarity) { - if let Some(trait_ref) = self.tcx.impl_trait_ref(self.tcx.hir().local_def_id(item.id)) { + let local_did = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); + if let Some(trait_ref) = self.tcx.impl_trait_ref(local_did) { let trait_def = self.tcx.trait_def(trait_ref.def_id); let unsafe_attr = impl_generics.and_then(|generics| { generics.params.iter().find(|p| p.pure_wrt_drop).map(|_| "may_dangle") diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 5af66969477c..afe658767f32 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -23,7 +23,7 @@ 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::{Subst, Substs}; +use rustc::ty::subst::{Subst, InternalSubsts}; use rustc::ty::util::Discr; use rustc::ty::util::IntTypeExt; use rustc::ty::subst::UnpackedKind; @@ -56,12 +56,6 @@ struct OnlySelfBounds(bool); /////////////////////////////////////////////////////////////////////////// // Main entry point -pub fn collect_item_types<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - for &module in tcx.hir().krate().modules.keys() { - tcx.ensure().collect_mod_item_types(tcx.hir().local_def_id(module)); - } -} - fn collect_mod_item_types<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module( module_def_id, @@ -118,7 +112,7 @@ impl<'a, 'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'a, 'tcx> { } fn visit_item(&mut self, item: &'tcx hir::Item) { - convert_item(self.tcx, item.id); + convert_item(self.tcx, item.hir_id); intravisit::walk_item(self, item); } @@ -129,12 +123,12 @@ impl<'a, 'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'a, 'tcx> { hir::GenericParamKind::Type { default: Some(_), .. } => { - let def_id = self.tcx.hir().local_def_id(param.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(param.hir_id); self.tcx.type_of(def_id); } hir::GenericParamKind::Type { .. } => {} hir::GenericParamKind::Const { .. } => { - let def_id = self.tcx.hir().local_def_id(param.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(param.hir_id); self.tcx.type_of(def_id); } } @@ -144,7 +138,7 @@ impl<'a, 'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'a, 'tcx> { fn visit_expr(&mut self, expr: &'tcx hir::Expr) { if let hir::ExprKind::Closure(..) = expr.node { - let def_id = self.tcx.hir().local_def_id(expr.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(expr.hir_id); self.tcx.generics_of(def_id); self.tcx.type_of(def_id); } @@ -152,12 +146,12 @@ impl<'a, 'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'a, 'tcx> { } fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem) { - convert_trait_item(self.tcx, trait_item.id); + convert_trait_item(self.tcx, trait_item.hir_id); intravisit::walk_trait_item(self, trait_item); } fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem) { - convert_impl_item(self.tcx, impl_item.id); + convert_impl_item(self.tcx, impl_item.hir_id); intravisit::walk_impl_item(self, impl_item); } } @@ -255,9 +249,9 @@ fn type_param_predicates<'a, 'tcx>( // written inline like `` or in a where clause like // `where T : Foo`. - let param_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let param_id = tcx.hir().as_local_hir_id(def_id).unwrap(); let param_owner = tcx.hir().ty_param_owner(param_id); - let param_owner_def_id = tcx.hir().local_def_id(param_owner); + let param_owner_def_id = tcx.hir().local_def_id_from_hir_id(param_owner); let generics = tcx.generics_of(param_owner_def_id); let index = generics.param_def_id_to_index[&def_id]; let ty = tcx.mk_ty_param(index, tcx.hir().ty_param_name(param_id).as_interned_str()); @@ -280,8 +274,8 @@ fn type_param_predicates<'a, 'tcx>( }, ); - let item_node_id = tcx.hir().as_local_node_id(item_def_id).unwrap(); - let ast_generics = match tcx.hir().get(item_node_id) { + let item_hir_id = tcx.hir().as_local_hir_id(item_def_id).unwrap(); + let ast_generics = match tcx.hir().get_by_hir_id(item_hir_id) { Node::TraitItem(item) => &item.generics, Node::ImplItem(item) => &item.generics, @@ -301,7 +295,7 @@ fn type_param_predicates<'a, 'tcx>( | ItemKind::Union(_, ref generics) => generics, ItemKind::Trait(_, _, ref generics, ..) => { // Implied `Self: Trait` and supertrait bounds. - if param_id == item_node_id { + if param_id == item_hir_id { let identity_trait_ref = ty::TraitRef::identity(tcx, item_def_id); Lrc::make_mut(&mut result) .predicates @@ -337,7 +331,7 @@ impl<'a, 'tcx> ItemCtxt<'a, 'tcx> { fn type_parameter_bounds_in_generics( &self, ast_generics: &hir::Generics, - param_id: ast::NodeId, + param_id: hir::HirId, ty: Ty<'tcx>, only_self_bounds: OnlySelfBounds, ) -> Vec<(ty::Predicate<'tcx>, Span)> { @@ -345,7 +339,7 @@ impl<'a, 'tcx> ItemCtxt<'a, 'tcx> { .params .iter() .filter_map(|param| match param.kind { - GenericParamKind::Type { .. } if param.id == param_id => Some(¶m.bounds), + GenericParamKind::Type { .. } if param.hir_id == param_id => Some(¶m.bounds), _ => None, }) .flat_map(|bounds| bounds.iter()) @@ -382,12 +376,12 @@ impl<'a, 'tcx> ItemCtxt<'a, 'tcx> { fn is_param<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, ast_ty: &hir::Ty, - param_id: ast::NodeId, + param_id: hir::HirId, ) -> bool { if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = ast_ty.node { match path.def { Def::SelfTy(Some(def_id), None) | Def::TyParam(def_id) => { - def_id == tcx.hir().local_def_id(param_id) + def_id == tcx.hir().local_def_id_from_hir_id(param_id) } _ => false, } @@ -396,10 +390,10 @@ fn is_param<'a, 'tcx>( } } -fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: ast::NodeId) { - let it = tcx.hir().expect_item(item_id); - debug!("convert: item {} with id {}", it.ident, it.id); - let def_id = tcx.hir().local_def_id(item_id); +fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: hir::HirId) { + let it = tcx.hir().expect_item_by_hir_id(item_id); + debug!("convert: item {} with id {}", it.ident, it.hir_id); + let def_id = tcx.hir().local_def_id_from_hir_id(item_id); match it.node { // These don't define types. hir::ItemKind::ExternCrate(_) @@ -408,7 +402,7 @@ fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: ast::NodeId) { | hir::ItemKind::GlobalAsm(_) => {} hir::ItemKind::ForeignMod(ref foreign_mod) => { for item in &foreign_mod.items { - let def_id = tcx.hir().local_def_id(item.id); + let def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id); tcx.generics_of(def_id); tcx.type_of(def_id); tcx.predicates_of(def_id); @@ -446,14 +440,14 @@ fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: ast::NodeId) { tcx.predicates_of(def_id); for f in struct_def.fields() { - let def_id = tcx.hir().local_def_id(f.id); + let def_id = tcx.hir().local_def_id_from_hir_id(f.hir_id); tcx.generics_of(def_id); tcx.type_of(def_id); tcx.predicates_of(def_id); } if !struct_def.is_struct() { - convert_variant_ctor(tcx, struct_def.id()); + convert_variant_ctor(tcx, struct_def.hir_id()); } } @@ -478,9 +472,9 @@ fn convert_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_id: ast::NodeId) { } } -fn convert_trait_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_item_id: ast::NodeId) { +fn convert_trait_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_item_id: hir::HirId) { let trait_item = tcx.hir().expect_trait_item(trait_item_id); - let def_id = tcx.hir().local_def_id(trait_item.id); + let def_id = tcx.hir().local_def_id_from_hir_id(trait_item.hir_id); tcx.generics_of(def_id); match trait_item.node { @@ -499,8 +493,8 @@ fn convert_trait_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_item_id: ast: tcx.predicates_of(def_id); } -fn convert_impl_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_item_id: ast::NodeId) { - let def_id = tcx.hir().local_def_id(impl_item_id); +fn convert_impl_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_item_id: hir::HirId) { + let def_id = tcx.hir().local_def_id_from_hir_id(impl_item_id); tcx.generics_of(def_id); tcx.type_of(def_id); tcx.predicates_of(def_id); @@ -509,8 +503,8 @@ fn convert_impl_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_item_id: ast::N } } -fn convert_variant_ctor<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ctor_id: ast::NodeId) { - let def_id = tcx.hir().local_def_id(ctor_id); +fn convert_variant_ctor<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ctor_id: hir::HirId) { + let def_id = tcx.hir().local_def_id_from_hir_id(ctor_id); tcx.generics_of(def_id); tcx.type_of(def_id); tcx.predicates_of(def_id); @@ -531,7 +525,7 @@ fn convert_enum_variant_types<'a, 'tcx>( let wrapped_discr = prev_discr.map_or(initial, |d| d.wrap_incr(tcx)); prev_discr = Some( if let Some(ref e) = variant.node.disr_expr { - let expr_did = tcx.hir().local_def_id(e.id); + let expr_did = tcx.hir().local_def_id_from_hir_id(e.hir_id); def.eval_explicit_discr(tcx, expr_did) } else if let Some(discr) = repr_type.disr_incr(tcx, prev_discr) { Some(discr) @@ -554,7 +548,7 @@ fn convert_enum_variant_types<'a, 'tcx>( ); for f in variant.node.data.fields() { - let def_id = tcx.hir().local_def_id(f.id); + let def_id = tcx.hir().local_def_id_from_hir_id(f.hir_id); tcx.generics_of(def_id); tcx.type_of(def_id); tcx.predicates_of(def_id); @@ -562,7 +556,7 @@ fn convert_enum_variant_types<'a, 'tcx>( // Convert the ctor, if any. This also registers the variant as // an item. - convert_variant_ctor(tcx, variant.node.data.id()); + convert_variant_ctor(tcx, variant.node.data.hir_id()); } } @@ -576,12 +570,12 @@ fn convert_variant<'a, 'tcx>( attribute_def_id: DefId ) -> ty::VariantDef { let mut seen_fields: FxHashMap = Default::default(); - let node_id = tcx.hir().as_local_node_id(did).unwrap(); + let hir_id = tcx.hir().as_local_hir_id(did).unwrap(); let fields = def .fields() .iter() .map(|f| { - let fid = tcx.hir().local_def_id(f.id); + let fid = tcx.hir().local_def_id_from_hir_id(f.hir_id); let dup_span = seen_fields.get(&f.ident.modern()).cloned(); if let Some(prev_span) = dup_span { struct_span_err!( @@ -600,7 +594,7 @@ fn convert_variant<'a, 'tcx>( ty::FieldDef { did: fid, ident: f.ident, - vis: ty::Visibility::from_hir(&f.vis, node_id, tcx), + vis: ty::Visibility::from_hir(&f.vis, hir_id, tcx), } }) .collect(); @@ -618,8 +612,8 @@ fn convert_variant<'a, 'tcx>( fn adt_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::AdtDef { use rustc::hir::*; - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - let item = match tcx.hir().get(node_id) { + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); + let item = match tcx.hir().get_by_hir_id(hir_id) { Node::Item(item) => item, _ => bug!(), }; @@ -633,10 +627,10 @@ fn adt_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Ad def.variants .iter() .map(|v| { - let did = tcx.hir().local_def_id(v.node.data.id()); + let did = tcx.hir().local_def_id_from_hir_id(v.node.data.hir_id()); let discr = if let Some(ref e) = v.node.disr_expr { distance_from_explicit = 0; - ty::VariantDiscr::Explicit(tcx.hir().local_def_id(e.id)) + ty::VariantDiscr::Explicit(tcx.hir().local_def_id_from_hir_id(e.hir_id)) } else { ty::VariantDiscr::Relative(distance_from_explicit) }; @@ -651,7 +645,7 @@ fn adt_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Ad ItemKind::Struct(ref def, _) => { // Use separate constructor id for unit/tuple structs and reuse did for braced structs. let ctor_id = if !def.is_struct() { - Some(tcx.hir().local_def_id(def.id())) + Some(tcx.hir().local_def_id_from_hir_id(def.hir_id())) } else { None }; @@ -693,11 +687,11 @@ fn super_predicates_of<'a, 'tcx>( trait_def_id: DefId, ) -> Lrc> { debug!("super_predicates(trait_def_id={:?})", trait_def_id); - let trait_node_id = tcx.hir().as_local_node_id(trait_def_id).unwrap(); + let trait_hir_id = tcx.hir().as_local_hir_id(trait_def_id).unwrap(); - let item = match tcx.hir().get(trait_node_id) { + let item = match tcx.hir().get_by_hir_id(trait_hir_id) { Node::Item(item) => item, - _ => bug!("trait_node_id {} is not an item", trait_node_id), + _ => bug!("trait_node_id {} is not an item", trait_hir_id), }; let (generics, bounds) = match item.node { @@ -721,7 +715,7 @@ fn super_predicates_of<'a, 'tcx>( // as one of its "superpredicates". let is_trait_alias = tcx.is_trait_alias(trait_def_id); let superbounds2 = icx.type_parameter_bounds_in_generics( - generics, item.id, self_param_ty, OnlySelfBounds(!is_trait_alias)); + generics, item.hir_id, self_param_ty, OnlySelfBounds(!is_trait_alias)); // Combine the two lists to form the complete set of superbounds: let superbounds: Vec<_> = superbounds1.into_iter().chain(superbounds2).collect(); @@ -886,14 +880,14 @@ fn has_late_bound_regions<'a, 'tcx>( fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Generics { use rustc::hir::*; - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); - let node = tcx.hir().get(node_id); + let node = tcx.hir().get_by_hir_id(hir_id); let parent_def_id = match node { Node::ImplItem(_) | Node::TraitItem(_) | Node::Variant(_) | Node::StructCtor(_) | Node::Field(_) => { - let parent_id = tcx.hir().get_parent(node_id); - Some(tcx.hir().local_def_id(parent_id)) + let parent_id = tcx.hir().get_parent_item(hir_id); + Some(tcx.hir().local_def_id_from_hir_id(parent_id)) } Node::Expr(&hir::Expr { node: hir::ExprKind::Closure(..), @@ -936,12 +930,12 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty // // Something of a hack: use the node id for the trait, also as // the node id for the Self type parameter. - let param_id = item.id; + let param_id = item.hir_id; opt_self = Some(ty::GenericParamDef { index: 0, name: keywords::SelfUpper.name().as_interned_str(), - def_id: tcx.hir().local_def_id(param_id), + def_id: tcx.hir().local_def_id_from_hir_id(param_id), pure_wrt_drop: false, kind: ty::GenericParamDefKind::Type { has_default: false, @@ -987,13 +981,12 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty .map(|(i, param)| ty::GenericParamDef { name: param.name.ident().as_interned_str(), index: own_start + i as u32, - def_id: tcx.hir().local_def_id(param.id), + def_id: tcx.hir().local_def_id_from_hir_id(param.hir_id), pure_wrt_drop: param.pure_wrt_drop, kind: ty::GenericParamDefKind::Lifetime, }), ); - let hir_id = tcx.hir().node_to_hir_id(node_id); let object_lifetime_defaults = tcx.object_lifetime_defaults(hir_id); // Now create the real type parameters. @@ -1003,67 +996,65 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty ast_generics .params .iter() - .filter_map(|param| match param.kind { - GenericParamKind::Type { - ref default, - synthetic, - .. - } => { - if param.name.ident().name == keywords::SelfUpper.name() { - span_bug!( - param.span, - "`Self` should not be the name of a regular parameter" - ); - } - - if !allow_defaults && default.is_some() { - if !tcx.features().default_type_parameter_fallback { - tcx.lint_node( - lint::builtin::INVALID_TYPE_PARAM_DEFAULT, - param.id, + .filter_map(|param| { + let kind = match param.kind { + GenericParamKind::Type { + ref default, + synthetic, + .. + } => { + if param.name.ident().name == keywords::SelfUpper.name() { + span_bug!( param.span, - &format!( - "defaults for type parameters are only allowed in \ - `struct`, `enum`, `type`, or `trait` definitions." - ), + "`Self` should not be the name of a regular parameter" ); } - } - let ty_param = ty::GenericParamDef { - index: type_start + i as u32, - name: param.name.ident().as_interned_str(), - def_id: tcx.hir().local_def_id(param.id), - pure_wrt_drop: param.pure_wrt_drop, - kind: ty::GenericParamDefKind::Type { + if !allow_defaults && default.is_some() { + if !tcx.features().default_type_parameter_fallback { + tcx.lint_hir( + lint::builtin::INVALID_TYPE_PARAM_DEFAULT, + param.hir_id, + param.span, + &format!( + "defaults for type parameters are only allowed in \ + `struct`, `enum`, `type`, or `trait` definitions." + ), + ); + } + } + + ty::GenericParamDefKind::Type { has_default: default.is_some(), object_lifetime_default: object_lifetime_defaults .as_ref() .map_or(rl::Set1::Empty, |o| o[i]), synthetic, - }, - }; - i += 1; - Some(ty_param) - } - GenericParamKind::Const { .. } => { - if param.name.ident().name == keywords::SelfUpper.name() { - span_bug!( - param.span, - "`Self` should not be the name of a regular parameter", - ); + } } + GenericParamKind::Const { .. } => { + if param.name.ident().name == keywords::SelfUpper.name() { + span_bug!( + param.span, + "`Self` should not be the name of a regular parameter", + ); + } - // Emit an error, but skip the parameter rather than aborting to - // continue to get other errors. - tcx.sess.struct_span_err( - param.span, - "const generics in any position are currently unsupported", - ).emit(); - None - } - _ => None, - }), + ty::GenericParamDefKind::Const + } + _ => return None, + }; + + let param_def = ty::GenericParamDef { + index: type_start + i as u32, + name: param.name.ident().as_interned_str(), + def_id: tcx.hir().local_def_id_from_hir_id(param.hir_id), + pure_wrt_drop: param.pure_wrt_drop, + kind, + }; + i += 1; + Some(param_def) + }) ); // provide junk type parameter defs - the only place that @@ -1097,7 +1088,7 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty }), ); - tcx.with_freevars(node_id, |fv| { + tcx.with_freevars(hir_id, |fv| { params.extend(fv.iter().zip((dummy_args.len() as u32)..).map(|(_, i)| { ty::GenericParamDef { index: type_start + i, @@ -1141,14 +1132,14 @@ fn report_assoc_ty_on_inherent_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, span: fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { use rustc::hir::*; - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); let icx = ItemCtxt::new(tcx, def_id); - match tcx.hir().get(node_id) { + match tcx.hir().get_by_hir_id(hir_id) { Node::TraitItem(item) => match item.node { TraitItemKind::Method(..) => { - let substs = Substs::identity_for_item(tcx, def_id); + let substs = InternalSubsts::identity_for_item(tcx, def_id); tcx.mk_fn_def(def_id, substs) } TraitItemKind::Const(ref ty, _) | TraitItemKind::Type(_, Some(ref ty)) => icx.to_ty(ty), @@ -1159,13 +1150,13 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { Node::ImplItem(item) => match item.node { ImplItemKind::Method(..) => { - let substs = Substs::identity_for_item(tcx, def_id); + let substs = InternalSubsts::identity_for_item(tcx, def_id); tcx.mk_fn_def(def_id, substs) } ImplItemKind::Const(ref ty, _) => icx.to_ty(ty), ImplItemKind::Existential(_) => { if tcx - .impl_trait_ref(tcx.hir().get_parent_did(node_id)) + .impl_trait_ref(tcx.hir().get_parent_did_by_hir_id(hir_id)) .is_none() { report_assoc_ty_on_inherent_impl(tcx, item.span); @@ -1175,7 +1166,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { } ImplItemKind::Type(ref ty) => { if tcx - .impl_trait_ref(tcx.hir().get_parent_did(node_id)) + .impl_trait_ref(tcx.hir().get_parent_did_by_hir_id(hir_id)) .is_none() { report_assoc_ty_on_inherent_impl(tcx, item.span); @@ -1192,12 +1183,12 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { | ItemKind::Ty(ref t, _) | ItemKind::Impl(.., ref t, _) => icx.to_ty(t), ItemKind::Fn(..) => { - let substs = Substs::identity_for_item(tcx, def_id); + let substs = InternalSubsts::identity_for_item(tcx, def_id); tcx.mk_fn_def(def_id, substs) } ItemKind::Enum(..) | ItemKind::Struct(..) | ItemKind::Union(..) => { let def = tcx.adt_def(def_id); - let substs = Substs::identity_for_item(tcx, def_id); + let substs = InternalSubsts::identity_for_item(tcx, def_id); tcx.mk_adt(def, substs) } ItemKind::Existential(hir::ExistTy { @@ -1245,7 +1236,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { Node::ForeignItem(foreign_item) => match foreign_item.node { ForeignItemKind::Fn(..) => { - let substs = Substs::identity_for_item(tcx, def_id); + let substs = InternalSubsts::identity_for_item(tcx, def_id); tcx.mk_fn_def(def_id, substs) } ForeignItemKind::Static(ref t, _) => icx.to_ty(t), @@ -1258,10 +1249,10 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { .. }) => match *def { VariantData::Unit(..) | VariantData::Struct(..) => { - tcx.type_of(tcx.hir().get_parent_did(node_id)) + tcx.type_of(tcx.hir().get_parent_did_by_hir_id(hir_id)) } VariantData::Tuple(..) => { - let substs = Substs::identity_for_item(tcx, def_id); + let substs = InternalSubsts::identity_for_item(tcx, def_id); tcx.mk_fn_def(def_id, substs) } }, @@ -1273,53 +1264,121 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { .. }) => { if gen.is_some() { - let hir_id = tcx.hir().node_to_hir_id(node_id); return tcx.typeck_tables_of(def_id).node_type(hir_id); } let substs = ty::ClosureSubsts { - substs: Substs::identity_for_item(tcx, def_id), + substs: InternalSubsts::identity_for_item(tcx, def_id), }; tcx.mk_closure(def_id, substs) } - Node::AnonConst(_) => match tcx.hir().get(tcx.hir().get_parent_node(node_id)) { - Node::Ty(&hir::Ty { - node: hir::TyKind::Array(_, ref constant), - .. - }) - | Node::Ty(&hir::Ty { - node: hir::TyKind::Typeof(ref constant), - .. - }) - | Node::Expr(&hir::Expr { - node: ExprKind::Repeat(_, ref constant), - .. - }) if constant.id == node_id => - { - tcx.types.usize - } + Node::AnonConst(_) => { + let parent_node = tcx.hir().get_by_hir_id(tcx.hir().get_parent_node_by_hir_id(hir_id)); + match parent_node { + Node::Ty(&hir::Ty { + node: hir::TyKind::Array(_, ref constant), + .. + }) + | Node::Ty(&hir::Ty { + node: hir::TyKind::Typeof(ref constant), + .. + }) + | Node::Expr(&hir::Expr { + node: ExprKind::Repeat(_, ref constant), + .. + }) if constant.hir_id == hir_id => + { + tcx.types.usize + } - Node::Variant(&Spanned { - node: - VariantKind { - disr_expr: Some(ref e), - .. - }, - .. - }) if e.id == node_id => - { - tcx.adt_def(tcx.hir().get_parent_did(node_id)) - .repr - .discr_type() - .to_ty(tcx) - } + Node::Variant(&Spanned { + node: + VariantKind { + disr_expr: Some(ref e), + .. + }, + .. + }) if e.hir_id == hir_id => + { + tcx.adt_def(tcx.hir().get_parent_did_by_hir_id(hir_id)) + .repr + .discr_type() + .to_ty(tcx) + } - x => { - bug!("unexpected const parent in type_of_def_id(): {:?}", x); + Node::Ty(&hir::Ty { node: hir::TyKind::Path(_), .. }) | + Node::Expr(&hir::Expr { node: ExprKind::Struct(..), .. }) | + Node::Expr(&hir::Expr { node: ExprKind::Path(_), .. }) => { + let path = match parent_node { + Node::Ty(&hir::Ty { node: hir::TyKind::Path(ref path), .. }) | + Node::Expr(&hir::Expr { node: ExprKind::Path(ref path), .. }) => { + path + } + Node::Expr(&hir::Expr { node: ExprKind::Struct(ref path, ..), .. }) => { + &*path + } + _ => unreachable!(), + }; + + match path { + QPath::Resolved(_, ref path) => { + let mut arg_index = 0; + let mut found_const = false; + for seg in &path.segments { + if let Some(generic_args) = &seg.args { + let args = &generic_args.args; + for arg in args { + if let GenericArg::Const(ct) = arg { + if ct.value.hir_id == hir_id { + found_const = true; + break; + } + arg_index += 1; + } + } + } + } + // Sanity check to make sure everything is as expected. + if !found_const { + bug!("no arg matching AnonConst in path") + } + match path.def { + // We've encountered an `AnonConst` in some path, so we need to + // figure out which generic parameter it corresponds to and return + // the relevant type. + Def::Struct(def_id) + | Def::Union(def_id) + | Def::Enum(def_id) + | Def::Fn(def_id) => { + let generics = tcx.generics_of(def_id); + let mut param_index = 0; + for param in &generics.params { + if let ty::GenericParamDefKind::Const = param.kind { + if param_index == arg_index { + return tcx.type_of(param.def_id); + } + param_index += 1; + } + } + // This is no generic parameter associated with the arg. This is + // probably from an extra arg where one is not needed. + return tcx.types.err; + } + Def::Err => tcx.types.err, + x => bug!("unexpected const parent path def {:?}", x), + } + } + x => bug!("unexpected const parent path {:?}", x), + } + } + + x => { + bug!("unexpected const parent in type_of_def_id(): {:?}", x); + } } - }, + } Node::GenericParam(param) => match ¶m.kind { hir::GenericParamKind::Type { default: Some(ref ty), .. } | @@ -1475,7 +1534,7 @@ fn find_existential_constraints<'a, 'tcx>( intravisit::NestedVisitorMap::All(&self.tcx.hir()) } fn visit_item(&mut self, it: &'tcx Item) { - let def_id = self.tcx.hir().local_def_id(it.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(it.hir_id); // the existential type itself or its children are not within its reveal scope if def_id != self.def_id { self.check(def_id); @@ -1483,7 +1542,7 @@ fn find_existential_constraints<'a, 'tcx>( } } fn visit_impl_item(&mut self, it: &'tcx ImplItem) { - let def_id = self.tcx.hir().local_def_id(it.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(it.hir_id); // the existential type itself or its children are not within its reveal scope if def_id != self.def_id { self.check(def_id); @@ -1491,7 +1550,7 @@ fn find_existential_constraints<'a, 'tcx>( } } fn visit_trait_item(&mut self, it: &'tcx TraitItem) { - let def_id = self.tcx.hir().local_def_id(it.id); + let def_id = self.tcx.hir().local_def_id_from_hir_id(it.hir_id); self.check(def_id); intravisit::walk_trait_item(self, it); } @@ -1502,16 +1561,16 @@ fn find_existential_constraints<'a, 'tcx>( tcx, found: None, }; - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - let parent = tcx.hir().get_parent(node_id); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); + let parent = tcx.hir().get_parent_item(hir_id); trace!("parent_id: {:?}", parent); - if parent == ast::CRATE_NODE_ID { + if parent == hir::CRATE_HIR_ID { intravisit::walk_crate(&mut locator, tcx.hir().krate()); } else { - trace!("parent: {:?}", tcx.hir().get(parent)); - match tcx.hir().get(parent) { + trace!("parent: {:?}", tcx.hir().get_by_hir_id(parent)); + match tcx.hir().get_by_hir_id(parent) { Node::Item(ref it) => intravisit::walk_item(&mut locator, it), Node::ImplItem(ref it) => intravisit::walk_impl_item(&mut locator, it), Node::TraitItem(ref it) => intravisit::walk_trait_item(&mut locator, it), @@ -1536,11 +1595,11 @@ fn fn_sig<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> ty::PolyFnSig use rustc::hir::*; use rustc::hir::Node::*; - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); let icx = ItemCtxt::new(tcx, def_id); - match tcx.hir().get(node_id) { + match tcx.hir().get_by_hir_id(hir_id) { TraitItem(hir::TraitItem { node: TraitItemKind::Method(sig, _), .. @@ -1559,7 +1618,7 @@ fn fn_sig<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> ty::PolyFnSig node: ForeignItemKind::Fn(ref fn_decl, _, _), .. }) => { - let abi = tcx.hir().get_foreign_abi(node_id); + let abi = tcx.hir().get_foreign_abi_by_hir_id(hir_id); compute_sig_of_foreign_fn_decl(tcx, def_id, fn_decl, abi) } @@ -1572,10 +1631,10 @@ fn fn_sig<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> ty::PolyFnSig }, .. }) => { - let ty = tcx.type_of(tcx.hir().get_parent_did(node_id)); + let ty = tcx.type_of(tcx.hir().get_parent_did_by_hir_id(hir_id)); let inputs = fields .iter() - .map(|f| tcx.type_of(tcx.hir().local_def_id(f.id))); + .map(|f| tcx.type_of(tcx.hir().local_def_id_from_hir_id(f.hir_id))); ty::Binder::bind(tcx.mk_fn_sig( inputs, ty, @@ -1704,8 +1763,7 @@ fn early_bound_lifetimes_from_generics<'a, 'tcx>( .iter() .filter(move |param| match param.kind { GenericParamKind::Lifetime { .. } => { - let hir_id = tcx.hir().node_to_hir_id(param.id); - !tcx.is_late_bound(hir_id) + !tcx.is_late_bound(param.hir_id) } _ => false, }) @@ -1812,8 +1870,8 @@ fn explicit_predicates_of<'a, 'tcx>( } } - let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); - let node = tcx.hir().get(node_id); + let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); + let node = tcx.hir().get_by_hir_id(hir_id); let mut is_trait = None; let mut is_default_impl_trait = None; @@ -1829,7 +1887,7 @@ fn explicit_predicates_of<'a, 'tcx>( Node::ImplItem(item) => match item.node { ImplItemKind::Existential(ref bounds) => { - let substs = Substs::identity_for_item(tcx, def_id); + let substs = InternalSubsts::identity_for_item(tcx, def_id); let opaque_ty = tcx.mk_opaque(def_id, substs); // Collect the bounds, i.e., the `A+B+'c` in `impl A+B+'c`. @@ -1874,7 +1932,7 @@ fn explicit_predicates_of<'a, 'tcx>( impl_trait_fn, ref generics, }) => { - let substs = Substs::identity_for_item(tcx, def_id); + let substs = InternalSubsts::identity_for_item(tcx, def_id); let opaque_ty = tcx.mk_opaque(def_id, substs); // Collect the bounds, i.e., the `A+B+'c` in `impl A+B+'c`. @@ -1942,7 +2000,7 @@ fn explicit_predicates_of<'a, 'tcx>( let mut index = parent_count + has_own_self as u32; for param in early_bound_lifetimes_from_generics(tcx, ast_generics) { let region = tcx.mk_region(ty::ReEarlyBound(ty::EarlyBoundRegion { - def_id: tcx.hir().local_def_id(param.id), + def_id: tcx.hir().local_def_id_from_hir_id(param.hir_id), index, name: param.name.ident().as_interned_str(), })); @@ -2062,7 +2120,8 @@ fn explicit_predicates_of<'a, 'tcx>( }; let assoc_ty = - tcx.mk_projection(tcx.hir().local_def_id(trait_item.id), self_trait_ref.substs); + tcx.mk_projection(tcx.hir().local_def_id_from_hir_id(trait_item.hir_id), + self_trait_ref.substs); let bounds = compute_bounds( &ItemCtxt::new(tcx, def_id), @@ -2224,7 +2283,7 @@ fn compute_sig_of_foreign_fn_decl<'a, 'tcx>( &format!( "use of SIMD type `{}` in FFI is highly experimental and \ may result in invalid code", - tcx.hir().node_to_pretty_string(ast_ty.id) + tcx.hir().hir_to_pretty_string(ast_ty.hir_id) ), ) .help("add #![feature(simd_ffi)] to the crate attributes to enable") diff --git a/src/librustc_typeck/constrained_type_params.rs b/src/librustc_typeck/constrained_type_params.rs index 6a530f454d2b..4b922c340388 100644 --- a/src/librustc_typeck/constrained_type_params.rs +++ b/src/librustc_typeck/constrained_type_params.rs @@ -1,6 +1,7 @@ use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::fold::{TypeFoldable, TypeVisitor}; use rustc::util::nodemap::FxHashSet; +use rustc::mir::interpret::ConstValue; use syntax::source_map::Span; #[derive(Clone, PartialEq, Eq, Hash, Debug)] @@ -14,6 +15,10 @@ impl From for Parameter { fn from(param: ty::EarlyBoundRegion) -> Self { Parameter(param.index) } } +impl From for Parameter { + fn from(param: ty::ParamConst) -> Self { Parameter(param.index) } +} + /// Returns the set of parameters constrained by the impl header. pub fn parameters_for_impl<'tcx>(impl_self_ty: Ty<'tcx>, impl_trait_ref: Option>) @@ -72,6 +77,16 @@ impl<'tcx> TypeVisitor<'tcx> for ParameterCollector { } false } + + fn visit_const(&mut self, c: &'tcx ty::LazyConst<'tcx>) -> bool { + if let ty::LazyConst::Evaluated(ty::Const { + val: ConstValue::Param(data), + .. + }) = c { + self.parameters.push(Parameter::from(*data)); + } + false + } } pub fn identify_constrained_type_params<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index feff79dc3f50..399cd6f890c2 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -423,7 +423,7 @@ impl Foo for Bar { E0049: r##" This error indicates that an attempted implementation of a trait method -has the wrong number of type parameters. +has the wrong number of type or const parameters. For example, the trait below has a method `foo` with a type parameter `T`, but the implementation of `foo` for the type `Bar` is missing this parameter: @@ -1032,6 +1032,7 @@ enum NightsWatch {} ``` "##, +// FIXME(const_generics:docs): example of inferring const parameter. E0087: r##" #### Note: this error code is no longer emitted by the compiler. @@ -1152,8 +1153,8 @@ fn main() { "##, E0091: r##" -You gave an unnecessary type parameter in a type alias. Erroneous code -example: +You gave an unnecessary type or const parameter in a type alias. Erroneous +code example: ```compile_fail,E0091 type Foo = u32; // error: type parameter `T` is unused @@ -1161,7 +1162,7 @@ type Foo = u32; // error: type parameter `T` is unused type Foo = Box
; // error: type parameter `B` is unused ``` -Please check you didn't write too many type parameters. Example: +Please check you didn't write too many parameters. Example: ``` type Foo = u32; // ok! diff --git a/src/librustc_typeck/impl_wf_check.rs b/src/librustc_typeck/impl_wf_check.rs index ed39874eeaad..5677f2c94d8e 100644 --- a/src/librustc_typeck/impl_wf_check.rs +++ b/src/librustc_typeck/impl_wf_check.rs @@ -79,7 +79,7 @@ struct ImplWfCheck<'a, 'tcx: 'a> { impl<'a, 'tcx> ItemLikeVisitor<'tcx> for ImplWfCheck<'a, 'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item) { if let hir::ItemKind::Impl(.., ref impl_item_refs) = item.node { - let impl_def_id = self.tcx.hir().local_def_id(item.id); + let impl_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); enforce_impl_params_are_constrained(self.tcx, impl_def_id, impl_item_refs); @@ -108,7 +108,7 @@ fn enforce_impl_params_are_constrained<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Disallow unconstrained lifetimes, but only if they appear in assoc types. let lifetimes_in_associated_types: FxHashSet<_> = impl_item_refs.iter() - .map(|item_ref| tcx.hir().local_def_id(item_ref.id.node_id)) + .map(|item_ref| tcx.hir().local_def_id_from_hir_id(item_ref.id.hir_id)) .filter(|&def_id| { let item = tcx.associated_item(def_id); item.kind == ty::AssociatedKind::Type && item.defaultness.has_value() @@ -120,7 +120,7 @@ fn enforce_impl_params_are_constrained<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, for param in &impl_generics.params { match param.kind { // Disallow ANY unconstrained type parameters. - ty::GenericParamDefKind::Type {..} => { + ty::GenericParamDefKind::Type { .. } => { let param_ty = ty::ParamTy::for_def(param); if !input_parameters.contains(&ctp::Parameter::from(param_ty)) { report_unused_parameter(tcx, @@ -139,6 +139,15 @@ fn enforce_impl_params_are_constrained<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ¶m.name.to_string()); } } + ty::GenericParamDefKind::Const => { + let param_ct = ty::ParamConst::for_def(param); + if !input_parameters.contains(&ctp::Parameter::from(param_ct)) { + report_unused_parameter(tcx, + tcx.def_span(param.def_id), + "const", + ¶m_ct.to_string()); + } + } } } diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 3682acd3c62c..ebb617c23c6c 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -102,10 +102,10 @@ use rustc::infer::InferOk; use rustc::lint; use rustc::middle; use rustc::session; -use rustc::session::CompileIncomplete; +use rustc::util::common::ErrorReported; use rustc::session::config::{EntryFnType, nightly_options}; use rustc::traits::{ObligationCause, ObligationCauseCode, TraitEngine, TraitEngineExt}; -use rustc::ty::subst::Substs; +use rustc::ty::subst::SubstsRef; use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::query::Providers; use rustc::util; @@ -116,7 +116,7 @@ use util::common::time; use std::iter; pub struct TypeAndSubsts<'tcx> { - substs: &'tcx Substs<'tcx>, + substs: SubstsRef<'tcx>, ty: Ty<'tcx>, } @@ -136,14 +136,14 @@ fn check_type_alias_enum_variants_enabled<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, } } -fn require_c_abi_if_variadic(tcx: TyCtxt<'_, '_, '_>, - decl: &hir::FnDecl, - abi: Abi, - span: Span) { - if decl.variadic && !(abi == Abi::C || abi == Abi::Cdecl) { +fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_, '_, '_>, + decl: &hir::FnDecl, + abi: Abi, + span: Span) { + if decl.c_variadic && !(abi == Abi::C || abi == Abi::Cdecl) { let mut err = struct_span_err!(tcx.sess, span, E0045, - "variadic function must have C or cdecl calling convention"); - err.span_label(span, "variadics require C or cdecl calling convention").emit(); + "C-variadic function must have C or cdecl calling convention"); + err.span_label(span, "C-variadics require C or cdecl calling convention").emit(); } } @@ -315,16 +315,18 @@ pub fn provide(providers: &mut Providers<'_>) { } pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) - -> Result<(), CompileIncomplete> + -> Result<(), ErrorReported> { tcx.sess.profiler(|p| p.start_activity(ProfileCategory::TypeChecking)); // this ensures that later parts of type checking can assume that items // have valid types and not error tcx.sess.track_errors(|| { - time(tcx.sess, "type collecting", || - collect::collect_item_types(tcx)); - + time(tcx.sess, "type collecting", || { + for &module in tcx.hir().krate().modules.keys() { + tcx.ensure().collect_mod_item_types(tcx.hir().local_def_id(module)); + } + }); })?; if tcx.features().rustc_attrs { @@ -353,16 +355,26 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) time(tcx.sess, "wf checking", || check::check_wf_new(tcx))?; - time(tcx.sess, "item-types checking", || check::check_item_types(tcx))?; + time(tcx.sess, "item-types checking", || { + tcx.sess.track_errors(|| { + for &module in tcx.hir().krate().modules.keys() { + tcx.ensure().check_mod_item_types(tcx.hir().local_def_id(module)); + } + }) + })?; - time(tcx.sess, "item-bodies checking", || check::check_item_bodies(tcx))?; + time(tcx.sess, "item-bodies checking", || tcx.typeck_item_bodies(LOCAL_CRATE))?; check_unused::check_crate(tcx); check_for_entry_fn(tcx); tcx.sess.profiler(|p| p.end_activity(ProfileCategory::TypeChecking)); - tcx.sess.compile_status() + if tcx.sess.err_count() == 0 { + Ok(()) + } else { + Err(ErrorReported) + } } /// A quasi-deprecated helper used in rustdoc and save-analysis to get @@ -371,8 +383,8 @@ pub fn hir_ty_to_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, hir_ty: &hir::Ty) -> // In case there are any projections etc, find the "environment" // def-id that will be used to determine the traits/predicates in // scope. This is derived from the enclosing item-like thing. - let env_node_id = tcx.hir().get_parent(hir_ty.id); - let env_def_id = tcx.hir().local_def_id(env_node_id); + let env_node_id = tcx.hir().get_parent_item(hir_ty.hir_id); + let env_def_id = tcx.hir().local_def_id_from_hir_id(env_node_id); let item_cx = self::collect::ItemCtxt::new(tcx, env_def_id); astconv::AstConv::ast_ty_to_ty(&item_cx, hir_ty) @@ -383,8 +395,8 @@ pub fn hir_trait_to_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, hir_trait: // In case there are any projections etc, find the "environment" // def-id that will be used to determine the traits/predicates in // scope. This is derived from the enclosing item-like thing. - let env_node_id = tcx.hir().get_parent(hir_trait.ref_id); - let env_def_id = tcx.hir().local_def_id(env_node_id); + let env_hir_id = tcx.hir().get_parent_item(hir_trait.hir_ref_id); + let env_def_id = tcx.hir().local_def_id_from_hir_id(env_hir_id); let item_cx = self::collect::ItemCtxt::new(tcx, env_def_id); let mut projections = Vec::new(); let (principal, _) = astconv::AstConv::instantiate_poly_trait_ref_inner( diff --git a/src/librustc_typeck/outlives/implicit_infer.rs b/src/librustc_typeck/outlives/implicit_infer.rs index 6c56e9991c8a..b560f3b49792 100644 --- a/src/librustc_typeck/outlives/implicit_infer.rs +++ b/src/librustc_typeck/outlives/implicit_infer.rs @@ -52,16 +52,16 @@ pub struct InferVisitor<'cx, 'tcx: 'cx> { impl<'cx, 'tcx> ItemLikeVisitor<'tcx> for InferVisitor<'cx, 'tcx> { fn visit_item(&mut self, item: &hir::Item) { - let item_did = self.tcx.hir().local_def_id(item.id); + let item_did = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); debug!("InferVisitor::visit_item(item={:?})", item_did); - let node_id = self + let hir_id = self .tcx .hir() - .as_local_node_id(item_did) + .as_local_hir_id(item_did) .expect("expected local def-id"); - let item = match self.tcx.hir().get(node_id) { + let item = match self.tcx.hir().get_by_hir_id(hir_id) { Node::Item(item) => item, _ => bug!(), }; diff --git a/src/librustc_typeck/outlives/mod.rs b/src/librustc_typeck/outlives/mod.rs index b3634d37cc2b..913990ee8789 100644 --- a/src/librustc_typeck/outlives/mod.rs +++ b/src/librustc_typeck/outlives/mod.rs @@ -26,10 +26,10 @@ fn inferred_outlives_of<'a, 'tcx>( ) -> Lrc>> { let id = tcx .hir() - .as_local_node_id(item_def_id) + .as_local_hir_id(item_def_id) .expect("expected local def-id"); - match tcx.hir().get(id) { + match tcx.hir().get_by_hir_id(id) { Node::Item(item) => match item.node { hir::ItemKind::Struct(..) | hir::ItemKind::Enum(..) | hir::ItemKind::Union(..) => { let crate_map = tcx.inferred_outlives_crate(LOCAL_CRATE); @@ -98,14 +98,22 @@ fn inferred_outlives_crate<'tcx>( .map(|(&def_id, set)| { let vec: Vec> = set .iter() - .map( + .filter_map( |ty::OutlivesPredicate(kind1, region2)| match kind1.unpack() { - UnpackedKind::Type(ty1) => ty::Predicate::TypeOutlives(ty::Binder::bind( - ty::OutlivesPredicate(ty1, region2), - )), - UnpackedKind::Lifetime(region1) => ty::Predicate::RegionOutlives( - ty::Binder::bind(ty::OutlivesPredicate(region1, region2)), - ), + UnpackedKind::Type(ty1) => { + Some(ty::Predicate::TypeOutlives(ty::Binder::bind( + ty::OutlivesPredicate(ty1, region2) + ))) + } + UnpackedKind::Lifetime(region1) => { + Some(ty::Predicate::RegionOutlives( + ty::Binder::bind(ty::OutlivesPredicate(region1, region2)) + )) + } + UnpackedKind::Const(_) => { + // Generic consts don't impose any constraints. + None + } }, ).collect(); (def_id, Lrc::new(vec)) diff --git a/src/librustc_typeck/outlives/test.rs b/src/librustc_typeck/outlives/test.rs index cbeb7f7b6919..e10c83612071 100644 --- a/src/librustc_typeck/outlives/test.rs +++ b/src/librustc_typeck/outlives/test.rs @@ -14,7 +14,7 @@ struct OutlivesTest<'a, 'tcx: 'a> { impl<'a, 'tcx> ItemLikeVisitor<'tcx> for OutlivesTest<'a, 'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item) { - let item_def_id = self.tcx.hir().local_def_id(item.id); + let item_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); // For unit testing: check for a special "rustc_outlives" // attribute and report an error with various results if found. diff --git a/src/librustc_typeck/outlives/utils.rs b/src/librustc_typeck/outlives/utils.rs index c886c7a4ffce..ee552ca9cbb2 100644 --- a/src/librustc_typeck/outlives/utils.rs +++ b/src/librustc_typeck/outlives/utils.rs @@ -118,6 +118,10 @@ pub fn insert_outlives_predicate<'tcx>( } required_predicates.insert(ty::OutlivesPredicate(kind, outlived_region)); } + + UnpackedKind::Const(_) => { + // Generic consts don't impose any constraints. + } } } diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs index 1d407870ee73..49d11150689a 100644 --- a/src/librustc_typeck/variance/constraints.rs +++ b/src/librustc_typeck/variance/constraints.rs @@ -4,9 +4,9 @@ //! We walk the set of items and, for each member, generate new constraints. use hir::def_id::DefId; -use rustc::ty::subst::{Substs, UnpackedKind}; +use rustc::mir::interpret::ConstValue; +use rustc::ty::subst::{SubstsRef, UnpackedKind}; use rustc::ty::{self, Ty, TyCtxt}; -use syntax::ast; use rustc::hir; use rustc::hir::itemlikevisit::ItemLikeVisitor; @@ -72,31 +72,31 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for ConstraintContext<'a, 'tcx> { match item.node { hir::ItemKind::Struct(ref struct_def, _) | hir::ItemKind::Union(ref struct_def, _) => { - self.visit_node_helper(item.id); + self.visit_node_helper(item.hir_id); if let hir::VariantData::Tuple(..) = *struct_def { - self.visit_node_helper(struct_def.id()); + self.visit_node_helper(struct_def.hir_id()); } } hir::ItemKind::Enum(ref enum_def, _) => { - self.visit_node_helper(item.id); + self.visit_node_helper(item.hir_id); for variant in &enum_def.variants { if let hir::VariantData::Tuple(..) = variant.node.data { - self.visit_node_helper(variant.node.data.id()); + self.visit_node_helper(variant.node.data.hir_id()); } } } hir::ItemKind::Fn(..) => { - self.visit_node_helper(item.id); + self.visit_node_helper(item.hir_id); } hir::ItemKind::ForeignMod(ref foreign_mod) => { for foreign_item in &foreign_mod.items { if let hir::ForeignItemKind::Fn(..) = foreign_item.node { - self.visit_node_helper(foreign_item.id); + self.visit_node_helper(foreign_item.hir_id); } } } @@ -107,21 +107,21 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for ConstraintContext<'a, 'tcx> { fn visit_trait_item(&mut self, trait_item: &hir::TraitItem) { if let hir::TraitItemKind::Method(..) = trait_item.node { - self.visit_node_helper(trait_item.id); + self.visit_node_helper(trait_item.hir_id); } } fn visit_impl_item(&mut self, impl_item: &hir::ImplItem) { if let hir::ImplItemKind::Method(..) = impl_item.node { - self.visit_node_helper(impl_item.id); + self.visit_node_helper(impl_item.hir_id); } } } impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { - fn visit_node_helper(&mut self, id: ast::NodeId) { + fn visit_node_helper(&mut self, id: hir::HirId) { let tcx = self.terms_cx.tcx; - let def_id = tcx.hir().local_def_id(id); + let def_id = tcx.hir().local_def_id_from_hir_id(id); self.build_constraints_for_item(def_id); } @@ -138,7 +138,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { return; } - let id = tcx.hir().as_local_node_id(def_id).unwrap(); + let id = tcx.hir().as_local_hir_id(def_id).unwrap(); let inferred_start = self.terms_cx.inferred_starts[&id]; let current_item = &CurrentItem { inferred_start }; match tcx.type_of(def_id).sty { @@ -222,7 +222,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { fn add_constraints_from_invariant_substs(&mut self, current: &CurrentItem, - substs: &Substs<'tcx>, + substs: SubstsRef<'tcx>, variance: VarianceTermPtr<'a>) { debug!("add_constraints_from_invariant_substs: substs={:?} variance={:?}", substs, @@ -230,12 +230,19 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { // Trait are always invariant so we can take advantage of that. let variance_i = self.invariant(variance); - for ty in substs.types() { - self.add_constraints_from_ty(current, ty, variance_i); - } - for region in substs.regions() { - self.add_constraints_from_region(current, region, variance_i); + for k in substs { + match k.unpack() { + UnpackedKind::Lifetime(lt) => { + self.add_constraints_from_region(current, lt, variance_i) + } + UnpackedKind::Type(ty) => { + self.add_constraints_from_ty(current, ty, variance_i) + } + UnpackedKind::Const(ct) => { + self.add_constraints_from_const(current, ct, variance_i) + } + } } } @@ -268,7 +275,11 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { self.add_constraints_from_mt(current, &ty::TypeAndMut { ty, mutbl }, variance); } - ty::Array(typ, _) | + ty::Array(typ, len) => { + self.add_constraints_from_ty(current, typ, variance); + self.add_constraints_from_const(current, len, variance); + } + ty::Slice(typ) => { self.add_constraints_from_ty(current, typ, variance); } @@ -344,7 +355,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { fn add_constraints_from_substs(&mut self, current: &CurrentItem, def_id: DefId, - substs: &Substs<'tcx>, + substs: SubstsRef<'tcx>, variance: VarianceTermPtr<'a>) { debug!("add_constraints_from_substs(def_id={:?}, substs={:?}, variance={:?})", def_id, @@ -356,7 +367,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { return; } - let (local, remote) = if let Some(id) = self.tcx().hir().as_local_node_id(def_id) { + let (local, remote) = if let Some(id) = self.tcx().hir().as_local_hir_id(def_id) { (Some(self.terms_cx.inferred_starts[&id]), None) } else { (None, Some(self.tcx().variances_of(def_id))) @@ -384,6 +395,9 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { UnpackedKind::Type(ty) => { self.add_constraints_from_ty(current, ty, variance_i) } + UnpackedKind::Const(ct) => { + self.add_constraints_from_const(current, ct, variance_i) + } } } } @@ -435,6 +449,26 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { } } + fn add_constraints_from_const( + &mut self, + current: &CurrentItem, + ct: &ty::LazyConst<'tcx>, + variance: VarianceTermPtr<'a> + ) { + debug!( + "add_constraints_from_const(ct={:?}, variance={:?})", + ct, + variance + ); + + if let ty::LazyConst::Evaluated(ct) = ct { + self.add_constraints_from_ty(current, ct.ty, variance); + if let ConstValue::Param(ref data) = ct.val { + self.add_constraint(current, data.index, variance); + } + } + } + /// Adds constraints appropriate for a mutability-type pair /// appearing in a context with ambient variance `variance` fn add_constraints_from_mt(&mut self, diff --git a/src/librustc_typeck/variance/solve.rs b/src/librustc_typeck/variance/solve.rs index f962c1313a92..cec33ba87dea 100644 --- a/src/librustc_typeck/variance/solve.rs +++ b/src/librustc_typeck/variance/solve.rs @@ -83,7 +83,7 @@ impl<'a, 'tcx> SolveContext<'a, 'tcx> { let solutions = &self.solutions; self.terms_cx.inferred_starts.iter().map(|(&id, &InferredIndex(start))| { - let def_id = tcx.hir().local_def_id(id); + let def_id = tcx.hir().local_def_id_from_hir_id(id); let generics = tcx.generics_of(def_id); let mut variances = solutions[start..start+generics.count()].to_vec(); diff --git a/src/librustc_typeck/variance/terms.rs b/src/librustc_typeck/variance/terms.rs index 4e562992e8cf..50c8d5adfa37 100644 --- a/src/librustc_typeck/variance/terms.rs +++ b/src/librustc_typeck/variance/terms.rs @@ -12,10 +12,9 @@ use arena::TypedArena; use rustc::ty::{self, TyCtxt}; use std::fmt; -use syntax::ast; use rustc::hir; use rustc::hir::itemlikevisit::ItemLikeVisitor; -use crate::util::nodemap::NodeMap; +use crate::util::nodemap::HirIdMap; use self::VarianceTerm::*; @@ -55,11 +54,11 @@ pub struct TermsContext<'a, 'tcx: 'a> { // For marker types, UnsafeCell, and other lang items where // variance is hardcoded, records the item-id and the hardcoded // variance. - pub lang_items: Vec<(ast::NodeId, Vec)>, + pub lang_items: Vec<(hir::HirId, Vec)>, // Maps from the node id of an item to the first inferred index // used for its type & region parameters. - pub inferred_starts: NodeMap, + pub inferred_starts: HirIdMap, // Maps from an InferredIndex to the term for that variable. pub inferred_terms: Vec>, @@ -86,7 +85,7 @@ pub fn determine_parameters_to_be_inferred<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx> terms_cx } -fn lang_items(tcx: TyCtxt<'_, '_, '_>) -> Vec<(ast::NodeId, Vec)> { +fn lang_items(tcx: TyCtxt<'_, '_, '_>) -> Vec<(hir::HirId, Vec)> { let lang_items = tcx.lang_items(); let all = vec![ (lang_items.phantom_data(), vec![ty::Covariant]), @@ -96,14 +95,14 @@ fn lang_items(tcx: TyCtxt<'_, '_, '_>) -> Vec<(ast::NodeId, Vec)> all.into_iter() // iterating over (Option, Variance) .filter(|&(ref d,_)| d.is_some()) .map(|(d, v)| (d.unwrap(), v)) // (DefId, Variance) - .filter_map(|(d, v)| tcx.hir().as_local_node_id(d).map(|n| (n, v))) // (NodeId, Variance) + .filter_map(|(d, v)| tcx.hir().as_local_hir_id(d).map(|n| (n, v))) // (HirId, Variance) .collect() } impl<'a, 'tcx> TermsContext<'a, 'tcx> { - fn add_inferreds_for_item(&mut self, id: ast::NodeId) { + fn add_inferreds_for_item(&mut self, id: hir::HirId) { let tcx = self.tcx; - let def_id = tcx.hir().local_def_id(id); + let def_id = tcx.hir().local_def_id_from_hir_id(id); let count = tcx.generics_of(def_id).count(); if count == 0 { @@ -129,36 +128,36 @@ impl<'a, 'tcx> TermsContext<'a, 'tcx> { impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for TermsContext<'a, 'tcx> { fn visit_item(&mut self, item: &hir::Item) { debug!("add_inferreds for item {}", - self.tcx.hir().node_to_string(item.id)); + self.tcx.hir().hir_to_string(item.hir_id)); match item.node { hir::ItemKind::Struct(ref struct_def, _) | hir::ItemKind::Union(ref struct_def, _) => { - self.add_inferreds_for_item(item.id); + self.add_inferreds_for_item(item.hir_id); if let hir::VariantData::Tuple(..) = *struct_def { - self.add_inferreds_for_item(struct_def.id()); + self.add_inferreds_for_item(struct_def.hir_id()); } } hir::ItemKind::Enum(ref enum_def, _) => { - self.add_inferreds_for_item(item.id); + self.add_inferreds_for_item(item.hir_id); for variant in &enum_def.variants { if let hir::VariantData::Tuple(..) = variant.node.data { - self.add_inferreds_for_item(variant.node.data.id()); + self.add_inferreds_for_item(variant.node.data.hir_id()); } } } hir::ItemKind::Fn(..) => { - self.add_inferreds_for_item(item.id); + self.add_inferreds_for_item(item.hir_id); } hir::ItemKind::ForeignMod(ref foreign_mod) => { for foreign_item in &foreign_mod.items { if let hir::ForeignItemKind::Fn(..) = foreign_item.node { - self.add_inferreds_for_item(foreign_item.id); + self.add_inferreds_for_item(foreign_item.hir_id); } } } @@ -169,13 +168,13 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for TermsContext<'a, 'tcx> { fn visit_trait_item(&mut self, trait_item: &hir::TraitItem) { if let hir::TraitItemKind::Method(..) = trait_item.node { - self.add_inferreds_for_item(trait_item.id); + self.add_inferreds_for_item(trait_item.hir_id); } } fn visit_impl_item(&mut self, impl_item: &hir::ImplItem) { if let hir::ImplItemKind::Method(..) = impl_item.node { - self.add_inferreds_for_item(impl_item.id); + self.add_inferreds_for_item(impl_item.hir_id); } } } diff --git a/src/librustc_typeck/variance/test.rs b/src/librustc_typeck/variance/test.rs index 0f566e6ded97..d04b1b276a2c 100644 --- a/src/librustc_typeck/variance/test.rs +++ b/src/librustc_typeck/variance/test.rs @@ -12,7 +12,7 @@ struct VarianceTest<'a, 'tcx: 'a> { impl<'a, 'tcx> ItemLikeVisitor<'tcx> for VarianceTest<'a, 'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item) { - let item_def_id = self.tcx.hir().local_def_id(item.id); + let item_def_id = self.tcx.hir().local_def_id_from_hir_id(item.hir_id); // For unit testing: check for a special "rustc_variance" // attribute and report an error with various results if found. diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs index 952541bb85f9..20fa6009b310 100644 --- a/src/librustdoc/clean/auto_trait.rs +++ b/src/librustdoc/clean/auto_trait.rs @@ -3,17 +3,17 @@ use rustc::traits::auto_trait as auto; use rustc::ty::{self, TypeFoldable}; use std::fmt::Debug; -use self::def_ctor::{get_def_from_def_id, get_def_from_node_id}; +use self::def_ctor::{get_def_from_def_id, get_def_from_hir_id}; use super::*; -pub struct AutoTraitFinder<'a, 'tcx: 'a, 'rcx: 'a> { - pub cx: &'a core::DocContext<'a, 'tcx, 'rcx>, +pub struct AutoTraitFinder<'a, 'tcx> { + pub cx: &'a core::DocContext<'tcx>, pub f: auto::AutoTraitFinder<'a, 'tcx>, } -impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> { - pub fn new(cx: &'a core::DocContext<'a, 'tcx, 'rcx>) -> Self { +impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { + pub fn new(cx: &'a core::DocContext<'tcx>) -> Self { let f = auto::AutoTraitFinder::new(&cx.tcx); AutoTraitFinder { cx, f } @@ -25,9 +25,9 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> { }) } - pub fn get_with_node_id(&self, id: ast::NodeId, name: String) -> Vec { - get_def_from_node_id(&self.cx, id, name, &|def_ctor, name| { - let did = self.cx.tcx.hir().local_def_id(id); + pub fn get_with_hir_id(&self, id: hir::HirId, name: String) -> Vec { + get_def_from_hir_id(&self.cx, id, name, &|def_ctor, name| { + let did = self.cx.tcx.hir().local_def_id_from_hir_id(id); self.get_auto_trait_impls(did, &def_ctor, Some(name)) }) } @@ -115,7 +115,6 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> { if result.is_auto() { let trait_ = hir::TraitRef { path: get_path_for_type(self.cx.tcx, trait_def_id, hir::def::Def::Trait), - ref_id: ast::DUMMY_NODE_ID, hir_ref_id: hir::DUMMY_HIR_ID, }; diff --git a/src/librustdoc/clean/blanket_impl.rs b/src/librustdoc/clean/blanket_impl.rs index 55abcb4a93bd..aaae0bafd9e0 100644 --- a/src/librustdoc/clean/blanket_impl.rs +++ b/src/librustdoc/clean/blanket_impl.rs @@ -9,14 +9,14 @@ use crate::core::DocAccessLevels; use super::*; -use self::def_ctor::{get_def_from_def_id, get_def_from_node_id}; +use self::def_ctor::{get_def_from_def_id, get_def_from_hir_id}; -pub struct BlanketImplFinder<'a, 'tcx: 'a, 'rcx: 'a> { - pub cx: &'a core::DocContext<'a, 'tcx, 'rcx>, +pub struct BlanketImplFinder<'a, 'tcx> { + pub cx: &'a core::DocContext<'tcx>, } -impl<'a, 'tcx, 'rcx> BlanketImplFinder <'a, 'tcx, 'rcx> { - pub fn new(cx: &'a core::DocContext<'a, 'tcx, 'rcx>) -> Self { +impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> { + pub fn new(cx: &'a core::DocContext<'tcx>) -> Self { BlanketImplFinder { cx } } @@ -26,9 +26,9 @@ impl<'a, 'tcx, 'rcx> BlanketImplFinder <'a, 'tcx, 'rcx> { }) } - pub fn get_with_node_id(&self, id: ast::NodeId, name: String) -> Vec { - get_def_from_node_id(&self.cx, id, name, &|def_ctor, name| { - let did = self.cx.tcx.hir().local_def_id(id); + pub fn get_with_hir_id(&self, id: hir::HirId, name: String) -> Vec { + get_def_from_hir_id(&self.cx, id, name, &|def_ctor, name| { + let did = self.cx.tcx.hir().local_def_id_from_hir_id(id); self.get_blanket_impls(did, &def_ctor, Some(name)) }) } @@ -123,7 +123,6 @@ impl<'a, 'tcx, 'rcx> BlanketImplFinder <'a, 'tcx, 'rcx> { path: get_path_for_type(infcx.tcx, trait_def_id, hir::def::Def::Trait), - ref_id: ast::DUMMY_NODE_ID, hir_ref_id: hir::DUMMY_HIR_ID, }; let provided_trait_methods = diff --git a/src/librustdoc/clean/def_ctor.rs b/src/librustdoc/clean/def_ctor.rs index fce86d590159..405a2e66d6e5 100644 --- a/src/librustdoc/clean/def_ctor.rs +++ b/src/librustdoc/clean/def_ctor.rs @@ -2,7 +2,7 @@ use crate::core::DocContext; use super::*; -pub fn get_def_from_def_id(cx: &DocContext<'_, '_, '_>, +pub fn get_def_from_def_id(cx: &DocContext<'_>, def_id: DefId, callback: &F, ) -> Vec @@ -38,13 +38,13 @@ where F: Fn(& dyn Fn(DefId) -> Def) -> Vec { } } -pub fn get_def_from_node_id(cx: &DocContext<'_, '_, '_>, - id: ast::NodeId, - name: String, - callback: &F, +pub fn get_def_from_hir_id(cx: &DocContext<'_>, + id: hir::HirId, + name: String, + callback: &F, ) -> Vec where F: Fn(& dyn Fn(DefId) -> Def, String) -> Vec { - let item = &cx.tcx.hir().expect_item(id).node; + let item = &cx.tcx.hir().expect_item_by_hir_id(id).node; callback(&match *item { hir::ItemKind::Struct(_, _) => Def::Struct, diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index cdffbdd540f8..880f67281b96 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -36,7 +36,7 @@ use super::Clean; /// The returned value is `None` if the definition could not be inlined, /// and `Some` of a vector of items if it was successfully expanded. pub fn try_inline( - cx: &DocContext<'_, '_, '_>, + cx: &DocContext<'_>, def: Def, name: ast::Name, visited: &mut FxHashSet @@ -129,7 +129,7 @@ pub fn try_inline( Some(ret) } -pub fn try_inline_glob(cx: &DocContext<'_, '_, '_>, def: Def, visited: &mut FxHashSet) +pub fn try_inline_glob(cx: &DocContext<'_>, def: Def, visited: &mut FxHashSet) -> Option> { if def == Def::Err { return None } @@ -146,7 +146,7 @@ pub fn try_inline_glob(cx: &DocContext<'_, '_, '_>, def: Def, visited: &mut FxHa } } -pub fn load_attrs(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Attributes { +pub fn load_attrs(cx: &DocContext<'_>, did: DefId) -> clean::Attributes { cx.tcx.get_attrs(did).clean(cx) } @@ -154,7 +154,7 @@ pub fn load_attrs(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Attributes /// /// These names are used later on by HTML rendering to generate things like /// source links back to the original item. -pub fn record_extern_fqn(cx: &DocContext<'_, '_, '_>, did: DefId, kind: clean::TypeKind) { +pub fn record_extern_fqn(cx: &DocContext<'_>, did: DefId, kind: clean::TypeKind) { let mut crate_name = cx.tcx.crate_name(did.krate).to_string(); if did.is_local() { crate_name = cx.crate_name.clone().unwrap_or(crate_name); @@ -182,7 +182,7 @@ pub fn record_extern_fqn(cx: &DocContext<'_, '_, '_>, did: DefId, kind: clean::T } } -pub fn build_external_trait(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Trait { +pub fn build_external_trait(cx: &DocContext<'_>, did: DefId) -> clean::Trait { let auto_trait = cx.tcx.trait_def(did).has_auto_impl; let trait_items = cx.tcx.associated_items(did).map(|item| item.clean(cx)).collect(); let predicates = cx.tcx.predicates_of(did); @@ -202,7 +202,7 @@ pub fn build_external_trait(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::T } } -fn build_external_function(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Function { +fn build_external_function(cx: &DocContext<'_>, did: DefId) -> clean::Function { let sig = cx.tcx.fn_sig(did); let constness = if cx.tcx.is_min_const_fn(did) { @@ -224,7 +224,7 @@ fn build_external_function(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Fu } } -fn build_enum(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Enum { +fn build_enum(cx: &DocContext<'_>, did: DefId) -> clean::Enum { let predicates = cx.tcx.predicates_of(did); clean::Enum { @@ -234,7 +234,7 @@ fn build_enum(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Enum { } } -fn build_struct(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Struct { +fn build_struct(cx: &DocContext<'_>, did: DefId) -> clean::Struct { let predicates = cx.tcx.predicates_of(did); let variant = cx.tcx.adt_def(did).non_enum_variant(); @@ -250,7 +250,7 @@ fn build_struct(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Struct { } } -fn build_union(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Union { +fn build_union(cx: &DocContext<'_>, did: DefId) -> clean::Union { let predicates = cx.tcx.predicates_of(did); let variant = cx.tcx.adt_def(did).non_enum_variant(); @@ -262,7 +262,7 @@ fn build_union(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Union { } } -fn build_type_alias(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Typedef { +fn build_type_alias(cx: &DocContext<'_>, did: DefId) -> clean::Typedef { let predicates = cx.tcx.predicates_of(did); clean::Typedef { @@ -271,7 +271,7 @@ fn build_type_alias(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Typedef { } } -pub fn build_impls(cx: &DocContext<'_, '_, '_>, did: DefId) -> Vec { +pub fn build_impls(cx: &DocContext<'_>, did: DefId) -> Vec { let tcx = cx.tcx; let mut impls = Vec::new(); @@ -282,7 +282,7 @@ pub fn build_impls(cx: &DocContext<'_, '_, '_>, did: DefId) -> Vec impls } -pub fn build_impl(cx: &DocContext<'_, '_, '_>, did: DefId, ret: &mut Vec) { +pub fn build_impl(cx: &DocContext<'_>, did: DefId, ret: &mut Vec) { if !cx.renderinfo.borrow_mut().inlined.insert(did) { return } @@ -393,7 +393,7 @@ pub fn build_impl(cx: &DocContext<'_, '_, '_>, did: DefId, ret: &mut Vec, + cx: &DocContext<'_>, did: DefId, visited: &mut FxHashSet ) -> clean::Module { @@ -404,7 +404,7 @@ fn build_module( is_crate: false, }; - fn fill_in(cx: &DocContext<'_, '_, '_>, did: DefId, items: &mut Vec, + fn fill_in(cx: &DocContext<'_>, did: DefId, items: &mut Vec, visited: &mut FxHashSet) { // If we're re-exporting a re-export it may actually re-export something in // two namespaces, so the target may be listed twice. Make sure we only @@ -421,22 +421,22 @@ fn build_module( } } -pub fn print_inlined_const(cx: &DocContext<'_, '_, '_>, did: DefId) -> String { - if let Some(node_id) = cx.tcx.hir().as_local_node_id(did) { - cx.tcx.hir().node_to_pretty_string(node_id) +pub fn print_inlined_const(cx: &DocContext<'_>, did: DefId) -> String { + if let Some(node_id) = cx.tcx.hir().as_local_hir_id(did) { + cx.tcx.hir().hir_to_pretty_string(node_id) } else { cx.tcx.rendered_const(did) } } -fn build_const(cx: &DocContext<'_, '_, '_>, did: DefId) -> clean::Constant { +fn build_const(cx: &DocContext<'_>, did: DefId) -> clean::Constant { clean::Constant { type_: cx.tcx.type_of(did).clean(cx), expr: print_inlined_const(cx, did) } } -fn build_static(cx: &DocContext<'_, '_, '_>, did: DefId, mutable: bool) -> clean::Static { +fn build_static(cx: &DocContext<'_>, did: DefId, mutable: bool) -> clean::Static { clean::Static { type_: cx.tcx.type_of(did).clean(cx), mutability: if mutable {clean::Mutable} else {clean::Immutable}, @@ -444,7 +444,7 @@ fn build_static(cx: &DocContext<'_, '_, '_>, did: DefId, mutable: bool) -> clean } } -fn build_macro(cx: &DocContext<'_, '_, '_>, did: DefId, name: ast::Name) -> clean::ItemEnum { +fn build_macro(cx: &DocContext<'_>, did: DefId, name: ast::Name) -> clean::ItemEnum { let imported_from = cx.tcx.original_crate_name(did.krate); match cx.cstore.load_macro_untracked(did, cx.sess()) { LoadedMacro::MacroDef(def) => { @@ -546,7 +546,7 @@ fn separate_supertrait_bounds(mut g: clean::Generics) (g, ty_bounds) } -pub fn record_extern_trait(cx: &DocContext<'_, '_, '_>, did: DefId) { +pub fn record_extern_trait(cx: &DocContext<'_>, did: DefId) { if did.is_local() { return; } diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 03dff1087704..f2bf7ead5619 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -20,7 +20,7 @@ use rustc::mir::interpret::GlobalId; use rustc::hir::{self, GenericArg, HirVec}; use rustc::hir::def::{self, Def, CtorKind}; use rustc::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; -use rustc::ty::subst::Substs; +use rustc::ty::subst::{InternalSubsts, SubstsRef}; use rustc::ty::{self, TyCtxt, Region, RegionVid, Ty, AdtKind}; use rustc::ty::fold::TypeFolder; use rustc::ty::layout::VariantIdx; @@ -71,56 +71,56 @@ thread_local!(pub static MAX_DEF_ID: RefCell> = Defau const FN_OUTPUT_NAME: &'static str = "Output"; // extract the stability index for a node from tcx, if possible -fn get_stability(cx: &DocContext<'_, '_, '_>, def_id: DefId) -> Option { +fn get_stability(cx: &DocContext<'_>, def_id: DefId) -> Option { cx.tcx.lookup_stability(def_id).clean(cx) } -fn get_deprecation(cx: &DocContext<'_, '_, '_>, def_id: DefId) -> Option { +fn get_deprecation(cx: &DocContext<'_>, def_id: DefId) -> Option { cx.tcx.lookup_deprecation(def_id).clean(cx) } pub trait Clean { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> T; + fn clean(&self, cx: &DocContext<'_>) -> T; } impl, U> Clean> for [T] { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Vec { + fn clean(&self, cx: &DocContext<'_>) -> Vec { self.iter().map(|x| x.clean(cx)).collect() } } impl, U, V: Idx> Clean> for IndexVec { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> IndexVec { + fn clean(&self, cx: &DocContext<'_>) -> IndexVec { self.iter().map(|x| x.clean(cx)).collect() } } impl, U> Clean for P { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> U { + fn clean(&self, cx: &DocContext<'_>) -> U { (**self).clean(cx) } } impl, U> Clean for Rc { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> U { + fn clean(&self, cx: &DocContext<'_>) -> U { (**self).clean(cx) } } impl, U> Clean> for Option { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Option { + fn clean(&self, cx: &DocContext<'_>) -> Option { self.as_ref().map(|v| v.clean(cx)) } } impl Clean for ty::Binder where T: Clean { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> U { + fn clean(&self, cx: &DocContext<'_>) -> U { self.skip_binder().clean(cx) } } impl, U> Clean> for P<[T]> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Vec { + fn clean(&self, cx: &DocContext<'_>) -> Vec { self.iter().map(|x| x.clean(cx)).collect() } } @@ -139,8 +139,8 @@ pub struct Crate { pub masked_crates: FxHashSet, } -impl<'a, 'tcx, 'rcx> Clean for visit_ast::RustdocVisitor<'a, 'tcx, 'rcx> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Crate { +impl<'a, 'tcx> Clean for visit_ast::RustdocVisitor<'a, 'tcx> { + fn clean(&self, cx: &DocContext<'_>) -> Crate { use crate::visit_lib::LibEmbargoVisitor; { @@ -234,7 +234,7 @@ pub struct ExternalCrate { } impl Clean for CrateNum { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> ExternalCrate { + fn clean(&self, cx: &DocContext<'_>) -> ExternalCrate { let root = DefId { krate: *self, index: CRATE_DEF_INDEX }; let krate_span = cx.tcx.def_span(root); let krate_src = cx.sess().source_map().span_to_filename(krate_span); @@ -582,7 +582,7 @@ pub struct Module { } impl Clean for doctree::Module { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let name = if self.name.is_some() { self.name.expect("No name provided").clean(cx) } else { @@ -1023,7 +1023,7 @@ impl AttributesExt for Attributes { } impl Clean for [ast::Attribute] { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Attributes { + fn clean(&self, cx: &DocContext<'_>) -> Attributes { Attributes::from_ast(cx.sess().diagnostic(), self) } } @@ -1035,7 +1035,7 @@ pub enum GenericBound { } impl GenericBound { - fn maybe_sized(cx: &DocContext<'_, '_, '_>) -> GenericBound { + fn maybe_sized(cx: &DocContext<'_>) -> GenericBound { let did = cx.tcx.require_lang_item(lang_items::SizedTraitLangItem); let empty = cx.tcx.intern_substs(&[]); let path = external_path(cx, &cx.tcx.item_name(did).as_str(), @@ -1052,7 +1052,7 @@ impl GenericBound { }, hir::TraitBoundModifier::Maybe) } - fn is_sized_bound(&self, cx: &DocContext<'_, '_, '_>) -> bool { + fn is_sized_bound(&self, cx: &DocContext<'_>) -> bool { use rustc::hir::TraitBoundModifier as TBM; if let GenericBound::TraitBound(PolyTrait { ref trait_, .. }, TBM::None) = *self { if trait_.def_id() == cx.tcx.lang_items().sized_trait() { @@ -1078,7 +1078,7 @@ impl GenericBound { } impl Clean for hir::GenericBound { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> GenericBound { + fn clean(&self, cx: &DocContext<'_>) -> GenericBound { match *self { hir::GenericBound::Outlives(lt) => GenericBound::Outlives(lt.clean(cx)), hir::GenericBound::Trait(ref t, modifier) => { @@ -1088,8 +1088,8 @@ impl Clean for hir::GenericBound { } } -fn external_generic_args(cx: &DocContext<'_, '_, '_>, trait_did: Option, has_self: bool, - bindings: Vec, substs: &Substs<'_>) -> GenericArgs { +fn external_generic_args(cx: &DocContext<'_>, trait_did: Option, has_self: bool, + bindings: Vec, substs: SubstsRef<'_>) -> GenericArgs { let lifetimes = substs.regions().filter_map(|v| v.clean(cx)).collect(); let types = substs.types().skip(has_self as usize).collect::>(); @@ -1130,8 +1130,8 @@ fn external_generic_args(cx: &DocContext<'_, '_, '_>, trait_did: Option, // trait_did should be set to a trait's DefId if called on a TraitRef, in order to sugar // from Fn<(A, B,), C> to Fn(A, B) -> C -fn external_path(cx: &DocContext<'_, '_, '_>, name: &str, trait_did: Option, has_self: bool, - bindings: Vec, substs: &Substs<'_>) -> Path { +fn external_path(cx: &DocContext<'_>, name: &str, trait_did: Option, has_self: bool, + bindings: Vec, substs: SubstsRef<'_>) -> Path { Path { global: false, def: Def::Err, @@ -1143,7 +1143,7 @@ fn external_path(cx: &DocContext<'_, '_, '_>, name: &str, trait_did: Option Clean for (&'a ty::TraitRef<'tcx>, Vec) { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> GenericBound { + fn clean(&self, cx: &DocContext<'_>) -> GenericBound { let (trait_ref, ref bounds) = *self; inline::record_extern_fqn(cx, trait_ref.def_id, TypeKind::Trait); let path = external_path(cx, &cx.tcx.item_name(trait_ref.def_id).as_str(), @@ -1187,13 +1187,13 @@ impl<'a, 'tcx> Clean for (&'a ty::TraitRef<'tcx>, Vec } impl<'tcx> Clean for ty::TraitRef<'tcx> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> GenericBound { + fn clean(&self, cx: &DocContext<'_>) -> GenericBound { (self, vec![]).clean(cx) } } -impl<'tcx> Clean>> for Substs<'tcx> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Option> { +impl<'tcx> Clean>> for InternalSubsts<'tcx> { + fn clean(&self, cx: &DocContext<'_>) -> Option> { let mut v = Vec::new(); v.extend(self.regions().filter_map(|r| r.clean(cx)).map(GenericBound::Outlives)); v.extend(self.types().map(|t| GenericBound::TraitBound(PolyTrait { @@ -1220,8 +1220,8 @@ impl Lifetime { } impl Clean for hir::Lifetime { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Lifetime { - if self.id != ast::DUMMY_NODE_ID { + fn clean(&self, cx: &DocContext<'_>) -> Lifetime { + if self.hir_id != hir::DUMMY_HIR_ID { let def = cx.tcx.named_region(self.hir_id); match def { Some(rl::Region::EarlyBound(_, node_id, _)) | @@ -1239,7 +1239,7 @@ impl Clean for hir::Lifetime { } impl Clean for hir::GenericParam { - fn clean(&self, _: &DocContext<'_, '_, '_>) -> Lifetime { + fn clean(&self, _: &DocContext<'_>) -> Lifetime { match self.kind { hir::GenericParamKind::Lifetime { .. } => { if self.bounds.len() > 0 { @@ -1263,7 +1263,7 @@ impl Clean for hir::GenericParam { } impl Clean for hir::ConstArg { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Constant { + fn clean(&self, cx: &DocContext<'_>) -> Constant { Constant { type_: cx.tcx.type_of(cx.tcx.hir().body_owner_def_id(self.value.body)).clean(cx), expr: print_const_expr(cx, self.value.body), @@ -1272,13 +1272,13 @@ impl Clean for hir::ConstArg { } impl<'tcx> Clean for ty::GenericParamDef { - fn clean(&self, _cx: &DocContext<'_, '_, '_>) -> Lifetime { + fn clean(&self, _cx: &DocContext<'_>) -> Lifetime { Lifetime(self.name.to_string()) } } impl Clean> for ty::RegionKind { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Option { + fn clean(&self, cx: &DocContext<'_>) -> Option { match *self { ty::ReStatic => Some(Lifetime::statik()), ty::ReLateBound(_, ty::BrNamed(_, name)) => Some(Lifetime(name.to_string())), @@ -1307,7 +1307,7 @@ pub enum WherePredicate { } impl Clean for hir::WherePredicate { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> WherePredicate { + fn clean(&self, cx: &DocContext<'_>) -> WherePredicate { match *self { hir::WherePredicate::BoundPredicate(ref wbp) => { WherePredicate::BoundPredicate { @@ -1334,7 +1334,7 @@ impl Clean for hir::WherePredicate { } impl<'a> Clean> for ty::Predicate<'a> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Option { + fn clean(&self, cx: &DocContext<'_>) -> Option { use rustc::ty::Predicate; match *self { @@ -1353,7 +1353,7 @@ impl<'a> Clean> for ty::Predicate<'a> { } impl<'a> Clean for ty::TraitPredicate<'a> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> WherePredicate { + fn clean(&self, cx: &DocContext<'_>) -> WherePredicate { WherePredicate::BoundPredicate { ty: self.trait_ref.self_ty().clean(cx), bounds: vec![self.trait_ref.clean(cx)] @@ -1362,7 +1362,7 @@ impl<'a> Clean for ty::TraitPredicate<'a> { } impl<'tcx> Clean for ty::SubtypePredicate<'tcx> { - fn clean(&self, _cx: &DocContext<'_, '_, '_>) -> WherePredicate { + fn clean(&self, _cx: &DocContext<'_>) -> WherePredicate { panic!("subtype predicates are an internal rustc artifact \ and should not be seen by rustdoc") } @@ -1371,7 +1371,7 @@ impl<'tcx> Clean for ty::SubtypePredicate<'tcx> { impl<'tcx> Clean> for ty::OutlivesPredicate,ty::Region<'tcx>> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Option { + fn clean(&self, cx: &DocContext<'_>) -> Option { let ty::OutlivesPredicate(ref a, ref b) = *self; match (a, b) { @@ -1389,7 +1389,7 @@ impl<'tcx> Clean> for } impl<'tcx> Clean> for ty::OutlivesPredicate, ty::Region<'tcx>> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Option { + fn clean(&self, cx: &DocContext<'_>) -> Option { let ty::OutlivesPredicate(ref ty, ref lt) = *self; match lt { @@ -1405,7 +1405,7 @@ impl<'tcx> Clean> for ty::OutlivesPredicate, ty: } impl<'tcx> Clean for ty::ProjectionPredicate<'tcx> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> WherePredicate { + fn clean(&self, cx: &DocContext<'_>) -> WherePredicate { WherePredicate::EqPredicate { lhs: self.projection_ty.clean(cx), rhs: self.ty.clean(cx) @@ -1414,7 +1414,7 @@ impl<'tcx> Clean for ty::ProjectionPredicate<'tcx> { } impl<'tcx> Clean for ty::ProjectionTy<'tcx> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Type { + fn clean(&self, cx: &DocContext<'_>) -> Type { let trait_ = match self.trait_ref(cx.tcx).clean(cx) { GenericBound::TraitBound(t, _) => t.trait_, GenericBound::Outlives(_) => panic!("cleaning a trait got a lifetime"), @@ -1462,7 +1462,7 @@ impl GenericParamDef { } impl<'tcx> Clean for ty::GenericParamDef { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> GenericParamDef { + fn clean(&self, cx: &DocContext<'_>) -> GenericParamDef { let (name, kind) = match self.kind { ty::GenericParamDefKind::Lifetime => { (self.name.to_string(), GenericParamDefKind::Lifetime) @@ -1482,6 +1482,9 @@ impl<'tcx> Clean for ty::GenericParamDef { synthetic: None, }) } + ty::GenericParamDefKind::Const { .. } => { + unimplemented!() // FIXME(const_generics) + } }; GenericParamDef { @@ -1492,7 +1495,7 @@ impl<'tcx> Clean for ty::GenericParamDef { } impl Clean for hir::GenericParam { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> GenericParamDef { + fn clean(&self, cx: &DocContext<'_>) -> GenericParamDef { let (name, kind) = match self.kind { hir::GenericParamKind::Lifetime { .. } => { let name = if self.bounds.len() > 0 { @@ -1513,7 +1516,7 @@ impl Clean for hir::GenericParam { } hir::GenericParamKind::Type { ref default, synthetic } => { (self.name.ident().name.clean(cx), GenericParamDefKind::Type { - did: cx.tcx.hir().local_def_id(self.id), + did: cx.tcx.hir().local_def_id_from_hir_id(self.hir_id), bounds: self.bounds.clean(cx), default: default.clean(cx), synthetic: synthetic, @@ -1521,7 +1524,7 @@ impl Clean for hir::GenericParam { } hir::GenericParamKind::Const { ref ty } => { (self.name.ident().name.clean(cx), GenericParamDefKind::Const { - did: cx.tcx.hir().local_def_id(self.id), + did: cx.tcx.hir().local_def_id_from_hir_id(self.hir_id), ty: ty.clean(cx), }) } @@ -1542,7 +1545,7 @@ pub struct Generics { } impl Clean for hir::Generics { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Generics { + fn clean(&self, cx: &DocContext<'_>) -> Generics { // Synthetic type-parameters are inserted after normal ones. // In order for normal parameters to be able to refer to synthetic ones, // scans them first. @@ -1612,7 +1615,7 @@ impl Clean for hir::Generics { impl<'a, 'tcx> Clean for (&'a ty::Generics, &'a Lrc>) { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Generics { + fn clean(&self, cx: &DocContext<'_>) -> Generics { use self::WherePredicate as WP; let (gens, preds) = *self; @@ -1629,6 +1632,9 @@ impl<'a, 'tcx> Clean for (&'a ty::Generics, } Some(param.clean(cx)) } + ty::GenericParamDefKind::Const { .. } => { + unimplemented!() // FIXME(const_generics) + } }).collect::>(); let mut where_predicates = preds.predicates.iter() @@ -1678,6 +1684,9 @@ impl<'a, 'tcx> Clean for (&'a ty::Generics, .flat_map(|param| match param.kind { ty::GenericParamDefKind::Lifetime => Some(param.clean(cx)), ty::GenericParamDefKind::Type { .. } => None, + ty::GenericParamDefKind::Const { .. } => { + unimplemented!() // FIXME(const_generics) + } }).chain(simplify::ty_params(stripped_typarams).into_iter()) .collect(), where_predicates: simplify::where_clauses(cx, where_predicates), @@ -1693,7 +1702,7 @@ pub struct Method { } impl<'a> Clean for (&'a hir::MethodSig, &'a hir::Generics, hir::BodyId) { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Method { + fn clean(&self, cx: &DocContext<'_>) -> Method { let (generics, decl) = enter_impl_trait(cx, || { (self.1.clean(cx), (&*self.0.decl, self.2).clean(cx)) }); @@ -1720,12 +1729,12 @@ pub struct Function { } impl Clean for doctree::Function { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let (generics, decl) = enter_impl_trait(cx, || { (self.generics.clean(cx), (&self.decl, self.body).clean(cx)) }); - let did = cx.tcx.hir().local_def_id(self.id); + let did = cx.tcx.hir().local_def_id_from_hir_id(self.id); let constness = if cx.tcx.is_min_const_fn(did) { hir::Constness::Const } else { @@ -1752,7 +1761,6 @@ impl Clean for doctree::Function { pub struct FnDecl { pub inputs: Arguments, pub output: FunctionRetTy, - pub variadic: bool, pub attrs: Attributes, } @@ -1792,7 +1800,7 @@ pub struct Arguments { } impl<'a> Clean for (&'a [hir::Ty], &'a [ast::Ident]) { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Arguments { + fn clean(&self, cx: &DocContext<'_>) -> Arguments { Arguments { values: self.0.iter().enumerate().map(|(i, ty)| { let mut name = self.1.get(i).map(|ident| ident.to_string()) @@ -1810,7 +1818,7 @@ impl<'a> Clean for (&'a [hir::Ty], &'a [ast::Ident]) { } impl<'a> Clean for (&'a [hir::Ty], hir::BodyId) { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Arguments { + fn clean(&self, cx: &DocContext<'_>) -> Arguments { let body = cx.tcx.hir().body(self.1); Arguments { @@ -1827,20 +1835,19 @@ impl<'a> Clean for (&'a [hir::Ty], hir::BodyId) { impl<'a, A: Copy> Clean for (&'a hir::FnDecl, A) where (&'a [hir::Ty], A): Clean { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> FnDecl { + fn clean(&self, cx: &DocContext<'_>) -> FnDecl { FnDecl { inputs: (&self.0.inputs[..], self.1).clean(cx), output: self.0.output.clean(cx), - variadic: self.0.variadic, attrs: Attributes::default() } } } impl<'a, 'tcx> Clean for (DefId, ty::PolyFnSig<'tcx>) { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> FnDecl { + fn clean(&self, cx: &DocContext<'_>) -> FnDecl { let (did, sig) = *self; - let mut names = if cx.tcx.hir().as_local_node_id(did).is_some() { + let mut names = if cx.tcx.hir().as_local_hir_id(did).is_some() { vec![].into_iter() } else { cx.tcx.fn_arg_names(did).into_iter() @@ -1849,7 +1856,6 @@ impl<'a, 'tcx> Clean for (DefId, ty::PolyFnSig<'tcx>) { FnDecl { output: Return(sig.skip_binder().output().clean(cx)), attrs: Attributes::default(), - variadic: sig.skip_binder().variadic, inputs: Arguments { values: sig.skip_binder().inputs().iter().map(|t| { Argument { @@ -1899,7 +1905,7 @@ pub enum FunctionRetTy { } impl Clean for hir::FunctionRetTy { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> FunctionRetTy { + fn clean(&self, cx: &DocContext<'_>) -> FunctionRetTy { match *self { hir::Return(ref typ) => Return(typ.clean(cx)), hir::DefaultReturn(..) => DefaultReturn, @@ -1928,14 +1934,14 @@ pub struct Trait { } impl Clean for doctree::Trait { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let attrs = self.attrs.clean(cx); let is_spotlight = attrs.has_doc_flag("spotlight"); Item { name: Some(self.name.clean(cx)), attrs: attrs, source: self.whence.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -1959,13 +1965,13 @@ pub struct TraitAlias { } impl Clean for doctree::TraitAlias { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let attrs = self.attrs.clean(cx); Item { name: Some(self.name.clean(cx)), attrs, source: self.whence.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -1978,7 +1984,7 @@ impl Clean for doctree::TraitAlias { } impl Clean for hir::IsAuto { - fn clean(&self, _: &DocContext<'_, '_, '_>) -> bool { + fn clean(&self, _: &DocContext<'_>) -> bool { match *self { hir::IsAuto::Yes => true, hir::IsAuto::No => false, @@ -1987,13 +1993,13 @@ impl Clean for hir::IsAuto { } impl Clean for hir::TraitRef { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Type { - resolve_type(cx, self.path.clean(cx), self.ref_id) + fn clean(&self, cx: &DocContext<'_>) -> Type { + resolve_type(cx, self.path.clean(cx), self.hir_ref_id) } } impl Clean for hir::PolyTraitRef { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> PolyTrait { + fn clean(&self, cx: &DocContext<'_>) -> PolyTrait { PolyTrait { trait_: self.trait_ref.clean(cx), generic_params: self.bound_generic_params.clean(cx) @@ -2002,7 +2008,7 @@ impl Clean for hir::PolyTraitRef { } impl Clean for hir::TraitItem { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let inner = match self.node { hir::TraitItemKind::Const(ref ty, default) => { AssociatedConstItem(ty.clean(cx), @@ -2025,21 +2031,22 @@ impl Clean for hir::TraitItem { AssociatedTypeItem(bounds.clean(cx), default.clean(cx)) } }; + let local_did = cx.tcx.hir().local_def_id_from_hir_id(self.hir_id); Item { name: Some(self.ident.name.clean(cx)), attrs: self.attrs.clean(cx), source: self.span.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id), + def_id: local_did, visibility: None, - stability: get_stability(cx, cx.tcx.hir().local_def_id(self.id)), - deprecation: get_deprecation(cx, cx.tcx.hir().local_def_id(self.id)), + stability: get_stability(cx, local_did), + deprecation: get_deprecation(cx, local_did), inner, } } } impl Clean for hir::ImplItem { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let inner = match self.node { hir::ImplItemKind::Const(ref ty, expr) => { AssociatedConstItem(ty.clean(cx), @@ -2057,21 +2064,22 @@ impl Clean for hir::ImplItem { generics: Generics::default(), }, true), }; + let local_did = cx.tcx.hir().local_def_id_from_hir_id(self.hir_id); Item { name: Some(self.ident.name.clean(cx)), source: self.span.clean(cx), attrs: self.attrs.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id), + def_id: local_did, visibility: self.vis.clean(cx), - stability: get_stability(cx, cx.tcx.hir().local_def_id(self.id)), - deprecation: get_deprecation(cx, cx.tcx.hir().local_def_id(self.id)), + stability: get_stability(cx, local_did), + deprecation: get_deprecation(cx, local_did), inner, } } } impl<'tcx> Clean for ty::AssociatedItem { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let inner = match self.kind { ty::AssociatedKind::Const => { let ty = cx.tcx.type_of(self.def_id); @@ -2252,6 +2260,7 @@ pub enum Type { Slice(Box), Array(Box, String), Never, + CVarArgs, Unique(Box), RawPointer(Mutability, Box), BorrowedRef { @@ -2290,6 +2299,7 @@ pub enum PrimitiveType { Reference, Fn, Never, + CVarArgs, } #[derive(Clone, RustcEncodable, RustcDecodable, Copy, Debug)] @@ -2469,6 +2479,7 @@ impl PrimitiveType { Reference => "reference", Fn => "fn", Never => "never", + CVarArgs => "...", } } @@ -2513,11 +2524,12 @@ impl From for PrimitiveType { } impl Clean for hir::Ty { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Type { + fn clean(&self, cx: &DocContext<'_>) -> Type { use rustc::hir::*; match self.node { TyKind::Never => Never, + TyKind::CVarArgs(_) => CVarArgs, TyKind::Ptr(ref m) => RawPointer(m.mutbl.clean(cx), box m.ty.clean(cx)), TyKind::Rptr(ref l, ref m) => { let lifetime = if l.is_elided() { @@ -2530,9 +2542,9 @@ impl Clean for hir::Ty { } TyKind::Slice(ref ty) => Slice(box ty.clean(cx)), TyKind::Array(ref ty, ref length) => { - let def_id = cx.tcx.hir().local_def_id(length.id); + let def_id = cx.tcx.hir().local_def_id_from_hir_id(length.hir_id); let param_env = cx.tcx.param_env(def_id); - let substs = Substs::identity_for_item(cx.tcx, def_id); + let substs = InternalSubsts::identity_for_item(cx.tcx, def_id); let cid = GlobalId { instance: ty::Instance::new(def_id, substs), promoted: None @@ -2599,7 +2611,7 @@ impl Clean for hir::Ty { if let Some(lt) = lifetime.cloned() { if !lt.is_elided() { let lt_def_id = - cx.tcx.hir().local_def_id(param.id); + cx.tcx.hir().local_def_id_from_hir_id(param.hir_id); lt_substs.insert(lt_def_id, lt.clean(cx)); } } @@ -2607,7 +2619,8 @@ impl Clean for hir::Ty { } hir::GenericParamKind::Type { ref default, .. } => { let ty_param_def = - Def::TyParam(cx.tcx.hir().local_def_id(param.id)); + Def::TyParam( + cx.tcx.hir().local_def_id_from_hir_id(param.hir_id)); let mut j = 0; let type_ = generic_args.args.iter().find_map(|arg| { match arg { @@ -2631,7 +2644,8 @@ impl Clean for hir::Ty { } hir::GenericParamKind::Const { .. } => { let const_param_def = - Def::ConstParam(cx.tcx.hir().local_def_id(param.id)); + Def::ConstParam( + cx.tcx.hir().local_def_id_from_hir_id(param.hir_id)); let mut j = 0; let const_ = generic_args.args.iter().find_map(|arg| { match arg { @@ -2656,7 +2670,7 @@ impl Clean for hir::Ty { }); return cx.enter_alias(ty_substs, lt_substs, const_substs, || ty.clean(cx)); } - resolve_type(cx, path.clean(cx), self.id) + resolve_type(cx, path.clean(cx), self.hir_id) } TyKind::Path(hir::QPath::Resolved(Some(ref qself), ref p)) => { let mut segments: Vec<_> = p.segments.clone().into(); @@ -2669,7 +2683,7 @@ impl Clean for hir::Ty { Type::QPath { name: p.segments.last().expect("segments were empty").ident.name.clean(cx), self_type: box qself.clean(cx), - trait_: box resolve_type(cx, trait_path.clean(cx), self.id) + trait_: box resolve_type(cx, trait_path.clean(cx), self.hir_id) } } TyKind::Path(hir::QPath::TypeRelative(ref qself, ref segment)) => { @@ -2686,7 +2700,7 @@ impl Clean for hir::Ty { Type::QPath { name: segment.ident.name.clean(cx), self_type: box qself.clean(cx), - trait_: box resolve_type(cx, trait_path.clean(cx), self.id) + trait_: box resolve_type(cx, trait_path.clean(cx), self.hir_id) } } TyKind::TraitObject(ref bounds, ref lifetime) => { @@ -2712,7 +2726,7 @@ impl Clean for hir::Ty { } impl<'tcx> Clean for Ty<'tcx> { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Type { + fn clean(&self, cx: &DocContext<'_>) -> Type { match self.sty { ty::Never => Never, ty::Bool => Primitive(PrimitiveType::Bool), @@ -2774,7 +2788,7 @@ impl<'tcx> Clean for Ty<'tcx> { ty::Foreign(did) => { inline::record_extern_fqn(cx, did, TypeKind::Foreign); let path = external_path(cx, &cx.tcx.item_name(did).as_str(), - None, false, vec![], Substs::empty()); + None, false, vec![], InternalSubsts::empty()); ResolvedPath { path: path, typarams: None, @@ -2907,22 +2921,24 @@ impl<'tcx> Clean for Ty<'tcx> { } impl Clean for hir::StructField { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { + let local_did = cx.tcx.hir().local_def_id_from_hir_id(self.hir_id); + Item { name: Some(self.ident.name).clean(cx), attrs: self.attrs.clean(cx), source: self.span.clean(cx), visibility: self.vis.clean(cx), - stability: get_stability(cx, cx.tcx.hir().local_def_id(self.id)), - deprecation: get_deprecation(cx, cx.tcx.hir().local_def_id(self.id)), - def_id: cx.tcx.hir().local_def_id(self.id), + stability: get_stability(cx, local_did), + deprecation: get_deprecation(cx, local_did), + def_id: local_did, inner: StructFieldItem(self.ty.clean(cx)), } } } impl<'tcx> Clean for ty::FieldDef { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.ident.name).clean(cx), attrs: cx.tcx.get_attrs(self.did).clean(cx), @@ -2945,7 +2961,7 @@ pub enum Visibility { } impl Clean> for hir::Visibility { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Option { + fn clean(&self, cx: &DocContext<'_>) -> Option { Some(match self.node { hir::VisibilityKind::Public => Visibility::Public, hir::VisibilityKind::Inherited => Visibility::Inherited, @@ -2960,7 +2976,7 @@ impl Clean> for hir::Visibility { } impl Clean> for ty::Visibility { - fn clean(&self, _: &DocContext<'_, '_, '_>) -> Option { + fn clean(&self, _: &DocContext<'_>) -> Option { Some(if *self == ty::Visibility::Public { Public } else { Inherited }) } } @@ -2982,12 +2998,12 @@ pub struct Union { } impl Clean for doctree::Struct { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -3002,12 +3018,12 @@ impl Clean for doctree::Struct { } impl Clean for doctree::Union { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -3032,7 +3048,7 @@ pub struct VariantStruct { } impl Clean for ::rustc::hir::VariantData { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> VariantStruct { + fn clean(&self, cx: &DocContext<'_>) -> VariantStruct { VariantStruct { struct_type: doctree::struct_type_from_def(self), fields: self.fields().iter().map(|x| x.clean(cx)).collect(), @@ -3049,12 +3065,12 @@ pub struct Enum { } impl Clean for doctree::Enum { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -3073,7 +3089,7 @@ pub struct Variant { } impl Clean for doctree::Variant { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), @@ -3081,7 +3097,7 @@ impl Clean for doctree::Variant { visibility: None, stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.def.id()), + def_id: cx.tcx.hir().local_def_id_from_hir_id(self.def.hir_id()), inner: VariantItem(Variant { kind: self.def.clean(cx), }), @@ -3090,7 +3106,7 @@ impl Clean for doctree::Variant { } impl<'tcx> Clean for ty::VariantDef { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let kind = match self.ctor_kind { CtorKind::Const => VariantKind::CLike, CtorKind::Fn => { @@ -3138,7 +3154,7 @@ pub enum VariantKind { } impl Clean for hir::VariantData { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> VariantKind { + fn clean(&self, cx: &DocContext<'_>) -> VariantKind { if self.is_struct() { VariantKind::Struct(self.clean(cx)) } else if self.is_unit() { @@ -3169,7 +3185,7 @@ impl Span { } impl Clean for syntax_pos::Span { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Span { + fn clean(&self, cx: &DocContext<'_>) -> Span { if self.is_dummy() { return Span::empty(); } @@ -3202,7 +3218,7 @@ impl Path { } impl Clean for hir::Path { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Path { + fn clean(&self, cx: &DocContext<'_>) -> Path { Path { global: self.is_global(), def: self.def, @@ -3225,7 +3241,7 @@ pub enum GenericArgs { } impl Clean for hir::GenericArgs { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> GenericArgs { + fn clean(&self, cx: &DocContext<'_>) -> GenericArgs { if self.parenthesized { let output = self.bindings[0].ty.clean(cx); GenericArgs::Parenthesized { @@ -3267,7 +3283,7 @@ pub struct PathSegment { } impl Clean for hir::PathSegment { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> PathSegment { + fn clean(&self, cx: &DocContext<'_>) -> PathSegment { PathSegment { name: self.ident.name.clean(cx), args: self.with_generic_args(|generic_args| generic_args.clean(cx)) @@ -3339,21 +3355,21 @@ fn qpath_to_string(p: &hir::QPath) -> String { impl Clean for Ident { #[inline] - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> String { + fn clean(&self, cx: &DocContext<'_>) -> String { self.name.clean(cx) } } impl Clean for ast::Name { #[inline] - fn clean(&self, _: &DocContext<'_, '_, '_>) -> String { + fn clean(&self, _: &DocContext<'_>) -> String { self.to_string() } } impl Clean for InternedString { #[inline] - fn clean(&self, _: &DocContext<'_, '_, '_>) -> String { + fn clean(&self, _: &DocContext<'_>) -> String { self.to_string() } } @@ -3365,12 +3381,12 @@ pub struct Typedef { } impl Clean for doctree::Typedef { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id.clone()), + def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -3389,12 +3405,12 @@ pub struct Existential { } impl Clean for doctree::Existential { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id.clone()), + def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -3415,7 +3431,7 @@ pub struct BareFunctionDecl { } impl Clean for hir::BareFnTy { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> BareFunctionDecl { + fn clean(&self, cx: &DocContext<'_>) -> BareFunctionDecl { let (generic_params, decl) = enter_impl_trait(cx, || { (self.generic_params.clean(cx), (&*self.decl, &self.arg_names[..]).clean(cx)) }); @@ -3439,13 +3455,13 @@ pub struct Static { } impl Clean for doctree::Static { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { debug!("cleaning static {}: {:?}", self.name.clean(cx), self); Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -3465,12 +3481,12 @@ pub struct Constant { } impl Clean for doctree::Constant { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -3489,7 +3505,7 @@ pub enum Mutability { } impl Clean for hir::Mutability { - fn clean(&self, _: &DocContext<'_, '_, '_>) -> Mutability { + fn clean(&self, _: &DocContext<'_>) -> Mutability { match self { &hir::MutMutable => Mutable, &hir::MutImmutable => Immutable, @@ -3504,7 +3520,7 @@ pub enum ImplPolarity { } impl Clean for hir::ImplPolarity { - fn clean(&self, _: &DocContext<'_, '_, '_>) -> ImplPolarity { + fn clean(&self, _: &DocContext<'_>) -> ImplPolarity { match self { &hir::ImplPolarity::Positive => ImplPolarity::Positive, &hir::ImplPolarity::Negative => ImplPolarity::Negative, @@ -3525,17 +3541,17 @@ pub struct Impl { pub blanket_impl: Option, } -pub fn get_auto_traits_with_node_id( - cx: &DocContext<'_, '_, '_>, - id: ast::NodeId, +pub fn get_auto_traits_with_hir_id( + cx: &DocContext<'_>, + id: hir::HirId, name: String ) -> Vec { let finder = AutoTraitFinder::new(cx); - finder.get_with_node_id(id, name) + finder.get_with_hir_id(id, name) } pub fn get_auto_traits_with_def_id( - cx: &DocContext<'_, '_, '_>, + cx: &DocContext<'_>, id: DefId ) -> Vec { let finder = AutoTraitFinder::new(cx); @@ -3543,17 +3559,17 @@ pub fn get_auto_traits_with_def_id( finder.get_with_def_id(id) } -pub fn get_blanket_impls_with_node_id( - cx: &DocContext<'_, '_, '_>, - id: ast::NodeId, +pub fn get_blanket_impls_with_hir_id( + cx: &DocContext<'_>, + id: hir::HirId, name: String ) -> Vec { let finder = BlanketImplFinder::new(cx); - finder.get_with_node_id(id, name) + finder.get_with_hir_id(id, name) } pub fn get_blanket_impls_with_def_id( - cx: &DocContext<'_, '_, '_>, + cx: &DocContext<'_>, id: DefId ) -> Vec { let finder = BlanketImplFinder::new(cx); @@ -3562,7 +3578,7 @@ pub fn get_blanket_impls_with_def_id( } impl Clean> for doctree::Impl { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Vec { + fn clean(&self, cx: &DocContext<'_>) -> Vec { let mut ret = Vec::new(); let trait_ = self.trait_.clean(cx); let items = self.items.clean(cx); @@ -3584,7 +3600,7 @@ impl Clean> for doctree::Impl { name: None, attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id), visibility: self.vis.clean(cx), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), @@ -3604,7 +3620,7 @@ impl Clean> for doctree::Impl { } } -fn build_deref_target_impls(cx: &DocContext<'_, '_, '_>, +fn build_deref_target_impls(cx: &DocContext<'_>, items: &[Item], ret: &mut Vec) { use self::PrimitiveType::*; @@ -3652,6 +3668,7 @@ fn build_deref_target_impls(cx: &DocContext<'_, '_, '_>, Reference => None, Fn => None, Never => None, + CVarArgs => tcx.lang_items().va_list(), }; if let Some(did) = did { if !did.is_local() { @@ -3662,7 +3679,7 @@ fn build_deref_target_impls(cx: &DocContext<'_, '_, '_>, } impl Clean> for doctree::ExternCrate { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Vec { + fn clean(&self, cx: &DocContext<'_>) -> Vec { let please_inline = self.vis.node.is_pub() && self.attrs.iter().any(|a| { a.name() == "doc" && match a.meta_item_list() { @@ -3698,7 +3715,7 @@ impl Clean> for doctree::ExternCrate { } impl Clean> for doctree::Import { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Vec { + fn clean(&self, cx: &DocContext<'_>) -> Vec { // We consider inlining the documentation of `pub use` statements, but we // forcefully don't inline if this is not public or if the // #[doc(no_inline)] attribute is present. @@ -3772,7 +3789,7 @@ pub struct ImportSource { } impl Clean> for hir::ForeignMod { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Vec { + fn clean(&self, cx: &DocContext<'_>) -> Vec { let mut items = self.items.clean(cx); for item in &mut items { if let ForeignFunctionItem(ref mut f) = item.inner { @@ -3784,7 +3801,7 @@ impl Clean> for hir::ForeignMod { } impl Clean for hir::ForeignItem { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let inner = match self.node { hir::ForeignItemKind::Fn(ref decl, ref names, ref generics) => { let (generics, decl) = enter_impl_trait(cx, || { @@ -3813,14 +3830,16 @@ impl Clean for hir::ForeignItem { } }; + let local_did = cx.tcx.hir().local_def_id_from_hir_id(self.hir_id); + Item { name: Some(self.ident.clean(cx)), attrs: self.attrs.clean(cx), source: self.span.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id), + def_id: local_did, visibility: self.vis.clean(cx), - stability: get_stability(cx, cx.tcx.hir().local_def_id(self.id)), - deprecation: get_deprecation(cx, cx.tcx.hir().local_def_id(self.id)), + stability: get_stability(cx, local_did), + deprecation: get_deprecation(cx, local_did), inner, } } @@ -3829,11 +3848,11 @@ impl Clean for hir::ForeignItem { // Utilities pub trait ToSource { - fn to_src(&self, cx: &DocContext<'_, '_, '_>) -> String; + fn to_src(&self, cx: &DocContext<'_>) -> String; } impl ToSource for syntax_pos::Span { - fn to_src(&self, cx: &DocContext<'_, '_, '_>) -> String { + fn to_src(&self, cx: &DocContext<'_>) -> String { debug!("converting span {:?} to snippet", self.clean(cx)); let sn = match cx.sess().source_map().span_to_snippet(*self) { Ok(x) => x, @@ -3850,7 +3869,7 @@ fn name_from_pat(p: &hir::Pat) -> String { match p.node { PatKind::Wild => "_".to_string(), - PatKind::Binding(_, _, _, ident, _) => ident.to_string(), + PatKind::Binding(_, _, ident, _) => ident.to_string(), PatKind::TupleStruct(ref p, ..) | PatKind::Path(ref p) => qpath_to_string(p), PatKind::Struct(ref name, ref fields, etc) => { format!("{} {{ {}{} }}", qpath_to_string(name), @@ -3880,11 +3899,11 @@ fn name_from_pat(p: &hir::Pat) -> String { } } -fn print_const(cx: &DocContext<'_, '_, '_>, n: ty::LazyConst<'_>) -> String { +fn print_const(cx: &DocContext<'_>, n: ty::LazyConst<'_>) -> String { match n { ty::LazyConst::Unevaluated(def_id, _) => { - if let Some(node_id) = cx.tcx.hir().as_local_node_id(def_id) { - print_const_expr(cx, cx.tcx.hir().body_owned_by(node_id)) + if let Some(hir_id) = cx.tcx.hir().as_local_hir_id(def_id) { + print_const_expr(cx, cx.tcx.hir().body_owned_by(hir_id)) } else { inline::print_inlined_const(cx, def_id) } @@ -3902,15 +3921,15 @@ fn print_const(cx: &DocContext<'_, '_, '_>, n: ty::LazyConst<'_>) -> String { } } -fn print_const_expr(cx: &DocContext<'_, '_, '_>, body: hir::BodyId) -> String { +fn print_const_expr(cx: &DocContext<'_>, body: hir::BodyId) -> String { cx.tcx.hir().hir_to_pretty_string(body.hir_id) } /// Given a type Path, resolve it to a Type using the TyCtxt -fn resolve_type(cx: &DocContext<'_, '_, '_>, +fn resolve_type(cx: &DocContext<'_>, path: Path, - id: ast::NodeId) -> Type { - if id == ast::DUMMY_NODE_ID { + id: hir::HirId) -> Type { + if id == hir::DUMMY_HIR_ID { debug!("resolve_type({:?})", path); } else { debug!("resolve_type({:?},{:?})", path, id); @@ -3938,7 +3957,7 @@ fn resolve_type(cx: &DocContext<'_, '_, '_>, ResolvedPath { path: path, typarams: None, did: did, is_generic: is_generic } } -pub fn register_def(cx: &DocContext<'_, '_, '_>, def: Def) -> DefId { +pub fn register_def(cx: &DocContext<'_>, def: Def) -> DefId { debug!("register_def({:?})", def); let (did, kind) = match def { @@ -3973,7 +3992,7 @@ pub fn register_def(cx: &DocContext<'_, '_, '_>, def: Def) -> DefId { did } -fn resolve_use_source(cx: &DocContext<'_, '_, '_>, path: Path) -> ImportSource { +fn resolve_use_source(cx: &DocContext<'_>, path: Path) -> ImportSource { ImportSource { did: if path.def.opt_def_id().is_none() { None @@ -3991,7 +4010,7 @@ pub struct Macro { } impl Clean for doctree::Macro { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { let name = self.name.clean(cx); Item { name: Some(name.clone()), @@ -4020,7 +4039,7 @@ pub struct ProcMacro { } impl Clean for doctree::ProcMacro { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Item { + fn clean(&self, cx: &DocContext<'_>) -> Item { Item { name: Some(self.name.clean(cx)), attrs: self.attrs.clean(cx), @@ -4028,7 +4047,7 @@ impl Clean for doctree::ProcMacro { visibility: Some(Public), stability: self.stab.clean(cx), deprecation: self.depr.clean(cx), - def_id: cx.tcx.hir().local_def_id(self.id), + def_id: cx.tcx.hir().local_def_id_from_hir_id(self.id), inner: ProcMacroItem(ProcMacro { kind: self.kind, helpers: self.helpers.clean(cx), @@ -4054,7 +4073,7 @@ pub struct Deprecation { } impl Clean for attr::Stability { - fn clean(&self, _: &DocContext<'_, '_, '_>) -> Stability { + fn clean(&self, _: &DocContext<'_>) -> Stability { Stability { level: stability::StabilityLevel::from_attr_level(&self.level), feature: Some(self.feature.to_string()).filter(|f| !f.is_empty()), @@ -4081,13 +4100,13 @@ impl Clean for attr::Stability { } impl<'a> Clean for &'a attr::Stability { - fn clean(&self, dc: &DocContext<'_, '_, '_>) -> Stability { + fn clean(&self, dc: &DocContext<'_>) -> Stability { (**self).clean(dc) } } impl Clean for attr::Deprecation { - fn clean(&self, _: &DocContext<'_, '_, '_>) -> Deprecation { + fn clean(&self, _: &DocContext<'_>) -> Deprecation { Deprecation { since: self.since.map(|s| s.to_string()).filter(|s| !s.is_empty()), note: self.note.map(|n| n.to_string()).filter(|n| !n.is_empty()), @@ -4103,7 +4122,7 @@ pub struct TypeBinding { } impl Clean for hir::TypeBinding { - fn clean(&self, cx: &DocContext<'_, '_, '_>) -> TypeBinding { + fn clean(&self, cx: &DocContext<'_>) -> TypeBinding { TypeBinding { name: self.ident.name.clean(cx), ty: self.ty.clean(cx) @@ -4112,7 +4131,7 @@ impl Clean for hir::TypeBinding { } pub fn def_id_to_path( - cx: &DocContext<'_, '_, '_>, + cx: &DocContext<'_>, did: DefId, name: Option ) -> Vec { @@ -4129,7 +4148,7 @@ pub fn def_id_to_path( once(crate_name).chain(relative).collect() } -pub fn enter_impl_trait(cx: &DocContext<'_, '_, '_>, f: F) -> R +pub fn enter_impl_trait(cx: &DocContext<'_>, f: F) -> R where F: FnOnce() -> R, { @@ -4231,7 +4250,6 @@ where F: Fn(DefId) -> Def { def: def_ctor(def_id), segments: hir::HirVec::from_vec(apb.names.iter().map(|s| hir::PathSegment { ident: ast::Ident::from_str(&s), - id: None, hir_id: None, def: None, args: None, diff --git a/src/librustdoc/clean/simplify.rs b/src/librustdoc/clean/simplify.rs index 8614b72dffba..8ca570cb443c 100644 --- a/src/librustdoc/clean/simplify.rs +++ b/src/librustdoc/clean/simplify.rs @@ -22,7 +22,7 @@ use crate::clean::WherePredicate as WP; use crate::clean; use crate::core::DocContext; -pub fn where_clauses(cx: &DocContext<'_, '_, '_>, clauses: Vec) -> Vec { +pub fn where_clauses(cx: &DocContext<'_>, clauses: Vec) -> Vec { // First, partition the where clause into its separate components let mut params: BTreeMap<_, Vec<_>> = BTreeMap::new(); let mut lifetimes = Vec::new(); @@ -141,7 +141,7 @@ fn ty_bounds(bounds: Vec) -> Vec { bounds } -fn trait_is_same_or_supertrait(cx: &DocContext<'_, '_, '_>, child: DefId, +fn trait_is_same_or_supertrait(cx: &DocContext<'_>, child: DefId, trait_: DefId) -> bool { if child == trait_ { return true diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index e5caf7fdfa23..f2682e00430d 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -85,6 +85,9 @@ pub struct Options { /// Whether to display warnings during doc generation or while gathering doctests. By default, /// all non-rustdoc-specific lints are allowed when generating docs. pub display_warnings: bool, + /// Whether to run the `calculate-doc-coverage` pass, which counts the number of public items + /// with and without documentation. + pub show_coverage: bool, // Options that alter generated documentation pages @@ -128,6 +131,7 @@ impl fmt::Debug for Options { .field("default_passes", &self.default_passes) .field("manual_passes", &self.manual_passes) .field("display_warnings", &self.display_warnings) + .field("show_coverage", &self.show_coverage) .field("crate_version", &self.crate_version) .field("render_options", &self.render_options) .finish() @@ -199,7 +203,7 @@ pub struct RenderOptions { impl Options { /// Parses the given command-line for options. If an error message or other early-return has /// been printed, returns `Err` with the exit code. - pub fn from_matches(matches: &getopts::Matches) -> Result { + pub fn from_matches(matches: &getopts::Matches) -> Result { // Check for unstable options. nightly_options::check_nightly_options(&matches, &opts()); @@ -214,7 +218,7 @@ impl Options { if matches.opt_strs("passes") == ["list"] { println!("Available passes for running rustdoc:"); for pass in passes::PASSES { - println!("{:>20} - {}", pass.name(), pass.description()); + println!("{:>20} - {}", pass.name, pass.description); } println!("\nDefault passes for rustdoc:"); for &name in passes::DEFAULT_PASSES { @@ -224,6 +228,18 @@ impl Options { for &name in passes::DEFAULT_PRIVATE_PASSES { println!("{:>20}", name); } + + if nightly_options::is_nightly_build() { + println!("\nPasses run with `--show-coverage`:"); + for &name in passes::DEFAULT_COVERAGE_PASSES { + println!("{:>20}", name); + } + println!("\nPasses run with `--show-coverage --document-private-items`:"); + for &name in passes::PRIVATE_COVERAGE_PASSES { + println!("{:>20}", name); + } + } + return Err(0); } @@ -413,9 +429,16 @@ impl Options { } }); + let show_coverage = matches.opt_present("show-coverage"); + let document_private = matches.opt_present("document-private-items"); + let default_passes = if matches.opt_present("no-defaults") { passes::DefaultPassOption::None - } else if matches.opt_present("document-private-items") { + } else if show_coverage && document_private { + passes::DefaultPassOption::PrivateCoverage + } else if show_coverage { + passes::DefaultPassOption::Coverage + } else if document_private { passes::DefaultPassOption::Private } else { passes::DefaultPassOption::Default @@ -463,6 +486,7 @@ impl Options { default_passes, manual_passes, display_warnings, + show_coverage, crate_version, persist_doctests, render_options: RenderOptions { diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 4f70751c9053..47dbbc20980b 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -1,37 +1,37 @@ use rustc_lint; -use rustc_driver::{self, driver, target_features, abort_on_err}; use rustc::session::{self, config}; use rustc::hir::def_id::{DefId, DefIndex, DefIndexAddressSpace, CrateNum, LOCAL_CRATE}; use rustc::hir::def::Def; -use rustc::hir::{self, HirVec}; +use rustc::hir::{self, HirId, HirVec}; use rustc::middle::cstore::CrateStore; use rustc::middle::privacy::AccessLevels; -use rustc::ty::{self, TyCtxt, AllArenas}; -use rustc::hir::map as hir_map; +use rustc::ty::{self, TyCtxt}; use rustc::lint::{self, LintPass}; use rustc::session::config::ErrorOutputType; +use rustc::session::DiagnosticOutput; use rustc::util::nodemap::{FxHashMap, FxHashSet}; +use rustc_interface::interface; +use rustc_driver::abort_on_err; use rustc_resolve as resolve; -use rustc_metadata::creader::CrateLoader; use rustc_metadata::cstore::CStore; use rustc_target::spec::TargetTriple; -use syntax::ast::{self, Ident, NodeId}; +use syntax::ast::{self, Ident}; use syntax::source_map; use syntax::feature_gate::UnstableFeatures; use syntax::json::JsonEmitter; use syntax::ptr::P; use syntax::symbol::keywords; use syntax_pos::DUMMY_SP; -use errors::{self, FatalError}; +use errors; use errors::emitter::{Emitter, EmitterWriter}; use parking_lot::ReentrantMutex; use std::cell::RefCell; use std::mem; use rustc_data_structures::sync::{self, Lrc}; -use std::rc::Rc; use std::sync::Arc; +use std::rc::Rc; use crate::visit_ast::RustdocVisitor; use crate::config::{Options as RustdocOptions, RenderOptions}; @@ -46,12 +46,13 @@ pub use rustc::session::search_paths::SearchPath; pub type ExternalPaths = FxHashMap, clean::TypeKind)>; -pub struct DocContext<'a, 'tcx: 'a, 'rcx: 'a> { - pub tcx: TyCtxt<'a, 'tcx, 'tcx>, - pub resolver: &'a RefCell>, +pub struct DocContext<'tcx> { + + pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub resolver: Rc>>, /// The stack of module NodeIds up till this point pub crate_name: Option, - pub cstore: Rc, + pub cstore: Lrc, /// Later on moved into `html::render::CACHE_KEY` pub renderinfo: RefCell, /// Later on moved through `clean::Crate` into `html::render::CACHE_KEY` @@ -78,11 +79,18 @@ pub struct DocContext<'a, 'tcx: 'a, 'rcx: 'a> { pub all_traits: Vec, } -impl<'a, 'tcx, 'rcx> DocContext<'a, 'tcx, 'rcx> { +impl<'tcx> DocContext<'tcx> { pub fn sess(&self) -> &session::Session { &self.tcx.sess } + pub fn enter_resolver(&self, f: F) -> R + where F: FnOnce(&mut resolve::Resolver<'_>) -> R { + let resolver = &*self.resolver; + let resolver = resolver.as_ref().unwrap(); + resolver.borrow_mut().access(f) + } + /// Call the closure with the given parameters set as /// the substitutions for a type alias' RHS. pub fn enter_alias(&self, @@ -158,7 +166,7 @@ impl<'a, 'tcx, 'rcx> DocContext<'a, 'tcx, 'rcx> { /// Like the function of the same name on the HIR map, but skips calling it on fake DefIds. /// (This avoids a slice-index-out-of-bounds panic.) - pub fn as_local_node_id(&self, def_id: DefId) -> Option { + pub fn as_local_node_id(&self, def_id: DefId) -> Option { if self.all_fake_def_ids.borrow().contains(&def_id) { None } else { @@ -166,6 +174,15 @@ impl<'a, 'tcx, 'rcx> DocContext<'a, 'tcx, 'rcx> { } } + // FIXME(@ljedrz): remove the NodeId variant + pub fn as_local_hir_id(&self, def_id: DefId) -> Option { + if self.all_fake_def_ids.borrow().contains(&def_id) { + None + } else { + self.tcx.hir().as_local_hir_id(def_id) + } + } + pub fn get_real_ty(&self, def_id: DefId, def_ctor: &F, @@ -181,7 +198,6 @@ impl<'a, 'tcx, 'rcx> DocContext<'a, 'tcx, 'rcx> { real_name.unwrap_or(last.ident), None, None, - None, self.generics_to_path_params(generics.clone()), false, )); @@ -193,7 +209,6 @@ impl<'a, 'tcx, 'rcx> DocContext<'a, 'tcx, 'rcx> { }; hir::Ty { - id: ast::DUMMY_NODE_ID, node: hir::TyKind::Path(hir::QPath::Resolved(None, P(new_path))), span: DUMMY_SP, hir_id: hir::DUMMY_HIR_ID, @@ -213,7 +228,6 @@ impl<'a, 'tcx, 'rcx> DocContext<'a, 'tcx, 'rcx> { }; args.push(hir::GenericArg::Lifetime(hir::Lifetime { - id: ast::DUMMY_NODE_ID, hir_id: hir::DUMMY_HIR_ID, span: DUMMY_SP, name: hir::LifetimeName::Param(name), @@ -222,6 +236,9 @@ impl<'a, 'tcx, 'rcx> DocContext<'a, 'tcx, 'rcx> { ty::GenericParamDefKind::Type { .. } => { args.push(hir::GenericArg::Type(self.ty_param_to_ty(param.clone()))); } + ty::GenericParamDefKind::Const { .. } => { + unimplemented!() // FIXME(const_generics) + } } } @@ -235,7 +252,6 @@ impl<'a, 'tcx, 'rcx> DocContext<'a, 'tcx, 'rcx> { pub fn ty_param_to_ty(&self, param: ty::GenericParamDef) -> hir::Ty { debug!("ty_param_to_ty({:?}) {:?}", param, param.def_id); hir::Ty { - id: ast::DUMMY_NODE_ID, node: hir::TyKind::Path(hir::QPath::Resolved( None, P(hir::Path { @@ -268,7 +284,7 @@ impl DocAccessLevels for AccessLevels { /// will be created for the handler. pub fn new_handler(error_format: ErrorOutputType, source_map: Option>, - treat_err_as_bug: bool, + treat_err_as_bug: Option, ui_testing: bool, ) -> errors::Handler { // rustdoc doesn't override (or allow to override) anything from this that is relevant here, so @@ -359,19 +375,31 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt whitelisted_lints.extend(lint_opts.iter().map(|(lint, _)| lint).cloned()); - let lints = lint::builtin::HardwiredLints.get_lints() - .into_iter() - .chain(rustc_lint::SoftLints.get_lints().into_iter()) - .filter_map(|lint| { - if lint.name == warnings_lint_name || - lint.name == intra_link_resolution_failure_name { - None - } else { - Some((lint.name_lower(), lint::Allow)) - } - }) - .chain(lint_opts.into_iter()) - .collect::>(); + let lints = || { + lint::builtin::HardwiredLints + .get_lints() + .into_iter() + .chain(rustc_lint::SoftLints.get_lints().into_iter()) + }; + + let lint_opts = lints().filter_map(|lint| { + if lint.name == warnings_lint_name || + lint.name == intra_link_resolution_failure_name { + None + } else { + Some((lint.name_lower(), lint::Allow)) + } + }).chain(lint_opts.into_iter()).collect::>(); + + let lint_caps = lints().filter_map(|lint| { + // We don't want to whitelist *all* lints so let's + // ignore those ones. + if whitelisted_lints.iter().any(|l| &lint.name == l) { + None + } else { + Some((lint::LintId::of(lint), lint::Allow)) + } + }).collect(); let host_triple = TargetTriple::from_triple(config::host_triple()); // plays with error output here! @@ -380,7 +408,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt search_paths: libs, crate_types: vec![config::CrateType::Rlib], lint_opts: if !display_warnings { - lints + lint_opts } else { vec![] }, @@ -397,116 +425,42 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt describe_lints, ..Options::default() }; - driver::spawn_thread_pool(sessopts, move |sessopts| { - let source_map = Lrc::new(source_map::SourceMap::new(sessopts.file_path_mapping())); - let diagnostic_handler = new_handler(error_format, - Some(source_map.clone()), - debugging_options.treat_err_as_bug, - debugging_options.ui_testing); - let mut sess = session::build_session_( - sessopts, cpath, diagnostic_handler, source_map, - ); + let config = interface::Config { + opts: sessopts, + crate_cfg: config::parse_cfgspecs(cfgs), + input, + input_path: cpath, + output_file: None, + output_dir: None, + file_loader: None, + diagnostic_output: DiagnosticOutput::Default, + stderr: None, + crate_name: crate_name.clone(), + lint_caps, + }; - lint::builtin::HardwiredLints.get_lints() - .into_iter() - .chain(rustc_lint::SoftLints.get_lints().into_iter()) - .filter_map(|lint| { - // We don't want to whitelist *all* lints so let's - // ignore those ones. - if whitelisted_lints.iter().any(|l| &lint.name == l) { - None - } else { - Some(lint) - } - }) - .for_each(|l| { - sess.driver_lint_caps.insert(lint::LintId::of(l), - lint::Allow); - }); + interface::run_compiler_in_existing_thread_pool(config, |compiler| { + let sess = compiler.session(); - let codegen_backend = rustc_driver::get_codegen_backend(&sess); - let cstore = Rc::new(CStore::new(codegen_backend.metadata_loader())); - rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); - - let mut cfg = config::build_configuration(&sess, config::parse_cfgspecs(cfgs)); - target_features::add_configuration(&mut cfg, &sess, &*codegen_backend); - sess.parse_sess.config = cfg; - - let control = &driver::CompileController::basic(); - - let krate = match driver::phase_1_parse_input(control, &sess, &input) { - Ok(krate) => krate, - Err(mut e) => { - e.emit(); - FatalError.raise(); - } - }; - - let name = match crate_name { - Some(ref crate_name) => crate_name.clone(), - None => ::rustc_codegen_utils::link::find_crate_name(Some(&sess), &krate.attrs, &input), - }; - - let mut crate_loader = CrateLoader::new(&sess, &cstore, &name); - - let resolver_arenas = resolve::Resolver::arenas(); - let result = driver::phase_2_configure_and_expand_inner(&sess, - &cstore, - krate, - None, - &name, - None, - &resolver_arenas, - &mut crate_loader, - |_| Ok(())); - let driver::InnerExpansionResult { - mut hir_forest, - resolver, - .. - } = abort_on_err(result, &sess); - - // We need to hold on to the complete resolver, so we clone everything - // for the analysis passes to use. Suboptimal, but necessary in the + // We need to hold on to the complete resolver, so we cause everything to be + // cloned for the analysis passes to use. Suboptimal, but necessary in the // current architecture. - let defs = resolver.definitions.clone(); - let resolutions = ty::Resolutions { - freevars: resolver.freevars.clone(), - export_map: resolver.export_map.clone(), - trait_map: resolver.trait_map.clone(), - glob_map: resolver.glob_map.clone(), - maybe_unused_trait_imports: resolver.maybe_unused_trait_imports.clone(), - maybe_unused_extern_crates: resolver.maybe_unused_extern_crates.clone(), - extern_prelude: resolver.extern_prelude.iter().map(|(ident, entry)| { - (ident.name, entry.introduced_by_item) - }).collect(), - }; + let resolver = abort_on_err(compiler.expansion(), sess).peek().1.clone(); - let mut arenas = AllArenas::new(); - let hir_map = hir_map::map_crate(&sess, &*cstore, &mut hir_forest, &defs); - let output_filenames = driver::build_output_filenames(&input, - &None, - &None, - &[], - &sess); + if sess.err_count() > 0 { + sess.fatal("Compilation failed, aborting rustdoc"); + } - let resolver = RefCell::new(resolver); - abort_on_err(driver::phase_3_run_analysis_passes(&*codegen_backend, - control, - &sess, - &*cstore, - hir_map, - resolutions, - &mut arenas, - &name, - &output_filenames, - |tcx, _, result| { - if result.is_err() { - sess.fatal("Compilation failed, aborting rustdoc"); - } + let mut global_ctxt = abort_on_err(compiler.global_ctxt(), sess).take(); + + global_ctxt.enter(|tcx| { + tcx.analysis(LOCAL_CRATE).ok(); + + // Abort if there were any errors so far + sess.abort_if_errors(); let access_levels = tcx.privacy_access_levels(LOCAL_CRATE); - // Convert from a NodeId set to a DefId set since we don't always have easy access // to the map from defid -> nodeid let access_levels = AccessLevels { @@ -526,9 +480,9 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt let ctxt = DocContext { tcx, - resolver: &resolver, + resolver, crate_name, - cstore: cstore.clone(), + cstore: compiler.cstore().clone(), external_traits: Default::default(), active_extern_traits: Default::default(), renderinfo: RefCell::new(renderinfo), @@ -606,16 +560,21 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt passes::defaults(default_passes).iter().map(|p| p.to_string()).collect(); passes.extend(manual_passes); - for pass in &passes { - // the "unknown pass" error will be reported when late passes are run - if let Some(pass) = passes::find_pass(pass).and_then(|p| p.early_fn()) { - krate = pass(krate, &ctxt); + info!("Executing passes"); + + for pass_name in &passes { + match passes::find_pass(pass_name).map(|p| p.pass) { + Some(pass) => { + debug!("running pass {}", pass_name); + krate = pass(krate, &ctxt); + } + None => error!("unknown pass {}, skipping", *pass_name), } } ctxt.sess().abort_if_errors(); (krate, ctxt.renderinfo.into_inner(), render_options, passes) - }), &sess) + }) }) } diff --git a/src/librustdoc/doctree.rs b/src/librustdoc/doctree.rs index e8458385739d..9c54b40b422a 100644 --- a/src/librustdoc/doctree.rs +++ b/src/librustdoc/doctree.rs @@ -89,7 +89,7 @@ pub struct Struct { pub vis: hir::Visibility, pub stab: Option, pub depr: Option, - pub id: NodeId, + pub id: hir::HirId, pub struct_type: StructType, pub name: Name, pub generics: hir::Generics, @@ -102,7 +102,7 @@ pub struct Union { pub vis: hir::Visibility, pub stab: Option, pub depr: Option, - pub id: NodeId, + pub id: hir::HirId, pub struct_type: StructType, pub name: Name, pub generics: hir::Generics, @@ -118,7 +118,7 @@ pub struct Enum { pub variants: hir::HirVec, pub generics: hir::Generics, pub attrs: hir::HirVec, - pub id: NodeId, + pub id: hir::HirId, pub whence: Span, pub name: Name, } @@ -135,7 +135,7 @@ pub struct Variant { pub struct Function { pub decl: hir::FnDecl, pub attrs: hir::HirVec, - pub id: NodeId, + pub id: hir::HirId, pub name: Name, pub vis: hir::Visibility, pub stab: Option, @@ -150,7 +150,7 @@ pub struct Typedef { pub ty: P, pub gen: hir::Generics, pub name: Name, - pub id: ast::NodeId, + pub id: hir::HirId, pub attrs: hir::HirVec, pub whence: Span, pub vis: hir::Visibility, @@ -161,7 +161,7 @@ pub struct Typedef { pub struct Existential { pub exist_ty: hir::ExistTy, pub name: Name, - pub id: ast::NodeId, + pub id: hir::HirId, pub attrs: hir::HirVec, pub whence: Span, pub vis: hir::Visibility, @@ -179,7 +179,7 @@ pub struct Static { pub vis: hir::Visibility, pub stab: Option, pub depr: Option, - pub id: ast::NodeId, + pub id: hir::HirId, pub whence: Span, } @@ -191,7 +191,7 @@ pub struct Constant { pub vis: hir::Visibility, pub stab: Option, pub depr: Option, - pub id: ast::NodeId, + pub id: hir::HirId, pub whence: Span, } @@ -203,7 +203,7 @@ pub struct Trait { pub generics: hir::Generics, pub bounds: hir::HirVec, pub attrs: hir::HirVec, - pub id: ast::NodeId, + pub id: hir::HirId, pub whence: Span, pub vis: hir::Visibility, pub stab: Option, @@ -215,7 +215,7 @@ pub struct TraitAlias { pub generics: hir::Generics, pub bounds: hir::HirVec, pub attrs: hir::HirVec, - pub id: ast::NodeId, + pub id: hir::HirId, pub whence: Span, pub vis: hir::Visibility, pub stab: Option, @@ -236,7 +236,7 @@ pub struct Impl { pub vis: hir::Visibility, pub stab: Option, pub depr: Option, - pub id: ast::NodeId, + pub id: hir::HirId, } // For Macro we store the DefId instead of the NodeId, since we also create @@ -263,7 +263,7 @@ pub struct ExternCrate { pub struct Import { pub name: Name, - pub id: NodeId, + pub id: hir::HirId, pub vis: hir::Visibility, pub attrs: hir::HirVec, pub path: hir::Path, @@ -273,7 +273,7 @@ pub struct Import { pub struct ProcMacro { pub name: Name, - pub id: NodeId, + pub id: hir::HirId, pub kind: MacroKind, pub helpers: Vec, pub attrs: hir::HirVec, diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 4463dad1c8a1..d204a179ca62 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -609,6 +609,7 @@ fn fmt_type(t: &clean::Type, f: &mut fmt::Formatter<'_>, use_absolute: bool) -> primitive_link(f, PrimitiveType::Array, &format!("; {}]", n)) } clean::Never => primitive_link(f, PrimitiveType::Never, "!"), + clean::CVarArgs => primitive_link(f, PrimitiveType::CVarArgs, "..."), clean::RawPointer(m, ref t) => { match **t { clean::Generic(_) | clean::ResolvedPath {is_generic: true, ..} => { @@ -834,18 +835,10 @@ impl fmt::Display for clean::FunctionRetTy { impl fmt::Display for clean::FnDecl { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - if self.variadic { - if f.alternate() { - write!(f, "({args:#}, ...){arrow:#}", args = self.inputs, arrow = self.output) - } else { - write!(f, "({args}, ...){arrow}", args = self.inputs, arrow = self.output) - } + if f.alternate() { + write!(f, "({args:#}){arrow:#}", args = self.inputs, arrow = self.output) } else { - if f.alternate() { - write!(f, "({args:#}){arrow:#}", args = self.inputs, arrow = self.output) - } else { - write!(f, "({args}){arrow}", args = self.inputs, arrow = self.output) - } + write!(f, "({args}){arrow}", args = self.inputs, arrow = self.output) } } } @@ -907,12 +900,7 @@ impl<'a> fmt::Display for Function<'a> { } } - let mut args_plain = format!("({})", args_plain); - - if decl.variadic { - args.push_str(",
..."); - args_plain.push_str(", ..."); - } + let args_plain = format!("({})", args_plain); let output = if let hir::IsAsync::Async = asyncness { Cow::Owned(decl.sugared_async_return_type()) diff --git a/src/librustdoc/html/item_type.rs b/src/librustdoc/html/item_type.rs index 353fa4ae8c99..366e60b3ad92 100644 --- a/src/librustdoc/html/item_type.rs +++ b/src/librustdoc/html/item_type.rs @@ -15,7 +15,7 @@ use crate::clean; /// module headings. If you are adding to this enum and want to ensure that the sidebar also prints /// a heading, edit the listing in `html/render.rs`, function `sidebar_module`. This uses an /// ordering based on a helper function inside `item_module`, in the same file. -#[derive(Copy, PartialEq, Clone, Debug)] +#[derive(Copy, PartialEq, Eq, Clone, Debug, PartialOrd, Ord)] pub enum ItemType { Module = 0, ExternCrate = 1, diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 5e9f9ee9f80a..f11e268b9092 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -23,10 +23,10 @@ extern crate getopts; extern crate env_logger; extern crate rustc; extern crate rustc_data_structures; -extern crate rustc_codegen_utils; extern crate rustc_driver; extern crate rustc_resolve; extern crate rustc_lint; +extern crate rustc_interface; extern crate rustc_metadata; extern crate rustc_target; extern crate rustc_typeck; @@ -90,11 +90,11 @@ pub fn main() { rustc_driver::set_sigpipe_handler(); env_logger::init(); let res = std::thread::Builder::new().stack_size(thread_stack_size).spawn(move || { - syntax::with_globals(move || { + rustc_interface::interface::default_thread_pool(move || { get_args().map(|args| main_args(&args)).unwrap_or(1) }) }).unwrap().join().unwrap_or(rustc_driver::EXIT_FAILURE); - process::exit(res as i32); + process::exit(res); } fn get_args() -> Option> { @@ -347,6 +347,11 @@ fn opts() -> Vec { "generate-redirect-pages", "Generate extra pages to support legacy URLs and tool links") }), + unstable("show-coverage", |o| { + o.optflag("", + "show-coverage", + "calculate percentage of public items with documentation") + }), ] } @@ -358,7 +363,7 @@ fn usage(argv0: &str) { println!("{}", options.usage(&format!("{} [options] ", argv0))); } -fn main_args(args: &[String]) -> isize { +fn main_args(args: &[String]) -> i32 { let mut options = getopts::Options::new(); for option in opts() { (option.apply)(&mut options); @@ -391,7 +396,14 @@ fn main_args(args: &[String]) -> isize { let diag_opts = (options.error_format, options.debugging_options.treat_err_as_bug, options.debugging_options.ui_testing); + let show_coverage = options.show_coverage; rust_input(options, move |out| { + if show_coverage { + // if we ran coverage, bail early, we don't need to also generate docs at this point + // (also we didn't load in any of the useful passes) + return rustc_driver::EXIT_SUCCESS; + } + let Output { krate, passes, renderinfo, renderopts } = out; info!("going to format"); let (error_format, treat_err_as_bug, ui_testing) = diag_opts; @@ -428,7 +440,7 @@ where R: 'static + Send, let (tx, rx) = channel(); - let result = rustc_driver::monitor(move || syntax::with_globals(move || { + let result = rustc_driver::report_ices_to_stderr_if_any(move || syntax::with_globals(move || { let crate_name = options.crate_name.clone(); let crate_version = options.crate_version.clone(); let (mut krate, renderinfo, renderopts, passes) = core::run_core(options); @@ -441,28 +453,6 @@ where R: 'static + Send, krate.version = crate_version; - info!("Executing passes"); - - for pass in &passes { - // determine if we know about this pass - let pass = match passes::find_pass(pass) { - Some(pass) => if let Some(pass) = pass.late_fn() { - pass - } else { - // not a late pass, but still valid so don't report the error - continue - } - None => { - error!("unknown pass {}, skipping", *pass); - - continue - }, - }; - - // run it - krate = pass(krate); - } - tx.send(f(Output { krate: krate, renderinfo: renderinfo, diff --git a/src/librustdoc/markdown.rs b/src/librustdoc/markdown.rs index 0014d9ceb5ba..a2e2303bb27f 100644 --- a/src/librustdoc/markdown.rs +++ b/src/librustdoc/markdown.rs @@ -36,7 +36,7 @@ fn extract_leading_metadata<'a>(s: &'a str) -> (Vec<&'a str>, &'a str) { /// Render `input` (e.g., "foo.md") into an HTML file in `output` /// (e.g., output = "bar" => "bar/foo.html"). -pub fn render(input: PathBuf, options: RenderOptions, diag: &errors::Handler) -> isize { +pub fn render(input: PathBuf, options: RenderOptions, diag: &errors::Handler) -> i32 { let mut output = options.output; output.push(input.file_stem().unwrap()); output.set_extension("html"); @@ -126,7 +126,7 @@ pub fn render(input: PathBuf, options: RenderOptions, diag: &errors::Handler) -> } /// Runs any tests/code examples in the markdown file `input`. -pub fn test(mut options: Options, diag: &errors::Handler) -> isize { +pub fn test(mut options: Options, diag: &errors::Handler) -> i32 { let input_str = match load_string(&options.input, diag) { Ok(s) => s, Err(LoadStringError::ReadFail) => return 1, diff --git a/src/librustdoc/passes/calculate_doc_coverage.rs b/src/librustdoc/passes/calculate_doc_coverage.rs new file mode 100644 index 000000000000..fe407fa24d93 --- /dev/null +++ b/src/librustdoc/passes/calculate_doc_coverage.rs @@ -0,0 +1,166 @@ +use crate::clean; +use crate::core::DocContext; +use crate::fold::{self, DocFolder}; +use crate::passes::Pass; + +use syntax::attr; +use syntax_pos::FileName; + +use std::collections::BTreeMap; +use std::ops; + +pub const CALCULATE_DOC_COVERAGE: Pass = Pass { + name: "calculate-doc-coverage", + pass: calculate_doc_coverage, + description: "counts the number of items with and without documentation", +}; + +fn calculate_doc_coverage(krate: clean::Crate, _: &DocContext<'_>) -> clean::Crate { + let mut calc = CoverageCalculator::default(); + let krate = calc.fold_crate(krate); + + calc.print_results(); + + krate +} + +#[derive(Default, Copy, Clone)] +struct ItemCount { + total: u64, + with_docs: u64, +} + +impl ItemCount { + fn count_item(&mut self, has_docs: bool) { + self.total += 1; + + if has_docs { + self.with_docs += 1; + } + } + + fn percentage(&self) -> Option { + if self.total > 0 { + Some((self.with_docs as f64 * 100.0) / self.total as f64) + } else { + None + } + } +} + +impl ops::Sub for ItemCount { + type Output = Self; + + fn sub(self, rhs: Self) -> Self { + ItemCount { + total: self.total - rhs.total, + with_docs: self.with_docs - rhs.with_docs, + } + } +} + +impl ops::AddAssign for ItemCount { + fn add_assign(&mut self, rhs: Self) { + self.total += rhs.total; + self.with_docs += rhs.with_docs; + } +} + +#[derive(Default)] +struct CoverageCalculator { + items: BTreeMap, +} + +impl CoverageCalculator { + fn print_results(&self) { + let mut total = ItemCount::default(); + + fn print_table_line() { + println!("+-{0:->35}-+-{0:->10}-+-{0:->10}-+-{0:->10}-+", ""); + } + + fn print_table_record(name: &str, count: ItemCount, percentage: f64) { + println!("| {:<35} | {:>10} | {:>10} | {:>9.1}% |", + name, count.with_docs, count.total, percentage); + } + + print_table_line(); + println!("| {:<35} | {:>10} | {:>10} | {:>10} |", + "File", "Documented", "Total", "Percentage"); + print_table_line(); + + for (file, &count) in &self.items { + if let Some(percentage) = count.percentage() { + let mut name = file.to_string(); + // if a filename is too long, shorten it so we don't blow out the table + // FIXME(misdreavus): this needs to count graphemes, and probably also track + // double-wide characters... + if name.len() > 35 { + name = "...".to_string() + &name[name.len()-32..]; + } + + print_table_record(&name, count, percentage); + + total += count; + } + } + + print_table_line(); + print_table_record("Total", total, total.percentage().unwrap_or(0.0)); + print_table_line(); + } +} + +impl fold::DocFolder for CoverageCalculator { + fn fold_item(&mut self, i: clean::Item) -> Option { + let has_docs = !i.attrs.doc_strings.is_empty(); + + match i.inner { + _ if !i.def_id.is_local() => { + // non-local items are skipped because they can be out of the users control, + // especially in the case of trait impls, which rustdoc eagerly inlines + return Some(i); + } + clean::StrippedItem(..) => { + // don't count items in stripped modules + return Some(i); + } + clean::ImportItem(..) | clean::ExternCrateItem(..) => { + // docs on `use` and `extern crate` statements are not displayed, so they're not + // worth counting + return Some(i); + } + clean::ImplItem(ref impl_) + if attr::contains_name(&i.attrs.other_attrs, "automatically_derived") + || impl_.synthetic || impl_.blanket_impl.is_some() => + { + // built-in derives get the `#[automatically_derived]` attribute, and + // synthetic/blanket impls are made up by rustdoc and can't be documented + // FIXME(misdreavus): need to also find items that came out of a derive macro + return Some(i); + } + clean::ImplItem(ref impl_) => { + if let Some(ref tr) = impl_.trait_ { + debug!("impl {:#} for {:#} in {}", tr, impl_.for_, i.source.filename); + + // don't count trait impls, the missing-docs lint doesn't so we shouldn't + // either + return Some(i); + } else { + // inherent impls *can* be documented, and those docs show up, but in most + // cases it doesn't make sense, as all methods on a type are in one single + // impl block + debug!("impl {:#} in {}", impl_.for_, i.source.filename); + } + } + _ => { + debug!("counting {} {:?} in {}", i.type_(), i.name, i.source.filename); + self.items.entry(i.source.filename.clone()) + .or_default() + .count_item(has_docs); + } + } + + self.fold_item_recur(i) + } +} diff --git a/src/librustdoc/passes/check_code_block_syntax.rs b/src/librustdoc/passes/check_code_block_syntax.rs index f960374370e0..0556852c54ac 100644 --- a/src/librustdoc/passes/check_code_block_syntax.rs +++ b/src/librustdoc/passes/check_code_block_syntax.rs @@ -10,19 +10,21 @@ use crate::fold::DocFolder; use crate::html::markdown::{self, RustCodeBlock}; use crate::passes::Pass; -pub const CHECK_CODE_BLOCK_SYNTAX: Pass = - Pass::early("check-code-block-syntax", check_code_block_syntax, - "validates syntax inside Rust code blocks"); +pub const CHECK_CODE_BLOCK_SYNTAX: Pass = Pass { + name: "check-code-block-syntax", + pass: check_code_block_syntax, + description: "validates syntax inside Rust code blocks", +}; -pub fn check_code_block_syntax(krate: clean::Crate, cx: &DocContext<'_, '_, '_>) -> clean::Crate { +pub fn check_code_block_syntax(krate: clean::Crate, cx: &DocContext<'_>) -> clean::Crate { SyntaxChecker { cx }.fold_crate(krate) } -struct SyntaxChecker<'a, 'tcx: 'a, 'rcx: 'a> { - cx: &'a DocContext<'a, 'tcx, 'rcx>, +struct SyntaxChecker<'a, 'tcx: 'a> { + cx: &'a DocContext<'tcx>, } -impl<'a, 'tcx, 'rcx> SyntaxChecker<'a, 'tcx, 'rcx> { +impl<'a, 'tcx> SyntaxChecker<'a, 'tcx> { fn check_rust_syntax(&self, item: &clean::Item, dox: &str, code_block: RustCodeBlock) { let sess = ParseSess::new(FilePathMapping::empty()); let source_file = sess.source_map().new_source_file( @@ -96,7 +98,7 @@ impl<'a, 'tcx, 'rcx> SyntaxChecker<'a, 'tcx, 'rcx> { } } -impl<'a, 'tcx, 'rcx> DocFolder for SyntaxChecker<'a, 'tcx, 'rcx> { +impl<'a, 'tcx> DocFolder for SyntaxChecker<'a, 'tcx> { fn fold_item(&mut self, item: clean::Item) -> Option { if let Some(dox) = &item.attrs.collapsed_doc_value() { for code_block in markdown::rust_code_blocks(&dox) { diff --git a/src/librustdoc/passes/collapse_docs.rs b/src/librustdoc/passes/collapse_docs.rs index e5e60cbe7170..8666ba357b83 100644 --- a/src/librustdoc/passes/collapse_docs.rs +++ b/src/librustdoc/passes/collapse_docs.rs @@ -1,13 +1,16 @@ use crate::clean::{self, DocFragment, Item}; +use crate::core::DocContext; use crate::fold; use crate::fold::{DocFolder}; use crate::passes::Pass; use std::mem::replace; -pub const COLLAPSE_DOCS: Pass = - Pass::late("collapse-docs", collapse_docs, - "concatenates all document attributes into one document attribute"); +pub const COLLAPSE_DOCS: Pass = Pass { + name: "collapse-docs", + pass: collapse_docs, + description: "concatenates all document attributes into one document attribute", +}; #[derive(Copy, Clone, Debug, PartialEq, Eq)] enum DocFragmentKind { @@ -26,7 +29,7 @@ impl DocFragment { } } -pub fn collapse_docs(krate: clean::Crate) -> clean::Crate { +pub fn collapse_docs(krate: clean::Crate, _: &DocContext<'_>) -> clean::Crate { Collapser.fold_crate(krate) } diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 42fa3e2006b4..fefff1f3a759 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -4,7 +4,7 @@ use rustc::hir::def::Def; use rustc::hir::def_id::DefId; use rustc::ty; use syntax; -use syntax::ast::{self, Ident, NodeId}; +use syntax::ast::{self, Ident}; use syntax::feature_gate::UnstableFeatures; use syntax::symbol::Symbol; use syntax_pos::DUMMY_SP; @@ -19,11 +19,13 @@ use crate::passes::{look_for_tests, Pass}; use super::span_of_attrs; -pub const COLLECT_INTRA_DOC_LINKS: Pass = - Pass::early("collect-intra-doc-links", collect_intra_doc_links, - "reads a crate's documentation to resolve intra-doc-links"); +pub const COLLECT_INTRA_DOC_LINKS: Pass = Pass { + name: "collect-intra-doc-links", + pass: collect_intra_doc_links, + description: "reads a crate's documentation to resolve intra-doc-links", +}; -pub fn collect_intra_doc_links(krate: Crate, cx: &DocContext<'_, '_, '_>) -> Crate { +pub fn collect_intra_doc_links(krate: Crate, cx: &DocContext<'_>) -> Crate { if !UnstableFeatures::from_environment().is_nightly_build() { krate } else { @@ -45,14 +47,14 @@ enum PathKind { Type, } -struct LinkCollector<'a, 'tcx: 'a, 'rcx: 'a> { - cx: &'a DocContext<'a, 'tcx, 'rcx>, - mod_ids: Vec, +struct LinkCollector<'a, 'tcx> { + cx: &'a DocContext<'tcx>, + mod_ids: Vec, is_nightly_build: bool, } -impl<'a, 'tcx, 'rcx> LinkCollector<'a, 'tcx, 'rcx> { - fn new(cx: &'a DocContext<'a, 'tcx, 'rcx>) -> Self { +impl<'a, 'tcx> LinkCollector<'a, 'tcx> { + fn new(cx: &'a DocContext<'tcx>) -> Self { LinkCollector { cx, mod_ids: Vec::new(), @@ -67,7 +69,7 @@ impl<'a, 'tcx, 'rcx> LinkCollector<'a, 'tcx, 'rcx> { path_str: &str, is_val: bool, current_item: &Option, - parent_id: Option) + parent_id: Option) -> Result<(Def, Option), ()> { let cx = self.cx; @@ -76,12 +78,11 @@ impl<'a, 'tcx, 'rcx> LinkCollector<'a, 'tcx, 'rcx> { // path. if let Some(id) = parent_id.or(self.mod_ids.last().cloned()) { // FIXME: `with_scope` requires the `NodeId` of a module. - let result = cx.resolver.borrow_mut() - .with_scope(id, + let result = cx.enter_resolver(|resolver| resolver.with_scope(id, |resolver| { resolver.resolve_str_path_error(DUMMY_SP, &path_str, is_val) - }); + })); if let Ok(result) = result { // In case this is a trait item, skip the @@ -140,11 +141,9 @@ impl<'a, 'tcx, 'rcx> LinkCollector<'a, 'tcx, 'rcx> { } // FIXME: `with_scope` requires the `NodeId` of a module. - let ty = cx.resolver.borrow_mut() - .with_scope(id, - |resolver| { + let ty = cx.enter_resolver(|resolver| resolver.with_scope(id, |resolver| { resolver.resolve_str_path_error(DUMMY_SP, &path, false) - })?; + }))?; match ty.def { Def::Struct(did) | Def::Union(did) | Def::Enum(did) | Def::TyAlias(did) => { let item = cx.tcx.inherent_impls(did) @@ -216,10 +215,10 @@ impl<'a, 'tcx, 'rcx> LinkCollector<'a, 'tcx, 'rcx> { } } -impl<'a, 'tcx, 'rcx> DocFolder for LinkCollector<'a, 'tcx, 'rcx> { +impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> { fn fold_item(&mut self, mut item: Item) -> Option { - let item_node_id = if item.is_mod() { - if let Some(id) = self.cx.tcx.hir().as_local_node_id(item.def_id) { + let item_hir_id = if item.is_mod() { + if let Some(id) = self.cx.tcx.hir().as_local_hir_id(item.def_id) { Some(id) } else { debug!("attempting to fold on a non-local item: {:?}", item); @@ -246,14 +245,14 @@ impl<'a, 'tcx, 'rcx> DocFolder for LinkCollector<'a, 'tcx, 'rcx> { let current_item = match item.inner { ModuleItem(..) => { if item.attrs.inner_docs { - if item_node_id.unwrap() != NodeId::from_u32(0) { + if item_hir_id.unwrap() != hir::CRATE_HIR_ID { item.name.clone() } else { None } } else { match parent_node.or(self.mod_ids.last().cloned()) { - Some(parent) if parent != NodeId::from_u32(0) => { + Some(parent) if parent != ast::CRATE_NODE_ID => { // FIXME: can we pull the parent module's name from elsewhere? Some(self.cx.tcx.hir().name(parent).to_string()) } @@ -272,7 +271,7 @@ impl<'a, 'tcx, 'rcx> DocFolder for LinkCollector<'a, 'tcx, 'rcx> { }; if item.is_mod() && item.attrs.inner_docs { - self.mod_ids.push(item_node_id.unwrap()); + self.mod_ids.push(self.cx.tcx.hir().hir_to_node_id(item_hir_id.unwrap())); } let cx = self.cx; @@ -419,7 +418,7 @@ impl<'a, 'tcx, 'rcx> DocFolder for LinkCollector<'a, 'tcx, 'rcx> { } if item.is_mod() && !item.attrs.inner_docs { - self.mod_ids.push(item_node_id.unwrap()); + self.mod_ids.push(self.cx.tcx.hir().hir_to_node_id(item_hir_id.unwrap())); } if item.is_mod() { @@ -435,26 +434,27 @@ impl<'a, 'tcx, 'rcx> DocFolder for LinkCollector<'a, 'tcx, 'rcx> { } /// Resolves a string as a macro. -fn macro_resolve(cx: &DocContext<'_, '_, '_>, path_str: &str) -> Option { +fn macro_resolve(cx: &DocContext<'_>, path_str: &str) -> Option { use syntax::ext::base::{MacroKind, SyntaxExtension}; let segment = ast::PathSegment::from_ident(Ident::from_str(path_str)); let path = ast::Path { segments: vec![segment], span: DUMMY_SP }; - let mut resolver = cx.resolver.borrow_mut(); - let parent_scope = resolver.dummy_parent_scope(); - if let Ok(def) = resolver.resolve_macro_to_def_inner(&path, MacroKind::Bang, - &parent_scope, false, false) { - if let Def::Macro(_, MacroKind::ProcMacroStub) = def { - // skip proc-macro stubs, they'll cause `get_macro` to crash - } else { - if let SyntaxExtension::DeclMacro { .. } = *resolver.get_macro(def) { - return Some(def); + cx.enter_resolver(|resolver| { + let parent_scope = resolver.dummy_parent_scope(); + if let Ok(def) = resolver.resolve_macro_to_def_inner(&path, MacroKind::Bang, + &parent_scope, false, false) { + if let Def::Macro(_, MacroKind::ProcMacroStub) = def { + // skip proc-macro stubs, they'll cause `get_macro` to crash + } else { + if let SyntaxExtension::DeclMacro { .. } = *resolver.get_macro(def) { + return Some(def); + } } } - } - if let Some(def) = resolver.all_macros.get(&Symbol::intern(path_str)) { - return Some(*def); - } - None + if let Some(def) = resolver.all_macros.get(&Symbol::intern(path_str)) { + return Some(*def); + } + None + }) } /// Reports a resolution failure diagnostic. @@ -463,7 +463,7 @@ fn macro_resolve(cx: &DocContext<'_, '_, '_>, path_str: &str) -> Option { /// documentation attributes themselves. This is a little heavy-handed, so we display the markdown /// line containing the failure as a note as well. fn resolution_failure( - cx: &DocContext<'_, '_, '_>, + cx: &DocContext<'_>, attrs: &Attributes, path_str: &str, dox: &str, @@ -471,9 +471,9 @@ fn resolution_failure( ) { let sp = span_of_attrs(attrs); - let mut diag = cx.tcx.struct_span_lint_node( + let mut diag = cx.tcx.struct_span_lint_hir( lint::builtin::INTRA_DOC_LINK_RESOLUTION_FAILURE, - NodeId::from_u32(0), + hir::CRATE_HIR_ID, sp, &format!("`[{}]` cannot be resolved, ignoring it...", path_str), ); @@ -505,7 +505,7 @@ fn resolution_failure( diag.emit(); } -fn ambiguity_error(cx: &DocContext<'_, '_, '_>, attrs: &Attributes, +fn ambiguity_error(cx: &DocContext<'_>, attrs: &Attributes, path_str: &str, article1: &str, kind1: &str, disambig1: &str, article2: &str, kind2: &str, disambig2: &str) { @@ -561,7 +561,7 @@ fn type_ns_kind(def: Def, path_str: &str) -> (&'static str, &'static str, String } /// Given an enum variant's def, return the def of its enum and the associated fragment. -fn handle_variant(cx: &DocContext<'_, '_, '_>, def: Def) -> Result<(Def, Option), ()> { +fn handle_variant(cx: &DocContext<'_>, def: Def) -> Result<(Def, Option), ()> { use rustc::ty::DefIdTree; let parent = if let Some(parent) = cx.tcx.parent(def.def_id()) { @@ -602,7 +602,7 @@ fn is_primitive(path_str: &str, is_val: bool) -> Option { } } -fn primitive_impl(cx: &DocContext<'_, '_, '_>, path_str: &str) -> Option { +fn primitive_impl(cx: &DocContext<'_>, path_str: &str) -> Option { let tcx = cx.tcx; match path_str { "u8" => tcx.lang_items().u8_impl(), diff --git a/src/librustdoc/passes/collect_trait_impls.rs b/src/librustdoc/passes/collect_trait_impls.rs index 903cce3bc032..de043277c835 100644 --- a/src/librustdoc/passes/collect_trait_impls.rs +++ b/src/librustdoc/passes/collect_trait_impls.rs @@ -6,11 +6,13 @@ use super::Pass; use rustc::util::nodemap::FxHashSet; use rustc::hir::def_id::DefId; -pub const COLLECT_TRAIT_IMPLS: Pass = - Pass::early("collect-trait-impls", collect_trait_impls, - "retrieves trait impls for items in the crate"); +pub const COLLECT_TRAIT_IMPLS: Pass = Pass { + name: "collect-trait-impls", + pass: collect_trait_impls, + description: "retrieves trait impls for items in the crate", +}; -pub fn collect_trait_impls(krate: Crate, cx: &DocContext<'_, '_, '_>) -> Crate { +pub fn collect_trait_impls(krate: Crate, cx: &DocContext<'_>) -> Crate { let mut synth = SyntheticImplCollector::new(cx); let mut krate = synth.fold_crate(krate); @@ -136,13 +138,13 @@ pub fn collect_trait_impls(krate: Crate, cx: &DocContext<'_, '_, '_>) -> Crate { krate } -struct SyntheticImplCollector<'a, 'tcx: 'a, 'rcx: 'a> { - cx: &'a DocContext<'a, 'tcx, 'rcx>, +struct SyntheticImplCollector<'a, 'tcx> { + cx: &'a DocContext<'tcx>, impls: Vec, } -impl<'a, 'tcx, 'rcx> SyntheticImplCollector<'a, 'tcx, 'rcx> { - fn new(cx: &'a DocContext<'a, 'tcx, 'rcx>) -> Self { +impl<'a, 'tcx> SyntheticImplCollector<'a, 'tcx> { + fn new(cx: &'a DocContext<'tcx>) -> Self { SyntheticImplCollector { cx, impls: Vec::new(), @@ -150,14 +152,14 @@ impl<'a, 'tcx, 'rcx> SyntheticImplCollector<'a, 'tcx, 'rcx> { } } -impl<'a, 'tcx, 'rcx> DocFolder for SyntheticImplCollector<'a, 'tcx, 'rcx> { +impl<'a, 'tcx> DocFolder for SyntheticImplCollector<'a, 'tcx> { fn fold_item(&mut self, i: Item) -> Option { if i.is_struct() || i.is_enum() || i.is_union() { - if let (Some(node_id), Some(name)) = - (self.cx.tcx.hir().as_local_node_id(i.def_id), i.name.clone()) + if let (Some(hir_id), Some(name)) = + (self.cx.tcx.hir().as_local_hir_id(i.def_id), i.name.clone()) { - self.impls.extend(get_auto_traits_with_node_id(self.cx, node_id, name.clone())); - self.impls.extend(get_blanket_impls_with_node_id(self.cx, node_id, name)); + self.impls.extend(get_auto_traits_with_hir_id(self.cx, hir_id, name.clone())); + self.impls.extend(get_blanket_impls_with_hir_id(self.cx, hir_id, name)); } else { self.impls.extend(get_auto_traits_with_def_id(self.cx, i.def_id)); self.impls.extend(get_blanket_impls_with_def_id(self.cx, i.def_id)); diff --git a/src/librustdoc/passes/mod.rs b/src/librustdoc/passes/mod.rs index 4d7fef7a76a9..3c403d421c8f 100644 --- a/src/librustdoc/passes/mod.rs +++ b/src/librustdoc/passes/mod.rs @@ -1,13 +1,12 @@ //! Contains information about "passes", used to modify crate information during the documentation //! process. +use rustc::hir; use rustc::hir::def_id::DefId; use rustc::lint as lint; use rustc::middle::privacy::AccessLevels; use rustc::util::nodemap::DefIdSet; use std::mem; -use std::fmt; -use syntax::ast::NodeId; use syntax_pos::{DUMMY_SP, Span}; use std::ops::Range; @@ -46,84 +45,17 @@ pub use self::collect_trait_impls::COLLECT_TRAIT_IMPLS; mod check_code_block_syntax; pub use self::check_code_block_syntax::CHECK_CODE_BLOCK_SYNTAX; -/// Represents a single pass. +mod calculate_doc_coverage; +pub use self::calculate_doc_coverage::CALCULATE_DOC_COVERAGE; + +/// A single pass over the cleaned documentation. +/// +/// Runs in the compiler context, so it has access to types and traits and the like. #[derive(Copy, Clone)] -pub enum Pass { - /// An "early pass" is run in the compiler context, and can gather information about types and - /// traits and the like. - EarlyPass { - name: &'static str, - pass: fn(clean::Crate, &DocContext<'_, '_, '_>) -> clean::Crate, - description: &'static str, - }, - /// A "late pass" is run between crate cleaning and page generation. - LatePass { - name: &'static str, - pass: fn(clean::Crate) -> clean::Crate, - description: &'static str, - }, -} - -impl fmt::Debug for Pass { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let mut dbg = match *self { - Pass::EarlyPass { .. } => f.debug_struct("EarlyPass"), - Pass::LatePass { .. } => f.debug_struct("LatePass"), - }; - - dbg.field("name", &self.name()) - .field("pass", &"...") - .field("description", &self.description()) - .finish() - } -} - -impl Pass { - /// Constructs a new early pass. - pub const fn early(name: &'static str, - pass: fn(clean::Crate, &DocContext<'_, '_, '_>) -> clean::Crate, - description: &'static str) -> Pass { - Pass::EarlyPass { name, pass, description } - } - - /// Constructs a new late pass. - pub const fn late(name: &'static str, - pass: fn(clean::Crate) -> clean::Crate, - description: &'static str) -> Pass { - Pass::LatePass { name, pass, description } - } - - /// Returns the name of this pass. - pub fn name(self) -> &'static str { - match self { - Pass::EarlyPass { name, .. } | - Pass::LatePass { name, .. } => name, - } - } - - /// Returns the description of this pass. - pub fn description(self) -> &'static str { - match self { - Pass::EarlyPass { description, .. } | - Pass::LatePass { description, .. } => description, - } - } - - /// If this pass is an early pass, returns the pointer to its function. - pub fn early_fn(self) -> Option) -> clean::Crate> { - match self { - Pass::EarlyPass { pass, .. } => Some(pass), - _ => None, - } - } - - /// If this pass is a late pass, returns the pointer to its function. - pub fn late_fn(self) -> Option clean::Crate> { - match self { - Pass::LatePass { pass, .. } => Some(pass), - _ => None, - } - } +pub struct Pass { + pub name: &'static str, + pub pass: fn(clean::Crate, &DocContext<'_>) -> clean::Crate, + pub description: &'static str, } /// The full list of passes. @@ -138,39 +70,57 @@ pub const PASSES: &'static [Pass] = &[ COLLECT_INTRA_DOC_LINKS, CHECK_CODE_BLOCK_SYNTAX, COLLECT_TRAIT_IMPLS, + CALCULATE_DOC_COVERAGE, ]; /// The list of passes run by default. -pub const DEFAULT_PASSES: &'static [&'static str] = &[ +pub const DEFAULT_PASSES: &[&str] = &[ "collect-trait-impls", + "collapse-docs", + "unindent-comments", "check-private-items-doc-tests", "strip-hidden", "strip-private", "collect-intra-doc-links", "check-code-block-syntax", - "collapse-docs", - "unindent-comments", "propagate-doc-cfg", ]; /// The list of default passes run with `--document-private-items` is passed to rustdoc. -pub const DEFAULT_PRIVATE_PASSES: &'static [&'static str] = &[ +pub const DEFAULT_PRIVATE_PASSES: &[&str] = &[ "collect-trait-impls", + "collapse-docs", + "unindent-comments", "check-private-items-doc-tests", "strip-priv-imports", "collect-intra-doc-links", "check-code-block-syntax", - "collapse-docs", - "unindent-comments", "propagate-doc-cfg", ]; +/// The list of default passes run when `--doc-coverage` is passed to rustdoc. +pub const DEFAULT_COVERAGE_PASSES: &'static [&'static str] = &[ + "collect-trait-impls", + "strip-hidden", + "strip-private", + "calculate-doc-coverage", +]; + +/// The list of default passes run when `--doc-coverage --document-private-items` is passed to +/// rustdoc. +pub const PRIVATE_COVERAGE_PASSES: &'static [&'static str] = &[ + "collect-trait-impls", + "calculate-doc-coverage", +]; + /// A shorthand way to refer to which set of passes to use, based on the presence of /// `--no-defaults` or `--document-private-items`. #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum DefaultPassOption { Default, Private, + Coverage, + PrivateCoverage, None, } @@ -179,13 +129,15 @@ pub fn defaults(default_set: DefaultPassOption) -> &'static [&'static str] { match default_set { DefaultPassOption::Default => DEFAULT_PASSES, DefaultPassOption::Private => DEFAULT_PRIVATE_PASSES, + DefaultPassOption::Coverage => DEFAULT_COVERAGE_PASSES, + DefaultPassOption::PrivateCoverage => PRIVATE_COVERAGE_PASSES, DefaultPassOption::None => &[], } } /// If the given name matches a known pass, returns its information. -pub fn find_pass(pass_name: &str) -> Option { - PASSES.iter().find(|p| p.name() == pass_name).cloned() +pub fn find_pass(pass_name: &str) -> Option<&'static Pass> { + PASSES.iter().find(|p| p.name == pass_name) } struct Stripper<'a> { @@ -356,13 +308,13 @@ impl DocFolder for ImportStripper { } } -pub fn look_for_tests<'a, 'tcx: 'a, 'rcx: 'a>( - cx: &'a DocContext<'a, 'tcx, 'rcx>, +pub fn look_for_tests<'tcx>( + cx: &DocContext<'tcx>, dox: &str, item: &Item, check_missing_code: bool, ) { - if cx.as_local_node_id(item.def_id).is_none() { + if cx.as_local_hir_id(item.def_id).is_none() { // If non-local, no need to check anything. return; } @@ -383,18 +335,18 @@ pub fn look_for_tests<'a, 'tcx: 'a, 'rcx: 'a>( if find_testable_code(&dox, &mut tests, ErrorCodes::No).is_ok() { if check_missing_code == true && tests.found_tests == 0 { - let mut diag = cx.tcx.struct_span_lint_node( + let mut diag = cx.tcx.struct_span_lint_hir( lint::builtin::MISSING_DOC_CODE_EXAMPLES, - NodeId::from_u32(0), + hir::CRATE_HIR_ID, span_of_attrs(&item.attrs), "Missing code example in this documentation"); diag.emit(); } else if check_missing_code == false && tests.found_tests > 0 && !cx.renderinfo.borrow().access_levels.is_doc_reachable(item.def_id) { - let mut diag = cx.tcx.struct_span_lint_node( + let mut diag = cx.tcx.struct_span_lint_hir( lint::builtin::PRIVATE_DOC_TESTS, - NodeId::from_u32(0), + hir::CRATE_HIR_ID, span_of_attrs(&item.attrs), "Documentation test in private item"); diag.emit(); @@ -418,7 +370,7 @@ crate fn span_of_attrs(attrs: &clean::Attributes) -> Span { /// attributes are not all sugared doc comments. It's difficult to calculate the correct span in /// that case due to escaping and other source features. crate fn source_span_for_markdown_range( - cx: &DocContext<'_, '_, '_>, + cx: &DocContext<'_>, markdown: &str, md_range: &Range, attrs: &clean::Attributes, @@ -438,11 +390,11 @@ crate fn source_span_for_markdown_range( .span_to_snippet(span_of_attrs(attrs)) .ok()?; - let starting_line = markdown[..md_range.start].lines().count() - 1; - let ending_line = markdown[..md_range.end].lines().count() - 1; + let starting_line = markdown[..md_range.start].matches('\n').count(); + let ending_line = starting_line + markdown[md_range.start..md_range.end].matches('\n').count(); - // We use `split_terminator('\n')` instead of `lines()` when counting bytes so that we only - // we can treat CRLF and LF line endings the same way. + // We use `split_terminator('\n')` instead of `lines()` when counting bytes so that we treat + // CRLF and LF line endings the same way. let mut src_lines = snippet.split_terminator('\n'); let md_lines = markdown.split_terminator('\n'); diff --git a/src/librustdoc/passes/private_items_doc_tests.rs b/src/librustdoc/passes/private_items_doc_tests.rs index 819d15f65e8e..5560ebed9ae6 100644 --- a/src/librustdoc/passes/private_items_doc_tests.rs +++ b/src/librustdoc/passes/private_items_doc_tests.rs @@ -3,30 +3,31 @@ use crate::core::DocContext; use crate::fold::DocFolder; use crate::passes::{look_for_tests, Pass}; +pub const CHECK_PRIVATE_ITEMS_DOC_TESTS: Pass = Pass { + name: "check-private-items-doc-tests", + pass: check_private_items_doc_tests, + description: "check private items doc tests", +}; -pub const CHECK_PRIVATE_ITEMS_DOC_TESTS: Pass = - Pass::early("check-private-items-doc-tests", check_private_items_doc_tests, - "check private items doc tests"); - -struct PrivateItemDocTestLinter<'a, 'tcx: 'a, 'rcx: 'a> { - cx: &'a DocContext<'a, 'tcx, 'rcx>, +struct PrivateItemDocTestLinter<'a, 'tcx> { + cx: &'a DocContext<'tcx>, } -impl<'a, 'tcx, 'rcx> PrivateItemDocTestLinter<'a, 'tcx, 'rcx> { - fn new(cx: &'a DocContext<'a, 'tcx, 'rcx>) -> Self { +impl<'a, 'tcx> PrivateItemDocTestLinter<'a, 'tcx> { + fn new(cx: &'a DocContext<'tcx>) -> Self { PrivateItemDocTestLinter { cx, } } } -pub fn check_private_items_doc_tests(krate: Crate, cx: &DocContext<'_, '_, '_>) -> Crate { +pub fn check_private_items_doc_tests(krate: Crate, cx: &DocContext<'_>) -> Crate { let mut coll = PrivateItemDocTestLinter::new(cx); coll.fold_crate(krate) } -impl<'a, 'tcx, 'rcx> DocFolder for PrivateItemDocTestLinter<'a, 'tcx, 'rcx> { +impl<'a, 'tcx> DocFolder for PrivateItemDocTestLinter<'a, 'tcx> { fn fold_item(&mut self, item: Item) -> Option { let cx = self.cx; let dox = item.attrs.collapsed_doc_value().unwrap_or_else(String::new); diff --git a/src/librustdoc/passes/propagate_doc_cfg.rs b/src/librustdoc/passes/propagate_doc_cfg.rs index 9ba0b2272869..a71a1e001fc6 100644 --- a/src/librustdoc/passes/propagate_doc_cfg.rs +++ b/src/librustdoc/passes/propagate_doc_cfg.rs @@ -2,14 +2,17 @@ use std::sync::Arc; use crate::clean::{Crate, Item}; use crate::clean::cfg::Cfg; +use crate::core::DocContext; use crate::fold::DocFolder; use crate::passes::Pass; -pub const PROPAGATE_DOC_CFG: Pass = - Pass::late("propagate-doc-cfg", propagate_doc_cfg, - "propagates `#[doc(cfg(...))]` to child items"); +pub const PROPAGATE_DOC_CFG: Pass = Pass { + name: "propagate-doc-cfg", + pass: propagate_doc_cfg, + description: "propagates `#[doc(cfg(...))]` to child items", +}; -pub fn propagate_doc_cfg(cr: Crate) -> Crate { +pub fn propagate_doc_cfg(cr: Crate, _: &DocContext<'_>) -> Crate { CfgPropagator { parent_cfg: None }.fold_crate(cr) } diff --git a/src/librustdoc/passes/strip_hidden.rs b/src/librustdoc/passes/strip_hidden.rs index b3d50e06816c..240299c212ab 100644 --- a/src/librustdoc/passes/strip_hidden.rs +++ b/src/librustdoc/passes/strip_hidden.rs @@ -7,12 +7,14 @@ use crate::core::DocContext; use crate::fold::{DocFolder, StripItem}; use crate::passes::{ImplStripper, Pass}; -pub const STRIP_HIDDEN: Pass = - Pass::early("strip-hidden", strip_hidden, - "strips all doc(hidden) items from the output"); +pub const STRIP_HIDDEN: Pass = Pass { + name: "strip-hidden", + pass: strip_hidden, + description: "strips all doc(hidden) items from the output", +}; /// Strip items marked `#[doc(hidden)]` -pub fn strip_hidden(krate: clean::Crate, _: &DocContext<'_, '_, '_>) -> clean::Crate { +pub fn strip_hidden(krate: clean::Crate, _: &DocContext<'_>) -> clean::Crate { let mut retained = DefIdSet::default(); // strip all #[doc(hidden)] items diff --git a/src/librustdoc/passes/strip_priv_imports.rs b/src/librustdoc/passes/strip_priv_imports.rs index 3af1403e8749..516760ade666 100644 --- a/src/librustdoc/passes/strip_priv_imports.rs +++ b/src/librustdoc/passes/strip_priv_imports.rs @@ -3,9 +3,12 @@ use crate::fold::{DocFolder}; use crate::core::DocContext; use crate::passes::{ImportStripper, Pass}; -pub const STRIP_PRIV_IMPORTS: Pass = Pass::early("strip-priv-imports", strip_priv_imports, - "strips all private import statements (`use`, `extern crate`) from a crate"); +pub const STRIP_PRIV_IMPORTS: Pass = Pass { + name: "strip-priv-imports", + pass: strip_priv_imports, + description: "strips all private import statements (`use`, `extern crate`) from a crate", +}; -pub fn strip_priv_imports(krate: clean::Crate, _: &DocContext<'_, '_, '_>) -> clean::Crate { +pub fn strip_priv_imports(krate: clean::Crate, _: &DocContext<'_>) -> clean::Crate { ImportStripper.fold_crate(krate) } diff --git a/src/librustdoc/passes/strip_private.rs b/src/librustdoc/passes/strip_private.rs index e553d792eb69..fc742bf74d00 100644 --- a/src/librustdoc/passes/strip_private.rs +++ b/src/librustdoc/passes/strip_private.rs @@ -5,14 +5,16 @@ use crate::fold::{DocFolder}; use crate::core::DocContext; use crate::passes::{ImplStripper, ImportStripper, Stripper, Pass}; -pub const STRIP_PRIVATE: Pass = - Pass::early("strip-private", strip_private, - "strips all private items from a crate which cannot be seen externally, \ - implies strip-priv-imports"); +pub const STRIP_PRIVATE: Pass = Pass { + name: "strip-private", + pass: strip_private, + description: "strips all private items from a crate which cannot be seen externally, \ + implies strip-priv-imports", +}; /// Strip private items from the point of view of a crate or externally from a /// crate, specified by the `xcrate` flag. -pub fn strip_private(mut krate: clean::Crate, cx: &DocContext<'_, '_, '_>) -> clean::Crate { +pub fn strip_private(mut krate: clean::Crate, cx: &DocContext<'_>) -> clean::Crate { // This stripper collects all *retained* nodes. let mut retained = DefIdSet::default(); let access_levels = cx.renderinfo.borrow().access_levels.clone(); diff --git a/src/librustdoc/passes/unindent_comments.rs b/src/librustdoc/passes/unindent_comments.rs index 269e4cbe65f8..95e322f70b2e 100644 --- a/src/librustdoc/passes/unindent_comments.rs +++ b/src/librustdoc/passes/unindent_comments.rs @@ -3,14 +3,17 @@ use std::string::String; use std::usize; use crate::clean::{self, DocFragment, Item}; +use crate::core::DocContext; use crate::fold::{self, DocFolder}; use crate::passes::Pass; -pub const UNINDENT_COMMENTS: Pass = - Pass::late("unindent-comments", unindent_comments, - "removes excess indentation on comments in order for markdown to like it"); +pub const UNINDENT_COMMENTS: Pass = Pass { + name: "unindent-comments", + pass: unindent_comments, + description: "removes excess indentation on comments in order for markdown to like it", +}; -pub fn unindent_comments(krate: clean::Crate) -> clean::Crate { +pub fn unindent_comments(krate: clean::Crate, _: &DocContext<'_>) -> clean::Crate { CommentCleaner.fold_crate(krate) } diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 3db65205a2dc..f1d4d8470b2a 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -1,20 +1,16 @@ -use errors::{self, FatalError}; -use errors::emitter::ColorConfig; use rustc_data_structures::sync::Lrc; -use rustc_lint; -use rustc_driver::{self, driver, target_features, Compilation}; -use rustc_driver::driver::phase_2_configure_and_expand; -use rustc_metadata::cstore::CStore; +use rustc_interface::interface; use rustc::hir; use rustc::hir::intravisit; -use rustc::session::{self, CompileIncomplete, config}; +use rustc::hir::def_id::LOCAL_CRATE; +use rustc::session::{self, config, DiagnosticOutput}; use rustc::session::config::{OutputType, OutputTypes, Externs, CodegenOptions}; use rustc::session::search_paths::SearchPath; +use rustc::util::common::ErrorReported; use syntax::ast; use syntax::source_map::SourceMap; use syntax::edition::Edition; use syntax::feature_gate::UnstableFeatures; -use syntax::with_globals; use syntax_pos::{BytePos, DUMMY_SP, Pos, Span, FileName}; use tempfile::Builder as TempFileBuilder; use testing; @@ -22,8 +18,8 @@ use testing; use std::env; use std::io::prelude::*; use std::io; -use std::path::PathBuf; use std::panic::{self, AssertUnwindSafe}; +use std::path::PathBuf; use std::process::Command; use std::str; use std::sync::{Arc, Mutex}; @@ -43,7 +39,7 @@ pub struct TestOptions { pub attrs: Vec, } -pub fn run(mut options: Options) -> isize { +pub fn run(options: Options) -> i32 { let input = config::Input::File(options.input.clone()); let sessopts = config::Options { @@ -62,52 +58,31 @@ pub fn run(mut options: Options) -> isize { edition: options.edition, ..config::Options::default() }; - driver::spawn_thread_pool(sessopts, |sessopts| { - let source_map = Lrc::new(SourceMap::new(sessopts.file_path_mapping())); - let handler = - errors::Handler::with_tty_emitter(ColorConfig::Auto, - true, false, - Some(source_map.clone())); - let mut sess = session::build_session_( - sessopts, Some(options.input), handler, source_map.clone(), - ); - let codegen_backend = rustc_driver::get_codegen_backend(&sess); - let cstore = CStore::new(codegen_backend.metadata_loader()); - rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); + let config = interface::Config { + opts: sessopts, + crate_cfg: config::parse_cfgspecs(options.cfgs.clone()), + input, + input_path: None, + output_file: None, + output_dir: None, + file_loader: None, + diagnostic_output: DiagnosticOutput::Default, + stderr: None, + crate_name: options.crate_name.clone(), + lint_caps: Default::default(), + }; - let mut cfg = config::build_configuration(&sess, - config::parse_cfgspecs(options.cfgs.clone())); - target_features::add_configuration(&mut cfg, &sess, &*codegen_backend); - sess.parse_sess.config = cfg; + let mut test_args = options.test_args.clone(); + let display_warnings = options.display_warnings; - let krate = - match driver::phase_1_parse_input(&driver::CompileController::basic(), &sess, &input) { - Ok(krate) => krate, - Err(mut e) => { - e.emit(); - FatalError.raise(); - } - }; - let driver::ExpansionResult { defs, mut hir_forest, .. } = { - phase_2_configure_and_expand( - &sess, - &cstore, - krate, - None, - "rustdoc-test", - None, - |_| Ok(()), - ).expect("phase_2_configure_and_expand aborted in rustdoc!") - }; + let tests = interface::run_compiler(config, |compiler| -> Result<_, ErrorReported> { + let lower_to_hir = compiler.lower_to_hir()?; - let crate_name = options.crate_name.unwrap_or_else(|| { - ::rustc_codegen_utils::link::find_crate_name(None, &hir_forest.krate().attrs, &input) - }); - let mut opts = scrape_test_config(hir_forest.krate()); + let mut opts = scrape_test_config(lower_to_hir.peek().0.borrow().krate()); opts.display_warnings |= options.display_warnings; let mut collector = Collector::new( - crate_name, + compiler.crate_name()?.peek().to_string(), options.cfgs, options.libs, options.codegen_options, @@ -115,34 +90,40 @@ pub fn run(mut options: Options) -> isize { false, opts, options.maybe_sysroot, - Some(source_map), + Some(compiler.source_map().clone()), None, options.linker, options.edition, options.persist_doctests, ); - { - let map = hir::map::map_crate(&sess, &cstore, &mut hir_forest, &defs); - let krate = map.krate(); + let mut global_ctxt = compiler.global_ctxt()?.take(); + global_ctxt.enter(|tcx| { + let krate = tcx.hir().krate(); let mut hir_collector = HirCollector { - sess: &sess, + sess: compiler.session(), collector: &mut collector, - map: &map, - codes: ErrorCodes::from(sess.opts.unstable_features.is_nightly_build()), + map: tcx.hir(), + codes: ErrorCodes::from(compiler.session().opts + .unstable_features.is_nightly_build()), }; hir_collector.visit_testable("".to_string(), &krate.attrs, |this| { intravisit::walk_crate(this, krate); }); - } + }); - options.test_args.insert(0, "rustdoctest".to_string()); + Ok(collector.tests) + }).expect("compiler aborted in rustdoc!"); - testing::test_main(&options.test_args, - collector.tests.into_iter().collect(), - testing::Options::new().display_output(options.display_warnings)); - 0 - }) + test_args.insert(0, "rustdoctest".to_string()); + + testing::test_main( + &test_args, + tests, + testing::Options::new().display_output(display_warnings) + ); + + 0 } // Look for `#![doc(test(no_crate_inject))]`, used by crates in the std facade. @@ -238,16 +219,18 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize, } fn flush(&mut self) -> io::Result<()> { Ok(()) } } - struct Bomb(Arc>>, Box); + struct Bomb(Arc>>, Option>); impl Drop for Bomb { fn drop(&mut self) { - let _ = self.1.write_all(&self.0.lock().unwrap()); + let mut old = self.1.take().unwrap(); + let _ = old.write_all(&self.0.lock().unwrap()); + io::set_panic(Some(old)); } } let data = Arc::new(Mutex::new(Vec::new())); let old = io::set_panic(Some(box Sink(data.clone()))); - let _bomb = Bomb(data.clone(), old.unwrap_or(box io::stdout())); + let _bomb = Bomb(data.clone(), Some(old.unwrap_or(box io::stdout()))); enum DirState { Temp(tempfile::TempDir), @@ -263,91 +246,67 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize, } } - let (outdir, compile_result) = driver::spawn_thread_pool(sessopts, |sessopts| { - let source_map = Lrc::new(SourceMap::new(sessopts.file_path_mapping())); - let emitter = errors::emitter::EmitterWriter::new(box Sink(data.clone()), - Some(source_map.clone()), - false, - false); - - // Compile the code - let diagnostic_handler = errors::Handler::with_emitter(true, false, box emitter); - - let mut sess = session::build_session_( - sessopts, None, diagnostic_handler, source_map, + let outdir = if let Some(mut path) = persist_doctests { + path.push(format!("{}_{}", + filename + .to_string() + .rsplit('/') + .next() + .unwrap() + .replace(".", "_"), + line) ); - let codegen_backend = rustc_driver::get_codegen_backend(&sess); - let cstore = CStore::new(codegen_backend.metadata_loader()); - rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); + std::fs::create_dir_all(&path) + .expect("Couldn't create directory for doctest executables"); - let outdir = Mutex::new( - if let Some(mut path) = persist_doctests { - path.push(format!("{}_{}", - filename - .to_string() - .rsplit('/') - .next() - .unwrap() - .replace(".", "_"), - line) - ); - std::fs::create_dir_all(&path) - .expect("Couldn't create directory for doctest executables"); + DirState::Perm(path) + } else { + DirState::Temp(TempFileBuilder::new() + .prefix("rustdoctest") + .tempdir() + .expect("rustdoc needs a tempdir")) + }; + let output_file = outdir.path().join("rust_out"); - DirState::Perm(path) + let config = interface::Config { + opts: sessopts, + crate_cfg: config::parse_cfgspecs(cfgs), + input, + input_path: None, + output_file: Some(output_file.clone()), + output_dir: None, + file_loader: None, + diagnostic_output: DiagnosticOutput::Raw(box Sink(data.clone())), + stderr: Some(data.clone()), + crate_name: None, + lint_caps: Default::default(), + }; + + let compile_result = panic::catch_unwind(AssertUnwindSafe(|| { + interface::run_compiler(config, |compiler| { + if no_run { + compiler.global_ctxt().and_then(|global_ctxt| global_ctxt.take().enter(|tcx| { + tcx.analysis(LOCAL_CRATE) + })).ok(); } else { - DirState::Temp(TempFileBuilder::new() - .prefix("rustdoctest") - .tempdir() - .expect("rustdoc needs a tempdir")) - } - ); - let mut control = driver::CompileController::basic(); - - let mut cfg = config::build_configuration(&sess, config::parse_cfgspecs(cfgs.clone())); - target_features::add_configuration(&mut cfg, &sess, &*codegen_backend); - sess.parse_sess.config = cfg; - - let out = Some(outdir.lock().unwrap().path().join("rust_out")); - - if no_run { - control.after_analysis.stop = Compilation::Stop; - } - - let res = panic::catch_unwind(AssertUnwindSafe(|| { - driver::compile_input( - codegen_backend, - &sess, - &cstore, - &None, - &input, - &None, - &out, - None, - &control - ) - })); - - let compile_result = match res { - Ok(Ok(())) | Ok(Err(CompileIncomplete::Stopped)) => Ok(()), - Err(_) | Ok(Err(CompileIncomplete::Errored(_))) => Err(()) - }; - - (outdir, compile_result) - }); + compiler.compile().ok(); + }; + compiler.session().compile_status() + }) + })).map_err(|_| ()).and_then(|s| s.map_err(|_| ())); match (compile_result, compile_fail) { (Ok(()), true) => { panic!("test compiled while it wasn't supposed to") } (Ok(()), false) => {} - (Err(()), true) => { + (Err(_), true) => { if error_codes.len() > 0 { let out = String::from_utf8(data.lock().unwrap().to_vec()).unwrap(); error_codes.retain(|err| !out.contains(err)); } } - (Err(()), false) => { + (Err(_), false) => { panic!("couldn't compile the test") } } @@ -359,7 +318,8 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize, if no_run { return } // Run the code! - let mut cmd = Command::new(&outdir.lock().unwrap().path().join("rust_out")); + let mut cmd = Command::new(output_file); + match cmd.output() { Err(e) => panic!("couldn't run the test: {}{}", e, if e.kind() == io::ErrorKind::PermissionDenied { @@ -423,7 +383,7 @@ pub fn make_test(s: &str, // send all the errors that libsyntax emits directly into a `Sink` instead of stderr. let cm = Lrc::new(SourceMap::new(FilePathMapping::empty())); let emitter = EmitterWriter::new(box io::sink(), None, false, false); - let handler = Handler::with_emitter(false, false, box emitter); + let handler = Handler::with_emitter(false, None, box emitter); let sess = ParseSess::with_span_handler(handler, cm); let mut found_main = false; @@ -734,35 +694,26 @@ impl Tester for Collector { allow_fail: config.allow_fail, }, testfn: testing::DynTestFn(box move || { - let panic = io::set_panic(None); - let print = io::set_print(None); - match { - rustc_driver::in_named_rustc_thread(name, move || with_globals(move || { - io::set_panic(panic); - io::set_print(print); - run_test(&test, - &cratename, - &filename, - line, - cfgs, - libs, - cg, - externs, - config.should_panic, - config.no_run, - config.test_harness, - config.compile_fail, - config.error_codes, - &opts, - maybe_sysroot, - linker, - edition, - persist_doctests) - })) - } { - Ok(()) => (), - Err(err) => panic::resume_unwind(err), - } + run_test( + &test, + &cratename, + &filename, + line, + cfgs, + libs, + cg, + externs, + config.should_panic, + config.no_run, + config.test_harness, + config.compile_fail, + config.error_codes, + &opts, + maybe_sysroot, + linker, + edition, + persist_doctests + ) }), }); } @@ -868,7 +819,7 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for HirCollector<'a, 'hir> { fn visit_item(&mut self, item: &'hir hir::Item) { let name = if let hir::ItemKind::Impl(.., ref ty, _) = item.node { - self.map.node_to_pretty_string(ty.id) + self.map.hir_to_pretty_string(ty.hir_id) } else { item.ident.to_string() }; diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 2428a823d0b3..0c99f6ddeddf 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -27,10 +27,10 @@ use crate::doctree::*; // Also, is there some reason that this doesn't use the 'visit' // framework from syntax?. -pub struct RustdocVisitor<'a, 'tcx: 'a, 'rcx: 'a> { +pub struct RustdocVisitor<'a, 'tcx> { pub module: Module, pub attrs: hir::HirVec, - pub cx: &'a core::DocContext<'a, 'tcx, 'rcx>, + pub cx: &'a core::DocContext<'tcx>, view_item_stack: FxHashSet, inlining: bool, /// Are the current module and all of its parents public? @@ -38,10 +38,10 @@ pub struct RustdocVisitor<'a, 'tcx: 'a, 'rcx: 'a> { exact_paths: Option>>, } -impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { +impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { pub fn new( - cx: &'a core::DocContext<'a, 'tcx, 'rcx> - ) -> RustdocVisitor<'a, 'tcx, 'rcx> { + cx: &'a core::DocContext<'tcx> + ) -> RustdocVisitor<'a, 'tcx> { // If the root is re-exported, terminate all recursion. let mut stack = FxHashSet::default(); stack.insert(ast::CRATE_NODE_ID); @@ -66,13 +66,13 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { } } - fn stability(&self, id: ast::NodeId) -> Option { - self.cx.tcx.hir().opt_local_def_id(id) + fn stability(&self, id: hir::HirId) -> Option { + self.cx.tcx.hir().opt_local_def_id_from_hir_id(id) .and_then(|def_id| self.cx.tcx.lookup_stability(def_id)).cloned() } - fn deprecation(&self, id: ast::NodeId) -> Option { - self.cx.tcx.hir().opt_local_def_id(id) + fn deprecation(&self, id: hir::HirId) -> Option { + self.cx.tcx.hir().opt_local_def_id_from_hir_id(id) .and_then(|def_id| self.cx.tcx.lookup_deprecation(def_id)) } @@ -83,7 +83,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { krate.attrs.clone(), Spanned { span: syntax_pos::DUMMY_SP, node: hir::VisibilityKind::Public }, - ast::CRATE_NODE_ID, + hir::CRATE_HIR_ID, &krate.module, None); // Attach the crate's exported macros to the top-level module: @@ -101,12 +101,12 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { debug!("Visiting struct"); let struct_type = struct_type_from_def(&*sd); Struct { - id: item.id, + id: item.hir_id, struct_type, name, vis: item.vis.clone(), - stab: self.stability(item.id), - depr: self.deprecation(item.id), + stab: self.stability(item.hir_id), + depr: self.deprecation(item.hir_id), attrs: item.attrs.clone(), generics: generics.clone(), fields: sd.fields().iter().cloned().collect(), @@ -120,12 +120,12 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { debug!("Visiting union"); let struct_type = struct_type_from_def(&*sd); Union { - id: item.id, + id: item.hir_id, struct_type, name, vis: item.vis.clone(), - stab: self.stability(item.id), - depr: self.deprecation(item.id), + stab: self.stability(item.hir_id), + depr: self.deprecation(item.hir_id), attrs: item.attrs.clone(), generics: generics.clone(), fields: sd.fields().iter().cloned().collect(), @@ -142,17 +142,17 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { variants: def.variants.iter().map(|v| Variant { name: v.node.ident.name, attrs: v.node.attrs.clone(), - stab: self.stability(v.node.data.id()), - depr: self.deprecation(v.node.data.id()), + stab: self.stability(v.node.data.hir_id()), + depr: self.deprecation(v.node.data.hir_id()), def: v.node.data.clone(), whence: v.span, }).collect(), vis: it.vis.clone(), - stab: self.stability(it.id), - depr: self.deprecation(it.id), + stab: self.stability(it.hir_id), + depr: self.deprecation(it.hir_id), generics: params.clone(), attrs: it.attrs.clone(), - id: it.id, + id: it.hir_id, whence: it.span, } } @@ -202,21 +202,21 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { om.proc_macros.push(ProcMacro { name, - id: item.id, + id: item.hir_id, kind, helpers, attrs: item.attrs.clone(), whence: item.span, - stab: self.stability(item.id), - depr: self.deprecation(item.id), + stab: self.stability(item.hir_id), + depr: self.deprecation(item.hir_id), }); } None => { om.fns.push(Function { - id: item.id, + id: item.hir_id, vis: item.vis.clone(), - stab: self.stability(item.id), - depr: self.deprecation(item.id), + stab: self.stability(item.hir_id), + depr: self.deprecation(item.hir_id), attrs: item.attrs.clone(), decl: fd.clone(), name, @@ -230,7 +230,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { } pub fn visit_mod_contents(&mut self, span: Span, attrs: hir::HirVec, - vis: hir::Visibility, id: ast::NodeId, + vis: hir::Visibility, id: hir::HirId, m: &hir::Mod, name: Option) -> Module { let mut om = Module::new(name); @@ -240,7 +240,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { om.vis = vis.clone(); om.stab = self.stability(id); om.depr = self.deprecation(id); - om.id = id; + om.id = self.cx.tcx.hir().hir_to_node_id(id); // Keep track of if there were any private modules in the path. let orig_inside_public_path = self.inside_public_path; self.inside_public_path &= vis.node.is_pub(); @@ -262,14 +262,14 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { /// /// Returns `true` if the target has been inlined. fn maybe_inline_local(&mut self, - id: ast::NodeId, + id: hir::HirId, def: Def, renamed: Option, glob: bool, om: &mut Module, please_inline: bool) -> bool { - fn inherits_doc_hidden(cx: &core::DocContext<'_, '_, '_>, mut node: ast::NodeId) -> bool { + fn inherits_doc_hidden(cx: &core::DocContext<'_>, mut node: ast::NodeId) -> bool { while let Some(id) = cx.tcx.hir().get_enclosing_scope(node) { node = id; if cx.tcx.hir().attrs(node).lists("doc").has_word("hidden") { @@ -291,7 +291,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { return false; }; - let use_attrs = tcx.hir().attrs(id); + let use_attrs = tcx.hir().attrs_by_hir_id(id); // Don't inline `doc(hidden)` imports so they can be stripped at a later stage. let is_no_inline = use_attrs.lists("doc").has_word("no_inline") || use_attrs.lists("doc").has_word("hidden"); @@ -357,7 +357,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { Node::ForeignItem(it) if !glob => { // Generate a fresh `extern {}` block if we want to inline a foreign item. om.foreigns.push(hir::ForeignMod { - abi: tcx.hir().get_foreign_abi(it.id), + abi: tcx.hir().get_foreign_abi_by_hir_id(it.hir_id), items: vec![hir::ForeignItem { ident: renamed.unwrap_or(it.ident), .. it.clone() @@ -381,7 +381,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { let ident = renamed.unwrap_or(item.ident); if item.vis.node.is_pub() { - let def_id = self.cx.tcx.hir().local_def_id(item.id); + let def_id = self.cx.tcx.hir().local_def_id_from_hir_id(item.hir_id); self.store_path(def_id); } @@ -401,7 +401,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { _ if self.inlining && !item.vis.node.is_pub() => {} hir::ItemKind::GlobalAsm(..) => {} hir::ItemKind::ExternCrate(orig_name) => { - let def_id = self.cx.tcx.hir().local_def_id(item.id); + let def_id = self.cx.tcx.hir().local_def_id_from_hir_id(item.hir_id); om.extern_crates.push(ExternCrate { cnum: self.cx.tcx.extern_mod_stmt_cnum(def_id) .unwrap_or(LOCAL_CRATE), @@ -436,7 +436,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { } }); let ident = if is_glob { None } else { Some(ident) }; - if self.maybe_inline_local(item.id, + if self.maybe_inline_local(item.hir_id, path.def, ident, is_glob, @@ -448,7 +448,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { om.imports.push(Import { name: ident.name, - id: item.id, + id: item.hir_id, vis: item.vis.clone(), attrs: item.attrs.clone(), path: (**path).clone(), @@ -460,7 +460,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { om.mods.push(self.visit_mod_contents(item.span, item.attrs.clone(), item.vis.clone(), - item.id, + item.hir_id, m, Some(ident.name))); }, @@ -477,12 +477,12 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { ty: ty.clone(), gen: gen.clone(), name: ident.name, - id: item.id, + id: item.hir_id, attrs: item.attrs.clone(), whence: item.span, vis: item.vis.clone(), - stab: self.stability(item.id), - depr: self.deprecation(item.id), + stab: self.stability(item.hir_id), + depr: self.deprecation(item.hir_id), }; om.typedefs.push(t); }, @@ -490,12 +490,12 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { let t = Existential { exist_ty: exist_ty.clone(), name: ident.name, - id: item.id, + id: item.hir_id, attrs: item.attrs.clone(), whence: item.span, vis: item.vis.clone(), - stab: self.stability(item.id), - depr: self.deprecation(item.id), + stab: self.stability(item.hir_id), + depr: self.deprecation(item.hir_id), }; om.existentials.push(t); }, @@ -504,13 +504,13 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { type_: ty.clone(), mutability: mut_.clone(), expr: exp.clone(), - id: item.id, + id: item.hir_id, name: ident.name, attrs: item.attrs.clone(), whence: item.span, vis: item.vis.clone(), - stab: self.stability(item.id), - depr: self.deprecation(item.id), + stab: self.stability(item.hir_id), + depr: self.deprecation(item.hir_id), }; om.statics.push(s); }, @@ -518,13 +518,13 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { let s = Constant { type_: ty.clone(), expr: exp.clone(), - id: item.id, + id: item.hir_id, name: ident.name, attrs: item.attrs.clone(), whence: item.span, vis: item.vis.clone(), - stab: self.stability(item.id), - depr: self.deprecation(item.id), + stab: self.stability(item.hir_id), + depr: self.deprecation(item.hir_id), }; om.constants.push(s); }, @@ -539,12 +539,12 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { items, generics: gen.clone(), bounds: b.iter().cloned().collect(), - id: item.id, + id: item.hir_id, attrs: item.attrs.clone(), whence: item.span, vis: item.vis.clone(), - stab: self.stability(item.id), - depr: self.deprecation(item.id), + stab: self.stability(item.hir_id), + depr: self.deprecation(item.hir_id), }; om.traits.push(t); }, @@ -553,12 +553,12 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { name: ident.name, generics: gen.clone(), bounds: b.iter().cloned().collect(), - id: item.id, + id: item.hir_id, attrs: item.attrs.clone(), whence: item.span, vis: item.vis.clone(), - stab: self.stability(item.id), - depr: self.deprecation(item.id), + stab: self.stability(item.hir_id), + depr: self.deprecation(item.hir_id), }; om.trait_aliases.push(t); }, @@ -585,11 +585,11 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { for_: ty.clone(), items, attrs: item.attrs.clone(), - id: item.id, + id: item.hir_id, whence: item.span, vis: item.vis.clone(), - stab: self.stability(item.id), - depr: self.deprecation(item.id), + stab: self.stability(item.hir_id), + depr: self.deprecation(item.hir_id), }; om.impls.push(i); } @@ -609,13 +609,14 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { let matchers = tts.chunks(4).map(|arm| arm[0].span()).collect(); Macro { - def_id: self.cx.tcx.hir().local_def_id(def.id), + + def_id: self.cx.tcx.hir().local_def_id_from_hir_id(def.hir_id), attrs: def.attrs.clone(), name: renamed.unwrap_or(def.name), whence: def.span, matchers, - stab: self.stability(def.id), - depr: self.deprecation(def.id), + stab: self.stability(def.hir_id), + depr: self.deprecation(def.hir_id), imported_from: None, } } diff --git a/src/librustdoc/visit_lib.rs b/src/librustdoc/visit_lib.rs index f538c58c213e..def6f8b557b5 100644 --- a/src/librustdoc/visit_lib.rs +++ b/src/librustdoc/visit_lib.rs @@ -12,8 +12,8 @@ use crate::clean::{AttributesExt, NestedAttributesExt}; /// Similar to `librustc_privacy::EmbargoVisitor`, but also takes /// specific rustdoc annotations into account (i.e., `doc(hidden)`) -pub struct LibEmbargoVisitor<'a, 'tcx: 'a, 'rcx: 'a> { - cx: &'a crate::core::DocContext<'a, 'tcx, 'rcx>, +pub struct LibEmbargoVisitor<'a, 'tcx> { + cx: &'a crate::core::DocContext<'tcx>, // Accessibility levels for reachable nodes access_levels: RefMut<'a, AccessLevels>, // Previous accessibility level, None means unreachable @@ -22,10 +22,10 @@ pub struct LibEmbargoVisitor<'a, 'tcx: 'a, 'rcx: 'a> { visited_mods: FxHashSet, } -impl<'a, 'tcx, 'rcx> LibEmbargoVisitor<'a, 'tcx, 'rcx> { +impl<'a, 'tcx> LibEmbargoVisitor<'a, 'tcx> { pub fn new( - cx: &'a crate::core::DocContext<'a, 'tcx, 'rcx> - ) -> LibEmbargoVisitor<'a, 'tcx, 'rcx> { + cx: &'a crate::core::DocContext<'tcx> + ) -> LibEmbargoVisitor<'a, 'tcx> { LibEmbargoVisitor { cx, access_levels: RefMut::map(cx.renderinfo.borrow_mut(), |ri| &mut ri.access_levels), diff --git a/src/libstd/Cargo.toml b/src/libstd/Cargo.toml index 7d60a170422b..1a6b58f35b39 100644 --- a/src/libstd/Cargo.toml +++ b/src/libstd/Cargo.toml @@ -6,6 +6,7 @@ build = "build.rs" license = "MIT/Apache-2.0" repository = "https://github.com/rust-lang/rust.git" description = "The Rust Standard Library" +edition = "2018" [lib] name = "std" diff --git a/src/libstd/alloc.rs b/src/libstd/alloc.rs index 8b6e5680c2d6..a13da2901df9 100644 --- a/src/libstd/alloc.rs +++ b/src/libstd/alloc.rs @@ -64,7 +64,8 @@ use core::sync::atomic::{AtomicPtr, Ordering}; use core::{mem, ptr}; use core::ptr::NonNull; -use sys_common::util::dumb_print; + +use crate::sys_common::util::dumb_print; #[stable(feature = "alloc_module", since = "1.28.0")] #[doc(inline)] @@ -208,7 +209,7 @@ pub fn rust_oom(layout: Layout) -> ! { unsafe { mem::transmute(hook) } }; hook(layout); - unsafe { ::sys::abort_internal(); } + unsafe { crate::sys::abort_internal(); } } #[cfg(not(test))] diff --git a/src/libstd/build.rs b/src/libstd/build.rs index 9b4ea0829aa9..726c27321538 100644 --- a/src/libstd/build.rs +++ b/src/libstd/build.rs @@ -1,7 +1,5 @@ #![deny(warnings)] -extern crate cc; - use std::env; fn main() { diff --git a/src/libstd/collections/hash/bench.rs b/src/libstd/collections/hash/bench.rs index 8ca43f8ada21..7f5add054368 100644 --- a/src/libstd/collections/hash/bench.rs +++ b/src/libstd/collections/hash/bench.rs @@ -1,8 +1,6 @@ #![cfg(test)] -extern crate test; - -use self::test::Bencher; +use test::Bencher; #[bench] fn new_drop(b: &mut Bencher) { diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 4fb0235539c4..928de29b297f 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -1,18 +1,18 @@ use self::Entry::*; use self::VacantEntryState::*; -use intrinsics::unlikely; -use collections::CollectionAllocErr; -use cell::Cell; -use borrow::Borrow; -use cmp::max; -use fmt::{self, Debug}; +use crate::intrinsics::unlikely; +use crate::collections::CollectionAllocErr; +use crate::cell::Cell; +use crate::borrow::Borrow; +use crate::cmp::max; +use crate::fmt::{self, Debug}; #[allow(deprecated)] -use hash::{Hash, Hasher, BuildHasher, SipHasher13}; -use iter::{FromIterator, FusedIterator}; -use mem::{self, replace}; -use ops::{Deref, DerefMut, Index}; -use sys; +use crate::hash::{Hash, Hasher, BuildHasher, SipHasher13}; +use crate::iter::{FromIterator, FusedIterator}; +use crate::mem::{self, replace}; +use crate::ops::{Deref, DerefMut, Index}; +use crate::sys; use super::table::{self, Bucket, EmptyBucket, Fallibility, FullBucket, FullBucketMut, RawTable, SafeHash}; @@ -2341,6 +2341,11 @@ pub struct OccupiedEntry<'a, K: 'a, V: 'a> { elem: FullBucket>, } +#[stable(feature = "rust1", since = "1.0.0")] +unsafe impl<'a, K: 'a + Send, V: 'a + Send> Send for OccupiedEntry<'a, K, V> {} +#[stable(feature = "rust1", since = "1.0.0")] +unsafe impl<'a, K: 'a + Sync, V: 'a + Sync> Sync for OccupiedEntry<'a, K, V> {} + #[stable(feature= "debug_hash_map", since = "1.12.0")] impl Debug for OccupiedEntry<'_, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -2362,6 +2367,11 @@ pub struct VacantEntry<'a, K: 'a, V: 'a> { elem: VacantEntryState>, } +#[stable(feature = "rust1", since = "1.0.0")] +unsafe impl<'a, K: 'a + Send, V: 'a + Send> Send for VacantEntry<'a, K, V> {} +#[stable(feature = "rust1", since = "1.0.0")] +unsafe impl<'a, K: 'a + Sync, V: 'a + Sync> Sync for VacantEntry<'a, K, V> {} + #[stable(feature= "debug_hash_map", since = "1.12.0")] impl Debug for VacantEntry<'_, K, V> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -3328,7 +3338,7 @@ mod test_map { use super::HashMap; use super::Entry::{Occupied, Vacant}; use super::RandomState; - use cell::RefCell; + use crate::cell::RefCell; use rand::{thread_rng, Rng}; use realstd::collections::CollectionAllocErr::*; use realstd::mem::size_of; diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index 46a5f26df635..f2111f2d9e02 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -1,8 +1,8 @@ -use borrow::Borrow; -use fmt; -use hash::{Hash, BuildHasher}; -use iter::{Chain, FromIterator, FusedIterator}; -use ops::{BitOr, BitAnd, BitXor, Sub}; +use crate::borrow::Borrow; +use crate::fmt; +use crate::hash::{Hash, BuildHasher}; +use crate::iter::{Chain, FromIterator, FusedIterator}; +use crate::ops::{BitOr, BitAnd, BitXor, Sub}; use super::Recover; use super::map::{self, HashMap, Keys, RandomState}; @@ -850,7 +850,7 @@ impl Default for HashSet } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b, T, S> BitOr<&'b HashSet> for &'a HashSet +impl BitOr<&HashSet> for &HashSet where T: Eq + Hash + Clone, S: BuildHasher + Default { @@ -882,7 +882,7 @@ impl<'a, 'b, T, S> BitOr<&'b HashSet> for &'a HashSet } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b, T, S> BitAnd<&'b HashSet> for &'a HashSet +impl BitAnd<&HashSet> for &HashSet where T: Eq + Hash + Clone, S: BuildHasher + Default { @@ -914,7 +914,7 @@ impl<'a, 'b, T, S> BitAnd<&'b HashSet> for &'a HashSet } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b, T, S> BitXor<&'b HashSet> for &'a HashSet +impl BitXor<&HashSet> for &HashSet where T: Eq + Hash + Clone, S: BuildHasher + Default { @@ -946,7 +946,7 @@ impl<'a, 'b, T, S> BitXor<&'b HashSet> for &'a HashSet } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b, T, S> Sub<&'b HashSet> for &'a HashSet +impl Sub<&HashSet> for &HashSet where T: Eq + Hash + Clone, S: BuildHasher + Default { @@ -1751,7 +1751,7 @@ mod test_set { #[test] fn test_replace() { - use hash; + use crate::hash; #[derive(Debug)] struct Foo(&'static str, i32); diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs index 865431252acf..31e7a6931356 100644 --- a/src/libstd/collections/hash/table.rs +++ b/src/libstd/collections/hash/table.rs @@ -1,12 +1,11 @@ -use alloc::{Global, Alloc, Layout, LayoutErr, handle_alloc_error}; -use collections::CollectionAllocErr; -use hash::{BuildHasher, Hash, Hasher}; -use marker; -use mem::{size_of, needs_drop}; -use mem; -use ops::{Deref, DerefMut}; -use ptr::{self, Unique, NonNull}; -use hint; +use crate::alloc::{Global, Alloc, Layout, LayoutErr, handle_alloc_error}; +use crate::collections::CollectionAllocErr; +use crate::hash::{BuildHasher, Hash, Hasher}; +use crate::marker; +use crate::mem::{self, size_of, needs_drop}; +use crate::ops::{Deref, DerefMut}; +use crate::ptr::{self, Unique, NonNull}; +use crate::hint; use self::BucketState::*; diff --git a/src/libstd/collections/mod.rs b/src/libstd/collections/mod.rs index 9ebeff48426f..286ce2d389b8 100644 --- a/src/libstd/collections/mod.rs +++ b/src/libstd/collections/mod.rs @@ -412,7 +412,7 @@ #[stable(feature = "rust1", since = "1.0.0")] #[rustc_deprecated(reason = "moved to `std::ops::Bound`", since = "1.26.0")] #[doc(hidden)] -pub use ops::Bound; +pub use crate::ops::Bound; #[stable(feature = "rust1", since = "1.0.0")] pub use alloc_crate::collections::{BinaryHeap, BTreeMap, BTreeSet}; #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/env.rs b/src/libstd/env.rs index 543973ab991d..97c67f562a7d 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -13,13 +13,13 @@ #![stable(feature = "env", since = "1.0.0")] -use error::Error; -use ffi::{OsStr, OsString}; -use fmt; -use io; -use path::{Path, PathBuf}; -use sys; -use sys::os as os_imp; +use crate::error::Error; +use crate::ffi::{OsStr, OsString}; +use crate::fmt; +use crate::io; +use crate::path::{Path, PathBuf}; +use crate::sys; +use crate::sys::os as os_imp; /// Returns the current working directory as a [`PathBuf`]. /// @@ -800,7 +800,7 @@ impl fmt::Debug for ArgsOs { /// Constants associated with the current target #[stable(feature = "env", since = "1.0.0")] pub mod consts { - use sys::env::os; + use crate::sys::env::os; /// A string describing the architecture of the CPU that is currently /// in use. @@ -972,7 +972,7 @@ mod arch { mod tests { use super::*; - use path::Path; + use crate::path::Path; #[test] #[cfg_attr(target_os = "emscripten", ignore)] @@ -995,7 +995,7 @@ mod tests { #[test] #[cfg(windows)] fn split_paths_windows() { - use path::PathBuf; + use crate::path::PathBuf; fn check_parse(unparsed: &str, parsed: &[&str]) -> bool { split_paths(unparsed).collect::>() == @@ -1017,7 +1017,7 @@ mod tests { #[test] #[cfg(unix)] fn split_paths_unix() { - use path::PathBuf; + use crate::path::PathBuf; fn check_parse(unparsed: &str, parsed: &[&str]) -> bool { split_paths(unparsed).collect::>() == @@ -1034,7 +1034,7 @@ mod tests { #[test] #[cfg(unix)] fn join_paths_unix() { - use ffi::OsStr; + use crate::ffi::OsStr; fn test_eq(input: &[&str], output: &str) -> bool { &*join_paths(input.iter().cloned()).unwrap() == @@ -1052,7 +1052,7 @@ mod tests { #[test] #[cfg(windows)] fn join_paths_windows() { - use ffi::OsStr; + use crate::ffi::OsStr; fn test_eq(input: &[&str], output: &str) -> bool { &*join_paths(input.iter().cloned()).unwrap() == diff --git a/src/libstd/error.rs b/src/libstd/error.rs index ef8c97bebdff..3eb289501cb0 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -13,17 +13,18 @@ // coherence challenge (e.g., specialization, neg impls, etc) we can // reconsider what crate these items belong in. -use alloc::{AllocErr, LayoutErr, CannotReallocInPlace}; -use any::TypeId; -use borrow::Cow; -use cell; -use char; use core::array; -use fmt::{self, Debug, Display}; -use mem::transmute; -use num; -use str; -use string; + +use crate::alloc::{AllocErr, LayoutErr, CannotReallocInPlace}; +use crate::any::TypeId; +use crate::borrow::Cow; +use crate::cell; +use crate::char; +use crate::fmt::{self, Debug, Display}; +use crate::mem::transmute; +use crate::num; +use crate::str; +use crate::string; /// `Error` is a trait representing the basic expectations for error values, /// i.e., values of type `E` in [`Result`]. Errors must describe @@ -336,7 +337,7 @@ impl From for Box { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, 'b> From<&'b str> for Box { +impl<'a> From<&str> for Box { /// Converts a [`str`] into a box of dyn [`Error`] + [`Send`] + [`Sync`]. /// /// # Examples @@ -350,13 +351,13 @@ impl<'a, 'b> From<&'b str> for Box { /// assert!( /// mem::size_of::>() == mem::size_of_val(&a_boxed_error)) /// ``` - fn from(err: &'b str) -> Box { + fn from(err: &str) -> Box { From::from(String::from(err)) } } #[stable(feature = "string_box_error", since = "1.6.0")] -impl<'a> From<&'a str> for Box { +impl From<&str> for Box { /// Converts a [`str`] into a box of dyn [`Error`]. /// /// # Examples @@ -369,7 +370,7 @@ impl<'a> From<&'a str> for Box { /// let a_boxed_error = Box::::from(a_str_error); /// assert!(mem::size_of::>() == mem::size_of_val(&a_boxed_error)) /// ``` - fn from(err: &'a str) -> Box { + fn from(err: &str) -> Box { From::from(String::from(err)) } } @@ -466,14 +467,14 @@ impl Error for num::ParseIntError { } } -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] impl Error for num::TryFromIntError { fn description(&self) -> &str { self.__description() } } -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] impl Error for array::TryFromSliceError { fn description(&self) -> &str { self.__description() @@ -548,7 +549,7 @@ impl Error for cell::BorrowMutError { } } -#[unstable(feature = "try_from", issue = "33417")] +#[stable(feature = "try_from", since = "1.34.0")] impl Error for char::CharTryFromError { fn description(&self) -> &str { "converted integer out of range for `char`" @@ -852,7 +853,7 @@ impl dyn Error + Send + Sync { #[cfg(test)] mod tests { use super::Error; - use fmt; + use crate::fmt; #[derive(Debug, PartialEq)] struct A; diff --git a/src/libstd/f32.rs b/src/libstd/f32.rs index cb1f93581775..f6cd9e82abd4 100644 --- a/src/libstd/f32.rs +++ b/src/libstd/f32.rs @@ -9,9 +9,9 @@ #![allow(missing_docs)] #[cfg(not(test))] -use intrinsics; +use crate::intrinsics; #[cfg(not(test))] -use sys::cmath; +use crate::sys::cmath; #[stable(feature = "rust1", since = "1.0.0")] pub use core::f32::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON}; @@ -488,7 +488,7 @@ impl f32 { #[inline] pub fn log2(self) -> f32 { #[cfg(target_os = "android")] - return ::sys::android::log2f32(self); + return crate::sys::android::log2f32(self); #[cfg(not(target_os = "android"))] return unsafe { intrinsics::log2f32(self) }; } @@ -932,7 +932,7 @@ impl f32 { #[inline] pub fn acosh(self) -> f32 { match self { - x if x < 1.0 => ::f32::NAN, + x if x < 1.0 => crate::f32::NAN, x => (x + ((x * x) - 1.0).sqrt()).ln(), } } @@ -960,10 +960,10 @@ impl f32 { #[cfg(test)] mod tests { - use f32; - use f32::*; - use num::*; - use num::FpCategory as Fp; + use crate::f32; + use crate::f32::*; + use crate::num::*; + use crate::num::FpCategory as Fp; #[test] fn test_num_f32() { diff --git a/src/libstd/f64.rs b/src/libstd/f64.rs index 7fa7b8075193..8ff97ab828a7 100644 --- a/src/libstd/f64.rs +++ b/src/libstd/f64.rs @@ -9,9 +9,9 @@ #![allow(missing_docs)] #[cfg(not(test))] -use intrinsics; +use crate::intrinsics; #[cfg(not(test))] -use sys::cmath; +use crate::sys::cmath; #[stable(feature = "rust1", since = "1.0.0")] pub use core::f64::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON}; @@ -436,7 +436,7 @@ impl f64 { pub fn log2(self) -> f64 { self.log_wrapper(|n| { #[cfg(target_os = "android")] - return ::sys::android::log2f64(n); + return crate::sys::android::log2f64(n); #[cfg(not(target_os = "android"))] return unsafe { intrinsics::log2f64(n) }; }) @@ -906,10 +906,10 @@ impl f64 { #[cfg(test)] mod tests { - use f64; - use f64::*; - use num::*; - use num::FpCategory as Fp; + use crate::f64; + use crate::f64::*; + use crate::num::*; + use crate::num::FpCategory as Fp; #[test] fn test_num_f64() { diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 0ef722428278..ad3f45bfadaf 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -1,19 +1,19 @@ -use ascii; -use borrow::{Cow, Borrow}; -use cmp::Ordering; -use error::Error; -use fmt::{self, Write}; -use io; -use mem; -use memchr; -use ops; -use os::raw::c_char; -use ptr; -use rc::Rc; -use slice; -use str::{self, Utf8Error}; -use sync::Arc; -use sys; +use crate::ascii; +use crate::borrow::{Cow, Borrow}; +use crate::cmp::Ordering; +use crate::error::Error; +use crate::fmt::{self, Write}; +use crate::io; +use crate::mem; +use crate::memchr; +use crate::ops; +use crate::os::raw::c_char; +use crate::ptr; +use crate::rc::Rc; +use crate::slice; +use crate::str::{self, Utf8Error}; +use crate::sync::Arc; +use crate::sys; /// A type representing an owned, C-compatible, nul-terminated string with no nul bytes in the /// middle. @@ -690,8 +690,8 @@ impl<'a> From> for CString { } #[stable(feature = "box_from_c_str", since = "1.17.0")] -impl<'a> From<&'a CStr> for Box { - fn from(s: &'a CStr) -> Box { +impl From<&CStr> for Box { + fn from(s: &CStr) -> Box { let boxed: Box<[u8]> = Box::from(s.to_bytes_with_nul()); unsafe { Box::from_raw(Box::into_raw(boxed) as *mut CStr) } } @@ -767,7 +767,7 @@ impl From for Arc { } #[stable(feature = "shared_from_slice2", since = "1.24.0")] -impl<'a> From<&'a CStr> for Arc { +impl From<&CStr> for Arc { #[inline] fn from(s: &CStr) -> Arc { let arc: Arc<[u8]> = Arc::from(s.to_bytes_with_nul()); @@ -789,7 +789,7 @@ impl From for Rc { } #[stable(feature = "shared_from_slice2", since = "1.24.0")] -impl<'a> From<&'a CStr> for Rc { +impl From<&CStr> for Rc { #[inline] fn from(s: &CStr) -> Rc { let rc: Rc<[u8]> = Rc::from(s.to_bytes_with_nul()); @@ -1268,8 +1268,8 @@ impl ToOwned for CStr { } #[stable(feature = "cstring_asref", since = "1.7.0")] -impl<'a> From<&'a CStr> for CString { - fn from(s: &'a CStr) -> CString { +impl From<&CStr> for CString { + fn from(s: &CStr) -> CString { s.to_owned() } } @@ -1303,12 +1303,12 @@ impl AsRef for CString { #[cfg(test)] mod tests { use super::*; - use os::raw::c_char; - use borrow::Cow::{Borrowed, Owned}; - use hash::{Hash, Hasher}; - use collections::hash_map::DefaultHasher; - use rc::Rc; - use sync::Arc; + use crate::os::raw::c_char; + use crate::borrow::Cow::{Borrowed, Owned}; + use crate::hash::{Hash, Hasher}; + use crate::collections::hash_map::DefaultHasher; + use crate::rc::Rc; + use crate::sync::Arc; #[test] fn c_to_rust() { diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index 81433832ffc7..3a0590021c91 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -1,13 +1,13 @@ -use borrow::{Borrow, Cow}; -use fmt; -use ops; -use cmp; -use hash::{Hash, Hasher}; -use rc::Rc; -use sync::Arc; +use crate::borrow::{Borrow, Cow}; +use crate::fmt; +use crate::ops; +use crate::cmp; +use crate::hash::{Hash, Hasher}; +use crate::rc::Rc; +use crate::sync::Arc; -use sys::os_str::{Buf, Slice}; -use sys_common::{AsInner, IntoInner, FromInner}; +use crate::sys::os_str::{Buf, Slice}; +use crate::sys_common::{AsInner, IntoInner, FromInner}; /// A type that can represent owned, mutable platform-native strings, but is /// cheaply inter-convertible with Rust strings. @@ -357,8 +357,8 @@ impl From for OsString { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T: ?Sized + AsRef> From<&'a T> for OsString { - fn from(s: &'a T) -> OsString { +impl> From<&T> for OsString { + fn from(s: &T) -> OsString { s.as_ref().to_os_string() } } @@ -421,8 +421,8 @@ impl PartialEq for str { } #[stable(feature = "os_str_str_ref_eq", since = "1.29.0")] -impl<'a> PartialEq<&'a str> for OsString { - fn eq(&self, other: &&'a str) -> bool { +impl PartialEq<&str> for OsString { + fn eq(&self, other: &&str) -> bool { **self == **other } } @@ -656,8 +656,8 @@ impl OsStr { } #[stable(feature = "box_from_os_str", since = "1.17.0")] -impl<'a> From<&'a OsStr> for Box { - fn from(s: &'a OsStr) -> Box { +impl From<&OsStr> for Box { + fn from(s: &OsStr) -> Box { let rw = Box::into_raw(s.inner.into_box()) as *mut OsStr; unsafe { Box::from_raw(rw) } } @@ -707,7 +707,7 @@ impl From for Arc { } #[stable(feature = "shared_from_slice2", since = "1.24.0")] -impl<'a> From<&'a OsStr> for Arc { +impl From<&OsStr> for Arc { #[inline] fn from(s: &OsStr) -> Arc { let arc = s.inner.into_arc(); @@ -729,7 +729,7 @@ impl From for Rc { } #[stable(feature = "shared_from_slice2", since = "1.24.0")] -impl<'a> From<&'a OsStr> for Rc { +impl From<&OsStr> for Rc { #[inline] fn from(s: &OsStr) -> Rc { let rc = s.inner.into_rc(); @@ -968,10 +968,10 @@ impl AsInner for OsStr { #[cfg(test)] mod tests { use super::*; - use sys_common::{AsInner, IntoInner}; + use crate::sys_common::{AsInner, IntoInner}; - use rc::Rc; - use sync::Arc; + use crate::rc::Rc; + use crate::sync::Arc; #[test] fn test_os_string_with_capacity() { diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 79b5686faac6..25f2dd73504a 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -7,13 +7,13 @@ #![stable(feature = "rust1", since = "1.0.0")] -use fmt; -use ffi::OsString; -use io::{self, SeekFrom, Seek, Read, Initializer, Write}; -use path::{Path, PathBuf}; -use sys::fs as fs_imp; -use sys_common::{AsInnerMut, FromInner, AsInner, IntoInner}; -use time::SystemTime; +use crate::fmt; +use crate::ffi::OsString; +use crate::io::{self, SeekFrom, Seek, Read, Initializer, Write}; +use crate::path::{Path, PathBuf}; +use crate::sys::fs as fs_imp; +use crate::sys_common::{AsInnerMut, FromInner, AsInner, IntoInner}; +use crate::time::SystemTime; /// A reference to an open file on the filesystem. /// @@ -2096,26 +2096,27 @@ impl AsInnerMut for DirBuilder { #[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten"))))] mod tests { - use io::prelude::*; + use crate::io::prelude::*; + + use crate::fs::{self, File, OpenOptions}; + use crate::io::{ErrorKind, SeekFrom}; + use crate::path::Path; + use crate::str; + use crate::sys_common::io::test::{TempDir, tmpdir}; + use crate::thread; - use fs::{self, File, OpenOptions}; - use io::{ErrorKind, SeekFrom}; - use path::Path; use rand::{rngs::StdRng, FromEntropy, RngCore}; - use str; - use sys_common::io::test::{TempDir, tmpdir}; - use thread; #[cfg(windows)] - use os::windows::fs::{symlink_dir, symlink_file}; + use crate::os::windows::fs::{symlink_dir, symlink_file}; #[cfg(windows)] - use sys::fs::symlink_junction; + use crate::sys::fs::symlink_junction; #[cfg(unix)] - use os::unix::fs::symlink as symlink_dir; + use crate::os::unix::fs::symlink as symlink_dir; #[cfg(unix)] - use os::unix::fs::symlink as symlink_file; + use crate::os::unix::fs::symlink as symlink_file; #[cfg(unix)] - use os::unix::fs::symlink as symlink_junction; + use crate::os::unix::fs::symlink as symlink_junction; macro_rules! check { ($e:expr) => ( match $e { @@ -2334,7 +2335,7 @@ mod tests { #[test] #[cfg(unix)] fn file_test_io_read_write_at() { - use os::unix::fs::FileExt; + use crate::os::unix::fs::FileExt; let tmpdir = tmpdir(); let filename = tmpdir.join("file_rt_io_file_test_read_write_at.txt"); @@ -2390,7 +2391,7 @@ mod tests { #[test] #[cfg(unix)] fn set_get_unix_permissions() { - use os::unix::fs::PermissionsExt; + use crate::os::unix::fs::PermissionsExt; let tmpdir = tmpdir(); let filename = &tmpdir.join("set_get_unix_permissions"); @@ -2411,7 +2412,7 @@ mod tests { #[test] #[cfg(windows)] fn file_test_io_seek_read_write() { - use os::windows::fs::FileExt; + use crate::os::windows::fs::FileExt; let tmpdir = tmpdir(); let filename = tmpdir.join("file_rt_io_file_test_seek_read_write.txt"); @@ -3013,7 +3014,7 @@ mod tests { #[test] fn open_flavors() { - use fs::OpenOptions as OO; + use crate::fs::OpenOptions as OO; fn c(t: &T) -> T { t.clone() } let tmpdir = tmpdir(); diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index 0c1d155a9168..a14c10d0b61e 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -1,12 +1,12 @@ //! Buffering wrappers for I/O traits -use io::prelude::*; +use crate::io::prelude::*; -use cmp; -use error; -use fmt; -use io::{self, Initializer, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom}; -use memchr; +use crate::cmp; +use crate::error; +use crate::fmt; +use crate::io::{self, Initializer, DEFAULT_BUF_SIZE, Error, ErrorKind, SeekFrom, IoVec, IoVecMut}; +use crate::memchr; /// The `BufReader` struct adds buffering to any reader. /// @@ -101,7 +101,9 @@ impl BufReader { } } } +} +impl BufReader { /// Gets a reference to the underlying reader. /// /// It is inadvisable to directly read from the underlying reader. @@ -235,6 +237,19 @@ impl Read for BufReader { Ok(nread) } + fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + let total_len = bufs.iter().map(|b| b.len()).sum::(); + if self.pos == self.cap && total_len >= self.buf.len() { + return self.inner.read_vectored(bufs); + } + let nread = { + let mut rem = self.fill_buf()?; + rem.read_vectored(bufs)? + }; + self.consume(nread); + Ok(nread) + } + // we can't skip unconditionally because of the large buffer case in read. unsafe fn initializer(&self) -> Initializer { self.inner.initializer() @@ -577,9 +592,25 @@ impl Write for BufWriter { self.panicked = false; r } else { - Write::write(&mut self.buf, buf) + self.buf.write(buf) } } + + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + let total_len = bufs.iter().map(|b| b.len()).sum::(); + if self.buf.len() + total_len > self.buf.capacity() { + self.flush_buf()?; + } + if total_len >= self.buf.capacity() { + self.panicked = true; + let r = self.inner.as_mut().unwrap().write_vectored(bufs); + self.panicked = false; + r + } else { + self.buf.write_vectored(bufs) + } + } + fn flush(&mut self) -> io::Result<()> { self.flush_buf().and_then(|()| self.get_mut().flush()) } @@ -948,11 +979,10 @@ impl fmt::Debug for LineWriter where W: fmt::Debug { #[cfg(test)] mod tests { - use io::prelude::*; - use io::{self, BufReader, BufWriter, LineWriter, SeekFrom}; - use sync::atomic::{AtomicUsize, Ordering}; - use thread; - use test; + use crate::io::prelude::*; + use crate::io::{self, BufReader, BufWriter, LineWriter, SeekFrom}; + use crate::sync::atomic::{AtomicUsize, Ordering}; + use crate::thread; /// A dummy reader intended at testing short-reads propagation. pub struct ShortReader { diff --git a/src/libstd/io/cursor.rs b/src/libstd/io/cursor.rs index 758d85686729..873da0898c7f 100644 --- a/src/libstd/io/cursor.rs +++ b/src/libstd/io/cursor.rs @@ -1,8 +1,9 @@ -use io::prelude::*; +use crate::io::prelude::*; + +use crate::cmp; +use crate::io::{self, Initializer, SeekFrom, Error, ErrorKind, IoVec, IoVecMut}; use core::convert::TryInto; -use cmp; -use io::{self, Initializer, SeekFrom, Error, ErrorKind}; /// A `Cursor` wraps an in-memory buffer and provides it with a /// [`Seek`] implementation. @@ -221,6 +222,18 @@ impl Read for Cursor where T: AsRef<[u8]> { Ok(n) } + fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + let mut nread = 0; + for buf in bufs { + let n = self.read(buf)?; + nread += n; + if n < buf.len() { + break; + } + } + Ok(nread) + } + fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> { let n = buf.len(); Read::read_exact(&mut self.fill_buf()?, buf)?; @@ -251,6 +264,23 @@ fn slice_write(pos_mut: &mut u64, slice: &mut [u8], buf: &[u8]) -> io::Result], +) -> io::Result +{ + let mut nwritten = 0; + for buf in bufs { + let n = slice_write(pos_mut, slice, buf)?; + nwritten += n; + if n < buf.len() { + break; + } + } + Ok(nwritten) +} + // Resizing write implementation fn vec_write(pos_mut: &mut u64, vec: &mut Vec, buf: &[u8]) -> io::Result { let pos: usize = (*pos_mut).try_into().map_err(|_| { @@ -278,12 +308,31 @@ fn vec_write(pos_mut: &mut u64, vec: &mut Vec, buf: &[u8]) -> io::Result, + bufs: &[IoVec<'_>], +) -> io::Result +{ + let mut nwritten = 0; + for buf in bufs { + nwritten += vec_write(pos_mut, vec, buf)?; + } + Ok(nwritten) +} + #[stable(feature = "rust1", since = "1.0.0")] impl Write for Cursor<&mut [u8]> { #[inline] fn write(&mut self, buf: &[u8]) -> io::Result { slice_write(&mut self.pos, self.inner, buf) } + + #[inline] + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + slice_write_vectored(&mut self.pos, self.inner, bufs) + } + fn flush(&mut self) -> io::Result<()> { Ok(()) } } @@ -292,6 +341,11 @@ impl Write for Cursor<&mut Vec> { fn write(&mut self, buf: &[u8]) -> io::Result { vec_write(&mut self.pos, self.inner, buf) } + + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + vec_write_vectored(&mut self.pos, self.inner, bufs) + } + fn flush(&mut self) -> io::Result<()> { Ok(()) } } @@ -300,6 +354,11 @@ impl Write for Cursor> { fn write(&mut self, buf: &[u8]) -> io::Result { vec_write(&mut self.pos, &mut self.inner, buf) } + + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + vec_write_vectored(&mut self.pos, &mut self.inner, bufs) + } + fn flush(&mut self) -> io::Result<()> { Ok(()) } } @@ -309,13 +368,19 @@ impl Write for Cursor> { fn write(&mut self, buf: &[u8]) -> io::Result { slice_write(&mut self.pos, &mut self.inner, buf) } + + #[inline] + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + slice_write_vectored(&mut self.pos, &mut self.inner, bufs) + } + fn flush(&mut self) -> io::Result<()> { Ok(()) } } #[cfg(test)] mod tests { - use io::prelude::*; - use io::{Cursor, SeekFrom}; + use crate::io::prelude::*; + use crate::io::{Cursor, SeekFrom, IoVec, IoVecMut}; #[test] fn test_vec_writer() { @@ -323,7 +388,10 @@ mod tests { assert_eq!(writer.write(&[0]).unwrap(), 1); assert_eq!(writer.write(&[1, 2, 3]).unwrap(), 3); assert_eq!(writer.write(&[4, 5, 6, 7]).unwrap(), 4); - let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7]; + assert_eq!(writer.write_vectored( + &[IoVec::new(&[]), IoVec::new(&[8, 9]), IoVec::new(&[10])], + ).unwrap(), 3); + let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; assert_eq!(writer, b); } @@ -333,7 +401,10 @@ mod tests { assert_eq!(writer.write(&[0]).unwrap(), 1); assert_eq!(writer.write(&[1, 2, 3]).unwrap(), 3); assert_eq!(writer.write(&[4, 5, 6, 7]).unwrap(), 4); - let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7]; + assert_eq!(writer.write_vectored( + &[IoVec::new(&[]), IoVec::new(&[8, 9]), IoVec::new(&[10])], + ).unwrap(), 3); + let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; assert_eq!(&writer.get_ref()[..], b); } @@ -344,7 +415,10 @@ mod tests { assert_eq!(writer.write(&[0]).unwrap(), 1); assert_eq!(writer.write(&[1, 2, 3]).unwrap(), 3); assert_eq!(writer.write(&[4, 5, 6, 7]).unwrap(), 4); - let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7]; + assert_eq!(writer.write_vectored( + &[IoVec::new(&[]), IoVec::new(&[8, 9]), IoVec::new(&[10])], + ).unwrap(), 3); + let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; assert_eq!(&writer.get_ref()[..], b); } @@ -366,6 +440,26 @@ mod tests { assert_eq!(&**writer.get_ref(), b); } + #[test] + fn test_box_slice_writer_vectored() { + let mut writer = Cursor::new(vec![0u8; 9].into_boxed_slice()); + assert_eq!(writer.position(), 0); + assert_eq!(writer.write_vectored(&[IoVec::new(&[0])]).unwrap(), 1); + assert_eq!(writer.position(), 1); + assert_eq!( + writer.write_vectored(&[IoVec::new(&[1, 2, 3]), IoVec::new(&[4, 5, 6, 7])]).unwrap(), + 7, + ); + assert_eq!(writer.position(), 8); + assert_eq!(writer.write_vectored(&[]).unwrap(), 0); + assert_eq!(writer.position(), 8); + + assert_eq!(writer.write_vectored(&[IoVec::new(&[8, 9])]).unwrap(), 1); + assert_eq!(writer.write_vectored(&[IoVec::new(&[10])]).unwrap(), 0); + let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8]; + assert_eq!(&**writer.get_ref(), b); + } + #[test] fn test_buf_writer() { let mut buf = [0 as u8; 9]; @@ -387,6 +481,31 @@ mod tests { assert_eq!(buf, b); } + #[test] + fn test_buf_writer_vectored() { + let mut buf = [0 as u8; 9]; + { + let mut writer = Cursor::new(&mut buf[..]); + assert_eq!(writer.position(), 0); + assert_eq!(writer.write_vectored(&[IoVec::new(&[0])]).unwrap(), 1); + assert_eq!(writer.position(), 1); + assert_eq!( + writer.write_vectored( + &[IoVec::new(&[1, 2, 3]), IoVec::new(&[4, 5, 6, 7])], + ).unwrap(), + 7, + ); + assert_eq!(writer.position(), 8); + assert_eq!(writer.write_vectored(&[]).unwrap(), 0); + assert_eq!(writer.position(), 8); + + assert_eq!(writer.write_vectored(&[IoVec::new(&[8, 9])]).unwrap(), 1); + assert_eq!(writer.write_vectored(&[IoVec::new(&[10])]).unwrap(), 0); + } + let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7, 8]; + assert_eq!(buf, b); + } + #[test] fn test_buf_writer_seek() { let mut buf = [0 as u8; 8]; @@ -447,6 +566,35 @@ mod tests { assert_eq!(reader.read(&mut buf).unwrap(), 0); } + #[test] + fn test_mem_reader_vectored() { + let mut reader = Cursor::new(vec![0, 1, 2, 3, 4, 5, 6, 7]); + let mut buf = []; + assert_eq!(reader.read_vectored(&mut [IoVecMut::new(&mut buf)]).unwrap(), 0); + assert_eq!(reader.position(), 0); + let mut buf = [0]; + assert_eq!( + reader.read_vectored(&mut [IoVecMut::new(&mut []), IoVecMut::new(&mut buf)]).unwrap(), + 1, + ); + assert_eq!(reader.position(), 1); + let b: &[_] = &[0]; + assert_eq!(buf, b); + let mut buf1 = [0; 4]; + let mut buf2 = [0; 4]; + assert_eq!( + reader.read_vectored( + &mut [IoVecMut::new(&mut buf1), IoVecMut::new(&mut buf2)], + ).unwrap(), + 7, + ); + let b1: &[_] = &[1, 2, 3, 4]; + let b2: &[_] = &[5, 6, 7]; + assert_eq!(buf1, b1); + assert_eq!(&buf2[..3], b2); + assert_eq!(reader.read(&mut buf).unwrap(), 0); + } + #[test] fn test_boxed_slice_reader() { let mut reader = Cursor::new(vec![0, 1, 2, 3, 4, 5, 6, 7].into_boxed_slice()); @@ -469,6 +617,35 @@ mod tests { assert_eq!(reader.read(&mut buf).unwrap(), 0); } + #[test] + fn test_boxed_slice_reader_vectored() { + let mut reader = Cursor::new(vec![0, 1, 2, 3, 4, 5, 6, 7].into_boxed_slice()); + let mut buf = []; + assert_eq!(reader.read_vectored(&mut [IoVecMut::new(&mut buf)]).unwrap(), 0); + assert_eq!(reader.position(), 0); + let mut buf = [0]; + assert_eq!( + reader.read_vectored(&mut [IoVecMut::new(&mut []), IoVecMut::new(&mut buf)]).unwrap(), + 1, + ); + assert_eq!(reader.position(), 1); + let b: &[_] = &[0]; + assert_eq!(buf, b); + let mut buf1 = [0; 4]; + let mut buf2 = [0; 4]; + assert_eq!( + reader.read_vectored( + &mut [IoVecMut::new(&mut buf1), IoVecMut::new(&mut buf2)], + ).unwrap(), + 7, + ); + let b1: &[_] = &[1, 2, 3, 4]; + let b2: &[_] = &[5, 6, 7]; + assert_eq!(buf1, b1); + assert_eq!(&buf2[..3], b2); + assert_eq!(reader.read(&mut buf).unwrap(), 0); + } + #[test] fn read_to_end() { let mut reader = Cursor::new(vec![0, 1, 2, 3, 4, 5, 6, 7]); @@ -499,6 +676,35 @@ mod tests { assert_eq!(reader.read(&mut buf).unwrap(), 0); } + #[test] + fn test_slice_reader_vectored() { + let in_buf = vec![0, 1, 2, 3, 4, 5, 6, 7]; + let reader = &mut &in_buf[..]; + let mut buf = []; + assert_eq!(reader.read_vectored(&mut [IoVecMut::new(&mut buf)]).unwrap(), 0); + let mut buf = [0]; + assert_eq!( + reader.read_vectored(&mut [IoVecMut::new(&mut []), IoVecMut::new(&mut buf)]).unwrap(), + 1, + ); + assert_eq!(reader.len(), 7); + let b: &[_] = &[0]; + assert_eq!(buf, b); + let mut buf1 = [0; 4]; + let mut buf2 = [0; 4]; + assert_eq!( + reader.read_vectored( + &mut [IoVecMut::new(&mut buf1), IoVecMut::new(&mut buf2)], + ).unwrap(), + 7, + ); + let b1: &[_] = &[1, 2, 3, 4]; + let b2: &[_] = &[5, 6, 7]; + assert_eq!(buf1, b1); + assert_eq!(&buf2[..3], b2); + assert_eq!(reader.read(&mut buf).unwrap(), 0); + } + #[test] fn test_read_exact() { let in_buf = vec![0, 1, 2, 3, 4, 5, 6, 7]; diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs index e9b4f60182c4..614b79124cc6 100644 --- a/src/libstd/io/error.rs +++ b/src/libstd/io/error.rs @@ -1,8 +1,8 @@ -use error; -use fmt; -use result; -use sys; -use convert::From; +use crate::error; +use crate::fmt; +use crate::result; +use crate::sys; +use crate::convert::From; /// A specialized [`Result`](../result/enum.Result.html) type for I/O /// operations. @@ -556,6 +556,14 @@ impl error::Error for Error { Repr::Custom(ref c) => c.error.cause(), } } + + fn source(&self) -> Option<&(dyn error::Error + 'static)> { + match self.repr { + Repr::Os(..) => None, + Repr::Simple(..) => None, + Repr::Custom(ref c) => c.error.source(), + } + } } fn _assert_error_is_sync_send() { @@ -566,10 +574,10 @@ fn _assert_error_is_sync_send() { #[cfg(test)] mod test { use super::{Error, ErrorKind, Repr, Custom}; - use error; - use fmt; - use sys::os::error_string; - use sys::decode_error_kind; + use crate::error; + use crate::fmt; + use crate::sys::os::error_string; + use crate::sys::decode_error_kind; #[test] fn test_debug_error() { diff --git a/src/libstd/io/impls.rs b/src/libstd/io/impls.rs index 2577b284714a..b286e4016da7 100644 --- a/src/libstd/io/impls.rs +++ b/src/libstd/io/impls.rs @@ -1,7 +1,8 @@ -use cmp; -use io::{self, SeekFrom, Read, Initializer, Write, Seek, BufRead, Error, ErrorKind}; -use fmt; -use mem; +use crate::cmp; +use crate::io::{self, SeekFrom, Read, Initializer, Write, Seek, BufRead, Error, ErrorKind, IoVecMut, + IoVec}; +use crate::fmt; +use crate::mem; // ============================================================================= // Forwarding implementations @@ -13,6 +14,11 @@ impl Read for &mut R { (**self).read(buf) } + #[inline] + fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + (**self).read_vectored(bufs) + } + #[inline] unsafe fn initializer(&self) -> Initializer { (**self).initializer() @@ -38,6 +44,11 @@ impl Write for &mut W { #[inline] fn write(&mut self, buf: &[u8]) -> io::Result { (**self).write(buf) } + #[inline] + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + (**self).write_vectored(bufs) + } + #[inline] fn flush(&mut self) -> io::Result<()> { (**self).flush() } @@ -82,6 +93,11 @@ impl Read for Box { (**self).read(buf) } + #[inline] + fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + (**self).read_vectored(bufs) + } + #[inline] unsafe fn initializer(&self) -> Initializer { (**self).initializer() @@ -107,6 +123,11 @@ impl Write for Box { #[inline] fn write(&mut self, buf: &[u8]) -> io::Result { (**self).write(buf) } + #[inline] + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + (**self).write_vectored(bufs) + } + #[inline] fn flush(&mut self) -> io::Result<()> { (**self).flush() } @@ -144,6 +165,20 @@ impl BufRead for Box { } } +// Used by panicking::default_hook +#[cfg(test)] +/// This impl is only used by printing logic, so any error returned is always +/// of kind `Other`, and should be ignored. +impl Write for Box { + fn write(&mut self, buf: &[u8]) -> io::Result { + (**self).write(buf).map_err(|_| ErrorKind::Other.into()) + } + + fn flush(&mut self) -> io::Result<()> { + (**self).flush().map_err(|_| ErrorKind::Other.into()) + } +} + // ============================================================================= // In-memory buffer implementations @@ -171,6 +206,19 @@ impl Read for &[u8] { Ok(amt) } + #[inline] + fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + let mut nread = 0; + for buf in bufs { + nread += self.read(buf)?; + if self.is_empty() { + break; + } + } + + Ok(nread) + } + #[inline] unsafe fn initializer(&self) -> Initializer { Initializer::nop() @@ -231,6 +279,19 @@ impl Write for &mut [u8] { Ok(amt) } + #[inline] + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + let mut nwritten = 0; + for buf in bufs { + nwritten += self.write(buf)?; + if self.is_empty() { + break; + } + } + + Ok(nwritten) + } + #[inline] fn write_all(&mut self, data: &[u8]) -> io::Result<()> { if self.write(data)? == data.len() { @@ -254,6 +315,16 @@ impl Write for Vec { Ok(buf.len()) } + #[inline] + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + let len = bufs.iter().map(|b| b.len()).sum(); + self.reserve(len); + for buf in bufs { + self.extend_from_slice(buf); + } + Ok(len) + } + #[inline] fn write_all(&mut self, buf: &[u8]) -> io::Result<()> { self.extend_from_slice(buf); @@ -266,8 +337,7 @@ impl Write for Vec { #[cfg(test)] mod tests { - use io::prelude::*; - use test; + use crate::io::prelude::*; #[bench] fn bench_read_slice(b: &mut test::Bencher) { diff --git a/src/libstd/io/lazy.rs b/src/libstd/io/lazy.rs index e3ebe82e3dac..e864aa2c864b 100644 --- a/src/libstd/io/lazy.rs +++ b/src/libstd/io/lazy.rs @@ -1,8 +1,8 @@ -use cell::Cell; -use ptr; -use sync::Arc; -use sys_common; -use sys_common::mutex::Mutex; +use crate::cell::Cell; +use crate::ptr; +use crate::sync::Arc; +use crate::sys_common; +use crate::sys_common::mutex::Mutex; pub struct Lazy { // We never call `lock.init()`, so it is UB to attempt to acquire this mutex reentrantly! diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index b634ea43e34e..e3e2754a7aa0 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -259,12 +259,14 @@ #![stable(feature = "rust1", since = "1.0.0")] -use cmp; -use fmt; -use slice; -use str; -use memchr; -use ptr; +use crate::cmp; +use crate::fmt; +use crate::slice; +use crate::str; +use crate::memchr; +use crate::ops::{Deref, DerefMut}; +use crate::ptr; +use crate::sys; #[stable(feature = "rust1", since = "1.0.0")] pub use self::buffered::{BufReader, BufWriter, LineWriter}; @@ -295,7 +297,7 @@ mod lazy; mod util; mod stdio; -const DEFAULT_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE; +const DEFAULT_BUF_SIZE: usize = crate::sys_common::io::DEFAULT_BUF_SIZE; struct Guard<'a> { buf: &'a mut Vec, len: usize } @@ -520,6 +522,22 @@ pub trait Read { #[stable(feature = "rust1", since = "1.0.0")] fn read(&mut self, buf: &mut [u8]) -> Result; + /// Like `read`, except that it reads into a slice of buffers. + /// + /// Data is copied to fill each buffer in order, with the final buffer + /// written to possibly being only partially filled. This method must behave + /// as a single call to `read` with the buffers concatenated would. + /// + /// The default implementation simply passes the first nonempty buffer to + /// `read`. + #[unstable(feature = "iovec", issue = "58452")] + fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result { + match bufs.iter_mut().find(|b| !b.is_empty()) { + Some(buf) => self.read(buf), + None => Ok(0), + } + } + /// Determines if this `Read`er can work with buffers of uninitialized /// memory. /// @@ -867,6 +885,92 @@ pub trait Read { } } +/// A buffer type used with `Read::read_vectored`. +/// +/// It is semantically a wrapper around an `&mut [u8]`, but is guaranteed to be +/// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on +/// Windows. +#[unstable(feature = "iovec", issue = "58452")] +#[repr(transparent)] +pub struct IoVecMut<'a>(sys::io::IoVecMut<'a>); + +#[unstable(feature = "iovec", issue = "58452")] +impl<'a> fmt::Debug for IoVecMut<'a> { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fmt::Debug::fmt(self.0.as_slice(), fmt) + } +} + +impl<'a> IoVecMut<'a> { + /// Creates a new `IoVecMut` wrapping a byte slice. + /// + /// # Panics + /// + /// Panics on Windows if the slice is larger than 4GB. + #[unstable(feature = "iovec", issue = "58452")] + #[inline] + pub fn new(buf: &'a mut [u8]) -> IoVecMut<'a> { + IoVecMut(sys::io::IoVecMut::new(buf)) + } +} + +#[unstable(feature = "iovec", issue = "58452")] +impl<'a> Deref for IoVecMut<'a> { + type Target = [u8]; + + #[inline] + fn deref(&self) -> &[u8] { + self.0.as_slice() + } +} + +#[unstable(feature = "iovec", issue = "58452")] +impl<'a> DerefMut for IoVecMut<'a> { + #[inline] + fn deref_mut(&mut self) -> &mut [u8] { + self.0.as_mut_slice() + } +} + +/// A buffer type used with `Write::write_vectored`. +/// +/// It is semantically a wrapper around an `&[u8]`, but is guaranteed to be +/// ABI compatible with the `iovec` type on Unix platforms and `WSABUF` on +/// Windows. +#[unstable(feature = "iovec", issue = "58452")] +#[repr(transparent)] +pub struct IoVec<'a>(sys::io::IoVec<'a>); + +#[unstable(feature = "iovec", issue = "58452")] +impl<'a> fmt::Debug for IoVec<'a> { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fmt::Debug::fmt(self.0.as_slice(), fmt) + } +} + +impl<'a> IoVec<'a> { + /// Creates a new `IoVec` wrapping a byte slice. + /// + /// # Panics + /// + /// Panics on Windows if the slice is larger than 4GB. + #[unstable(feature = "iovec", issue = "58452")] + #[inline] + pub fn new(buf: &'a [u8]) -> IoVec<'a> { + IoVec(sys::io::IoVec::new(buf)) + } +} + +#[unstable(feature = "iovec", issue = "58452")] +impl<'a> Deref for IoVec<'a> { + type Target = [u8]; + + #[inline] + fn deref(&self) -> &[u8] { + self.0.as_slice() + } +} + /// A type used to conditionally initialize buffers passed to `Read` methods. #[unstable(feature = "read_initializer", issue = "42788")] #[derive(Debug)] @@ -997,6 +1101,22 @@ pub trait Write { #[stable(feature = "rust1", since = "1.0.0")] fn write(&mut self, buf: &[u8]) -> Result; + /// Like `write`, except that it writes from a slice of buffers. + /// + /// Data is copied to from each buffer in order, with the final buffer + /// read from possibly being only partially consumed. This method must + /// behave as a call to `write` with the buffers concatenated would. + /// + /// The default implementation simply passes the first nonempty buffer to + /// `write`. + #[unstable(feature = "iovec", issue = "58452")] + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> Result { + match bufs.iter().find(|b| !b.is_empty()) { + Some(buf) => self.write(buf), + None => Ok(0), + } + } + /// Flush this output stream, ensuring that all intermediately buffered /// contents reach their destination. /// @@ -1458,7 +1578,7 @@ pub trait BufRead: Read { /// /// If successful, this function will return the total number of bytes read. /// - /// An empty buffer returned indicates that the stream has reached EOF. + /// If this function returns `Ok(0)`, the stream has reached EOF. /// /// # Errors /// @@ -1691,13 +1811,23 @@ impl Read for Chain { fn read(&mut self, buf: &mut [u8]) -> Result { if !self.done_first { match self.first.read(buf)? { - 0 if buf.len() != 0 => { self.done_first = true; } + 0 if buf.len() != 0 => self.done_first = true, n => return Ok(n), } } self.second.read(buf) } + fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> Result { + if !self.done_first { + match self.first.read_vectored(bufs)? { + 0 if bufs.iter().any(|b| !b.is_empty()) => self.done_first = true, + n => return Ok(n), + } + } + self.second.read_vectored(bufs) + } + unsafe fn initializer(&self) -> Initializer { let initializer = self.first.initializer(); if initializer.should_initialize() { @@ -2025,10 +2155,9 @@ impl Iterator for Lines { #[cfg(test)] mod tests { - use io::prelude::*; - use io; + use crate::io::prelude::*; + use crate::io; use super::Cursor; - use test; use super::repeat; #[test] diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index 0324568e6fb5..d53a294fa6a9 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -1,21 +1,30 @@ -use io::prelude::*; +#![cfg_attr(test, allow(unused))] -use cell::RefCell; -use fmt; -use io::lazy::Lazy; -use io::{self, Initializer, BufReader, LineWriter}; -use sync::{Arc, Mutex, MutexGuard}; -use sys::stdio; -use sys_common::remutex::{ReentrantMutex, ReentrantMutexGuard}; -use thread::LocalKey; +use crate::io::prelude::*; + +use crate::cell::RefCell; +use crate::fmt; +use crate::io::lazy::Lazy; +use crate::io::{self, Initializer, BufReader, LineWriter}; +use crate::sync::{Arc, Mutex, MutexGuard}; +use crate::sys::stdio; +use crate::sys_common::remutex::{ReentrantMutex, ReentrantMutexGuard}; +use crate::thread::LocalKey; -/// Stdout used by print! and println! macros thread_local! { + /// Stdout used by print! and println! macros static LOCAL_STDOUT: RefCell>> = { RefCell::new(None) } } +thread_local! { + /// Stderr used by eprint! and eprintln! macros, and panics + static LOCAL_STDERR: RefCell>> = { + RefCell::new(None) + } +} + /// A handle to a raw instance of the standard input stream of this process. /// /// This handle is not synchronized or buffered in any fashion. Constructed via @@ -668,8 +677,7 @@ impl fmt::Debug for StderrLock<'_> { issue = "0")] #[doc(hidden)] pub fn set_panic(sink: Option>) -> Option> { - use panicking::LOCAL_STDERR; - use mem; + use crate::mem; LOCAL_STDERR.with(move |slot| { mem::replace(&mut *slot.borrow_mut(), sink) }).and_then(|mut s| { @@ -692,7 +700,7 @@ pub fn set_panic(sink: Option>) -> Option>) -> Option> { - use mem; + use crate::mem; LOCAL_STDOUT.with(move |slot| { mem::replace(&mut *slot.borrow_mut(), sink) }).and_then(|mut s| { @@ -740,6 +748,7 @@ where reason = "implementation detail which may disappear or be replaced at any time", issue = "0")] #[doc(hidden)] +#[cfg(not(test))] pub fn _print(args: fmt::Arguments) { print_to(args, &LOCAL_STDOUT, stdout, "stdout"); } @@ -748,15 +757,18 @@ pub fn _print(args: fmt::Arguments) { reason = "implementation detail which may disappear or be replaced at any time", issue = "0")] #[doc(hidden)] +#[cfg(not(test))] pub fn _eprint(args: fmt::Arguments) { - use panicking::LOCAL_STDERR; print_to(args, &LOCAL_STDERR, stderr, "stderr"); } +#[cfg(test)] +pub use realstd::io::{_eprint, _print}; + #[cfg(test)] mod tests { - use panic::{UnwindSafe, RefUnwindSafe}; - use thread; + use crate::panic::{UnwindSafe, RefUnwindSafe}; + use crate::thread; use super::*; #[test] diff --git a/src/libstd/io/util.rs b/src/libstd/io/util.rs index 8df961a9add6..6aaf8f1889ac 100644 --- a/src/libstd/io/util.rs +++ b/src/libstd/io/util.rs @@ -1,8 +1,8 @@ #![allow(missing_copy_implementations)] -use fmt; -use io::{self, Read, Initializer, Write, ErrorKind, BufRead}; -use mem; +use crate::fmt; +use crate::io::{self, Read, Initializer, Write, ErrorKind, BufRead, IoVec, IoVecMut}; +use crate::mem; /// Copies the entire contents of a reader into a writer. /// @@ -152,6 +152,15 @@ impl Read for Repeat { Ok(buf.len()) } + #[inline] + fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + let mut nwritten = 0; + for buf in bufs { + nwritten += self.read(buf)?; + } + Ok(nwritten) + } + #[inline] unsafe fn initializer(&self) -> Initializer { Initializer::nop() @@ -195,6 +204,13 @@ pub fn sink() -> Sink { Sink { _priv: () } } impl Write for Sink { #[inline] fn write(&mut self, buf: &[u8]) -> io::Result { Ok(buf.len()) } + + #[inline] + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + let total_len = bufs.iter().map(|b| b.len()).sum(); + Ok(total_len) + } + #[inline] fn flush(&mut self) -> io::Result<()> { Ok(()) } } @@ -208,8 +224,8 @@ impl fmt::Debug for Sink { #[cfg(test)] mod tests { - use io::prelude::*; - use io::{copy, sink, empty, repeat}; + use crate::io::prelude::*; + use crate::io::{copy, sink, empty, repeat}; #[test] fn copy_copies() { diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 6dd3a6cc0fdb..e31680f23f1d 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -187,7 +187,7 @@ //! [`sync`]: sync/index.html //! [`thread`]: thread/index.html //! [`use std::env`]: env/index.html -//! [`use`]: ../book/ch07-02-modules-and-use-to-control-scope-and-privacy.html#the-use-keyword-to-bring-paths-into-a-scope +//! [`use`]: ../book/ch07-02-defining-modules-to-control-scope-and-privacy.html //! [crates.io]: https://crates.io //! [deref-coercions]: ../book/ch15-02-deref.html#implicit-deref-coercions-with-functions-and-methods //! [files]: fs/struct.File.html @@ -209,13 +209,17 @@ #![deny(intra_doc_link_resolution_failure)] #![deny(missing_debug_implementations)] +#![deny(rust_2018_idioms)] +#![allow(explicit_outlives_requirements)] +#![allow(elided_lifetimes_in_paths)] + // Tell the compiler to link to either panic_abort or panic_unwind #![needs_panic_runtime] // std may use features in a platform-specific way #![allow(unused_features)] -#![cfg_attr(test, feature(test, update_panic_count))] +#![cfg_attr(test, feature(print_internals, set_stdio, test, update_panic_count))] #![cfg_attr(all(target_vendor = "fortanix", target_env = "sgx"), feature(global_asm, range_contains, slice_index_methods, decl_macro, coerce_unsized, sgx_platform, ptr_wrapping_offset_from))] @@ -234,6 +238,7 @@ #![feature(arbitrary_self_types)] #![feature(array_error_internals)] #![feature(asm)] +#![feature(bind_by_move_pattern_guards)] #![feature(box_syntax)] #![feature(c_variadic)] #![feature(cfg_target_has_atomic)] @@ -296,7 +301,6 @@ #![feature(str_internals)] #![feature(thread_local)] #![feature(toowned_clone_into)] -#![feature(try_from)] #![feature(try_reserve)] #![feature(unboxed_closures)] #![feature(untagged_unions)] @@ -313,29 +317,25 @@ use prelude::v1::*; // Access to Bencher, etc. #[cfg(test)] extern crate test; -#[cfg(test)] extern crate rand; // Re-export a few macros from core #[stable(feature = "rust1", since = "1.0.0")] pub use core::{assert_eq, assert_ne, debug_assert, debug_assert_eq, debug_assert_ne}; #[stable(feature = "rust1", since = "1.0.0")] -pub use core::{unreachable, unimplemented, write, writeln, try}; +pub use core::{unreachable, unimplemented, write, writeln, r#try}; #[allow(unused_imports)] // macros from `alloc` are not used on all platforms #[macro_use] extern crate alloc as alloc_crate; #[doc(masked)] +#[allow(unused_extern_crates)] extern crate libc; -extern crate rustc_demangle; // We always need an unwinder currently for backtraces #[doc(masked)] #[allow(unused_extern_crates)] extern crate unwind; -#[cfg(feature = "backtrace")] -extern crate backtrace_sys; - // During testing, this crate is not actually the "real" std library, but rather // it links to the real std library, which was compiled from this same source // code. So any lang items std defines are conditionally excluded (or else they @@ -344,9 +344,6 @@ extern crate backtrace_sys; // testing gives test-std access to real-std lang items and globals. See #2912 #[cfg(test)] extern crate std as realstd; -#[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] -extern crate fortanix_sgx_abi; - // The standard macros that are not built-in to the compiler. #[macro_use] mod macros; diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index b9204d27f539..9d0eb2e6b1ce 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -53,8 +53,7 @@ /// ``` #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] -#[cfg_attr(stage0, allow_internal_unstable)] -#[cfg_attr(not(stage0), allow_internal_unstable(__rust_unstable_column, libstd_sys_internals))] +#[allow_internal_unstable(__rust_unstable_column, libstd_sys_internals)] macro_rules! panic { () => ({ panic!("explicit panic") @@ -112,8 +111,7 @@ macro_rules! panic { /// ``` #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] -#[cfg_attr(stage0, allow_internal_unstable)] -#[cfg_attr(not(stage0), allow_internal_unstable(print_internals))] +#[allow_internal_unstable(print_internals)] macro_rules! print { ($($arg:tt)*) => ($crate::io::_print(format_args!($($arg)*))); } @@ -145,8 +143,7 @@ macro_rules! print { /// ``` #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] -#[cfg_attr(stage0, allow_internal_unstable)] -#[cfg_attr(not(stage0), allow_internal_unstable(print_internals, format_args_nl))] +#[allow_internal_unstable(print_internals, format_args_nl)] macro_rules! println { () => (print!("\n")); ($($arg:tt)*) => ({ @@ -177,8 +174,7 @@ macro_rules! println { /// ``` #[macro_export] #[stable(feature = "eprint", since = "1.19.0")] -#[cfg_attr(stage0, allow_internal_unstable)] -#[cfg_attr(not(stage0), allow_internal_unstable(print_internals))] +#[allow_internal_unstable(print_internals)] macro_rules! eprint { ($($arg:tt)*) => ($crate::io::_eprint(format_args!($($arg)*))); } @@ -206,8 +202,7 @@ macro_rules! eprint { /// ``` #[macro_export] #[stable(feature = "eprint", since = "1.19.0")] -#[cfg_attr(stage0, allow_internal_unstable)] -#[cfg_attr(not(stage0), allow_internal_unstable(print_internals, format_args_nl))] +#[allow_internal_unstable(print_internals, format_args_nl)] macro_rules! eprintln { () => (eprint!("\n")); ($($arg:tt)*) => ({ @@ -330,10 +325,9 @@ macro_rules! dbg { /// A macro to await on an async call. #[macro_export] #[unstable(feature = "await_macro", issue = "50547")] -#[cfg_attr(stage0, allow_internal_unstable)] -#[cfg_attr(not(stage0), allow_internal_unstable(gen_future, generators))] +#[allow_internal_unstable(gen_future, generators)] #[allow_internal_unsafe] -macro_rules! await { +macro_rules! r#await { ($e:expr) => { { let mut pinned = $e; loop { diff --git a/src/libstd/memchr.rs b/src/libstd/memchr.rs index 9f44c67c1cc5..d69294b2d200 100644 --- a/src/libstd/memchr.rs +++ b/src/libstd/memchr.rs @@ -22,7 +22,7 @@ /// ``` #[inline] pub fn memchr(needle: u8, haystack: &[u8]) -> Option { - ::sys::memchr::memchr(needle, haystack) + crate::sys::memchr::memchr(needle, haystack) } /// A safe interface to `memrchr`. @@ -42,7 +42,7 @@ pub fn memchr(needle: u8, haystack: &[u8]) -> Option { /// ``` #[inline] pub fn memrchr(needle: u8, haystack: &[u8]) -> Option { - ::sys::memchr::memrchr(needle, haystack) + crate::sys::memchr::memrchr(needle, haystack) } #[cfg(test)] diff --git a/src/libstd/net/addr.rs b/src/libstd/net/addr.rs index 4b60ee8e6dad..f5a87cc3ea67 100644 --- a/src/libstd/net/addr.rs +++ b/src/libstd/net/addr.rs @@ -1,16 +1,16 @@ -use fmt; -use hash; -use io; -use mem; -use net::{ntoh, hton, IpAddr, Ipv4Addr, Ipv6Addr}; -use option; -use sys::net::netc as c; -use sys_common::{FromInner, AsInner, IntoInner}; -use sys_common::net::LookupHost; -use vec; -use iter; -use slice; -use convert::TryInto; +use crate::fmt; +use crate::hash; +use crate::io; +use crate::mem; +use crate::net::{ntoh, hton, IpAddr, Ipv4Addr, Ipv6Addr}; +use crate::option; +use crate::sys::net::netc as c; +use crate::sys_common::{FromInner, AsInner, IntoInner}; +use crate::sys_common::net::LookupHost; +use crate::vec; +use crate::iter; +use crate::slice; +use crate::convert::TryInto; /// An internet socket address, either IPv4 or IPv6. /// @@ -921,8 +921,8 @@ impl ToSocketAddrs for String { #[cfg(all(test, not(target_os = "emscripten")))] mod tests { - use net::*; - use net::test::{tsa, sa6, sa4}; + use crate::net::*; + use crate::net::test::{tsa, sa6, sa4}; #[test] fn to_socket_addr_ipaddr_u16() { diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index c85612901681..fa256ce50865 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -3,11 +3,11 @@ be to be stable", issue = "27709")] -use cmp::Ordering; -use fmt; -use hash; -use sys::net::netc as c; -use sys_common::{AsInner, FromInner}; +use crate::cmp::Ordering; +use crate::fmt; +use crate::hash; +use crate::sys::net::netc as c; +use crate::sys_common::{AsInner, FromInner}; /// An IP address, either IPv4 or IPv6. /// @@ -1509,9 +1509,9 @@ impl From<[u16; 8]> for IpAddr { // Tests for this module #[cfg(all(test, not(target_os = "emscripten")))] mod tests { - use net::*; - use net::Ipv6MulticastScope::*; - use net::test::{tsa, sa6, sa4}; + use crate::net::*; + use crate::net::Ipv6MulticastScope::*; + use crate::net::test::{tsa, sa6, sa4}; #[test] fn test_from_str_ipv4() { diff --git a/src/libstd/net/mod.rs b/src/libstd/net/mod.rs index 93e724db3d4d..b68146939fdc 100644 --- a/src/libstd/net/mod.rs +++ b/src/libstd/net/mod.rs @@ -28,7 +28,7 @@ #![stable(feature = "rust1", since = "1.0.0")] -use io::{self, Error, ErrorKind}; +use crate::io::{self, Error, ErrorKind}; #[stable(feature = "rust1", since = "1.0.0")] pub use self::ip::{IpAddr, Ipv4Addr, Ipv6Addr, Ipv6MulticastScope}; diff --git a/src/libstd/net/parser.rs b/src/libstd/net/parser.rs index 70e0c2ad4b49..7951cd6bcf28 100644 --- a/src/libstd/net/parser.rs +++ b/src/libstd/net/parser.rs @@ -3,10 +3,10 @@ //! This module is "publicly exported" through the `FromStr` implementations //! below. -use error::Error; -use fmt; -use net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}; -use str::FromStr; +use crate::error::Error; +use crate::fmt; +use crate::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}; +use crate::str::FromStr; struct Parser<'a> { // parsing as ASCII, so can use byte array diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs index 51bd76ae4363..ce0c5c0bb0dc 100644 --- a/src/libstd/net/tcp.rs +++ b/src/libstd/net/tcp.rs @@ -1,11 +1,11 @@ -use io::prelude::*; +use crate::io::prelude::*; -use fmt; -use io::{self, Initializer}; -use net::{ToSocketAddrs, SocketAddr, Shutdown}; -use sys_common::net as net_imp; -use sys_common::{AsInner, FromInner, IntoInner}; -use time::Duration; +use crate::fmt; +use crate::io::{self, Initializer, IoVec, IoVecMut}; +use crate::net::{ToSocketAddrs, SocketAddr, Shutdown}; +use crate::sys_common::net as net_imp; +use crate::sys_common::{AsInner, FromInner, IntoInner}; +use crate::time::Duration; /// A TCP stream between a local and a remote socket. /// @@ -569,6 +569,10 @@ impl TcpStream { impl Read for TcpStream { fn read(&mut self, buf: &mut [u8]) -> io::Result { self.0.read(buf) } + fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + self.0.read_vectored(bufs) + } + #[inline] unsafe fn initializer(&self) -> Initializer { Initializer::nop() @@ -577,12 +581,21 @@ impl Read for TcpStream { #[stable(feature = "rust1", since = "1.0.0")] impl Write for TcpStream { fn write(&mut self, buf: &[u8]) -> io::Result { self.0.write(buf) } + + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + self.0.write_vectored(bufs) + } + fn flush(&mut self) -> io::Result<()> { Ok(()) } } #[stable(feature = "rust1", since = "1.0.0")] impl Read for &TcpStream { fn read(&mut self, buf: &mut [u8]) -> io::Result { self.0.read(buf) } + fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + self.0.read_vectored(bufs) + } + #[inline] unsafe fn initializer(&self) -> Initializer { Initializer::nop() @@ -591,6 +604,11 @@ impl Read for &TcpStream { #[stable(feature = "rust1", since = "1.0.0")] impl Write for &TcpStream { fn write(&mut self, buf: &[u8]) -> io::Result { self.0.write(buf) } + + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + self.0.write_vectored(bufs) + } + fn flush(&mut self) -> io::Result<()> { Ok(()) } } @@ -911,14 +929,14 @@ impl fmt::Debug for TcpListener { #[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten"))))] mod tests { - use io::ErrorKind; - use io::prelude::*; - use net::*; - use net::test::{next_test_ip4, next_test_ip6}; - use sync::mpsc::channel; - use sys_common::AsInner; - use time::{Instant, Duration}; - use thread; + use crate::io::{ErrorKind, IoVec, IoVecMut}; + use crate::io::prelude::*; + use crate::net::*; + use crate::net::test::{next_test_ip4, next_test_ip6}; + use crate::sync::mpsc::channel; + use crate::sys_common::AsInner; + use crate::time::{Instant, Duration}; + use crate::thread; fn each_ip(f: &mut dyn FnMut(SocketAddr)) { f(next_test_ip4()); @@ -1184,6 +1202,53 @@ mod tests { }) } + #[test] + fn read_vectored() { + each_ip(&mut |addr| { + let srv = t!(TcpListener::bind(&addr)); + let mut s1 = t!(TcpStream::connect(&addr)); + let mut s2 = t!(srv.accept()).0; + + let len = s1.write(&[10, 11, 12]).unwrap(); + assert_eq!(len, 3); + + let mut a = []; + let mut b = [0]; + let mut c = [0; 3]; + let len = t!(s2.read_vectored( + &mut [IoVecMut::new(&mut a), IoVecMut::new(&mut b), IoVecMut::new(&mut c)], + )); + assert!(len > 0); + assert_eq!(b, [10]); + // some implementations don't support readv, so we may only fill the first buffer + assert!(len == 1 || c == [11, 12, 0]); + }) + } + + #[test] + fn write_vectored() { + each_ip(&mut |addr| { + let srv = t!(TcpListener::bind(&addr)); + let mut s1 = t!(TcpStream::connect(&addr)); + let mut s2 = t!(srv.accept()).0; + + let a = []; + let b = [10]; + let c = [11, 12]; + t!(s1.write_vectored(&[IoVec::new(&a), IoVec::new(&b), IoVec::new(&c)])); + + let mut buf = [0; 4]; + let len = t!(s2.read(&mut buf)); + // some implementations don't support writev, so we may only write the first buffer + if len == 1 { + assert_eq!(buf, [10, 0, 0, 0]); + } else { + assert_eq!(len, 3); + assert_eq!(buf, [10, 11, 12, 0]); + } + }) + } + #[test] fn double_bind() { each_ip(&mut |addr| { @@ -1677,21 +1742,6 @@ mod tests { }) } - #[test] - fn connect_timeout_unbound() { - // bind and drop a socket to track down a "probably unassigned" port - let socket = TcpListener::bind("127.0.0.1:0").unwrap(); - let addr = socket.local_addr().unwrap(); - drop(socket); - - let timeout = Duration::from_secs(1); - let e = TcpStream::connect_timeout(&addr, timeout).unwrap_err(); - assert!(e.kind() == io::ErrorKind::ConnectionRefused || - e.kind() == io::ErrorKind::TimedOut || - e.kind() == io::ErrorKind::Other, - "bad error: {} {:?}", e, e.kind()); - } - #[test] fn connect_timeout_valid() { let listener = TcpListener::bind("127.0.0.1:0").unwrap(); diff --git a/src/libstd/net/test.rs b/src/libstd/net/test.rs index eb5862cbdd94..89fefd9d1d5e 100644 --- a/src/libstd/net/test.rs +++ b/src/libstd/net/test.rs @@ -1,8 +1,8 @@ #![allow(warnings)] // not used on emscripten -use env; -use net::{SocketAddr, SocketAddrV4, SocketAddrV6, Ipv4Addr, Ipv6Addr, ToSocketAddrs}; -use sync::atomic::{AtomicUsize, Ordering}; +use crate::env; +use crate::net::{SocketAddr, SocketAddrV4, SocketAddrV6, Ipv4Addr, Ipv6Addr, ToSocketAddrs}; +use crate::sync::atomic::{AtomicUsize, Ordering}; static PORT: AtomicUsize = AtomicUsize::new(0); diff --git a/src/libstd/net/udp.rs b/src/libstd/net/udp.rs index d49871ce7bd8..edc9d665444a 100644 --- a/src/libstd/net/udp.rs +++ b/src/libstd/net/udp.rs @@ -1,9 +1,9 @@ -use fmt; -use io::{self, Error, ErrorKind}; -use net::{ToSocketAddrs, SocketAddr, Ipv4Addr, Ipv6Addr}; -use sys_common::net as net_imp; -use sys_common::{AsInner, FromInner, IntoInner}; -use time::Duration; +use crate::fmt; +use crate::io::{self, Error, ErrorKind}; +use crate::net::{ToSocketAddrs, SocketAddr, Ipv4Addr, Ipv6Addr}; +use crate::sys_common::net as net_imp; +use crate::sys_common::{AsInner, FromInner, IntoInner}; +use crate::time::Duration; /// A UDP socket. /// @@ -808,13 +808,13 @@ impl fmt::Debug for UdpSocket { #[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten"))))] mod tests { - use io::ErrorKind; - use net::*; - use net::test::{next_test_ip4, next_test_ip6}; - use sync::mpsc::channel; - use sys_common::AsInner; - use time::{Instant, Duration}; - use thread; + use crate::io::ErrorKind; + use crate::net::*; + use crate::net::test::{next_test_ip4, next_test_ip6}; + use crate::sync::mpsc::channel; + use crate::sys_common::AsInner; + use crate::time::{Instant, Duration}; + use crate::thread; fn each_ip(f: &mut dyn FnMut(SocketAddr, SocketAddr)) { f(next_test_ip4(), next_test_ip4()); diff --git a/src/libstd/num.rs b/src/libstd/num.rs index c80b9a56704a..828d5720eec1 100644 --- a/src/libstd/num.rs +++ b/src/libstd/num.rs @@ -14,8 +14,8 @@ pub use core::num::Wrapping; #[stable(feature = "nonzero", since = "1.28.0")] pub use core::num::{NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU128, NonZeroUsize}; -#[cfg(test)] use fmt; -#[cfg(test)] use ops::{Add, Sub, Mul, Div, Rem}; +#[cfg(test)] use crate::fmt; +#[cfg(test)] use crate::ops::{Add, Sub, Mul, Div, Rem}; /// Helper function for testing numeric operations #[cfg(test)] @@ -35,16 +35,16 @@ pub fn test_num(ten: T, two: T) where #[cfg(test)] mod tests { - use u8; - use u16; - use u32; - use u64; - use usize; - use ops::Mul; + use crate::u8; + use crate::u16; + use crate::u32; + use crate::u64; + use crate::usize; + use crate::ops::Mul; #[test] fn test_saturating_add_uint() { - use usize::MAX; + use crate::usize::MAX; assert_eq!(3_usize.saturating_add(5_usize), 8_usize); assert_eq!(3_usize.saturating_add(MAX-1), MAX); assert_eq!(MAX.saturating_add(MAX), MAX); @@ -53,7 +53,7 @@ mod tests { #[test] fn test_saturating_sub_uint() { - use usize::MAX; + use crate::usize::MAX; assert_eq!(5_usize.saturating_sub(3_usize), 2_usize); assert_eq!(3_usize.saturating_sub(5_usize), 0_usize); assert_eq!(0_usize.saturating_sub(1_usize), 0_usize); @@ -62,7 +62,7 @@ mod tests { #[test] fn test_saturating_add_int() { - use isize::{MIN,MAX}; + use crate::isize::{MIN,MAX}; assert_eq!(3i32.saturating_add(5), 8); assert_eq!(3isize.saturating_add(MAX-1), MAX); assert_eq!(MAX.saturating_add(MAX), MAX); @@ -74,7 +74,7 @@ mod tests { #[test] fn test_saturating_sub_int() { - use isize::{MIN,MAX}; + use crate::isize::{MIN,MAX}; assert_eq!(3i32.saturating_sub(5), -2); assert_eq!(MIN.saturating_sub(1), MIN); assert_eq!((-2isize).saturating_sub(MAX), MIN); @@ -232,8 +232,8 @@ mod tests { assert_eq!(u64_val.to_string(), "0"); } - fn from_str(t: &str) -> Option { - ::str::FromStr::from_str(t).ok() + fn from_str(t: &str) -> Option { + crate::str::FromStr::from_str(t).ok() } #[test] @@ -275,8 +275,7 @@ mod tests { #[cfg(test)] mod bench { - extern crate test; - use self::test::Bencher; + use test::Bencher; #[bench] fn bench_pow_function(b: &mut Bencher) { diff --git a/src/libstd/os/android/fs.rs b/src/libstd/os/android/fs.rs index 7aab6bf27ca8..9b24f86204bb 100644 --- a/src/libstd/os/android/fs.rs +++ b/src/libstd/os/android/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::android::raw; +use crate::os::android::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/android/raw.rs b/src/libstd/os/android/raw.rs index e03de8a7cc40..acf5ca1e4297 100644 --- a/src/libstd/os/android/raw.rs +++ b/src/libstd/os/android/raw.rs @@ -8,7 +8,7 @@ definitions")] #![allow(deprecated)] -use os::raw::c_long; +use crate::os::raw::c_long; #[stable(feature = "pthread_t", since = "1.8.0")] pub type pthread_t = c_long; @@ -19,8 +19,8 @@ pub use self::arch::{dev_t, mode_t, blkcnt_t, blksize_t, ino_t, nlink_t, off_t, #[cfg(any(target_arch = "arm", target_arch = "x86"))] mod arch { - use os::raw::{c_uint, c_uchar, c_ulonglong, c_longlong, c_ulong}; - use os::unix::raw::{uid_t, gid_t}; + use crate::os::raw::{c_uint, c_uchar, c_ulonglong, c_longlong, c_ulong}; + use crate::os::unix::raw::{uid_t, gid_t}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64; @@ -89,8 +89,8 @@ mod arch { #[cfg(target_arch = "aarch64")] mod arch { - use os::raw::{c_uchar, c_ulong}; - use os::unix::raw::{uid_t, gid_t}; + use crate::os::raw::{c_uchar, c_ulong}; + use crate::os::unix::raw::{uid_t, gid_t}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64; @@ -157,8 +157,8 @@ mod arch { #[cfg(target_arch = "x86_64")] mod arch { - use os::raw::{c_uint, c_long, c_ulong}; - use os::unix::raw::{uid_t, gid_t}; + use crate::os::raw::{c_uint, c_long, c_ulong}; + use crate::os::unix::raw::{uid_t, gid_t}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64; diff --git a/src/libstd/os/bitrig/fs.rs b/src/libstd/os/bitrig/fs.rs index 8d6da3b7a073..849d4aa67f20 100644 --- a/src/libstd/os/bitrig/fs.rs +++ b/src/libstd/os/bitrig/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::bitrig::raw; +use crate::os::bitrig::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/bitrig/raw.rs b/src/libstd/os/bitrig/raw.rs index 034dc986b691..c966d5a8e5b4 100644 --- a/src/libstd/os/bitrig/raw.rs +++ b/src/libstd/os/bitrig/raw.rs @@ -8,8 +8,8 @@ definitions")] #![allow(deprecated)] -use os::raw::c_long; -use os::unix::raw::{uid_t, gid_t}; +use crate::os::raw::c_long; +use crate::os::unix::raw::{uid_t, gid_t}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; diff --git a/src/libstd/os/dragonfly/fs.rs b/src/libstd/os/dragonfly/fs.rs index 14f5e8035687..ba38660224f2 100644 --- a/src/libstd/os/dragonfly/fs.rs +++ b/src/libstd/os/dragonfly/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::dragonfly::raw; +use crate::os::dragonfly::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/dragonfly/raw.rs b/src/libstd/os/dragonfly/raw.rs index 4f36652ddcf5..46ef5a1e7cf7 100644 --- a/src/libstd/os/dragonfly/raw.rs +++ b/src/libstd/os/dragonfly/raw.rs @@ -8,7 +8,7 @@ definitions")] #![allow(deprecated)] -use os::raw::c_long; +use crate::os::raw::c_long; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; diff --git a/src/libstd/os/emscripten/fs.rs b/src/libstd/os/emscripten/fs.rs index 33c41c9223e6..aa6aa38283de 100644 --- a/src/libstd/os/emscripten/fs.rs +++ b/src/libstd/os/emscripten/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::emscripten::raw; +use crate::os::emscripten::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/emscripten/raw.rs b/src/libstd/os/emscripten/raw.rs index d59ce482ef78..e55134879794 100644 --- a/src/libstd/os/emscripten/raw.rs +++ b/src/libstd/os/emscripten/raw.rs @@ -10,7 +10,7 @@ definitions")] #![allow(deprecated)] -use os::raw::{c_long, c_short, c_uint, c_ulong}; +use crate::os::raw::{c_long, c_short, c_uint, c_ulong}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32; diff --git a/src/libstd/os/fortanix_sgx/mod.rs b/src/libstd/os/fortanix_sgx/mod.rs index bd6f4b4465b2..bca22e717d72 100644 --- a/src/libstd/os/fortanix_sgx/mod.rs +++ b/src/libstd/os/fortanix_sgx/mod.rs @@ -11,34 +11,35 @@ /// /// [ABI documentation]: https://docs.rs/fortanix-sgx-abi/ pub mod usercalls { - pub use sys::abi::usercalls::*; + pub use crate::sys::abi::usercalls::*; /// Primitives for allocating memory in userspace as well as copying data /// to and from user memory. pub mod alloc { - pub use sys::abi::usercalls::alloc::*; + pub use crate::sys::abi::usercalls::alloc::*; } /// Lowest-level interfaces to usercalls and usercall ABI type definitions. pub mod raw { - pub use sys::abi::usercalls::raw::{do_usercall, Usercalls as UsercallNrs}; - pub use sys::abi::usercalls::raw::{accept_stream, alloc, async_queues, bind_stream, close, - connect_stream, exit, flush, free, insecure_time, + pub use crate::sys::abi::usercalls::raw::{do_usercall, Usercalls as UsercallNrs}; + pub use crate::sys::abi::usercalls::raw::{accept_stream, alloc, async_queues, bind_stream, + close, connect_stream, exit, flush, free, insecure_time, launch_thread, read, read_alloc, send, wait, write}; // fortanix-sgx-abi re-exports - pub use sys::abi::usercalls::raw::{ByteBuffer, FifoDescriptor, Return, Usercall}; - pub use sys::abi::usercalls::raw::Error; - pub use sys::abi::usercalls::raw::{EV_RETURNQ_NOT_EMPTY, EV_UNPARK, EV_USERCALLQ_NOT_FULL, - FD_STDERR, FD_STDIN, FD_STDOUT, RESULT_SUCCESS, - USERCALL_USER_DEFINED, WAIT_INDEFINITE, WAIT_NO}; - pub use sys::abi::usercalls::raw::{Fd, Result, Tcs}; + pub use crate::sys::abi::usercalls::raw::{ByteBuffer, FifoDescriptor, Return, Usercall}; + pub use crate::sys::abi::usercalls::raw::Error; + pub use crate::sys::abi::usercalls::raw::{EV_RETURNQ_NOT_EMPTY, EV_UNPARK, + EV_USERCALLQ_NOT_FULL, FD_STDERR, FD_STDIN, FD_STDOUT, + RESULT_SUCCESS, USERCALL_USER_DEFINED, WAIT_INDEFINITE, + WAIT_NO}; + pub use crate::sys::abi::usercalls::raw::{Fd, Result, Tcs}; } } /// Functions for querying mapping information for pointers. pub mod mem { - pub use sys::abi::mem::*; + pub use crate::sys::abi::mem::*; } -pub use sys::ext::{io, arch, ffi}; +pub use crate::sys::ext::{io, arch, ffi}; diff --git a/src/libstd/os/freebsd/fs.rs b/src/libstd/os/freebsd/fs.rs index 1b4a0fcfa7c1..4cc3a4b91fbd 100644 --- a/src/libstd/os/freebsd/fs.rs +++ b/src/libstd/os/freebsd/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::freebsd::raw; +use crate::os::freebsd::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/freebsd/raw.rs b/src/libstd/os/freebsd/raw.rs index 7d90e583b5b9..0c58154ae607 100644 --- a/src/libstd/os/freebsd/raw.rs +++ b/src/libstd/os/freebsd/raw.rs @@ -8,7 +8,7 @@ definitions")] #![allow(deprecated)] -use os::raw::c_long; +use crate::os::raw::c_long; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; diff --git a/src/libstd/os/fuchsia/fs.rs b/src/libstd/os/fuchsia/fs.rs index 8c2d23cb1c2e..1544bdfbe0cd 100644 --- a/src/libstd/os/fuchsia/fs.rs +++ b/src/libstd/os/fuchsia/fs.rs @@ -1,7 +1,7 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/fuchsia/raw.rs b/src/libstd/os/fuchsia/raw.rs index b4a6bd3295c6..7e44a79b371c 100644 --- a/src/libstd/os/fuchsia/raw.rs +++ b/src/libstd/os/fuchsia/raw.rs @@ -8,7 +8,7 @@ definitions")] #![allow(deprecated)] -use os::raw::c_ulong; +use crate::os::raw::c_ulong; #[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32; @@ -25,7 +25,7 @@ pub use self::arch::{off_t, ino_t, nlink_t, blksize_t, blkcnt_t, stat, time_t}; target_arch = "powerpc", target_arch = "arm"))] mod arch { - use os::raw::{c_long, c_short, c_uint}; + use crate::os::raw::{c_long, c_short, c_uint}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; @@ -81,7 +81,7 @@ mod arch { #[cfg(target_arch = "mips")] mod arch { - use os::raw::{c_long, c_ulong}; + use crate::os::raw::{c_long, c_ulong}; #[cfg(target_env = "musl")] #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = i64; @@ -151,7 +151,7 @@ mod arch { #[cfg(target_arch = "aarch64")] mod arch { - use os::raw::{c_long, c_int}; + use crate::os::raw::{c_long, c_int}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; @@ -207,7 +207,7 @@ mod arch { #[cfg(target_arch = "x86_64")] mod arch { - use os::raw::{c_long, c_int}; + use crate::os::raw::{c_long, c_int}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; diff --git a/src/libstd/os/haiku/fs.rs b/src/libstd/os/haiku/fs.rs index 2ed1ca975d8b..4097f8c26a62 100644 --- a/src/libstd/os/haiku/fs.rs +++ b/src/libstd/os/haiku/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::haiku::raw; +use crate::os::haiku::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/haiku/raw.rs b/src/libstd/os/haiku/raw.rs index e6af8f29807c..d86f4f3ba57c 100644 --- a/src/libstd/os/haiku/raw.rs +++ b/src/libstd/os/haiku/raw.rs @@ -4,8 +4,8 @@ #![allow(deprecated)] -use os::raw::{c_long}; -use os::unix::raw::{uid_t, gid_t}; +use crate::os::raw::{c_long}; +use crate::os::unix::raw::{uid_t, gid_t}; // Use the direct definition of usize, instead of uintptr_t like in libc #[stable(feature = "pthread_t", since = "1.8.0")] pub type pthread_t = usize; diff --git a/src/libstd/os/hermit/fs.rs b/src/libstd/os/hermit/fs.rs index b94324475e5a..eb28a839ba86 100644 --- a/src/libstd/os/hermit/fs.rs +++ b/src/libstd/os/hermit/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::hermit::raw; +use crate::os::hermit::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/ios/fs.rs b/src/libstd/os/ios/fs.rs index 7f0bdb80b20d..7b625f5e3fe3 100644 --- a/src/libstd/os/ios/fs.rs +++ b/src/libstd/os/ios/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::ios::raw; +use crate::os::ios::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/ios/raw.rs b/src/libstd/os/ios/raw.rs index 1b528ce8c91b..fa38bca09e26 100644 --- a/src/libstd/os/ios/raw.rs +++ b/src/libstd/os/ios/raw.rs @@ -8,7 +8,7 @@ definitions")] #![allow(deprecated)] -use os::raw::c_long; +use crate::os::raw::c_long; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; diff --git a/src/libstd/os/linux/fs.rs b/src/libstd/os/linux/fs.rs index 572d814fc069..ec5e98370768 100644 --- a/src/libstd/os/linux/fs.rs +++ b/src/libstd/os/linux/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::linux::raw; +use crate::os::linux::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/linux/raw.rs b/src/libstd/os/linux/raw.rs index e5ab8a839cb7..77eeacb4b477 100644 --- a/src/libstd/os/linux/raw.rs +++ b/src/libstd/os/linux/raw.rs @@ -9,7 +9,7 @@ #![allow(deprecated)] #![allow(missing_debug_implementations)] -use os::raw::c_ulong; +use crate::os::raw::c_ulong; #[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32; @@ -28,7 +28,7 @@ pub use self::arch::{off_t, ino_t, nlink_t, blksize_t, blkcnt_t, stat, time_t}; target_arch = "asmjs", target_arch = "wasm32"))] mod arch { - use os::raw::{c_long, c_short, c_uint}; + use crate::os::raw::{c_long, c_short, c_uint}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; @@ -84,7 +84,7 @@ mod arch { #[cfg(target_arch = "mips")] mod arch { - use os::raw::{c_long, c_ulong}; + use crate::os::raw::{c_long, c_ulong}; #[cfg(target_env = "musl")] #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = i64; @@ -156,7 +156,7 @@ mod arch { #[cfg(target_arch = "aarch64")] mod arch { - use os::raw::{c_long, c_int}; + use crate::os::raw::{c_long, c_int}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; @@ -212,7 +212,7 @@ mod arch { #[cfg(any(target_arch = "x86_64", target_arch = "powerpc64"))] mod arch { - use os::raw::{c_long, c_int}; + use crate::os::raw::{c_long, c_int}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; diff --git a/src/libstd/os/macos/fs.rs b/src/libstd/os/macos/fs.rs index 1227fc46fcdc..1bd66ad4c764 100644 --- a/src/libstd/os/macos/fs.rs +++ b/src/libstd/os/macos/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::macos::raw; +use crate::os::macos::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/macos/raw.rs b/src/libstd/os/macos/raw.rs index 684cb891e001..5685642c07ff 100644 --- a/src/libstd/os/macos/raw.rs +++ b/src/libstd/os/macos/raw.rs @@ -8,7 +8,7 @@ definitions")] #![allow(deprecated)] -use os::raw::c_long; +use crate::os::raw::c_long; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; diff --git a/src/libstd/os/mod.rs b/src/libstd/os/mod.rs index 6215ba47e30a..5cce3df71d6a 100644 --- a/src/libstd/os/mod.rs +++ b/src/libstd/os/mod.rs @@ -12,10 +12,10 @@ cfg_if! { // cross-platform way in the documentation #[stable(feature = "rust1", since = "1.0.0")] - pub use sys::unix_ext as unix; + pub use crate::sys::unix_ext as unix; #[stable(feature = "rust1", since = "1.0.0")] - pub use sys::windows_ext as windows; + pub use crate::sys::windows_ext as windows; #[doc(cfg(target_os = "linux"))] pub mod linux; @@ -26,11 +26,11 @@ cfg_if! { #[cfg(any(target_os = "redox", unix))] #[stable(feature = "rust1", since = "1.0.0")] - pub use sys::ext as unix; + pub use crate::sys::ext as unix; #[cfg(windows)] #[stable(feature = "rust1", since = "1.0.0")] - pub use sys::ext as windows; + pub use crate::sys::ext as windows; #[cfg(any(target_os = "linux", target_os = "l4re"))] pub mod linux; diff --git a/src/libstd/os/netbsd/fs.rs b/src/libstd/os/netbsd/fs.rs index 7022013e9dd2..6dffb70b5dc7 100644 --- a/src/libstd/os/netbsd/fs.rs +++ b/src/libstd/os/netbsd/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::netbsd::raw; +use crate::os::netbsd::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/netbsd/raw.rs b/src/libstd/os/netbsd/raw.rs index f02bae801a24..1d5d5c6891e3 100644 --- a/src/libstd/os/netbsd/raw.rs +++ b/src/libstd/os/netbsd/raw.rs @@ -8,8 +8,8 @@ definitions")] #![allow(deprecated)] -use os::raw::c_long; -use os::unix::raw::{uid_t, gid_t}; +use crate::os::raw::c_long; +use crate::os::unix::raw::{uid_t, gid_t}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; diff --git a/src/libstd/os/openbsd/fs.rs b/src/libstd/os/openbsd/fs.rs index 4d9749199f94..73f9757f3b79 100644 --- a/src/libstd/os/openbsd/fs.rs +++ b/src/libstd/os/openbsd/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::openbsd::raw; +use crate::os::openbsd::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/openbsd/raw.rs b/src/libstd/os/openbsd/raw.rs index 27710ca6ce7b..094168453d79 100644 --- a/src/libstd/os/openbsd/raw.rs +++ b/src/libstd/os/openbsd/raw.rs @@ -8,7 +8,7 @@ definitions")] #![allow(deprecated)] -use os::raw::c_long; +use crate::os::raw::c_long; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; diff --git a/src/libstd/os/raw/mod.rs b/src/libstd/os/raw/mod.rs index 78288a6a1f0c..e9043b4b40d7 100644 --- a/src/libstd/os/raw/mod.rs +++ b/src/libstd/os/raw/mod.rs @@ -86,9 +86,8 @@ pub use core::ffi::c_void; #[cfg(test)] #[allow(unused_imports)] mod tests { - use any::TypeId; - use libc; - use mem; + use crate::any::TypeId; + use crate::mem; macro_rules! ok { ($($t:ident)*) => {$( @@ -99,7 +98,7 @@ mod tests { #[test] fn same() { - use os::raw; + use crate::os::raw; ok!(c_char c_schar c_uchar c_short c_ushort c_int c_uint c_long c_ulong c_longlong c_ulonglong c_float c_double); } diff --git a/src/libstd/os/solaris/fs.rs b/src/libstd/os/solaris/fs.rs index f2f89b5dd8bc..55a8d5d1ef00 100644 --- a/src/libstd/os/solaris/fs.rs +++ b/src/libstd/os/solaris/fs.rs @@ -1,12 +1,10 @@ #![stable(feature = "metadata_ext", since = "1.1.0")] -use libc; - -use fs::Metadata; -use sys_common::AsInner; +use crate::fs::Metadata; +use crate::sys_common::AsInner; #[allow(deprecated)] -use os::solaris::raw; +use crate::os::solaris::raw; /// OS-specific extensions to [`fs::Metadata`]. /// diff --git a/src/libstd/os/solaris/raw.rs b/src/libstd/os/solaris/raw.rs index 3c2c063ca41e..93270efea2b6 100644 --- a/src/libstd/os/solaris/raw.rs +++ b/src/libstd/os/solaris/raw.rs @@ -8,8 +8,8 @@ definitions")] #![allow(deprecated)] -use os::raw::c_long; -use os::unix::raw::{uid_t, gid_t}; +use crate::os::raw::c_long; +use crate::os::unix::raw::{uid_t, gid_t}; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64; #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64; diff --git a/src/libstd/panic.rs b/src/libstd/panic.rs index daeac7107a56..6a16414c1417 100644 --- a/src/libstd/panic.rs +++ b/src/libstd/panic.rs @@ -2,21 +2,21 @@ #![stable(feature = "std_panic", since = "1.9.0")] -use any::Any; -use cell::UnsafeCell; -use fmt; -use future::Future; -use pin::Pin; -use ops::{Deref, DerefMut}; -use panicking; -use ptr::{Unique, NonNull}; -use rc::Rc; -use sync::{Arc, Mutex, RwLock, atomic}; -use task::{Waker, Poll}; -use thread::Result; +use crate::any::Any; +use crate::cell::UnsafeCell; +use crate::fmt; +use crate::future::Future; +use crate::pin::Pin; +use crate::ops::{Deref, DerefMut}; +use crate::panicking; +use crate::ptr::{Unique, NonNull}; +use crate::rc::Rc; +use crate::sync::{Arc, Mutex, RwLock, atomic}; +use crate::task::{Waker, Poll}; +use crate::thread::Result; #[stable(feature = "panic_hooks", since = "1.10.0")] -pub use panicking::{take_hook, set_hook}; +pub use crate::panicking::{take_hook, set_hook}; #[stable(feature = "panic_hooks", since = "1.10.0")] pub use core::panic::{PanicInfo, Location}; @@ -385,7 +385,7 @@ impl Future for AssertUnwindSafe { #[stable(feature = "catch_unwind", since = "1.9.0")] pub fn catch_unwind R + UnwindSafe, R>(f: F) -> Result { unsafe { - panicking::try(f) + panicking::r#try(f) } } diff --git a/src/libstd/panicking.rs b/src/libstd/panicking.rs index aaffc9bad454..eae885602d3e 100644 --- a/src/libstd/panicking.rs +++ b/src/libstd/panicking.rs @@ -7,29 +7,26 @@ //! * Executing a panic up to doing the actual implementation //! * Shims around "try" -use core::panic::BoxMeUp; +use core::panic::{BoxMeUp, PanicInfo, Location}; -use io::prelude::*; +use crate::any::Any; +use crate::fmt; +use crate::intrinsics; +use crate::mem; +use crate::ptr; +use crate::raw; +use crate::sys::stdio::panic_output; +use crate::sys_common::rwlock::RWLock; +use crate::sys_common::thread_info; +use crate::sys_common::util; +use crate::thread; -use any::Any; -use cell::RefCell; -use core::panic::{PanicInfo, Location}; -use fmt; -use intrinsics; -use mem; -use ptr; -use raw; -use sys::stdio::panic_output; -use sys_common::rwlock::RWLock; -use sys_common::thread_info; -use sys_common::util; -use thread; - -thread_local! { - pub static LOCAL_STDERR: RefCell>> = { - RefCell::new(None) - } -} +#[cfg(not(test))] +use crate::io::set_panic; +// make sure to use the stderr output configured +// by libtest in the real copy of std +#[cfg(test)] +use realstd::io::set_panic; // Binary interface to the panic runtime that the standard library depends on. // @@ -159,7 +156,7 @@ pub fn take_hook() -> Box { fn default_hook(info: &PanicInfo) { #[cfg(feature = "backtrace")] - use sys_common::backtrace; + use crate::sys_common::backtrace; // If this is a double panic, make sure that we print a backtrace // for this panic. Otherwise only print it if logging is enabled. @@ -186,13 +183,13 @@ fn default_hook(info: &PanicInfo) { let thread = thread_info::current_thread(); let name = thread.as_ref().and_then(|t| t.name()).unwrap_or(""); - let write = |err: &mut dyn (::io::Write)| { + let write = |err: &mut dyn crate::io::Write| { let _ = writeln!(err, "thread '{}' panicked at '{}', {}", name, msg, location); #[cfg(feature = "backtrace")] { - use sync::atomic::{AtomicBool, Ordering}; + use crate::sync::atomic::{AtomicBool, Ordering}; static FIRST_PANIC: AtomicBool = AtomicBool::new(true); @@ -205,12 +202,11 @@ fn default_hook(info: &PanicInfo) { } }; - if let Some(mut local) = LOCAL_STDERR.with(|s| s.borrow_mut().take()) { - write(&mut *local); - let mut s = Some(local); - LOCAL_STDERR.with(|slot| { - *slot.borrow_mut() = s.take(); - }); + if let Some(mut local) = set_panic(None) { + // NB. In `cfg(test)` this uses the forwarding impl + // for `Box`. + write(&mut local); + set_panic(Some(local)); } else if let Some(mut out) = panic_output() { write(&mut out); } @@ -221,7 +217,7 @@ fn default_hook(info: &PanicInfo) { #[doc(hidden)] #[unstable(feature = "update_panic_count", issue = "0")] pub fn update_panic_count(amt: isize) -> usize { - use cell::Cell; + use crate::cell::Cell; thread_local! { static PANIC_COUNT: Cell = Cell::new(0) } PANIC_COUNT.with(|c| { @@ -235,7 +231,7 @@ pub fn update_panic_count(amt: isize) -> usize { pub use realstd::rt::update_panic_count; /// Invoke a closure, capturing the cause of an unwinding panic if one occurs. -pub unsafe fn try R>(f: F) -> Result> { +pub unsafe fn r#try R>(f: F) -> Result> { #[allow(unions_with_drop_fields)] union Data { f: F, @@ -352,7 +348,7 @@ fn continue_panic_fmt(info: &PanicInfo) -> ! { } fn fill(&mut self) -> &mut String { - use fmt::Write; + use crate::fmt::Write; let inner = self.inner; self.string.get_or_insert_with(|| { diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 240b92a17db4..ea3fcd8ce285 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -67,23 +67,22 @@ #![stable(feature = "rust1", since = "1.0.0")] -use borrow::{Borrow, Cow}; -use cmp; -use error::Error; -use fmt; -use fs; -use hash::{Hash, Hasher}; -use io; -use iter::{self, FusedIterator}; -use ops::{self, Deref}; -use rc::Rc; -use str::FromStr; -use string::ParseError; -use sync::Arc; +use crate::borrow::{Borrow, Cow}; +use crate::cmp; +use crate::error::Error; +use crate::fmt; +use crate::fs; +use crate::hash::{Hash, Hasher}; +use crate::io; +use crate::iter::{self, FusedIterator}; +use crate::ops::{self, Deref}; +use crate::rc::Rc; +use crate::str::FromStr; +use crate::sync::Arc; -use ffi::{OsStr, OsString}; +use crate::ffi::{OsStr, OsString}; -use sys::path::{is_sep_byte, is_verbatim_sep, MAIN_SEP_STR, parse_prefix}; +use crate::sys::path::{is_sep_byte, is_verbatim_sep, MAIN_SEP_STR, parse_prefix}; //////////////////////////////////////////////////////////////////////////////// // GENERAL NOTES @@ -280,7 +279,7 @@ pub fn is_separator(c: char) -> bool { /// /// For example, `/` on Unix and `\` on Windows. #[stable(feature = "rust1", since = "1.0.0")] -pub const MAIN_SEPARATOR: char = ::sys::path::MAIN_SEP; +pub const MAIN_SEPARATOR: char = crate::sys::path::MAIN_SEP; //////////////////////////////////////////////////////////////////////////////// // Misc helpers @@ -1457,8 +1456,8 @@ impl PathBuf { } #[stable(feature = "box_from_path", since = "1.17.0")] -impl<'a> From<&'a Path> for Box { - fn from(path: &'a Path) -> Box { +impl From<&Path> for Box { + fn from(path: &Path) -> Box { let boxed: Box = path.inner.into(); let rw = Box::into_raw(boxed) as *mut Path; unsafe { Box::from_raw(rw) } @@ -1495,8 +1494,8 @@ impl Clone for Box { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T: ?Sized + AsRef> From<&'a T> for PathBuf { - fn from(s: &'a T) -> PathBuf { +impl> From<&T> for PathBuf { + fn from(s: &T) -> PathBuf { PathBuf::from(s.as_ref().to_os_string()) } } @@ -1533,7 +1532,7 @@ impl From for PathBuf { #[stable(feature = "path_from_str", since = "1.32.0")] impl FromStr for PathBuf { - type Err = ParseError; + type Err = core::convert::Infallible; fn from_str(s: &str) -> Result { Ok(PathBuf::from(s)) @@ -1631,7 +1630,7 @@ impl From for Arc { } #[stable(feature = "shared_from_slice2", since = "1.24.0")] -impl<'a> From<&'a Path> for Arc { +impl From<&Path> for Arc { /// Converts a Path into a Rc by copying the Path data into a new Rc buffer. #[inline] fn from(s: &Path) -> Arc { @@ -1651,7 +1650,7 @@ impl From for Rc { } #[stable(feature = "shared_from_slice2", since = "1.24.0")] -impl<'a> From<&'a Path> for Rc { +impl From<&Path> for Rc { /// Converts a Path into a Rc by copying the Path data into a new Rc buffer. #[inline] fn from(s: &Path) -> Rc { @@ -2820,8 +2819,8 @@ impl Error for StripPrefixError { mod tests { use super::*; - use rc::Rc; - use sync::Arc; + use crate::rc::Rc; + use crate::sync::Arc; macro_rules! t( ($path:expr, iter: $iter:expr) => ( @@ -2908,7 +2907,7 @@ mod tests { #[test] fn into() { - use borrow::Cow; + use crate::borrow::Cow; let static_path = Path::new("/home/foo"); let static_cow_path: Cow<'static, Path> = static_path.into(); @@ -4008,7 +4007,7 @@ mod tests { #[test] fn test_eq_receivers() { - use borrow::Cow; + use crate::borrow::Cow; let borrowed: &Path = Path::new("foo/bar"); let mut owned: PathBuf = PathBuf::new(); @@ -4033,8 +4032,8 @@ mod tests { #[test] pub fn test_compare() { - use hash::{Hash, Hasher}; - use collections::hash_map::DefaultHasher; + use crate::hash::{Hash, Hasher}; + use crate::collections::hash_map::DefaultHasher; fn hash(t: T) -> u64 { let mut s = DefaultHasher::new(); diff --git a/src/libstd/prelude/v1.rs b/src/libstd/prelude/v1.rs index 3001c899f620..ce1e8e3319cf 100644 --- a/src/libstd/prelude/v1.rs +++ b/src/libstd/prelude/v1.rs @@ -9,41 +9,41 @@ // Re-exported core operators #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use marker::{Copy, Send, Sized, Sync, Unpin}; +pub use crate::marker::{Copy, Send, Sized, Sync, Unpin}; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use ops::{Drop, Fn, FnMut, FnOnce}; +pub use crate::ops::{Drop, Fn, FnMut, FnOnce}; // Re-exported functions #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use mem::drop; +pub use crate::mem::drop; // Re-exported types and traits #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use clone::Clone; +pub use crate::clone::Clone; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use cmp::{PartialEq, PartialOrd, Eq, Ord}; +pub use crate::cmp::{PartialEq, PartialOrd, Eq, Ord}; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use convert::{AsRef, AsMut, Into, From}; +pub use crate::convert::{AsRef, AsMut, Into, From}; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use default::Default; +pub use crate::default::Default; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use iter::{Iterator, Extend, IntoIterator}; +pub use crate::iter::{Iterator, Extend, IntoIterator}; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use iter::{DoubleEndedIterator, ExactSizeIterator}; +pub use crate::iter::{DoubleEndedIterator, ExactSizeIterator}; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use option::Option::{self, Some, None}; +pub use crate::option::Option::{self, Some, None}; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use result::Result::{self, Ok, Err}; +pub use crate::result::Result::{self, Ok, Err}; // The file so far is equivalent to src/libcore/prelude/v1.rs, @@ -54,16 +54,16 @@ pub use result::Result::{self, Ok, Err}; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use boxed::Box; +pub use crate::boxed::Box; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use borrow::ToOwned; +pub use crate::borrow::ToOwned; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use slice::SliceConcatExt; +pub use crate::slice::SliceConcatExt; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use string::{String, ToString}; +pub use crate::string::{String, ToString}; #[stable(feature = "rust1", since = "1.0.0")] #[doc(no_inline)] -pub use vec::Vec; +pub use crate::vec::Vec; diff --git a/src/libstd/process.rs b/src/libstd/process.rs index a2ef85016d8a..568400093440 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -106,17 +106,17 @@ #![stable(feature = "process", since = "1.0.0")] -use io::prelude::*; +use crate::io::prelude::*; -use ffi::OsStr; -use fmt; -use fs; -use io::{self, Initializer}; -use path::Path; -use str; -use sys::pipe::{read2, AnonPipe}; -use sys::process as imp; -use sys_common::{AsInner, AsInnerMut, FromInner, IntoInner}; +use crate::ffi::OsStr; +use crate::fmt; +use crate::fs; +use crate::io::{self, Initializer}; +use crate::path::Path; +use crate::str; +use crate::sys::pipe::{read2, AnonPipe}; +use crate::sys::process as imp; +use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner}; /// Representation of a running or exited child process. /// @@ -1015,7 +1015,7 @@ impl From for Stdio { /// /// `ChildStdin` will be converted to `Stdio` using `Stdio::from` under the hood. /// - /// ```rust + /// ```rust,no_run /// use std::process::{Command, Stdio}; /// /// let reverse = Command::new("rev") @@ -1044,7 +1044,7 @@ impl From for Stdio { /// /// `ChildStdout` will be converted to `Stdio` using `Stdio::from` under the hood. /// - /// ```rust + /// ```rust,no_run /// use std::process::{Command, Stdio}; /// /// let hello = Command::new("echo") @@ -1481,8 +1481,8 @@ impl Child { /// [platform-specific behavior]: #platform-specific-behavior #[stable(feature = "rust1", since = "1.0.0")] pub fn exit(code: i32) -> ! { - ::sys_common::cleanup(); - ::sys::os::exit(code) + crate::sys_common::cleanup(); + crate::sys::os::exit(code) } /// Terminates the process in an abnormal fashion. @@ -1543,7 +1543,7 @@ pub fn exit(code: i32) -> ! { /// [panic hook]: ../../std/panic/fn.set_hook.html #[stable(feature = "process_abort", since = "1.17.0")] pub fn abort() -> ! { - unsafe { ::sys::abort_internal() }; + unsafe { crate::sys::abort_internal() }; } /// Returns the OS-assigned process identifier associated with this process. @@ -1561,7 +1561,7 @@ pub fn abort() -> ! { /// #[stable(feature = "getpid", since = "1.26.0")] pub fn id() -> u32 { - ::sys::os::getpid() + crate::sys::os::getpid() } /// A trait for implementing arbitrary return types in the `main` function. @@ -1623,10 +1623,10 @@ impl Termination for ExitCode { #[cfg(all(test, not(any(target_os = "cloudabi", target_os = "emscripten"))))] mod tests { - use io::prelude::*; + use crate::io::prelude::*; - use io::ErrorKind; - use str; + use crate::io::ErrorKind; + use crate::str; use super::{Command, Output, Stdio}; // FIXME(#10380) these tests should not all be ignored on android. @@ -1671,7 +1671,7 @@ mod tests { #[cfg(unix)] #[cfg_attr(target_os = "android", ignore)] fn signal_reported_right() { - use os::unix::process::ExitStatusExt; + use crate::os::unix::process::ExitStatusExt; let mut p = Command::new("/bin/sh") .arg("-c").arg("read a") @@ -1741,8 +1741,8 @@ mod tests { #[cfg_attr(target_os = "android", ignore)] #[cfg(unix)] fn uid_works() { - use os::unix::prelude::*; - use libc; + use crate::os::unix::prelude::*; + let mut p = Command::new("/bin/sh") .arg("-c").arg("true") .uid(unsafe { libc::getuid() }) @@ -1755,8 +1755,7 @@ mod tests { #[cfg_attr(target_os = "android", ignore)] #[cfg(unix)] fn uid_to_root_fails() { - use os::unix::prelude::*; - use libc; + use crate::os::unix::prelude::*; // if we're already root, this isn't a valid test. Most of the bots run // as non-root though (android is an exception). @@ -1881,7 +1880,7 @@ mod tests { #[test] fn test_override_env() { - use env; + use crate::env; // In some build environments (such as chrooted Nix builds), `env` can // only be found in the explicitly-provided PATH env variable, not in @@ -1910,7 +1909,7 @@ mod tests { #[test] fn test_capture_env_at_spawn() { - use env; + use crate::env; let mut cmd = env_cmd(); cmd.env("RUN_TEST_NEW_ENV1", "123"); @@ -1985,8 +1984,8 @@ mod tests { #[test] #[cfg(windows)] fn test_creation_flags() { - use os::windows::process::CommandExt; - use sys::c::{BOOL, DWORD, INFINITE}; + use crate::os::windows::process::CommandExt; + use crate::sys::c::{BOOL, DWORD, INFINITE}; #[repr(C, packed)] struct DEBUG_EVENT { pub event_code: DWORD, diff --git a/src/libstd/rt.rs b/src/libstd/rt.rs index 5ddb66b1897e..cf45eb0daba3 100644 --- a/src/libstd/rt.rs +++ b/src/libstd/rt.rs @@ -14,18 +14,18 @@ // Re-export some of our utilities which are expected by other crates. -pub use panicking::{begin_panic, begin_panic_fmt, update_panic_count}; +pub use crate::panicking::{begin_panic, begin_panic_fmt, update_panic_count}; // To reduce the generated code of the new `lang_start`, this function is doing // the real work. #[cfg(not(test))] -fn lang_start_internal(main: &(dyn Fn() -> i32 + Sync + ::panic::RefUnwindSafe), +fn lang_start_internal(main: &(dyn Fn() -> i32 + Sync + crate::panic::RefUnwindSafe), argc: isize, argv: *const *const u8) -> isize { - use panic; - use sys; - use sys_common; - use sys_common::thread_info; - use thread::Thread; + use crate::panic; + use crate::sys; + use crate::sys_common; + use crate::sys_common::thread_info; + use crate::thread::Thread; sys::init(); @@ -46,7 +46,7 @@ fn lang_start_internal(main: &(dyn Fn() -> i32 + Sync + ::panic::RefUnwindSafe), // Let's run some code! #[cfg(feature = "backtrace")] let exit_code = panic::catch_unwind(|| { - ::sys_common::backtrace::__rust_begin_short_backtrace(move || main()) + sys_common::backtrace::__rust_begin_short_backtrace(move || main()) }); #[cfg(not(feature = "backtrace"))] let exit_code = panic::catch_unwind(move || main()); @@ -58,7 +58,7 @@ fn lang_start_internal(main: &(dyn Fn() -> i32 + Sync + ::panic::RefUnwindSafe), #[cfg(not(test))] #[lang = "start"] -fn lang_start +fn lang_start (main: fn() -> T, argc: isize, argv: *const *const u8) -> isize { lang_start_internal(&move || main().report(), argc, argv) diff --git a/src/libstd/sync/barrier.rs b/src/libstd/sync/barrier.rs index bc2e14d436a9..a4205daba8b6 100644 --- a/src/libstd/sync/barrier.rs +++ b/src/libstd/sync/barrier.rs @@ -1,5 +1,5 @@ -use fmt; -use sync::{Mutex, Condvar}; +use crate::fmt; +use crate::sync::{Mutex, Condvar}; /// A barrier enables multiple threads to synchronize the beginning /// of some computation. @@ -181,9 +181,9 @@ impl BarrierWaitResult { #[cfg(test)] mod tests { - use sync::{Arc, Barrier}; - use sync::mpsc::{channel, TryRecvError}; - use thread; + use crate::sync::{Arc, Barrier}; + use crate::sync::mpsc::{channel, TryRecvError}; + use crate::thread; #[test] #[cfg_attr(target_os = "emscripten", ignore)] diff --git a/src/libstd/sync/condvar.rs b/src/libstd/sync/condvar.rs index 036aff090ead..5ebb61754e1f 100644 --- a/src/libstd/sync/condvar.rs +++ b/src/libstd/sync/condvar.rs @@ -1,10 +1,10 @@ -use fmt; -use sync::atomic::{AtomicUsize, Ordering}; -use sync::{mutex, MutexGuard, PoisonError}; -use sys_common::condvar as sys; -use sys_common::mutex as sys_mutex; -use sys_common::poison::{self, LockResult}; -use time::{Duration, Instant}; +use crate::fmt; +use crate::sync::atomic::{AtomicUsize, Ordering}; +use crate::sync::{mutex, MutexGuard, PoisonError}; +use crate::sys_common::condvar as sys; +use crate::sys_common::mutex as sys_mutex; +use crate::sys_common::poison::{self, LockResult}; +use crate::time::{Duration, Instant}; /// A type indicating whether a timed wait on a condition variable returned /// due to a time out or not. @@ -612,12 +612,12 @@ impl Drop for Condvar { #[cfg(test)] mod tests { /// #![feature(wait_until)] - use sync::mpsc::channel; - use sync::{Condvar, Mutex, Arc}; - use sync::atomic::{AtomicBool, Ordering}; - use thread; - use time::Duration; - use u64; + use crate::sync::mpsc::channel; + use crate::sync::{Condvar, Mutex, Arc}; + use crate::sync::atomic::{AtomicBool, Ordering}; + use crate::thread; + use crate::time::Duration; + use crate::u64; #[test] fn smoke() { diff --git a/src/libstd/sync/mod.rs b/src/libstd/sync/mod.rs index 3d11af7dc10e..809ee8826981 100644 --- a/src/libstd/sync/mod.rs +++ b/src/libstd/sync/mod.rs @@ -165,7 +165,7 @@ pub use self::mutex::{Mutex, MutexGuard}; #[stable(feature = "rust1", since = "1.0.0")] pub use self::once::{Once, OnceState, ONCE_INIT}; #[stable(feature = "rust1", since = "1.0.0")] -pub use sys_common::poison::{PoisonError, TryLockError, TryLockResult, LockResult}; +pub use crate::sys_common::poison::{PoisonError, TryLockError, TryLockResult, LockResult}; #[stable(feature = "rust1", since = "1.0.0")] pub use self::rwlock::{RwLock, RwLockReadGuard, RwLockWriteGuard}; diff --git a/src/libstd/sync/mpsc/blocking.rs b/src/libstd/sync/mpsc/blocking.rs index eaf09a16756b..6eacfaec2535 100644 --- a/src/libstd/sync/mpsc/blocking.rs +++ b/src/libstd/sync/mpsc/blocking.rs @@ -1,10 +1,10 @@ //! Generic support for building blocking abstractions. -use thread::{self, Thread}; -use sync::atomic::{AtomicBool, Ordering}; -use sync::Arc; -use mem; -use time::Instant; +use crate::thread::{self, Thread}; +use crate::sync::atomic::{AtomicBool, Ordering}; +use crate::sync::Arc; +use crate::mem; +use crate::time::Instant; struct Inner { thread: Thread, diff --git a/src/libstd/sync/mpsc/cache_aligned.rs b/src/libstd/sync/mpsc/cache_aligned.rs index fb1177e03506..b14a9e5d61bd 100644 --- a/src/libstd/sync/mpsc/cache_aligned.rs +++ b/src/libstd/sync/mpsc/cache_aligned.rs @@ -1,4 +1,4 @@ -use ops::{Deref, DerefMut}; +use crate::ops::{Deref, DerefMut}; #[derive(Copy, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] #[repr(align(64))] diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index 5273345c6b4f..90c5c50c23b9 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -266,12 +266,12 @@ // And now that you've seen all the races that I found and attempted to fix, // here's the code for you to find some more! -use sync::Arc; -use error; -use fmt; -use mem; -use cell::UnsafeCell; -use time::{Duration, Instant}; +use crate::sync::Arc; +use crate::error; +use crate::fmt; +use crate::mem; +use crate::cell::UnsafeCell; +use crate::time::{Duration, Instant}; #[unstable(feature = "mpsc_select", issue = "27800")] pub use self::select::{Select, Handle}; @@ -1822,10 +1822,10 @@ impl From for RecvTimeoutError { #[cfg(all(test, not(target_os = "emscripten")))] mod tests { - use env; use super::*; - use thread; - use time::{Duration, Instant}; + use crate::env; + use crate::thread; + use crate::time::{Duration, Instant}; pub fn stress_factor() -> usize { match env::var("RUST_TEST_STRESS") { @@ -2514,10 +2514,10 @@ mod tests { #[cfg(all(test, not(target_os = "emscripten")))] mod sync_tests { - use env; - use thread; use super::*; - use time::Duration; + use crate::env; + use crate::thread; + use crate::time::Duration; pub fn stress_factor() -> usize { match env::var("RUST_TEST_STRESS") { diff --git a/src/libstd/sync/mpsc/mpsc_queue.rs b/src/libstd/sync/mpsc/mpsc_queue.rs index 794d11f1eac9..8f5681b97f44 100644 --- a/src/libstd/sync/mpsc/mpsc_queue.rs +++ b/src/libstd/sync/mpsc/mpsc_queue.rs @@ -15,8 +15,9 @@ pub use self::PopResult::*; use core::ptr; use core::cell::UnsafeCell; -use boxed::Box; -use sync::atomic::{AtomicPtr, Ordering}; + +use crate::boxed::Box; +use crate::sync::atomic::{AtomicPtr, Ordering}; /// A result of the `pop` function. pub enum PopResult { @@ -120,10 +121,10 @@ impl Drop for Queue { #[cfg(all(test, not(target_os = "emscripten")))] mod tests { - use sync::mpsc::channel; use super::{Queue, Data, Empty, Inconsistent}; - use sync::Arc; - use thread; + use crate::sync::mpsc::channel; + use crate::sync::Arc; + use crate::thread; #[test] fn test_full() { diff --git a/src/libstd/sync/mpsc/oneshot.rs b/src/libstd/sync/mpsc/oneshot.rs index 36928c428e33..5c516d5de0f1 100644 --- a/src/libstd/sync/mpsc/oneshot.rs +++ b/src/libstd/sync/mpsc/oneshot.rs @@ -27,12 +27,12 @@ pub use self::UpgradeResult::*; pub use self::SelectionResult::*; use self::MyUpgrade::*; -use sync::mpsc::Receiver; -use sync::mpsc::blocking::{self, SignalToken}; -use cell::UnsafeCell; -use ptr; -use sync::atomic::{AtomicUsize, Ordering}; -use time::Instant; +use crate::sync::mpsc::Receiver; +use crate::sync::mpsc::blocking::{self, SignalToken}; +use crate::cell::UnsafeCell; +use crate::ptr; +use crate::sync::atomic::{AtomicUsize, Ordering}; +use crate::time::Instant; // Various states you can find a port in. const EMPTY: usize = 0; // initial state: no data, no blocked receiver diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs index 8591b55dc58e..19c949086454 100644 --- a/src/libstd/sync/mpsc/select.rs +++ b/src/libstd/sync/mpsc/select.rs @@ -46,16 +46,14 @@ #![rustc_deprecated(since = "1.32.0", reason = "channel selection will be removed in a future release")] - -use fmt; - use core::cell::{Cell, UnsafeCell}; use core::marker; use core::ptr; use core::usize; -use sync::mpsc::{Receiver, RecvError}; -use sync::mpsc::blocking::{self, SignalToken}; +use crate::fmt; +use crate::sync::mpsc::{Receiver, RecvError}; +use crate::sync::mpsc::blocking::{self, SignalToken}; /// The "receiver set" of the select interface. This structure is used to manage /// a set of receivers which are being selected over. diff --git a/src/libstd/sync/mpsc/select_tests.rs b/src/libstd/sync/mpsc/select_tests.rs index be048511caae..18d93462c78d 100644 --- a/src/libstd/sync/mpsc/select_tests.rs +++ b/src/libstd/sync/mpsc/select_tests.rs @@ -2,8 +2,8 @@ /// This file exists to hack around https://github.com/rust-lang/rust/issues/47238 -use thread; -use sync::mpsc::*; +use crate::thread; +use crate::sync::mpsc::*; // Don't use the libstd version so we can pull in the right Select structure // (std::comm points at the wrong one) diff --git a/src/libstd/sync/mpsc/shared.rs b/src/libstd/sync/mpsc/shared.rs index 3da73ac0b822..6a5d861f0e9c 100644 --- a/src/libstd/sync/mpsc/shared.rs +++ b/src/libstd/sync/mpsc/shared.rs @@ -14,16 +14,16 @@ use core::cmp; use core::intrinsics::abort; use core::isize; -use cell::UnsafeCell; -use ptr; -use sync::atomic::{AtomicUsize, AtomicIsize, AtomicBool, Ordering}; -use sync::mpsc::blocking::{self, SignalToken}; -use sync::mpsc::mpsc_queue as mpsc; -use sync::mpsc::select::StartResult::*; -use sync::mpsc::select::StartResult; -use sync::{Mutex, MutexGuard}; -use thread; -use time::Instant; +use crate::cell::UnsafeCell; +use crate::ptr; +use crate::sync::atomic::{AtomicUsize, AtomicIsize, AtomicBool, Ordering}; +use crate::sync::mpsc::blocking::{self, SignalToken}; +use crate::sync::mpsc::mpsc_queue as mpsc; +use crate::sync::mpsc::select::StartResult::*; +use crate::sync::mpsc::select::StartResult; +use crate::sync::{Mutex, MutexGuard}; +use crate::thread; +use crate::time::Instant; const DISCONNECTED: isize = isize::MIN; const FUDGE: isize = 1024; diff --git a/src/libstd/sync/mpsc/spsc_queue.rs b/src/libstd/sync/mpsc/spsc_queue.rs index b43ccf074a42..0edb1c24e801 100644 --- a/src/libstd/sync/mpsc/spsc_queue.rs +++ b/src/libstd/sync/mpsc/spsc_queue.rs @@ -6,11 +6,11 @@ // http://www.1024cores.net/home/lock-free-algorithms/queues/unbounded-spsc-queue -use boxed::Box; use core::ptr; use core::cell::UnsafeCell; -use sync::atomic::{AtomicPtr, AtomicUsize, Ordering}; +use crate::boxed::Box; +use crate::sync::atomic::{AtomicPtr, AtomicUsize, Ordering}; use super::cache_aligned::CacheAligned; @@ -233,10 +233,10 @@ impl Drop for Queue(guard: &MutexGuard<'a, T>) -> &'a poison::Fla #[cfg(all(test, not(target_os = "emscripten")))] mod tests { - use sync::mpsc::channel; - use sync::{Arc, Mutex, Condvar}; - use sync::atomic::{AtomicUsize, Ordering}; - use thread; + use crate::sync::mpsc::channel; + use crate::sync::{Arc, Mutex, Condvar}; + use crate::sync::atomic::{AtomicUsize, Ordering}; + use crate::thread; struct Packet(Arc<(Mutex, Condvar)>); diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs index e207d0170d7b..a036c2666625 100644 --- a/src/libstd/sync/once.rs +++ b/src/libstd/sync/once.rs @@ -52,11 +52,11 @@ // You'll find a few more details in the implementation, but that's the gist of // it! -use fmt; -use marker; -use ptr; -use sync::atomic::{AtomicUsize, AtomicBool, Ordering}; -use thread::{self, Thread}; +use crate::fmt; +use crate::marker; +use crate::ptr; +use crate::sync::atomic::{AtomicUsize, AtomicBool, Ordering}; +use crate::thread::{self, Thread}; /// A synchronization primitive which can be used to run a one-time global /// initialization. Useful for one-time initialization for FFI or related @@ -514,9 +514,9 @@ impl OnceState { #[cfg(all(test, not(target_os = "emscripten")))] mod tests { - use panic; - use sync::mpsc::channel; - use thread; + use crate::panic; + use crate::sync::mpsc::channel; + use crate::thread; use super::Once; #[test] diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index 7f3cb4f72c7b..0be83c76d625 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -1,10 +1,10 @@ -use cell::UnsafeCell; -use fmt; -use mem; -use ops::{Deref, DerefMut}; -use ptr; -use sys_common::poison::{self, LockResult, TryLockError, TryLockResult}; -use sys_common::rwlock as sys; +use crate::cell::UnsafeCell; +use crate::fmt; +use crate::mem; +use crate::ops::{Deref, DerefMut}; +use crate::ptr; +use crate::sys_common::poison::{self, LockResult, TryLockError, TryLockResult}; +use crate::sys_common::rwlock as sys; /// A reader-writer lock /// @@ -554,10 +554,10 @@ impl Drop for RwLockWriteGuard<'_, T> { #[cfg(all(test, not(target_os = "emscripten")))] mod tests { use rand::{self, Rng}; - use sync::mpsc::channel; - use thread; - use sync::{Arc, RwLock, TryLockError}; - use sync::atomic::{AtomicUsize, Ordering}; + use crate::sync::mpsc::channel; + use crate::thread; + use crate::sync::{Arc, RwLock, TryLockError}; + use crate::sync::atomic::{AtomicUsize, Ordering}; #[derive(Eq, PartialEq, Debug)] struct NonCopy(i32); diff --git a/src/libstd/sys/cloudabi/abi/bitflags.rs b/src/libstd/sys/cloudabi/abi/bitflags.rs index f764cc1df5a5..306936213ed1 100644 --- a/src/libstd/sys/cloudabi/abi/bitflags.rs +++ b/src/libstd/sys/cloudabi/abi/bitflags.rs @@ -25,8 +25,7 @@ // ignore-license #[cfg(feature = "bitflags")] -#[macro_use] -extern crate bitflags; +use bitflags::bitflags; // Minimal implementation of bitflags! in case we can't depend on the bitflags // crate. Only implements `bits()` and a `from_bits_truncate()` that doesn't diff --git a/src/libstd/sys/cloudabi/abi/cloudabi.rs b/src/libstd/sys/cloudabi/abi/cloudabi.rs index 83d45b3547bc..2307e2167c5c 100644 --- a/src/libstd/sys/cloudabi/abi/cloudabi.rs +++ b/src/libstd/sys/cloudabi/abi/cloudabi.rs @@ -1090,10 +1090,10 @@ pub union auxv_union { #[test] #[cfg(target_pointer_width = "32")] fn auxv_layout_test_32() { - assert_eq!(::core::mem::size_of::(), 8); - assert_eq!(::core::mem::align_of::(), 4); + assert_eq!(core::mem::size_of::(), 8); + assert_eq!(core::mem::align_of::(), 4); unsafe { - let obj: auxv = ::core::mem::uninitialized(); + let obj: auxv = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.a_type as *const _ as usize - base, 0); assert_eq!(&obj.union.a_val as *const _ as usize - base, 4); @@ -1103,10 +1103,10 @@ fn auxv_layout_test_32() { #[test] #[cfg(target_pointer_width = "64")] fn auxv_layout_test_64() { - assert_eq!(::core::mem::size_of::(), 16); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 16); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: auxv = ::core::mem::uninitialized(); + let obj: auxv = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.a_type as *const _ as usize - base, 0); assert_eq!(&obj.union.a_val as *const _ as usize - base, 8); @@ -1124,10 +1124,10 @@ pub struct ciovec { #[test] #[cfg(target_pointer_width = "32")] fn ciovec_layout_test_32() { - assert_eq!(::core::mem::size_of::(), 8); - assert_eq!(::core::mem::align_of::(), 4); + assert_eq!(core::mem::size_of::(), 8); + assert_eq!(core::mem::align_of::(), 4); unsafe { - let obj: ciovec = ::core::mem::uninitialized(); + let obj: ciovec = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.buf.0 as *const _ as usize - base, 0); assert_eq!(&obj.buf.1 as *const _ as usize - base, 4); @@ -1136,10 +1136,10 @@ fn ciovec_layout_test_32() { #[test] #[cfg(target_pointer_width = "64")] fn ciovec_layout_test_64() { - assert_eq!(::core::mem::size_of::(), 16); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 16); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: ciovec = ::core::mem::uninitialized(); + let obj: ciovec = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.buf.0 as *const _ as usize - base, 0); assert_eq!(&obj.buf.1 as *const _ as usize - base, 8); @@ -1164,10 +1164,10 @@ pub struct dirent { } #[test] fn dirent_layout_test() { - assert_eq!(::core::mem::size_of::(), 24); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 24); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: dirent = ::core::mem::uninitialized(); + let obj: dirent = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.d_next as *const _ as usize - base, 0); assert_eq!(&obj.d_ino as *const _ as usize - base, 8); @@ -1228,10 +1228,10 @@ pub struct event_proc_terminate { } #[test] fn event_layout_test() { - assert_eq!(::core::mem::size_of::(), 32); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 32); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: event = ::core::mem::uninitialized(); + let obj: event = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.userdata as *const _ as usize - base, 0); assert_eq!(&obj.error as *const _ as usize - base, 8); @@ -1262,10 +1262,10 @@ pub struct fdstat { } #[test] fn fdstat_layout_test() { - assert_eq!(::core::mem::size_of::(), 24); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 24); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: fdstat = ::core::mem::uninitialized(); + let obj: fdstat = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.fs_filetype as *const _ as usize - base, 0); assert_eq!(&obj.fs_flags as *const _ as usize - base, 2); @@ -1299,10 +1299,10 @@ pub struct filestat { } #[test] fn filestat_layout_test() { - assert_eq!(::core::mem::size_of::(), 56); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 56); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: filestat = ::core::mem::uninitialized(); + let obj: filestat = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.st_dev as *const _ as usize - base, 0); assert_eq!(&obj.st_ino as *const _ as usize - base, 8); @@ -1325,10 +1325,10 @@ pub struct iovec { #[test] #[cfg(target_pointer_width = "32")] fn iovec_layout_test_32() { - assert_eq!(::core::mem::size_of::(), 8); - assert_eq!(::core::mem::align_of::(), 4); + assert_eq!(core::mem::size_of::(), 8); + assert_eq!(core::mem::align_of::(), 4); unsafe { - let obj: iovec = ::core::mem::uninitialized(); + let obj: iovec = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.buf.0 as *const _ as usize - base, 0); assert_eq!(&obj.buf.1 as *const _ as usize - base, 4); @@ -1337,10 +1337,10 @@ fn iovec_layout_test_32() { #[test] #[cfg(target_pointer_width = "64")] fn iovec_layout_test_64() { - assert_eq!(::core::mem::size_of::(), 16); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 16); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: iovec = ::core::mem::uninitialized(); + let obj: iovec = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.buf.0 as *const _ as usize - base, 0); assert_eq!(&obj.buf.1 as *const _ as usize - base, 8); @@ -1360,10 +1360,10 @@ pub struct lookup { } #[test] fn lookup_layout_test() { - assert_eq!(::core::mem::size_of::(), 8); - assert_eq!(::core::mem::align_of::(), 4); + assert_eq!(core::mem::size_of::(), 8); + assert_eq!(core::mem::align_of::(), 4); unsafe { - let obj: lookup = ::core::mem::uninitialized(); + let obj: lookup = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.fd as *const _ as usize - base, 0); assert_eq!(&obj.flags as *const _ as usize - base, 4); @@ -1394,10 +1394,10 @@ pub struct recv_in { #[test] #[cfg(target_pointer_width = "32")] fn recv_in_layout_test_32() { - assert_eq!(::core::mem::size_of::(), 20); - assert_eq!(::core::mem::align_of::(), 4); + assert_eq!(core::mem::size_of::(), 20); + assert_eq!(core::mem::align_of::(), 4); unsafe { - let obj: recv_in = ::core::mem::uninitialized(); + let obj: recv_in = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.ri_data.0 as *const _ as usize - base, 0); assert_eq!(&obj.ri_data.1 as *const _ as usize - base, 4); @@ -1409,10 +1409,10 @@ fn recv_in_layout_test_32() { #[test] #[cfg(target_pointer_width = "64")] fn recv_in_layout_test_64() { - assert_eq!(::core::mem::size_of::(), 40); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 40); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: recv_in = ::core::mem::uninitialized(); + let obj: recv_in = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.ri_data.0 as *const _ as usize - base, 0); assert_eq!(&obj.ri_data.1 as *const _ as usize - base, 8); @@ -1438,10 +1438,10 @@ pub struct recv_out { #[test] #[cfg(target_pointer_width = "32")] fn recv_out_layout_test_32() { - assert_eq!(::core::mem::size_of::(), 52); - assert_eq!(::core::mem::align_of::(), 4); + assert_eq!(core::mem::size_of::(), 52); + assert_eq!(core::mem::align_of::(), 4); unsafe { - let obj: recv_out = ::core::mem::uninitialized(); + let obj: recv_out = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.ro_datalen as *const _ as usize - base, 0); assert_eq!(&obj.ro_fdslen as *const _ as usize - base, 4); @@ -1452,10 +1452,10 @@ fn recv_out_layout_test_32() { #[test] #[cfg(target_pointer_width = "64")] fn recv_out_layout_test_64() { - assert_eq!(::core::mem::size_of::(), 64); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 64); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: recv_out = ::core::mem::uninitialized(); + let obj: recv_out = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.ro_datalen as *const _ as usize - base, 0); assert_eq!(&obj.ro_fdslen as *const _ as usize - base, 8); @@ -1480,10 +1480,10 @@ pub struct send_in { #[test] #[cfg(target_pointer_width = "32")] fn send_in_layout_test_32() { - assert_eq!(::core::mem::size_of::(), 20); - assert_eq!(::core::mem::align_of::(), 4); + assert_eq!(core::mem::size_of::(), 20); + assert_eq!(core::mem::align_of::(), 4); unsafe { - let obj: send_in = ::core::mem::uninitialized(); + let obj: send_in = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.si_data.0 as *const _ as usize - base, 0); assert_eq!(&obj.si_data.1 as *const _ as usize - base, 4); @@ -1495,10 +1495,10 @@ fn send_in_layout_test_32() { #[test] #[cfg(target_pointer_width = "64")] fn send_in_layout_test_64() { - assert_eq!(::core::mem::size_of::(), 40); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 40); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: send_in = ::core::mem::uninitialized(); + let obj: send_in = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.si_data.0 as *const _ as usize - base, 0); assert_eq!(&obj.si_data.1 as *const _ as usize - base, 8); @@ -1518,10 +1518,10 @@ pub struct send_out { #[test] #[cfg(target_pointer_width = "32")] fn send_out_layout_test_32() { - assert_eq!(::core::mem::size_of::(), 4); - assert_eq!(::core::mem::align_of::(), 4); + assert_eq!(core::mem::size_of::(), 4); + assert_eq!(core::mem::align_of::(), 4); unsafe { - let obj: send_out = ::core::mem::uninitialized(); + let obj: send_out = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.so_datalen as *const _ as usize - base, 0); } @@ -1529,10 +1529,10 @@ fn send_out_layout_test_32() { #[test] #[cfg(target_pointer_width = "64")] fn send_out_layout_test_64() { - assert_eq!(::core::mem::size_of::(), 8); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 8); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: send_out = ::core::mem::uninitialized(); + let obj: send_out = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.so_datalen as *const _ as usize - base, 0); } @@ -1647,10 +1647,10 @@ pub struct subscription_proc_terminate { #[test] #[cfg(target_pointer_width = "32")] fn subscription_layout_test_32() { - assert_eq!(::core::mem::size_of::(), 56); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 56); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: subscription = ::core::mem::uninitialized(); + let obj: subscription = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.userdata as *const _ as usize - base, 0); assert_eq!(&obj.unused as *const _ as usize - base, 8); @@ -1674,10 +1674,10 @@ fn subscription_layout_test_32() { #[test] #[cfg(target_pointer_width = "64")] fn subscription_layout_test_64() { - assert_eq!(::core::mem::size_of::(), 56); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 56); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: subscription = ::core::mem::uninitialized(); + let obj: subscription = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.userdata as *const _ as usize - base, 0); assert_eq!(&obj.unused as *const _ as usize - base, 8); @@ -1728,10 +1728,10 @@ pub struct tcb { #[test] #[cfg(target_pointer_width = "32")] fn tcb_layout_test_32() { - assert_eq!(::core::mem::size_of::(), 4); - assert_eq!(::core::mem::align_of::(), 4); + assert_eq!(core::mem::size_of::(), 4); + assert_eq!(core::mem::align_of::(), 4); unsafe { - let obj: tcb = ::core::mem::uninitialized(); + let obj: tcb = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.parent as *const _ as usize - base, 0); } @@ -1739,10 +1739,10 @@ fn tcb_layout_test_32() { #[test] #[cfg(target_pointer_width = "64")] fn tcb_layout_test_64() { - assert_eq!(::core::mem::size_of::(), 8); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 8); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: tcb = ::core::mem::uninitialized(); + let obj: tcb = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.parent as *const _ as usize - base, 0); } @@ -1773,10 +1773,10 @@ pub struct threadattr { #[test] #[cfg(target_pointer_width = "32")] fn threadattr_layout_test_32() { - assert_eq!(::core::mem::size_of::(), 16); - assert_eq!(::core::mem::align_of::(), 4); + assert_eq!(core::mem::size_of::(), 16); + assert_eq!(core::mem::align_of::(), 4); unsafe { - let obj: threadattr = ::core::mem::uninitialized(); + let obj: threadattr = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.entry_point as *const _ as usize - base, 0); assert_eq!(&obj.stack.0 as *const _ as usize - base, 4); @@ -1787,10 +1787,10 @@ fn threadattr_layout_test_32() { #[test] #[cfg(target_pointer_width = "64")] fn threadattr_layout_test_64() { - assert_eq!(::core::mem::size_of::(), 32); - assert_eq!(::core::mem::align_of::(), 8); + assert_eq!(core::mem::size_of::(), 32); + assert_eq!(core::mem::align_of::(), 8); unsafe { - let obj: threadattr = ::core::mem::uninitialized(); + let obj: threadattr = core::mem::uninitialized(); let base = &obj as *const _ as usize; assert_eq!(&obj.entry_point as *const _ as usize - base, 0); assert_eq!(&obj.stack.0 as *const _ as usize - base, 8); diff --git a/src/libstd/sys/cloudabi/args.rs b/src/libstd/sys/cloudabi/args.rs index 4147ffff8711..dea562abad3f 100644 --- a/src/libstd/sys/cloudabi/args.rs +++ b/src/libstd/sys/cloudabi/args.rs @@ -1,4 +1,4 @@ -pub use sys::cloudabi::shims::args::*; +pub use crate::sys::cloudabi::shims::args::*; #[allow(dead_code)] pub fn init(_: isize, _: *const *const u8) {} diff --git a/src/libstd/sys/cloudabi/backtrace.rs b/src/libstd/sys/cloudabi/backtrace.rs index 72f28550435a..a15d2238e556 100644 --- a/src/libstd/sys/cloudabi/backtrace.rs +++ b/src/libstd/sys/cloudabi/backtrace.rs @@ -1,9 +1,10 @@ -use error::Error; -use ffi::CStr; -use intrinsics; -use io; -use libc; -use sys_common::backtrace::Frame; +use crate::error::Error; +use crate::ffi::CStr; +use crate::fmt; +use crate::intrinsics; +use crate::io; +use crate::sys_common::backtrace::Frame; + use unwind as uw; pub struct BacktraceContext; @@ -22,8 +23,8 @@ impl Error for UnwindError { } } -impl ::fmt::Display for UnwindError { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { +impl fmt::Display for UnwindError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}: {:?}", self.description(), self.0) } } diff --git a/src/libstd/sys/cloudabi/condvar.rs b/src/libstd/sys/cloudabi/condvar.rs index 758f29653aeb..7aa0b0b6f491 100644 --- a/src/libstd/sys/cloudabi/condvar.rs +++ b/src/libstd/sys/cloudabi/condvar.rs @@ -1,10 +1,10 @@ -use cell::UnsafeCell; -use mem; -use sync::atomic::{AtomicU32, Ordering}; -use sys::cloudabi::abi; -use sys::mutex::{self, Mutex}; -use sys::time::checked_dur2intervals; -use time::Duration; +use crate::cell::UnsafeCell; +use crate::mem; +use crate::sync::atomic::{AtomicU32, Ordering}; +use crate::sys::cloudabi::abi; +use crate::sys::mutex::{self, Mutex}; +use crate::sys::time::checked_dur2intervals; +use crate::time::Duration; extern "C" { #[thread_local] diff --git a/src/libstd/sys/cloudabi/io.rs b/src/libstd/sys/cloudabi/io.rs new file mode 100644 index 000000000000..8b02d3fd19d3 --- /dev/null +++ b/src/libstd/sys/cloudabi/io.rs @@ -0,0 +1,32 @@ +pub struct IoVec<'a>(&'a [u8]); + +impl<'a> IoVec<'a> { + #[inline] + pub fn new(buf: &'a [u8]) -> IoVec<'a> { + IoVec(buf) + } + + #[inline] + pub fn as_slice(&self) -> &[u8] { + self.0 + } +} + +pub struct IoVecMut<'a>(&'a mut [u8]); + +impl<'a> IoVecMut<'a> { + #[inline] + pub fn new(buf: &'a mut [u8]) -> IoVecMut<'a> { + IoVecMut(buf) + } + + #[inline] + pub fn as_slice(&self) -> &[u8] { + self.0 + } + + #[inline] + pub fn as_mut_slice(&mut self) -> &mut [u8] { + self.0 + } +} diff --git a/src/libstd/sys/cloudabi/mod.rs b/src/libstd/sys/cloudabi/mod.rs index cd621b769456..47c90fddd867 100644 --- a/src/libstd/sys/cloudabi/mod.rs +++ b/src/libstd/sys/cloudabi/mod.rs @@ -1,6 +1,5 @@ -use io; -use libc; -use mem; +use crate::io::ErrorKind; +use crate::mem; #[path = "../unix/alloc.rs"] pub mod alloc; @@ -10,6 +9,7 @@ pub mod backtrace; #[path = "../unix/cmath.rs"] pub mod cmath; pub mod condvar; +pub mod io; #[path = "../unix/memchr.rs"] pub mod memchr; pub mod mutex; @@ -32,29 +32,29 @@ pub use self::shims::*; #[allow(dead_code)] pub fn init() {} -pub fn decode_error_kind(errno: i32) -> io::ErrorKind { +pub fn decode_error_kind(errno: i32) -> ErrorKind { match errno { - x if x == abi::errno::ACCES as i32 => io::ErrorKind::PermissionDenied, - x if x == abi::errno::ADDRINUSE as i32 => io::ErrorKind::AddrInUse, - x if x == abi::errno::ADDRNOTAVAIL as i32 => io::ErrorKind::AddrNotAvailable, - x if x == abi::errno::AGAIN as i32 => io::ErrorKind::WouldBlock, - x if x == abi::errno::CONNABORTED as i32 => io::ErrorKind::ConnectionAborted, - x if x == abi::errno::CONNREFUSED as i32 => io::ErrorKind::ConnectionRefused, - x if x == abi::errno::CONNRESET as i32 => io::ErrorKind::ConnectionReset, - x if x == abi::errno::EXIST as i32 => io::ErrorKind::AlreadyExists, - x if x == abi::errno::INTR as i32 => io::ErrorKind::Interrupted, - x if x == abi::errno::INVAL as i32 => io::ErrorKind::InvalidInput, - x if x == abi::errno::NOENT as i32 => io::ErrorKind::NotFound, - x if x == abi::errno::NOTCONN as i32 => io::ErrorKind::NotConnected, - x if x == abi::errno::PERM as i32 => io::ErrorKind::PermissionDenied, - x if x == abi::errno::PIPE as i32 => io::ErrorKind::BrokenPipe, - x if x == abi::errno::TIMEDOUT as i32 => io::ErrorKind::TimedOut, - _ => io::ErrorKind::Other, + x if x == abi::errno::ACCES as i32 => ErrorKind::PermissionDenied, + x if x == abi::errno::ADDRINUSE as i32 => ErrorKind::AddrInUse, + x if x == abi::errno::ADDRNOTAVAIL as i32 => ErrorKind::AddrNotAvailable, + x if x == abi::errno::AGAIN as i32 => ErrorKind::WouldBlock, + x if x == abi::errno::CONNABORTED as i32 => ErrorKind::ConnectionAborted, + x if x == abi::errno::CONNREFUSED as i32 => ErrorKind::ConnectionRefused, + x if x == abi::errno::CONNRESET as i32 => ErrorKind::ConnectionReset, + x if x == abi::errno::EXIST as i32 => ErrorKind::AlreadyExists, + x if x == abi::errno::INTR as i32 => ErrorKind::Interrupted, + x if x == abi::errno::INVAL as i32 => ErrorKind::InvalidInput, + x if x == abi::errno::NOENT as i32 => ErrorKind::NotFound, + x if x == abi::errno::NOTCONN as i32 => ErrorKind::NotConnected, + x if x == abi::errno::PERM as i32 => ErrorKind::PermissionDenied, + x if x == abi::errno::PIPE as i32 => ErrorKind::BrokenPipe, + x if x == abi::errno::TIMEDOUT as i32 => ErrorKind::TimedOut, + _ => ErrorKind::Other, } } pub unsafe fn abort_internal() -> ! { - ::core::intrinsics::abort(); + core::intrinsics::abort(); } pub use libc::strlen; diff --git a/src/libstd/sys/cloudabi/mutex.rs b/src/libstd/sys/cloudabi/mutex.rs index ae62d8bfdb0c..5e191e31d5fc 100644 --- a/src/libstd/sys/cloudabi/mutex.rs +++ b/src/libstd/sys/cloudabi/mutex.rs @@ -1,8 +1,8 @@ -use cell::UnsafeCell; -use mem; -use sync::atomic::{AtomicU32, Ordering}; -use sys::cloudabi::abi; -use sys::rwlock::{self, RWLock}; +use crate::cell::UnsafeCell; +use crate::mem; +use crate::sync::atomic::{AtomicU32, Ordering}; +use crate::sys::cloudabi::abi; +use crate::sys::rwlock::{self, RWLock}; extern "C" { #[thread_local] diff --git a/src/libstd/sys/cloudabi/os.rs b/src/libstd/sys/cloudabi/os.rs index 8a6464125de6..7db7808a0878 100644 --- a/src/libstd/sys/cloudabi/os.rs +++ b/src/libstd/sys/cloudabi/os.rs @@ -1,8 +1,9 @@ -use ffi::CStr; -use libc::{self, c_int}; -use str; +use crate::ffi::CStr; +use crate::str; -pub use sys::cloudabi::shims::os::*; +use libc::c_int; + +pub use crate::sys::cloudabi::shims::os::*; pub fn errno() -> i32 { extern "C" { diff --git a/src/libstd/sys/cloudabi/rwlock.rs b/src/libstd/sys/cloudabi/rwlock.rs index 7f08c2c78691..6da3f3841b6c 100644 --- a/src/libstd/sys/cloudabi/rwlock.rs +++ b/src/libstd/sys/cloudabi/rwlock.rs @@ -1,7 +1,7 @@ -use cell::UnsafeCell; -use mem; -use sync::atomic::{AtomicU32, Ordering}; -use sys::cloudabi::abi; +use crate::cell::UnsafeCell; +use crate::mem; +use crate::sync::atomic::{AtomicU32, Ordering}; +use crate::sys::cloudabi::abi; extern "C" { #[thread_local] diff --git a/src/libstd/sys/cloudabi/shims/args.rs b/src/libstd/sys/cloudabi/shims/args.rs index f924a434263f..f5cf71caf6c0 100644 --- a/src/libstd/sys/cloudabi/shims/args.rs +++ b/src/libstd/sys/cloudabi/shims/args.rs @@ -1,4 +1,4 @@ -use ffi::OsString; +use crate::ffi::OsString; pub struct Args(()); diff --git a/src/libstd/sys/cloudabi/shims/fs.rs b/src/libstd/sys/cloudabi/shims/fs.rs index 3af10a74c7d4..56667bef0070 100644 --- a/src/libstd/sys/cloudabi/shims/fs.rs +++ b/src/libstd/sys/cloudabi/shims/fs.rs @@ -1,10 +1,10 @@ -use ffi::OsString; -use fmt; -use hash::{Hash, Hasher}; -use io::{self, SeekFrom}; -use path::{Path, PathBuf}; -use sys::time::SystemTime; -use sys::{unsupported, Void}; +use crate::ffi::OsString; +use crate::fmt; +use crate::hash::{Hash, Hasher}; +use crate::io::{self, SeekFrom}; +use crate::path::{Path, PathBuf}; +use crate::sys::time::SystemTime; +use crate::sys::{unsupported, Void}; pub struct File(Void); diff --git a/src/libstd/sys/cloudabi/shims/mod.rs b/src/libstd/sys/cloudabi/shims/mod.rs index 080eac19ceb0..fbb5ff55f222 100644 --- a/src/libstd/sys/cloudabi/shims/mod.rs +++ b/src/libstd/sys/cloudabi/shims/mod.rs @@ -1,4 +1,4 @@ -use io; +use crate::io; pub mod args; pub mod env; diff --git a/src/libstd/sys/cloudabi/shims/net.rs b/src/libstd/sys/cloudabi/shims/net.rs index b4caa899a75d..6d2a4962ab44 100644 --- a/src/libstd/sys/cloudabi/shims/net.rs +++ b/src/libstd/sys/cloudabi/shims/net.rs @@ -1,10 +1,11 @@ -use fmt; -use io; -use net::{Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr}; -use time::Duration; -use sys::{unsupported, Void}; -use convert::TryFrom; +use crate::fmt; +use crate::io::{self, IoVec, IoVecMut}; +use crate::net::{Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr}; +use crate::time::Duration; +use crate::sys::{unsupported, Void}; +use crate::convert::TryFrom; +#[allow(unused_extern_crates)] pub extern crate libc as netc; pub struct TcpStream(Void); @@ -42,10 +43,18 @@ impl TcpStream { match self.0 {} } + pub fn read_vectored(&self, _: &mut [IoVecMut<'_>]) -> io::Result { + match self.0 {} + } + pub fn write(&self, _: &[u8]) -> io::Result { match self.0 {} } + pub fn write_vectored(&self, _: &[IoVec<'_>]) -> io::Result { + match self.0 {} + } + pub fn peer_addr(&self) -> io::Result { match self.0 {} } @@ -288,10 +297,10 @@ impl Iterator for LookupHost { } } -impl<'a> TryFrom<&'a str> for LookupHost { +impl TryFrom<&str> for LookupHost { type Error = io::Error; - fn try_from(_v: &'a str) -> io::Result { + fn try_from(_v: &str) -> io::Result { unsupported() } } diff --git a/src/libstd/sys/cloudabi/shims/os.rs b/src/libstd/sys/cloudabi/shims/os.rs index 31cb18ea5268..0c4690e12b05 100644 --- a/src/libstd/sys/cloudabi/shims/os.rs +++ b/src/libstd/sys/cloudabi/shims/os.rs @@ -1,10 +1,10 @@ -use error::Error as StdError; -use ffi::{OsStr, OsString}; -use fmt; -use io; -use iter; -use path::{self, PathBuf}; -use sys::{unsupported, Void}; +use crate::error::Error as StdError; +use crate::ffi::{OsStr, OsString}; +use crate::fmt; +use crate::io; +use crate::iter; +use crate::path::{self, PathBuf}; +use crate::sys::{unsupported, Void}; pub fn getcwd() -> io::Result { unsupported() diff --git a/src/libstd/sys/cloudabi/shims/pipe.rs b/src/libstd/sys/cloudabi/shims/pipe.rs index 30ef79dd769b..f3debb950474 100644 --- a/src/libstd/sys/cloudabi/shims/pipe.rs +++ b/src/libstd/sys/cloudabi/shims/pipe.rs @@ -1,5 +1,5 @@ -use io; -use sys::Void; +use crate::io; +use crate::sys::Void; pub struct AnonPipe(Void); diff --git a/src/libstd/sys/cloudabi/shims/process.rs b/src/libstd/sys/cloudabi/shims/process.rs index 49b9d5e266ec..710c42c11490 100644 --- a/src/libstd/sys/cloudabi/shims/process.rs +++ b/src/libstd/sys/cloudabi/shims/process.rs @@ -1,10 +1,10 @@ -use ffi::OsStr; -use fmt; -use io; -use sys::fs::File; -use sys::pipe::AnonPipe; -use sys::{unsupported, Void}; -use sys_common::process::{CommandEnv, DefaultEnvKey}; +use crate::ffi::OsStr; +use crate::fmt; +use crate::io; +use crate::sys::fs::File; +use crate::sys::pipe::AnonPipe; +use crate::sys::{unsupported, Void}; +use crate::sys_common::process::{CommandEnv, DefaultEnvKey}; //////////////////////////////////////////////////////////////////////////////// // Command diff --git a/src/libstd/sys/cloudabi/stdio.rs b/src/libstd/sys/cloudabi/stdio.rs index 81d79213f615..601563c5b1fc 100644 --- a/src/libstd/sys/cloudabi/stdio.rs +++ b/src/libstd/sys/cloudabi/stdio.rs @@ -1,5 +1,5 @@ -use io; -use sys::cloudabi::abi; +use crate::io; +use crate::sys::cloudabi::abi; pub struct Stdin(()); pub struct Stdout(()); @@ -59,7 +59,7 @@ pub fn is_ebadf(err: &io::Error) -> bool { err.raw_os_error() == Some(abi::errno::BADF as i32) } -pub const STDIN_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE; +pub const STDIN_BUF_SIZE: usize = crate::sys_common::io::DEFAULT_BUF_SIZE; pub fn panic_output() -> Option { Stderr::new().ok() diff --git a/src/libstd/sys/cloudabi/thread.rs b/src/libstd/sys/cloudabi/thread.rs index 950420420f09..f853346e0e63 100644 --- a/src/libstd/sys/cloudabi/thread.rs +++ b/src/libstd/sys/cloudabi/thread.rs @@ -1,14 +1,13 @@ -use boxed::FnBox; -use cmp; -use ffi::CStr; -use io; -use libc; -use mem; -use ptr; -use sys::cloudabi::abi; -use sys::time::checked_dur2intervals; -use sys_common::thread::*; -use time::Duration; +use crate::boxed::FnBox; +use crate::cmp; +use crate::ffi::CStr; +use crate::io; +use crate::mem; +use crate::ptr; +use crate::sys::cloudabi::abi; +use crate::sys::time::checked_dur2intervals; +use crate::sys_common::thread::*; +use crate::time::Duration; pub const DEFAULT_MIN_STACK_SIZE: usize = 2 * 1024 * 1024; diff --git a/src/libstd/sys/cloudabi/time.rs b/src/libstd/sys/cloudabi/time.rs index 545e3c0ce845..d7502c61eff2 100644 --- a/src/libstd/sys/cloudabi/time.rs +++ b/src/libstd/sys/cloudabi/time.rs @@ -1,6 +1,6 @@ -use mem; -use sys::cloudabi::abi; -use time::Duration; +use crate::mem; +use crate::sys::cloudabi::abi; +use crate::time::Duration; const NSEC_PER_SEC: abi::timestamp = 1_000_000_000; diff --git a/src/libstd/sys/mod.rs b/src/libstd/sys/mod.rs index 0a56f4fad6d1..5ba9304c09b9 100644 --- a/src/libstd/sys/mod.rs +++ b/src/libstd/sys/mod.rs @@ -67,7 +67,7 @@ cfg_if! { pub mod unix_ext {} } else { // On other platforms like Windows document the bare bones of unix - use os::linux as platform; + use crate::os::linux as platform; #[path = "unix/ext/mod.rs"] pub mod unix_ext; } diff --git a/src/libstd/sys/redox/args.rs b/src/libstd/sys/redox/args.rs index 4e51be03f6f0..f9e2f5ba311a 100644 --- a/src/libstd/sys/redox/args.rs +++ b/src/libstd/sys/redox/args.rs @@ -5,9 +5,9 @@ #![allow(dead_code)] // runtime init functions not used during testing -use ffi::OsString; -use marker::PhantomData; -use vec; +use crate::ffi::OsString; +use crate::marker::PhantomData; +use crate::vec; /// One-time global initialization. pub unsafe fn init(argc: isize, argv: *const *const u8) { imp::init(argc, argv) } @@ -46,14 +46,13 @@ impl DoubleEndedIterator for Args { } mod imp { - use os::unix::prelude::*; - use mem; - use ffi::{CStr, OsString}; - use marker::PhantomData; - use libc; + use crate::os::unix::prelude::*; + use crate::mem; + use crate::ffi::{CStr, OsString}; + use crate::marker::PhantomData; use super::Args; - use sys_common::mutex::Mutex; + use crate::sys_common::mutex::Mutex; static mut GLOBAL_ARGS_PTR: usize = 0; static LOCK: Mutex = Mutex::new(); diff --git a/src/libstd/sys/redox/backtrace/mod.rs b/src/libstd/sys/redox/backtrace/mod.rs index 9a007241073c..8ea2783580a4 100644 --- a/src/libstd/sys/redox/backtrace/mod.rs +++ b/src/libstd/sys/redox/backtrace/mod.rs @@ -9,13 +9,13 @@ mod tracing; mod printing; pub mod gnu { - use io; - use fs; + use crate::io; + use crate::fs; + use crate::vec::Vec; + use crate::ffi::OsStr; + use crate::os::unix::ffi::OsStrExt; + use crate::io::Read; use libc::c_char; - use vec::Vec; - use ffi::OsStr; - use os::unix::ffi::OsStrExt; - use io::Read; pub fn get_executable_filename() -> io::Result<(Vec, fs::File)> { let mut exefile = fs::File::open("sys:exe")?; diff --git a/src/libstd/sys/redox/backtrace/printing.rs b/src/libstd/sys/redox/backtrace/printing.rs index c50c7154f0cd..489eed4562de 100644 --- a/src/libstd/sys/redox/backtrace/printing.rs +++ b/src/libstd/sys/redox/backtrace/printing.rs @@ -1 +1 @@ -pub use sys_common::gnu::libbacktrace::{foreach_symbol_fileline, resolve_symname}; +pub use crate::sys_common::gnu::libbacktrace::{foreach_symbol_fileline, resolve_symname}; diff --git a/src/libstd/sys/redox/backtrace/tracing.rs b/src/libstd/sys/redox/backtrace/tracing.rs index 59a8c5fab3d4..e7a68eadbde3 100644 --- a/src/libstd/sys/redox/backtrace/tracing.rs +++ b/src/libstd/sys/redox/backtrace/tracing.rs @@ -1,8 +1,8 @@ -use error::Error; -use io; -use libc; -use sys::backtrace::BacktraceContext; -use sys_common::backtrace::Frame; +use crate::error::Error; +use crate::fmt; +use crate::io; +use crate::sys::backtrace::BacktraceContext; +use crate::sys_common::backtrace::Frame; use unwind as uw; @@ -20,8 +20,8 @@ impl Error for UnwindError { } } -impl ::fmt::Display for UnwindError { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { +impl fmt::Display for UnwindError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}: {:?}", self.description(), self.0) } } diff --git a/src/libstd/sys/redox/condvar.rs b/src/libstd/sys/redox/condvar.rs index 5f9eee588c33..a6365cac23ea 100644 --- a/src/libstd/sys/redox/condvar.rs +++ b/src/libstd/sys/redox/condvar.rs @@ -1,10 +1,10 @@ -use cell::UnsafeCell; -use intrinsics::{atomic_cxchg, atomic_load, atomic_xadd, atomic_xchg}; -use ptr; -use time::Duration; +use crate::cell::UnsafeCell; +use crate::intrinsics::{atomic_cxchg, atomic_load, atomic_xadd, atomic_xchg}; +use crate::ptr; +use crate::time::Duration; -use sys::mutex::{mutex_unlock, Mutex}; -use sys::syscall::{futex, TimeSpec, FUTEX_WAIT, FUTEX_WAKE, FUTEX_REQUEUE}; +use crate::sys::mutex::{mutex_unlock, Mutex}; +use crate::sys::syscall::{futex, TimeSpec, FUTEX_WAIT, FUTEX_WAKE, FUTEX_REQUEUE}; pub struct Condvar { lock: UnsafeCell<*mut i32>, @@ -48,7 +48,7 @@ impl Condvar { atomic_xadd(seq, 1); - let _ = futex(seq, FUTEX_REQUEUE, 1, ::usize::MAX, *lock); + let _ = futex(seq, FUTEX_REQUEUE, 1, crate::usize::MAX, *lock); } } diff --git a/src/libstd/sys/redox/ext/ffi.rs b/src/libstd/sys/redox/ext/ffi.rs index 848880d26e89..671498bc3903 100644 --- a/src/libstd/sys/redox/ext/ffi.rs +++ b/src/libstd/sys/redox/ext/ffi.rs @@ -2,10 +2,10 @@ #![stable(feature = "rust1", since = "1.0.0")] -use ffi::{OsStr, OsString}; -use mem; -use sys::os_str::Buf; -use sys_common::{FromInner, IntoInner, AsInner}; +use crate::ffi::{OsStr, OsString}; +use crate::mem; +use crate::sys::os_str::Buf; +use crate::sys_common::{FromInner, IntoInner, AsInner}; /// Redox-specific extensions to [`OsString`]. /// diff --git a/src/libstd/sys/redox/ext/fs.rs b/src/libstd/sys/redox/ext/fs.rs index 8b81273f201c..53b9dd68f734 100644 --- a/src/libstd/sys/redox/ext/fs.rs +++ b/src/libstd/sys/redox/ext/fs.rs @@ -2,11 +2,11 @@ #![stable(feature = "rust1", since = "1.0.0")] -use fs::{self, Permissions, OpenOptions}; -use io; -use path::Path; -use sys; -use sys_common::{FromInner, AsInner, AsInnerMut}; +use crate::fs::{self, Permissions, OpenOptions}; +use crate::io; +use crate::path::Path; +use crate::sys; +use crate::sys_common::{FromInner, AsInner, AsInnerMut}; /// Redox-specific extensions to [`fs::Permissions`]. /// diff --git a/src/libstd/sys/redox/ext/io.rs b/src/libstd/sys/redox/ext/io.rs index 3ee0c6010a7a..f431f96c541f 100644 --- a/src/libstd/sys/redox/ext/io.rs +++ b/src/libstd/sys/redox/ext/io.rs @@ -2,11 +2,11 @@ #![stable(feature = "rust1", since = "1.0.0")] -use fs; -use net; -use sys; -use io; -use sys_common::{self, AsInner, FromInner, IntoInner}; +use crate::fs; +use crate::net; +use crate::sys; +use crate::io; +use crate::sys_common::{self, AsInner, FromInner, IntoInner}; /// Raw file descriptors. #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/sys/redox/ext/net.rs b/src/libstd/sys/redox/ext/net.rs index 7411b8e068f6..2c121787804d 100644 --- a/src/libstd/sys/redox/ext/net.rs +++ b/src/libstd/sys/redox/ext/net.rs @@ -2,13 +2,13 @@ //! Unix-specific networking functionality -use fmt; -use io::{self, Error, ErrorKind, Initializer}; -use net::Shutdown; -use os::unix::io::{RawFd, AsRawFd, FromRawFd, IntoRawFd}; -use path::Path; -use time::Duration; -use sys::{cvt, fd::FileDesc, syscall}; +use crate::fmt; +use crate::io::{self, Error, ErrorKind, Initializer}; +use crate::net::Shutdown; +use crate::os::unix::io::{RawFd, AsRawFd, FromRawFd, IntoRawFd}; +use crate::path::Path; +use crate::time::Duration; +use crate::sys::{cvt, fd::FileDesc, syscall}; /// An address associated with a Unix socket. /// diff --git a/src/libstd/sys/redox/ext/process.rs b/src/libstd/sys/redox/ext/process.rs index 020075531dd0..e981cb93d441 100644 --- a/src/libstd/sys/redox/ext/process.rs +++ b/src/libstd/sys/redox/ext/process.rs @@ -2,11 +2,11 @@ #![stable(feature = "rust1", since = "1.0.0")] -use io; -use os::unix::io::{FromRawFd, RawFd, AsRawFd, IntoRawFd}; -use process; -use sys; -use sys_common::{AsInnerMut, AsInner, FromInner, IntoInner}; +use crate::io; +use crate::os::unix::io::{FromRawFd, RawFd, AsRawFd, IntoRawFd}; +use crate::process; +use crate::sys; +use crate::sys_common::{AsInnerMut, AsInner, FromInner, IntoInner}; /// Redox-specific extensions to the [`process::Command`] builder, /// diff --git a/src/libstd/sys/redox/ext/thread.rs b/src/libstd/sys/redox/ext/thread.rs index 21b140ad718a..629eaef04ce3 100644 --- a/src/libstd/sys/redox/ext/thread.rs +++ b/src/libstd/sys/redox/ext/thread.rs @@ -2,8 +2,8 @@ #![stable(feature = "thread_extensions", since = "1.9.0")] -use sys_common::{AsInner, IntoInner}; -use thread::JoinHandle; +use crate::sys_common::{AsInner, IntoInner}; +use crate::thread::JoinHandle; #[stable(feature = "thread_extensions", since = "1.9.0")] #[allow(deprecated)] diff --git a/src/libstd/sys/redox/fast_thread_local.rs b/src/libstd/sys/redox/fast_thread_local.rs index 95263e6f5e31..1202708a4769 100644 --- a/src/libstd/sys/redox/fast_thread_local.rs +++ b/src/libstd/sys/redox/fast_thread_local.rs @@ -1,9 +1,9 @@ #![cfg(target_thread_local)] #![unstable(feature = "thread_local_internals", issue = "0")] -use cell::{Cell, UnsafeCell}; -use mem; -use ptr; +use crate::cell::{Cell, UnsafeCell}; +use crate::mem; +use crate::ptr; pub struct Key { @@ -15,7 +15,7 @@ pub struct Key { dtor_running: Cell, } -unsafe impl ::marker::Sync for Key { } +unsafe impl Sync for Key { } impl Key { pub const fn new() -> Key { @@ -57,7 +57,7 @@ pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) { // *should* be the case that this loop always terminates because we // provide the guarantee that a TLS key cannot be set after it is // flagged for destruction. - use sys_common::thread_local as os; + use crate::sys_common::thread_local as os; static DTORS: os::StaticKey = os::StaticKey::new(Some(run_dtors)); type List = Vec<(*mut u8, unsafe extern fn(*mut u8))>; diff --git a/src/libstd/sys/redox/fd.rs b/src/libstd/sys/redox/fd.rs index fbf31aae2d0e..a42e486db223 100644 --- a/src/libstd/sys/redox/fd.rs +++ b/src/libstd/sys/redox/fd.rs @@ -1,9 +1,9 @@ #![unstable(reason = "not public", issue = "0", feature = "fd")] -use io::{self, Read}; -use mem; -use sys::{cvt, syscall}; -use sys_common::AsInner; +use crate::io::{self, Read}; +use crate::mem; +use crate::sys::{cvt, syscall}; +use crate::sys_common::AsInner; pub struct FileDesc { fd: usize, diff --git a/src/libstd/sys/redox/fs.rs b/src/libstd/sys/redox/fs.rs index 97e5dcebfeab..159ee9911bd3 100644 --- a/src/libstd/sys/redox/fs.rs +++ b/src/libstd/sys/redox/fs.rs @@ -1,14 +1,14 @@ -use os::unix::prelude::*; +use crate::os::unix::prelude::*; -use ffi::{OsString, OsStr}; -use fmt; -use io::{self, Error, ErrorKind, SeekFrom}; -use path::{Path, PathBuf}; -use sync::Arc; -use sys::fd::FileDesc; -use sys::time::SystemTime; -use sys::{cvt, syscall}; -use sys_common::{AsInner, FromInner}; +use crate::ffi::{OsString, OsStr}; +use crate::fmt; +use crate::io::{self, Error, ErrorKind, SeekFrom}; +use crate::path::{Path, PathBuf}; +use crate::sync::Arc; +use crate::sys::fd::FileDesc; +use crate::sys::time::SystemTime; +use crate::sys::{cvt, syscall}; +use crate::sys_common::{AsInner, FromInner}; pub struct File(FileDesc); @@ -457,7 +457,7 @@ pub fn canonicalize(p: &Path) -> io::Result { } pub fn copy(from: &Path, to: &Path) -> io::Result { - use fs::{File, set_permissions}; + use crate::fs::{File, set_permissions}; if !from.is_file() { return Err(Error::new(ErrorKind::InvalidInput, "the source path is not an existing regular file")) diff --git a/src/libstd/sys/redox/io.rs b/src/libstd/sys/redox/io.rs new file mode 100644 index 000000000000..8b02d3fd19d3 --- /dev/null +++ b/src/libstd/sys/redox/io.rs @@ -0,0 +1,32 @@ +pub struct IoVec<'a>(&'a [u8]); + +impl<'a> IoVec<'a> { + #[inline] + pub fn new(buf: &'a [u8]) -> IoVec<'a> { + IoVec(buf) + } + + #[inline] + pub fn as_slice(&self) -> &[u8] { + self.0 + } +} + +pub struct IoVecMut<'a>(&'a mut [u8]); + +impl<'a> IoVecMut<'a> { + #[inline] + pub fn new(buf: &'a mut [u8]) -> IoVecMut<'a> { + IoVecMut(buf) + } + + #[inline] + pub fn as_slice(&self) -> &[u8] { + self.0 + } + + #[inline] + pub fn as_mut_slice(&mut self) -> &mut [u8] { + self.0 + } +} diff --git a/src/libstd/sys/redox/mod.rs b/src/libstd/sys/redox/mod.rs index c106db8ddfaf..7f3ac1f1bb5b 100644 --- a/src/libstd/sys/redox/mod.rs +++ b/src/libstd/sys/redox/mod.rs @@ -1,6 +1,6 @@ #![allow(dead_code, missing_docs, nonstandard_style)] -use io::{self, ErrorKind}; +use crate::io::ErrorKind; pub use libc::strlen; pub use self::rand::hashmap_random_keys; @@ -17,6 +17,7 @@ pub mod ext; pub mod fast_thread_local; pub mod fd; pub mod fs; +pub mod io; pub mod memchr; pub mod mutex; pub mod net; @@ -63,8 +64,8 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind { } } -pub fn cvt(result: Result) -> io::Result { - result.map_err(|err| io::Error::from_raw_os_error(err.errno)) +pub fn cvt(result: Result) -> crate::io::Result { + result.map_err(|err| crate::io::Error::from_raw_os_error(err.errno)) } #[doc(hidden)] @@ -82,9 +83,9 @@ macro_rules! impl_is_minus_one { impl_is_minus_one! { i8 i16 i32 i64 isize } -pub fn cvt_libc(t: T) -> io::Result { +pub fn cvt_libc(t: T) -> crate::io::Result { if t.is_minus_one() { - Err(io::Error::last_os_error()) + Err(crate::io::Error::last_os_error()) } else { Ok(t) } @@ -92,5 +93,5 @@ pub fn cvt_libc(t: T) -> io::Result { /// On Redox, use an illegal instruction to abort pub unsafe fn abort_internal() -> ! { - ::core::intrinsics::abort(); + core::intrinsics::abort(); } diff --git a/src/libstd/sys/redox/mutex.rs b/src/libstd/sys/redox/mutex.rs index bf39cc485911..59399df0294c 100644 --- a/src/libstd/sys/redox/mutex.rs +++ b/src/libstd/sys/redox/mutex.rs @@ -1,8 +1,8 @@ -use cell::UnsafeCell; -use intrinsics::{atomic_cxchg, atomic_xchg}; -use ptr; +use crate::cell::UnsafeCell; +use crate::intrinsics::{atomic_cxchg, atomic_xchg}; +use crate::ptr; -use sys::syscall::{futex, getpid, FUTEX_WAIT, FUTEX_WAKE}; +use crate::sys::syscall::{futex, getpid, FUTEX_WAIT, FUTEX_WAKE}; pub unsafe fn mutex_try_lock(m: *mut i32) -> bool { atomic_cxchg(m, 0, 1).0 == 0 diff --git a/src/libstd/sys/redox/net/dns/answer.rs b/src/libstd/sys/redox/net/dns/answer.rs index c0450c11ed6b..e9b406bc685a 100644 --- a/src/libstd/sys/redox/net/dns/answer.rs +++ b/src/libstd/sys/redox/net/dns/answer.rs @@ -1,5 +1,5 @@ -use string::String; -use vec::Vec; +use crate::string::String; +use crate::vec::Vec; #[derive(Clone, Debug)] pub struct DnsAnswer { diff --git a/src/libstd/sys/redox/net/dns/mod.rs b/src/libstd/sys/redox/net/dns/mod.rs index 8f0a0610af5e..6533e0d5efb7 100644 --- a/src/libstd/sys/redox/net/dns/mod.rs +++ b/src/libstd/sys/redox/net/dns/mod.rs @@ -1,10 +1,10 @@ pub use self::answer::DnsAnswer; pub use self::query::DnsQuery; -use slice; -use u16; -use string::String; -use vec::Vec; +use crate::slice; +use crate::u16; +use crate::string::String; +use crate::vec::Vec; mod answer; mod query; diff --git a/src/libstd/sys/redox/net/dns/query.rs b/src/libstd/sys/redox/net/dns/query.rs index dcb554d82deb..65fb241b0373 100644 --- a/src/libstd/sys/redox/net/dns/query.rs +++ b/src/libstd/sys/redox/net/dns/query.rs @@ -1,4 +1,4 @@ -use string::String; +use crate::string::String; #[derive(Clone, Debug)] pub struct DnsQuery { diff --git a/src/libstd/sys/redox/net/mod.rs b/src/libstd/sys/redox/net/mod.rs index 9e7599aebbbd..dbaa140ed8a0 100644 --- a/src/libstd/sys/redox/net/mod.rs +++ b/src/libstd/sys/redox/net/mod.rs @@ -1,13 +1,13 @@ -use fs::File; -use io::{Error, Read, self}; -use iter::Iterator; -use net::{Ipv4Addr, SocketAddr, SocketAddrV4}; -use str::FromStr; -use string::{String, ToString}; -use sys::syscall::EINVAL; -use time::{self, Duration}; -use vec::{IntoIter, Vec}; -use convert::{TryFrom, TryInto}; +use crate::fs::File; +use crate::io::{Error, Read, self}; +use crate::iter::Iterator; +use crate::net::{Ipv4Addr, SocketAddr, SocketAddrV4}; +use crate::str::FromStr; +use crate::string::{String, ToString}; +use crate::sys::syscall::EINVAL; +use crate::time::{self, Duration}; +use crate::vec::{IntoIter, Vec}; +use crate::convert::{TryFrom, TryInto}; use self::dns::{Dns, DnsQuery}; @@ -35,7 +35,7 @@ impl Iterator for LookupHost { } } -impl<'a> TryFrom<&'a str> for LookupHost { +impl TryFrom<&str> for LookupHost { type Error = io::Error; fn try_from(s: &str) -> io::Result { diff --git a/src/libstd/sys/redox/net/tcp.rs b/src/libstd/sys/redox/net/tcp.rs index e0353b130bb4..5081c3de73c5 100644 --- a/src/libstd/sys/redox/net/tcp.rs +++ b/src/libstd/sys/redox/net/tcp.rs @@ -1,12 +1,12 @@ -use cmp; -use io::{self, Error, ErrorKind, Result}; -use mem; -use net::{SocketAddr, Shutdown}; -use path::Path; -use sys::fs::{File, OpenOptions}; -use sys::syscall::TimeSpec; -use sys_common::{AsInner, FromInner, IntoInner}; -use time::Duration; +use crate::cmp; +use crate::io::{self, Error, ErrorKind, Result, IoVec, IoVecMut}; +use crate::mem; +use crate::net::{SocketAddr, Shutdown}; +use crate::path::Path; +use crate::sys::fs::{File, OpenOptions}; +use crate::sys::syscall::TimeSpec; +use crate::sys_common::{AsInner, FromInner, IntoInner}; +use crate::time::Duration; use super::{path_to_peer_addr, path_to_local_addr}; @@ -34,10 +34,24 @@ impl TcpStream { self.0.read(buf) } + pub fn read_vectored(&self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + match bufs.iter_mut().find(|b| !b.is_empty()) { + Some(buf) => self.read(buf), + None => Ok(0), + } + } + pub fn write(&self, buf: &[u8]) -> Result { self.0.write(buf) } + pub fn write_vectored(&self, bufs: &[IoVec<'_>]) -> io::Result { + match bufs.iter().find(|b| !b.is_empty()) { + Some(buf) => self.write(buf), + None => Ok(0), + } + } + pub fn take_error(&self) -> Result> { Ok(None) } diff --git a/src/libstd/sys/redox/net/udp.rs b/src/libstd/sys/redox/net/udp.rs index 2a59b44f0936..b1a60b145708 100644 --- a/src/libstd/sys/redox/net/udp.rs +++ b/src/libstd/sys/redox/net/udp.rs @@ -1,13 +1,13 @@ -use cell::UnsafeCell; -use cmp; -use io::{self, Error, ErrorKind, Result}; -use mem; -use net::{SocketAddr, Ipv4Addr, Ipv6Addr}; -use path::Path; -use sys::fs::{File, OpenOptions}; -use sys::syscall::TimeSpec; -use sys_common::{AsInner, FromInner, IntoInner}; -use time::Duration; +use crate::cell::UnsafeCell; +use crate::cmp; +use crate::io::{self, Error, ErrorKind, Result}; +use crate::mem; +use crate::net::{SocketAddr, Ipv4Addr, Ipv6Addr}; +use crate::path::Path; +use crate::sys::fs::{File, OpenOptions}; +use crate::sys::syscall::TimeSpec; +use crate::sys_common::{AsInner, FromInner, IntoInner}; +use crate::time::Duration; use super::{path_to_peer_addr, path_to_local_addr}; diff --git a/src/libstd/sys/redox/os.rs b/src/libstd/sys/redox/os.rs index f7a26c949702..76e43a83b737 100644 --- a/src/libstd/sys/redox/os.rs +++ b/src/libstd/sys/redox/os.rs @@ -2,25 +2,25 @@ #![allow(unused_imports)] // lots of cfg code here -use libc::{self, c_char}; +use libc::c_char; -use os::unix::prelude::*; +use crate::os::unix::prelude::*; -use error::Error as StdError; -use ffi::{CStr, CString, OsStr, OsString}; -use fmt; -use io::{self, Read, Write}; -use iter; -use marker::PhantomData; -use mem; -use memchr; -use path::{self, PathBuf}; -use ptr; -use slice; -use str; -use sys_common::mutex::Mutex; -use sys::{cvt, cvt_libc, fd, syscall}; -use vec; +use crate::error::Error as StdError; +use crate::ffi::{CStr, CString, OsStr, OsString}; +use crate::fmt; +use crate::io::{self, Read, Write}; +use crate::iter; +use crate::marker::PhantomData; +use crate::mem; +use crate::memchr; +use crate::path::{self, PathBuf}; +use crate::ptr; +use crate::slice; +use crate::str; +use crate::sys_common::mutex::Mutex; +use crate::sys::{cvt, cvt_libc, fd, syscall}; +use crate::vec; extern { #[link_name = "__errno_location"] @@ -107,7 +107,7 @@ impl StdError for JoinPathsError { } pub fn current_exe() -> io::Result { - use fs::File; + use crate::fs::File; let mut file = File::open("sys:exe")?; @@ -218,13 +218,13 @@ pub fn page_size() -> usize { } pub fn temp_dir() -> PathBuf { - ::env::var_os("TMPDIR").map(PathBuf::from).unwrap_or_else(|| { + crate::env::var_os("TMPDIR").map(PathBuf::from).unwrap_or_else(|| { PathBuf::from("/tmp") }) } pub fn home_dir() -> Option { - return ::env::var_os("HOME").map(PathBuf::from); + return crate::env::var_os("HOME").map(PathBuf::from); } pub fn exit(code: i32) -> ! { diff --git a/src/libstd/sys/redox/os_str.rs b/src/libstd/sys/redox/os_str.rs index 9d5e084feb2d..79b43458d00f 100644 --- a/src/libstd/sys/redox/os_str.rs +++ b/src/libstd/sys/redox/os_str.rs @@ -1,14 +1,15 @@ /// The underlying OsString/OsStr implementation on Unix systems: just /// a `Vec`/`[u8]`. -use borrow::Cow; -use fmt; -use str; -use mem; -use rc::Rc; -use sync::Arc; -use sys_common::{AsInner, IntoInner}; -use sys_common::bytestring::debug_fmt_bytestring; +use crate::borrow::Cow; +use crate::fmt; +use crate::str; +use crate::mem; +use crate::rc::Rc; +use crate::sync::Arc; +use crate::sys_common::{AsInner, IntoInner}; +use crate::sys_common::bytestring::debug_fmt_bytestring; + use core::str::lossy::Utf8Lossy; #[derive(Clone, Hash)] diff --git a/src/libstd/sys/redox/path.rs b/src/libstd/sys/redox/path.rs index a7a8b03c8b1f..618d61e6fcb4 100644 --- a/src/libstd/sys/redox/path.rs +++ b/src/libstd/sys/redox/path.rs @@ -1,5 +1,5 @@ -use ffi::OsStr; -use path::Prefix; +use crate::ffi::OsStr; +use crate::path::Prefix; #[inline] pub fn is_sep_byte(b: u8) -> bool { diff --git a/src/libstd/sys/redox/pipe.rs b/src/libstd/sys/redox/pipe.rs index 9e40eadb2370..911ba9c3f652 100644 --- a/src/libstd/sys/redox/pipe.rs +++ b/src/libstd/sys/redox/pipe.rs @@ -1,6 +1,6 @@ -use io; -use sys::{cvt, syscall}; -use sys::fd::FileDesc; +use crate::io; +use crate::sys::{cvt, syscall}; +use crate::sys::fd::FileDesc; //////////////////////////////////////////////////////////////////////////////// // Anonymous pipes diff --git a/src/libstd/sys/redox/process.rs b/src/libstd/sys/redox/process.rs index 81af8eb553d0..8830cdf333ef 100644 --- a/src/libstd/sys/redox/process.rs +++ b/src/libstd/sys/redox/process.rs @@ -1,20 +1,21 @@ -use env::{split_paths}; -use ffi::{CStr, OsStr}; -use fmt; -use fs::File; -use io::{self, prelude::*, BufReader, Error, ErrorKind, SeekFrom}; +use crate::env::{self, split_paths}; +use crate::ffi::{CStr, OsStr}; +use crate::fmt; +use crate::fs::File; +use crate::io::{self, prelude::*, BufReader, Error, ErrorKind, SeekFrom}; +use crate::os::unix::ffi::OsStrExt; +use crate::path::{Path, PathBuf}; +use crate::ptr; +use crate::sys::ext::fs::MetadataExt; +use crate::sys::ext::io::AsRawFd; +use crate::sys::fd::FileDesc; +use crate::sys::fs::{File as SysFile, OpenOptions}; +use crate::sys::os::{ENV_LOCK, environ}; +use crate::sys::pipe::{self, AnonPipe}; +use crate::sys::{cvt, syscall}; +use crate::sys_common::process::{CommandEnv, DefaultEnvKey}; + use libc::{EXIT_SUCCESS, EXIT_FAILURE}; -use os::unix::ffi::OsStrExt; -use path::{Path, PathBuf}; -use ptr; -use sys::ext::fs::MetadataExt; -use sys::ext::io::AsRawFd; -use sys::fd::FileDesc; -use sys::fs::{File as SysFile, OpenOptions}; -use sys::os::{ENV_LOCK, environ}; -use sys::pipe::{self, AnonPipe}; -use sys::{cvt, syscall}; -use sys_common::process::{CommandEnv, DefaultEnvKey}; //////////////////////////////////////////////////////////////////////////////// // Command @@ -297,7 +298,7 @@ impl Command { let program = if self.program.contains(':') || self.program.contains('/') { Some(PathBuf::from(&self.program)) - } else if let Ok(path_env) = ::env::var("PATH") { + } else if let Ok(path_env) = env::var("PATH") { let mut program = None; for mut path in split_paths(&path_env) { path.push(&self.program); diff --git a/src/libstd/sys/redox/stdio.rs b/src/libstd/sys/redox/stdio.rs index 8571b38cefa1..33f5bdbb5d35 100644 --- a/src/libstd/sys/redox/stdio.rs +++ b/src/libstd/sys/redox/stdio.rs @@ -1,6 +1,6 @@ -use io; -use sys::{cvt, syscall}; -use sys::fd::FileDesc; +use crate::io; +use crate::sys::{cvt, syscall}; +use crate::sys::fd::FileDesc; pub struct Stdin(()); pub struct Stdout(()); @@ -54,10 +54,10 @@ impl io::Write for Stderr { } pub fn is_ebadf(err: &io::Error) -> bool { - err.raw_os_error() == Some(::sys::syscall::EBADF as i32) + err.raw_os_error() == Some(crate::sys::syscall::EBADF as i32) } -pub const STDIN_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE; +pub const STDIN_BUF_SIZE: usize = crate::sys_common::io::DEFAULT_BUF_SIZE; pub fn panic_output() -> Option { Stderr::new().ok() diff --git a/src/libstd/sys/redox/thread.rs b/src/libstd/sys/redox/thread.rs index 18679a7871e2..ae0b91b4d6c7 100644 --- a/src/libstd/sys/redox/thread.rs +++ b/src/libstd/sys/redox/thread.rs @@ -1,10 +1,10 @@ -use boxed::FnBox; -use ffi::CStr; -use io; -use mem; -use sys_common::thread::start_thread; -use sys::{cvt, syscall}; -use time::Duration; +use crate::boxed::FnBox; +use crate::ffi::CStr; +use crate::io; +use crate::mem; +use crate::sys_common::thread::start_thread; +use crate::sys::{cvt, syscall}; +use crate::time::Duration; pub const DEFAULT_MIN_STACK_SIZE: usize = 2 * 1024 * 1024; diff --git a/src/libstd/sys/redox/thread_local.rs b/src/libstd/sys/redox/thread_local.rs index a1929b941659..4bc8c4d5883d 100644 --- a/src/libstd/sys/redox/thread_local.rs +++ b/src/libstd/sys/redox/thread_local.rs @@ -1,8 +1,8 @@ #![allow(dead_code)] // not used on all platforms -use collections::BTreeMap; -use ptr; -use sync::atomic::{AtomicUsize, Ordering}; +use crate::collections::BTreeMap; +use crate::ptr; +use crate::sync::atomic::{AtomicUsize, Ordering}; pub type Key = usize; diff --git a/src/libstd/sys/redox/time.rs b/src/libstd/sys/redox/time.rs index 401b7012aa7e..9db3e85ca9c8 100644 --- a/src/libstd/sys/redox/time.rs +++ b/src/libstd/sys/redox/time.rs @@ -1,8 +1,9 @@ -use cmp::Ordering; -use fmt; -use sys::{cvt, syscall}; -use time::Duration; -use convert::TryInto; +use crate::cmp::Ordering; +use crate::fmt; +use crate::sys::{cvt, syscall}; +use crate::time::Duration; +use crate::convert::TryInto; + use core::hash::{Hash, Hasher}; const NSEC_PER_SEC: u64 = 1_000_000_000; diff --git a/src/libstd/sys/sgx/abi/mod.rs b/src/libstd/sys/sgx/abi/mod.rs index 509a1990d978..7426f7be9e96 100644 --- a/src/libstd/sys/sgx/abi/mod.rs +++ b/src/libstd/sys/sgx/abi/mod.rs @@ -1,5 +1,5 @@ use core::sync::atomic::{AtomicUsize, Ordering}; -use io::Write; +use crate::io::Write; // runtime features mod reloc; @@ -37,7 +37,7 @@ unsafe extern "C" fn tcs_init(secondary: bool) { }, // We need to wait until the initialization is done. BUSY => while RELOC_STATE.load(Ordering::Acquire) == BUSY { - ::core::arch::x86_64::_mm_pause() + core::arch::x86_64::_mm_pause() }, // Initialization is done. DONE => {}, diff --git a/src/libstd/sys/sgx/abi/panic.rs b/src/libstd/sys/sgx/abi/panic.rs index b2afacc70b82..83411cb5b4c2 100644 --- a/src/libstd/sys/sgx/abi/panic.rs +++ b/src/libstd/sys/sgx/abi/panic.rs @@ -1,7 +1,7 @@ use super::usercalls::{alloc::UserRef, self}; -use cmp; -use io::{self, Write}; -use mem; +use crate::cmp; +use crate::io::{self, Write}; +use crate::mem; extern "C" { fn take_debug_panic_buf_ptr() -> *mut u8; diff --git a/src/libstd/sys/sgx/abi/reloc.rs b/src/libstd/sys/sgx/abi/reloc.rs index 4dd41d70bd70..a39841bc36f5 100644 --- a/src/libstd/sys/sgx/abi/reloc.rs +++ b/src/libstd/sys/sgx/abi/reloc.rs @@ -1,4 +1,4 @@ -use slice::from_raw_parts; +use crate::slice::from_raw_parts; use super::mem; const R_X86_64_RELATIVE: u32 = 8; diff --git a/src/libstd/sys/sgx/abi/tls.rs b/src/libstd/sys/sgx/abi/tls.rs index e1fc36968452..b2a812c7231d 100644 --- a/src/libstd/sys/sgx/abi/tls.rs +++ b/src/libstd/sys/sgx/abi/tls.rs @@ -1,8 +1,8 @@ -use sync::atomic::{AtomicUsize, Ordering}; -use ptr; -use mem; -use cell::Cell; -use num::NonZeroUsize; +use crate::sync::atomic::{AtomicUsize, Ordering}; +use crate::ptr; +use crate::mem; +use crate::cell::Cell; +use crate::num::NonZeroUsize; use self::sync_bitset::*; #[cfg(target_pointer_width="64")] @@ -152,9 +152,9 @@ impl Tls { } mod sync_bitset { - use sync::atomic::{AtomicUsize, Ordering}; - use iter::{Enumerate, Peekable}; - use slice::Iter; + use crate::sync::atomic::{AtomicUsize, Ordering}; + use crate::iter::{Enumerate, Peekable}; + use crate::slice::Iter; use super::{TLS_KEYS_BITSET_SIZE, USIZE_BITS}; /// A bitset that can be used synchronously. diff --git a/src/libstd/sys/sgx/abi/usercalls/alloc.rs b/src/libstd/sys/sgx/abi/usercalls/alloc.rs index 0ccbbbc65015..b787bd1a5aba 100644 --- a/src/libstd/sys/sgx/abi/usercalls/alloc.rs +++ b/src/libstd/sys/sgx/abi/usercalls/alloc.rs @@ -1,11 +1,11 @@ #![allow(unused)] -use ptr::{self, NonNull}; -use mem; -use cell::UnsafeCell; -use slice; -use ops::{Deref, DerefMut, Index, IndexMut, CoerceUnsized}; -use slice::SliceIndex; +use crate::ptr::{self, NonNull}; +use crate::mem; +use crate::cell::UnsafeCell; +use crate::slice; +use crate::ops::{Deref, DerefMut, Index, IndexMut, CoerceUnsized}; +use crate::slice::SliceIndex; use fortanix_sgx_abi::*; use super::super::mem::is_user_range; diff --git a/src/libstd/sys/sgx/abi/usercalls/mod.rs b/src/libstd/sys/sgx/abi/usercalls/mod.rs index 511d6e9e9273..d84b6154cbeb 100644 --- a/src/libstd/sys/sgx/abi/usercalls/mod.rs +++ b/src/libstd/sys/sgx/abi/usercalls/mod.rs @@ -1,5 +1,5 @@ -use io::{Error as IoError, Result as IoResult}; -use time::Duration; +use crate::io::{Error as IoError, Result as IoResult}; +use crate::time::Duration; pub(crate) mod alloc; #[macro_use] @@ -22,7 +22,7 @@ pub fn read(fd: Fd, buf: &mut [u8]) -> IoResult { #[unstable(feature = "sgx_platform", issue = "56975")] pub fn read_alloc(fd: Fd) -> IoResult> { unsafe { - let userbuf = ByteBuffer { data: ::ptr::null_mut(), len: 0 }; + let userbuf = ByteBuffer { data: crate::ptr::null_mut(), len: 0 }; let mut userbuf = alloc::User::new_from_enclave(&userbuf); raw::read_alloc(fd, userbuf.as_raw_mut_ptr()).from_sgx_result()?; Ok(userbuf.copy_user_buffer()) diff --git a/src/libstd/sys/sgx/abi/usercalls/raw.rs b/src/libstd/sys/sgx/abi/usercalls/raw.rs index 447f20584f85..ad0b6d7b3d8e 100644 --- a/src/libstd/sys/sgx/abi/usercalls/raw.rs +++ b/src/libstd/sys/sgx/abi/usercalls/raw.rs @@ -3,8 +3,8 @@ #[unstable(feature = "sgx_platform", issue = "56975")] pub use fortanix_sgx_abi::*; -use ptr::NonNull; -use num::NonZeroU64; +use crate::ptr::NonNull; +use crate::num::NonZeroU64; #[repr(C)] struct UsercallReturn(u64, u64); @@ -35,7 +35,7 @@ pub unsafe fn do_usercall(nr: NonZeroU64, p1: u64, p2: u64, p3: u64, p4: u64, ab type Register = u64; trait RegisterArgument { - fn from_register(Register) -> Self; + fn from_register(_: Register) -> Self; fn into_register(self) -> Register; } diff --git a/src/libstd/sys/sgx/alloc.rs b/src/libstd/sys/sgx/alloc.rs index 95284190bddc..94dc8ec25b58 100644 --- a/src/libstd/sys/sgx/alloc.rs +++ b/src/libstd/sys/sgx/alloc.rs @@ -1,6 +1,4 @@ -extern crate dlmalloc; - -use alloc::{GlobalAlloc, Layout, System}; +use crate::alloc::{GlobalAlloc, Layout, System}; use super::waitqueue::SpinMutex; diff --git a/src/libstd/sys/sgx/args.rs b/src/libstd/sys/sgx/args.rs index bc138a64019a..b73bf9213b77 100644 --- a/src/libstd/sys/sgx/args.rs +++ b/src/libstd/sys/sgx/args.rs @@ -1,9 +1,9 @@ -use ffi::OsString; use super::abi::usercalls::{alloc, raw::ByteBuffer}; -use sync::atomic::{AtomicUsize, Ordering}; -use sys::os_str::Buf; -use sys_common::FromInner; -use slice; +use crate::ffi::OsString; +use crate::sync::atomic::{AtomicUsize, Ordering}; +use crate::sys::os_str::Buf; +use crate::sys_common::FromInner; +use crate::slice; static ARGS: AtomicUsize = AtomicUsize::new(0); type ArgsStore = Vec; diff --git a/src/libstd/sys/sgx/backtrace.rs b/src/libstd/sys/sgx/backtrace.rs index 2b8e1da05791..d0361574e39d 100644 --- a/src/libstd/sys/sgx/backtrace.rs +++ b/src/libstd/sys/sgx/backtrace.rs @@ -1,9 +1,10 @@ -use io; -use error::Error; -use libc; -use sys_common::backtrace::Frame; +use crate::io; +use crate::error::Error; +use crate::fmt; +use crate::sys_common::backtrace::Frame; +use crate::sys::sgx::abi::mem::image_base; + use unwind as uw; -use sys::sgx::abi::mem::image_base; pub struct BacktraceContext; @@ -21,8 +22,8 @@ impl Error for UnwindError { } } -impl ::fmt::Display for UnwindError { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { +impl fmt::Display for UnwindError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}: {:?}", self.description(), self.0) } } diff --git a/src/libstd/sys/sgx/condvar.rs b/src/libstd/sys/sgx/condvar.rs index b42e5490c72d..e9a7684f74d0 100644 --- a/src/libstd/sys/sgx/condvar.rs +++ b/src/libstd/sys/sgx/condvar.rs @@ -1,5 +1,5 @@ -use sys::mutex::Mutex; -use time::Duration; +use crate::sys::mutex::Mutex; +use crate::time::Duration; use super::waitqueue::{WaitVariable, WaitQueue, SpinMutex}; diff --git a/src/libstd/sys/sgx/ext/arch.rs b/src/libstd/sys/sgx/ext/arch.rs index 97f7d9181a53..53fb371947a9 100644 --- a/src/libstd/sys/sgx/ext/arch.rs +++ b/src/libstd/sys/sgx/ext/arch.rs @@ -4,7 +4,7 @@ //! Software Developer's Manual, Volume 3, Chapter 40. #![unstable(feature = "sgx_platform", issue = "56975")] -use mem::MaybeUninit; +use crate::mem::MaybeUninit; /// Wrapper struct to force 16-byte alignment. #[repr(align(16))] diff --git a/src/libstd/sys/sgx/ext/ffi.rs b/src/libstd/sys/sgx/ext/ffi.rs index 7b0ffea49ae7..ad7ade9b17d8 100644 --- a/src/libstd/sys/sgx/ext/ffi.rs +++ b/src/libstd/sys/sgx/ext/ffi.rs @@ -2,10 +2,10 @@ #![unstable(feature = "sgx_platform", issue = "56975")] -use ffi::{OsStr, OsString}; -use mem; -use sys::os_str::Buf; -use sys_common::{FromInner, IntoInner, AsInner}; +use crate::ffi::{OsStr, OsString}; +use crate::mem; +use crate::sys::os_str::Buf; +use crate::sys_common::{FromInner, IntoInner, AsInner}; /// SGX-specific extensions to [`OsString`]. /// diff --git a/src/libstd/sys/sgx/ext/io.rs b/src/libstd/sys/sgx/ext/io.rs index 1eb269783c5a..fc88d10d3edd 100644 --- a/src/libstd/sys/sgx/ext/io.rs +++ b/src/libstd/sys/sgx/ext/io.rs @@ -4,9 +4,9 @@ //! description of [`TryIntoRawFd`](trait.TryIntoRawFd.html) for more details. #![unstable(feature = "sgx_platform", issue = "56975")] -pub use sys::abi::usercalls::raw::Fd as RawFd; -use net; -use sys::{self, AsInner, FromInner, IntoInner, TryIntoInner}; +pub use crate::sys::abi::usercalls::raw::Fd as RawFd; +use crate::net; +use crate::sys::{self, AsInner, FromInner, IntoInner, TryIntoInner}; /// A trait to extract the raw SGX file descriptor from an underlying /// object. diff --git a/src/libstd/sys/sgx/fd.rs b/src/libstd/sys/sgx/fd.rs index 69077728b1a9..a9924f55f12b 100644 --- a/src/libstd/sys/sgx/fd.rs +++ b/src/libstd/sys/sgx/fd.rs @@ -1,8 +1,8 @@ use fortanix_sgx_abi::Fd; -use io; -use mem; -use sys::{AsInner, FromInner, IntoInner}; +use crate::io; +use crate::mem; +use crate::sys::{AsInner, FromInner, IntoInner}; use super::abi::usercalls; #[derive(Debug)] diff --git a/src/libstd/sys/sgx/fs.rs b/src/libstd/sys/sgx/fs.rs index 8b1c4476bc41..485d2c87fbd2 100644 --- a/src/libstd/sys/sgx/fs.rs +++ b/src/libstd/sys/sgx/fs.rs @@ -1,10 +1,10 @@ -use ffi::OsString; -use fmt; -use hash::{Hash, Hasher}; -use io::{self, SeekFrom}; -use path::{Path, PathBuf}; -use sys::time::SystemTime; -use sys::{unsupported, Void}; +use crate::ffi::OsString; +use crate::fmt; +use crate::hash::{Hash, Hasher}; +use crate::io::{self, SeekFrom}; +use crate::path::{Path, PathBuf}; +use crate::sys::time::SystemTime; +use crate::sys::{unsupported, Void}; pub struct File(Void); diff --git a/src/libstd/sys/sgx/io.rs b/src/libstd/sys/sgx/io.rs new file mode 100644 index 000000000000..8b02d3fd19d3 --- /dev/null +++ b/src/libstd/sys/sgx/io.rs @@ -0,0 +1,32 @@ +pub struct IoVec<'a>(&'a [u8]); + +impl<'a> IoVec<'a> { + #[inline] + pub fn new(buf: &'a [u8]) -> IoVec<'a> { + IoVec(buf) + } + + #[inline] + pub fn as_slice(&self) -> &[u8] { + self.0 + } +} + +pub struct IoVecMut<'a>(&'a mut [u8]); + +impl<'a> IoVecMut<'a> { + #[inline] + pub fn new(buf: &'a mut [u8]) -> IoVecMut<'a> { + IoVecMut(buf) + } + + #[inline] + pub fn as_slice(&self) -> &[u8] { + self.0 + } + + #[inline] + pub fn as_mut_slice(&mut self) -> &mut [u8] { + self.0 + } +} diff --git a/src/libstd/sys/sgx/mod.rs b/src/libstd/sys/sgx/mod.rs index 4225ecbb2065..325df7688f37 100644 --- a/src/libstd/sys/sgx/mod.rs +++ b/src/libstd/sys/sgx/mod.rs @@ -3,9 +3,9 @@ //! This module contains the facade (aka platform-specific) implementations of //! OS level functionality for Fortanix SGX. -use io; -use os::raw::c_char; -use sync::atomic::{AtomicBool, Ordering}; +use crate::io::ErrorKind; +use crate::os::raw::c_char; +use crate::sync::atomic::{AtomicBool, Ordering}; pub mod abi; mod waitqueue; @@ -20,6 +20,7 @@ pub mod env; pub mod ext; pub mod fd; pub mod fs; +pub mod io; pub mod memchr; pub mod mutex; pub mod net; @@ -41,12 +42,12 @@ pub fn init() { /// This function is used to implement functionality that simply doesn't exist. /// Programs relying on this functionality will need to deal with the error. -pub fn unsupported() -> io::Result { +pub fn unsupported() -> crate::io::Result { Err(unsupported_err()) } -pub fn unsupported_err() -> io::Error { - io::Error::new(io::ErrorKind::Other, +pub fn unsupported_err() -> crate::io::Error { + crate::io::Error::new(ErrorKind::Other, "operation not supported on SGX yet") } @@ -55,58 +56,58 @@ pub fn unsupported_err() -> io::Error { /// returned, the program might very well be able to function normally. This is /// what happens when `SGX_INEFFECTIVE_ERROR` is set to `true`. If it is /// `false`, the behavior is the same as `unsupported`. -pub fn sgx_ineffective(v: T) -> io::Result { +pub fn sgx_ineffective(v: T) -> crate::io::Result { static SGX_INEFFECTIVE_ERROR: AtomicBool = AtomicBool::new(false); if SGX_INEFFECTIVE_ERROR.load(Ordering::Relaxed) { - Err(io::Error::new(io::ErrorKind::Other, + Err(crate::io::Error::new(ErrorKind::Other, "operation can't be trusted to have any effect on SGX")) } else { Ok(v) } } -pub fn decode_error_kind(code: i32) -> io::ErrorKind { +pub fn decode_error_kind(code: i32) -> ErrorKind { use fortanix_sgx_abi::Error; // FIXME: not sure how to make sure all variants of Error are covered if code == Error::NotFound as _ { - io::ErrorKind::NotFound + ErrorKind::NotFound } else if code == Error::PermissionDenied as _ { - io::ErrorKind::PermissionDenied + ErrorKind::PermissionDenied } else if code == Error::ConnectionRefused as _ { - io::ErrorKind::ConnectionRefused + ErrorKind::ConnectionRefused } else if code == Error::ConnectionReset as _ { - io::ErrorKind::ConnectionReset + ErrorKind::ConnectionReset } else if code == Error::ConnectionAborted as _ { - io::ErrorKind::ConnectionAborted + ErrorKind::ConnectionAborted } else if code == Error::NotConnected as _ { - io::ErrorKind::NotConnected + ErrorKind::NotConnected } else if code == Error::AddrInUse as _ { - io::ErrorKind::AddrInUse + ErrorKind::AddrInUse } else if code == Error::AddrNotAvailable as _ { - io::ErrorKind::AddrNotAvailable + ErrorKind::AddrNotAvailable } else if code == Error::BrokenPipe as _ { - io::ErrorKind::BrokenPipe + ErrorKind::BrokenPipe } else if code == Error::AlreadyExists as _ { - io::ErrorKind::AlreadyExists + ErrorKind::AlreadyExists } else if code == Error::WouldBlock as _ { - io::ErrorKind::WouldBlock + ErrorKind::WouldBlock } else if code == Error::InvalidInput as _ { - io::ErrorKind::InvalidInput + ErrorKind::InvalidInput } else if code == Error::InvalidData as _ { - io::ErrorKind::InvalidData + ErrorKind::InvalidData } else if code == Error::TimedOut as _ { - io::ErrorKind::TimedOut + ErrorKind::TimedOut } else if code == Error::WriteZero as _ { - io::ErrorKind::WriteZero + ErrorKind::WriteZero } else if code == Error::Interrupted as _ { - io::ErrorKind::Interrupted + ErrorKind::Interrupted } else if code == Error::Other as _ { - io::ErrorKind::Other + ErrorKind::Other } else if code == Error::UnexpectedEof as _ { - io::ErrorKind::UnexpectedEof + ErrorKind::UnexpectedEof } else { - io::ErrorKind::Other + ErrorKind::Other } } @@ -131,9 +132,9 @@ pub unsafe fn abort_internal() -> ! { pub fn hashmap_random_keys() -> (u64, u64) { fn rdrand64() -> u64 { unsafe { - let mut ret: u64 = ::mem::uninitialized(); + let mut ret: u64 = crate::mem::uninitialized(); for _ in 0..10 { - if ::arch::x86_64::_rdrand64_step(&mut ret) == 1 { + if crate::arch::x86_64::_rdrand64_step(&mut ret) == 1 { return ret; } } @@ -143,7 +144,7 @@ pub fn hashmap_random_keys() -> (u64, u64) { (rdrand64(), rdrand64()) } -pub use sys_common::{AsInner, FromInner, IntoInner}; +pub use crate::sys_common::{AsInner, FromInner, IntoInner}; pub trait TryIntoInner: Sized { fn try_into_inner(self) -> Result; diff --git a/src/libstd/sys/sgx/net.rs b/src/libstd/sys/sgx/net.rs index 6e86b06b2862..e5e42e3d0b04 100644 --- a/src/libstd/sys/sgx/net.rs +++ b/src/libstd/sys/sgx/net.rs @@ -1,12 +1,12 @@ -use fmt; -use io; -use net::{SocketAddr, Shutdown, Ipv4Addr, Ipv6Addr, ToSocketAddrs}; -use time::Duration; -use sys::{unsupported, Void, sgx_ineffective, AsInner, FromInner, IntoInner, TryIntoInner}; -use sys::fd::FileDesc; -use convert::TryFrom; -use error; -use sync::Arc; +use crate::fmt; +use crate::io::{self, IoVec, IoVecMut}; +use crate::net::{SocketAddr, Shutdown, Ipv4Addr, Ipv6Addr, ToSocketAddrs}; +use crate::time::Duration; +use crate::sys::{unsupported, Void, sgx_ineffective, AsInner, FromInner, IntoInner, TryIntoInner}; +use crate::sys::fd::FileDesc; +use crate::convert::TryFrom; +use crate::error; +use crate::sync::Arc; use super::abi::usercalls; @@ -103,10 +103,26 @@ impl TcpStream { self.inner.inner.read(buf) } + pub fn read_vectored(&self, buf: &mut [IoVecMut<'_>]) -> io::Result { + let buf = match buf.get_mut(0) { + Some(buf) => buf, + None => return Ok(0), + }; + self.read(buf) + } + pub fn write(&self, buf: &[u8]) -> io::Result { self.inner.inner.write(buf) } + pub fn write_vectored(&self, buf: &[IoVec<'_>]) -> io::Result { + let buf = match buf.get(0) { + Some(buf) => buf, + None => return Ok(0), + }; + self.write(buf) + } + pub fn peer_addr(&self) -> io::Result { addr_to_sockaddr(&self.peer_addr) } @@ -404,10 +420,10 @@ impl Iterator for LookupHost { } } -impl<'a> TryFrom<&'a str> for LookupHost { +impl TryFrom<&str> for LookupHost { type Error = io::Error; - fn try_from(v: &'a str) -> io::Result { + fn try_from(v: &str) -> io::Result { LookupHost::new(v.to_owned()) } } diff --git a/src/libstd/sys/sgx/os.rs b/src/libstd/sys/sgx/os.rs index b1e4d371a677..2725e66ce5de 100644 --- a/src/libstd/sys/sgx/os.rs +++ b/src/libstd/sys/sgx/os.rs @@ -1,17 +1,17 @@ use fortanix_sgx_abi::{Error, RESULT_SUCCESS}; -use error::Error as StdError; -use ffi::{OsString, OsStr}; -use fmt; -use io; -use path::{self, PathBuf}; -use str; -use sys::{unsupported, Void, sgx_ineffective, decode_error_kind}; -use collections::HashMap; -use vec; -use sync::Mutex; -use sync::atomic::{AtomicUsize, Ordering}; -use sync::Once; +use crate::error::Error as StdError; +use crate::ffi::{OsString, OsStr}; +use crate::fmt; +use crate::io; +use crate::path::{self, PathBuf}; +use crate::str; +use crate::sys::{unsupported, Void, sgx_ineffective, decode_error_kind}; +use crate::collections::HashMap; +use crate::vec; +use crate::sync::Mutex; +use crate::sync::atomic::{AtomicUsize, Ordering}; +use crate::sync::Once; pub fn errno() -> i32 { RESULT_SUCCESS diff --git a/src/libstd/sys/sgx/os_str.rs b/src/libstd/sys/sgx/os_str.rs index 9d5e084feb2d..79b43458d00f 100644 --- a/src/libstd/sys/sgx/os_str.rs +++ b/src/libstd/sys/sgx/os_str.rs @@ -1,14 +1,15 @@ /// The underlying OsString/OsStr implementation on Unix systems: just /// a `Vec`/`[u8]`. -use borrow::Cow; -use fmt; -use str; -use mem; -use rc::Rc; -use sync::Arc; -use sys_common::{AsInner, IntoInner}; -use sys_common::bytestring::debug_fmt_bytestring; +use crate::borrow::Cow; +use crate::fmt; +use crate::str; +use crate::mem; +use crate::rc::Rc; +use crate::sync::Arc; +use crate::sys_common::{AsInner, IntoInner}; +use crate::sys_common::bytestring::debug_fmt_bytestring; + use core::str::lossy::Utf8Lossy; #[derive(Clone, Hash)] diff --git a/src/libstd/sys/sgx/path.rs b/src/libstd/sys/sgx/path.rs index 90b1fa7c97b9..1115de1fbe5b 100644 --- a/src/libstd/sys/sgx/path.rs +++ b/src/libstd/sys/sgx/path.rs @@ -1,5 +1,5 @@ -use path::Prefix; -use ffi::OsStr; +use crate::path::Prefix; +use crate::ffi::OsStr; #[inline] pub fn is_sep_byte(b: u8) -> bool { diff --git a/src/libstd/sys/sgx/pipe.rs b/src/libstd/sys/sgx/pipe.rs index ac48a6dc0332..2582b993b608 100644 --- a/src/libstd/sys/sgx/pipe.rs +++ b/src/libstd/sys/sgx/pipe.rs @@ -1,5 +1,5 @@ -use io; -use sys::Void; +use crate::io; +use crate::sys::Void; pub struct AnonPipe(Void); diff --git a/src/libstd/sys/sgx/process.rs b/src/libstd/sys/sgx/process.rs index 5357d931c736..c49daaa16320 100644 --- a/src/libstd/sys/sgx/process.rs +++ b/src/libstd/sys/sgx/process.rs @@ -1,10 +1,10 @@ -use ffi::OsStr; -use fmt; -use io; -use sys::fs::File; -use sys::pipe::AnonPipe; -use sys::{unsupported, Void}; -use sys_common::process::{CommandEnv, DefaultEnvKey}; +use crate::ffi::OsStr; +use crate::fmt; +use crate::io; +use crate::sys::fs::File; +use crate::sys::pipe::AnonPipe; +use crate::sys::{unsupported, Void}; +use crate::sys_common::process::{CommandEnv, DefaultEnvKey}; //////////////////////////////////////////////////////////////////////////////// // Command diff --git a/src/libstd/sys/sgx/rwlock.rs b/src/libstd/sys/sgx/rwlock.rs index 4dfbe86d14f4..372760bbf26b 100644 --- a/src/libstd/sys/sgx/rwlock.rs +++ b/src/libstd/sys/sgx/rwlock.rs @@ -1,12 +1,12 @@ -use alloc::{self, Layout}; -use num::NonZeroUsize; -use slice; -use str; +use crate::alloc::{self, Layout}; +use crate::num::NonZeroUsize; +use crate::slice; +use crate::str; use super::waitqueue::{ try_lock_or_false, NotifiedTcs, SpinMutex, SpinMutexGuard, WaitQueue, WaitVariable, }; -use mem; +use crate::mem; pub struct RWLock { readers: SpinMutex>>, @@ -206,7 +206,7 @@ pub unsafe extern "C" fn __rust_print_err(m: *mut u8, s: i32) { #[no_mangle] // NB. used by both libunwind and libpanic_abort pub unsafe extern "C" fn __rust_abort() { - ::sys::abort_internal(); + crate::sys::abort_internal(); } #[no_mangle] @@ -224,8 +224,8 @@ mod tests { use super::*; use core::array::FixedSizeArray; - use mem::MaybeUninit; - use {mem, ptr}; + use crate::mem::MaybeUninit; + use crate::{mem, ptr}; // The below test verifies that the bytes of initialized RWLock are the ones // we use in libunwind. diff --git a/src/libstd/sys/sgx/stdio.rs b/src/libstd/sys/sgx/stdio.rs index 57d66ed9a853..f2c6892bfb7f 100644 --- a/src/libstd/sys/sgx/stdio.rs +++ b/src/libstd/sys/sgx/stdio.rs @@ -1,7 +1,7 @@ use fortanix_sgx_abi as abi; -use io; -use sys::fd::FileDesc; +use crate::io; +use crate::sys::fd::FileDesc; pub struct Stdin(()); pub struct Stdout(()); @@ -52,7 +52,7 @@ impl io::Write for Stderr { } } -pub const STDIN_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE; +pub const STDIN_BUF_SIZE: usize = crate::sys_common::io::DEFAULT_BUF_SIZE; pub fn is_ebadf(err: &io::Error) -> bool { // FIXME: Rust normally maps Unix EBADF to `Other` diff --git a/src/libstd/sys/sgx/thread.rs b/src/libstd/sys/sgx/thread.rs index b4bdb03e61af..13569062ac18 100644 --- a/src/libstd/sys/sgx/thread.rs +++ b/src/libstd/sys/sgx/thread.rs @@ -1,7 +1,7 @@ -use boxed::FnBox; -use ffi::CStr; -use io; -use time::Duration; +use crate::boxed::FnBox; +use crate::ffi::CStr; +use crate::io; +use crate::time::Duration; use super::abi::usercalls; @@ -10,9 +10,9 @@ pub struct Thread(task_queue::JoinHandle); pub const DEFAULT_MIN_STACK_SIZE: usize = 4096; mod task_queue { - use sync::{Mutex, MutexGuard, Once}; - use sync::mpsc; - use boxed::FnBox; + use crate::sync::{Mutex, MutexGuard, Once}; + use crate::sync::mpsc; + use crate::boxed::FnBox; pub type JoinHandle = mpsc::Receiver<()>; diff --git a/src/libstd/sys/sgx/time.rs b/src/libstd/sys/sgx/time.rs index 407fe72b0e62..e4f789c3e365 100644 --- a/src/libstd/sys/sgx/time.rs +++ b/src/libstd/sys/sgx/time.rs @@ -1,4 +1,4 @@ -use time::Duration; +use crate::time::Duration; use super::abi::usercalls; #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)] diff --git a/src/libstd/sys/sgx/waitqueue.rs b/src/libstd/sys/sgx/waitqueue.rs index aec643b3175b..1dbf2afbf498 100644 --- a/src/libstd/sys/sgx/waitqueue.rs +++ b/src/libstd/sys/sgx/waitqueue.rs @@ -10,8 +10,8 @@ /// recorded in the enclave. The wakeup event state is protected by a spinlock. /// The queue and associated wait state are stored in a `WaitVariable`. -use ops::{Deref, DerefMut}; -use num::NonZeroUsize; +use crate::ops::{Deref, DerefMut}; +use crate::num::NonZeroUsize; use fortanix_sgx_abi::{Tcs, EV_UNPARK, WAIT_INDEFINITE}; use super::abi::usercalls; @@ -211,8 +211,8 @@ impl WaitQueue { /// A doubly-linked list where callers are in charge of memory allocation /// of the nodes in the list. mod unsafe_list { - use ptr::NonNull; - use mem; + use crate::ptr::NonNull; + use crate::mem; pub struct UnsafeListEntry { next: NonNull>, @@ -341,7 +341,7 @@ mod unsafe_list { #[cfg(test)] mod tests { use super::*; - use cell::Cell; + use crate::cell::Cell; unsafe fn assert_empty(list: &mut UnsafeList) { assert!(list.pop().is_none(), "assertion failed: list is not empty"); @@ -404,9 +404,9 @@ mod unsafe_list { /// Trivial spinlock-based implementation of `sync::Mutex`. // FIXME: Perhaps use Intel TSX to avoid locking? mod spin_mutex { - use cell::UnsafeCell; - use sync::atomic::{AtomicBool, Ordering, spin_loop_hint}; - use ops::{Deref, DerefMut}; + use crate::cell::UnsafeCell; + use crate::sync::atomic::{AtomicBool, Ordering, spin_loop_hint}; + use crate::ops::{Deref, DerefMut}; #[derive(Default)] pub struct SpinMutex { @@ -496,8 +496,8 @@ mod spin_mutex { #![allow(deprecated)] use super::*; - use sync::Arc; - use thread; + use crate::sync::Arc; + use crate::thread; #[test] fn sleep() { @@ -519,8 +519,8 @@ mod spin_mutex { #[cfg(test)] mod tests { use super::*; - use sync::Arc; - use thread; + use crate::sync::Arc; + use crate::thread; #[test] fn queue() { diff --git a/src/libstd/sys/unix/alloc.rs b/src/libstd/sys/unix/alloc.rs index 93e8e0e66967..8e8f5017da75 100644 --- a/src/libstd/sys/unix/alloc.rs +++ b/src/libstd/sys/unix/alloc.rs @@ -1,7 +1,6 @@ -use ptr; -use libc; -use sys_common::alloc::{MIN_ALIGN, realloc_fallback}; -use alloc::{GlobalAlloc, Layout, System}; +use crate::ptr; +use crate::sys_common::alloc::{MIN_ALIGN, realloc_fallback}; +use crate::alloc::{GlobalAlloc, Layout, System}; #[stable(feature = "alloc_system_type", since = "1.28.0")] unsafe impl GlobalAlloc for System { diff --git a/src/libstd/sys/unix/android.rs b/src/libstd/sys/unix/android.rs index 986fa27ede66..6774160bb256 100644 --- a/src/libstd/sys/unix/android.rs +++ b/src/libstd/sys/unix/android.rs @@ -21,7 +21,7 @@ use libc::{c_int, c_void, sighandler_t, size_t, ssize_t}; use libc::{ftruncate, pread, pwrite}; -use io; +use crate::io; use super::{cvt, cvt_r}; // The `log2` and `log2f` functions apparently appeared in android-18, or at @@ -49,12 +49,12 @@ use super::{cvt, cvt_r}; #[cfg(not(test))] pub fn log2f32(f: f32) -> f32 { - f.ln() * ::f32::consts::LOG2_E + f.ln() * crate::f32::consts::LOG2_E } #[cfg(not(test))] pub fn log2f64(f: f64) -> f64 { - f.ln() * ::f64::consts::LOG2_E + f.ln() * crate::f64::consts::LOG2_E } // Back in the day [1] the `signal` function was just an inline wrapper @@ -117,7 +117,7 @@ pub fn ftruncate64(fd: c_int, size: u64) -> io::Result<()> { pub unsafe fn cvt_pread64(fd: c_int, buf: *mut c_void, count: size_t, offset: i64) -> io::Result { - use convert::TryInto; + use crate::convert::TryInto; weak!(fn pread64(c_int, *mut c_void, size_t, i64) -> ssize_t); pread64.get().map(|f| cvt(f(fd, buf, count, offset))).unwrap_or_else(|| { if let Ok(o) = offset.try_into() { @@ -133,7 +133,7 @@ pub unsafe fn cvt_pread64(fd: c_int, buf: *mut c_void, count: size_t, offset: i6 pub unsafe fn cvt_pwrite64(fd: c_int, buf: *const c_void, count: size_t, offset: i64) -> io::Result { - use convert::TryInto; + use crate::convert::TryInto; weak!(fn pwrite64(c_int, *const c_void, size_t, i64) -> ssize_t); pwrite64.get().map(|f| cvt(f(fd, buf, count, offset))).unwrap_or_else(|| { if let Ok(o) = offset.try_into() { diff --git a/src/libstd/sys/unix/args.rs b/src/libstd/sys/unix/args.rs index db1c5f4fea54..18de1096df2a 100644 --- a/src/libstd/sys/unix/args.rs +++ b/src/libstd/sys/unix/args.rs @@ -5,9 +5,9 @@ #![allow(dead_code)] // runtime init functions not used during testing -use ffi::OsString; -use marker::PhantomData; -use vec; +use crate::ffi::OsString; +use crate::marker::PhantomData; +use crate::vec; /// One-time global initialization. pub unsafe fn init(argc: isize, argv: *const *const u8) { imp::init(argc, argv) } @@ -59,14 +59,13 @@ impl DoubleEndedIterator for Args { target_os = "fuchsia", target_os = "hermit"))] mod imp { - use os::unix::prelude::*; - use ptr; - use ffi::{CStr, OsString}; - use marker::PhantomData; - use libc; + use crate::os::unix::prelude::*; + use crate::ptr; + use crate::ffi::{CStr, OsString}; + use crate::marker::PhantomData; use super::Args; - use sys_common::mutex::Mutex; + use crate::sys_common::mutex::Mutex; static mut ARGC: isize = 0; static mut ARGV: *const *const u8 = ptr::null(); @@ -107,9 +106,8 @@ mod imp { #[cfg(any(target_os = "macos", target_os = "ios"))] mod imp { - use ffi::CStr; - use marker::PhantomData; - use libc; + use crate::ffi::CStr; + use crate::marker::PhantomData; use super::Args; pub unsafe fn init(_argc: isize, _argv: *const *const u8) { @@ -120,7 +118,7 @@ mod imp { #[cfg(target_os = "macos")] pub fn args() -> Args { - use os::unix::prelude::*; + use crate::os::unix::prelude::*; extern { // These functions are in crt_externs.h. fn _NSGetArgc() -> *mut libc::c_int; @@ -155,9 +153,9 @@ mod imp { // res #[cfg(target_os = "ios")] pub fn args() -> Args { - use ffi::OsString; - use mem; - use str; + use crate::ffi::OsString; + use crate::mem; + use crate::str; extern { fn sel_registerName(name: *const libc::c_uchar) -> Sel; diff --git a/src/libstd/sys/unix/backtrace/mod.rs b/src/libstd/sys/unix/backtrace/mod.rs index 79c3e39d8f8d..0887e5a4df93 100644 --- a/src/libstd/sys/unix/backtrace/mod.rs +++ b/src/libstd/sys/unix/backtrace/mod.rs @@ -83,8 +83,9 @@ mod printing; #[cfg(not(target_os = "emscripten"))] pub mod gnu { - use io; - use fs; + use crate::io; + use crate::fs; + use libc::c_char; #[cfg(not(any(target_os = "macos", target_os = "ios")))] @@ -94,8 +95,8 @@ pub mod gnu { #[cfg(any(target_os = "macos", target_os = "ios"))] pub fn get_executable_filename() -> io::Result<(Vec, fs::File)> { - use env; - use os::unix::ffi::OsStrExt; + use crate::env; + use crate::os::unix::ffi::OsStrExt; let filename = env::current_exe()?; let file = fs::File::open(&filename)?; diff --git a/src/libstd/sys/unix/backtrace/printing/dladdr.rs b/src/libstd/sys/unix/backtrace/printing/dladdr.rs index 09715db8c1a3..cf3bda640e92 100644 --- a/src/libstd/sys/unix/backtrace/printing/dladdr.rs +++ b/src/libstd/sys/unix/backtrace/printing/dladdr.rs @@ -1,9 +1,8 @@ -use io; -use intrinsics; -use ffi::CStr; -use libc; -use sys::backtrace::BacktraceContext; -use sys_common::backtrace::Frame; +use crate::io; +use crate::intrinsics; +use crate::ffi::CStr; +use crate::sys::backtrace::BacktraceContext; +use crate::sys_common::backtrace::Frame; pub fn resolve_symname(frame: Frame, callback: F, diff --git a/src/libstd/sys/unix/backtrace/printing/mod.rs b/src/libstd/sys/unix/backtrace/printing/mod.rs index d0303e6995f8..d090caede437 100644 --- a/src/libstd/sys/unix/backtrace/printing/mod.rs +++ b/src/libstd/sys/unix/backtrace/printing/mod.rs @@ -1,8 +1,8 @@ mod dladdr; -use sys::backtrace::BacktraceContext; -use sys_common::backtrace::Frame; -use io; +use crate::sys::backtrace::BacktraceContext; +use crate::sys_common::backtrace::Frame; +use crate::io; #[cfg(target_os = "emscripten")] pub use self::dladdr::resolve_symname; @@ -16,14 +16,14 @@ where } #[cfg(not(target_os = "emscripten"))] -pub use sys_common::gnu::libbacktrace::foreach_symbol_fileline; +pub use crate::sys_common::gnu::libbacktrace::foreach_symbol_fileline; #[cfg(not(target_os = "emscripten"))] pub fn resolve_symname(frame: Frame, callback: F, bc: &BacktraceContext) -> io::Result<()> where F: FnOnce(Option<&str>) -> io::Result<()> { - ::sys_common::gnu::libbacktrace::resolve_symname(frame, |symname| { + crate::sys_common::gnu::libbacktrace::resolve_symname(frame, |symname| { if symname.is_some() { callback(symname) } else { diff --git a/src/libstd/sys/unix/backtrace/tracing/backtrace_fn.rs b/src/libstd/sys/unix/backtrace/tracing/backtrace_fn.rs index 236762c5eb5d..a628d107ad6f 100644 --- a/src/libstd/sys/unix/backtrace/tracing/backtrace_fn.rs +++ b/src/libstd/sys/unix/backtrace/tracing/backtrace_fn.rs @@ -8,10 +8,10 @@ /// simple to use it should be used only on iOS devices as the only viable /// option. -use io; -use libc; -use sys::backtrace::BacktraceContext; -use sys_common::backtrace::Frame; +use crate::io; +use crate::ptr; +use crate::sys::backtrace::BacktraceContext; +use crate::sys_common::backtrace::Frame; #[inline(never)] // if we know this is a function call, we can skip it when // tracing @@ -20,7 +20,7 @@ pub fn unwind_backtrace(frames: &mut [Frame]) { const FRAME_LEN: usize = 100; assert!(FRAME_LEN >= frames.len()); - let mut raw_frames = [::ptr::null_mut(); FRAME_LEN]; + let mut raw_frames = [ptr::null_mut(); FRAME_LEN]; let nb_frames = unsafe { backtrace(raw_frames.as_mut_ptr(), raw_frames.len() as libc::c_int) } as usize; diff --git a/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs b/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs index 72a7968c514c..abbeca0fde6e 100644 --- a/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs +++ b/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs @@ -1,8 +1,8 @@ -use error::Error; -use io; -use libc; -use sys::backtrace::BacktraceContext; -use sys_common::backtrace::Frame; +use crate::error::Error; +use crate::fmt; +use crate::io; +use crate::sys::backtrace::BacktraceContext; +use crate::sys_common::backtrace::Frame; use unwind as uw; @@ -20,8 +20,8 @@ impl Error for UnwindError { } } -impl ::fmt::Display for UnwindError { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { +impl fmt::Display for UnwindError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}: {:?}", self.description(), self.0) } } diff --git a/src/libstd/sys/unix/condvar.rs b/src/libstd/sys/unix/condvar.rs index 3e048d5c6e4f..47fb6792f08a 100644 --- a/src/libstd/sys/unix/condvar.rs +++ b/src/libstd/sys/unix/condvar.rs @@ -1,7 +1,6 @@ -use cell::UnsafeCell; -use libc; -use sys::mutex::{self, Mutex}; -use time::Duration; +use crate::cell::UnsafeCell; +use crate::sys::mutex::{self, Mutex}; +use crate::time::Duration; pub struct Condvar { inner: UnsafeCell } @@ -41,7 +40,7 @@ impl Condvar { target_os = "android", target_os = "hermit")))] pub unsafe fn init(&mut self) { - use mem; + use crate::mem; let mut attr: libc::pthread_condattr_t = mem::uninitialized(); let r = libc::pthread_condattr_init(&mut attr); assert_eq!(r, 0); @@ -80,7 +79,7 @@ impl Condvar { target_os = "android", target_os = "hermit")))] pub unsafe fn wait_timeout(&self, mutex: &Mutex, dur: Duration) -> bool { - use mem; + use crate::mem; let mut now: libc::timespec = mem::zeroed(); let r = libc::clock_gettime(libc::CLOCK_MONOTONIC, &mut now); @@ -110,8 +109,8 @@ impl Condvar { // https://github.com/llvm-mirror/libcxx/blob/release_35/include/__mutex_base#L367 #[cfg(any(target_os = "macos", target_os = "ios", target_os = "android", target_os = "hermit"))] pub unsafe fn wait_timeout(&self, mutex: &Mutex, mut dur: Duration) -> bool { - use ptr; - use time::Instant; + use crate::ptr; + use crate::time::Instant; // 1000 years let max_dur = Duration::from_secs(1000 * 365 * 86400); diff --git a/src/libstd/sys/unix/ext/ffi.rs b/src/libstd/sys/unix/ext/ffi.rs index d1c3cd82ac51..0c0232398152 100644 --- a/src/libstd/sys/unix/ext/ffi.rs +++ b/src/libstd/sys/unix/ext/ffi.rs @@ -2,10 +2,10 @@ #![stable(feature = "rust1", since = "1.0.0")] -use ffi::{OsStr, OsString}; -use mem; -use sys::os_str::Buf; -use sys_common::{FromInner, IntoInner, AsInner}; +use crate::ffi::{OsStr, OsString}; +use crate::mem; +use crate::sys::os_str::Buf; +use crate::sys_common::{FromInner, IntoInner, AsInner}; /// Unix-specific extensions to [`OsString`]. /// diff --git a/src/libstd/sys/unix/ext/fs.rs b/src/libstd/sys/unix/ext/fs.rs index abcce3ab8296..d9baac993c42 100644 --- a/src/libstd/sys/unix/ext/fs.rs +++ b/src/libstd/sys/unix/ext/fs.rs @@ -2,13 +2,12 @@ #![stable(feature = "rust1", since = "1.0.0")] -use fs::{self, Permissions, OpenOptions}; -use io; -use libc; -use path::Path; -use sys; -use sys_common::{FromInner, AsInner, AsInnerMut}; -use sys::platform::fs::MetadataExt as UnixMetadataExt; +use crate::fs::{self, Permissions, OpenOptions}; +use crate::io; +use crate::path::Path; +use crate::sys; +use crate::sys_common::{FromInner, AsInner, AsInnerMut}; +use crate::sys::platform::fs::MetadataExt as UnixMetadataExt; /// Unix-specific extensions to [`File`]. /// diff --git a/src/libstd/sys/unix/ext/io.rs b/src/libstd/sys/unix/ext/io.rs index 73f4879e4e43..1a0b3b8962bd 100644 --- a/src/libstd/sys/unix/ext/io.rs +++ b/src/libstd/sys/unix/ext/io.rs @@ -2,12 +2,11 @@ #![stable(feature = "rust1", since = "1.0.0")] -use fs; -use os::raw; -use sys; -use io; -use sys_common::{AsInner, FromInner, IntoInner}; -use libc; +use crate::fs; +use crate::os::raw; +use crate::sys; +use crate::io; +use crate::sys_common::{AsInner, FromInner, IntoInner}; /// Raw file descriptors. #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/sys/unix/ext/net.rs b/src/libstd/sys/unix/ext/net.rs index acc064acfcd2..4fc79efe7ceb 100644 --- a/src/libstd/sys/unix/ext/net.rs +++ b/src/libstd/sys/unix/ext/net.rs @@ -15,19 +15,19 @@ mod libc { pub struct sockaddr_un; } -use ascii; -use ffi::OsStr; -use fmt; -use io::{self, Initializer}; -use mem; -use net::{self, Shutdown}; -use os::unix::ffi::OsStrExt; -use os::unix::io::{RawFd, AsRawFd, FromRawFd, IntoRawFd}; -use path::Path; -use time::Duration; -use sys::{self, cvt}; -use sys::net::Socket; -use sys_common::{self, AsInner, FromInner, IntoInner}; +use crate::ascii; +use crate::ffi::OsStr; +use crate::fmt; +use crate::io::{self, Initializer, IoVec, IoVecMut}; +use crate::mem; +use crate::net::{self, Shutdown}; +use crate::os::unix::ffi::OsStrExt; +use crate::os::unix::io::{RawFd, AsRawFd, FromRawFd, IntoRawFd}; +use crate::path::Path; +use crate::time::Duration; +use crate::sys::{self, cvt}; +use crate::sys::net::Socket; +use crate::sys_common::{self, AsInner, FromInner, IntoInner}; #[cfg(any(target_os = "linux", target_os = "android", target_os = "dragonfly", target_os = "freebsd", @@ -551,6 +551,10 @@ impl io::Read for UnixStream { io::Read::read(&mut &*self, buf) } + fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + io::Read::read_vectored(&mut &*self, bufs) + } + #[inline] unsafe fn initializer(&self) -> Initializer { Initializer::nop() @@ -563,6 +567,10 @@ impl<'a> io::Read for &'a UnixStream { self.0.read(buf) } + fn read_vectored(&mut self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + self.0.read_vectored(bufs) + } + #[inline] unsafe fn initializer(&self) -> Initializer { Initializer::nop() @@ -575,6 +583,10 @@ impl io::Write for UnixStream { io::Write::write(&mut &*self, buf) } + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + io::Write::write_vectored(&mut &*self, bufs) + } + fn flush(&mut self) -> io::Result<()> { io::Write::flush(&mut &*self) } @@ -586,6 +598,10 @@ impl<'a> io::Write for &'a UnixStream { self.0.write(buf) } + fn write_vectored(&mut self, bufs: &[IoVec<'_>]) -> io::Result { + self.0.write_vectored(bufs) + } + fn flush(&mut self) -> io::Result<()> { Ok(()) } @@ -1465,11 +1481,11 @@ impl IntoRawFd for UnixDatagram { #[cfg(all(test, not(target_os = "emscripten")))] mod test { - use thread; - use io::{self, ErrorKind}; - use io::prelude::*; - use time::Duration; - use sys_common::io::test::tmpdir; + use crate::thread; + use crate::io::{self, ErrorKind}; + use crate::io::prelude::*; + use crate::time::Duration; + use crate::sys_common::io::test::tmpdir; use super::*; @@ -1510,6 +1526,25 @@ mod test { thread.join().unwrap(); } + #[test] + fn vectored() { + let (mut s1, mut s2) = or_panic!(UnixStream::pair()); + + let len = or_panic!(s1.write_vectored( + &[IoVec::new(b"hello"), IoVec::new(b" "), IoVec::new(b"world!")], + )); + assert_eq!(len, 12); + + let mut buf1 = [0; 6]; + let mut buf2 = [0; 7]; + let len = or_panic!(s2.read_vectored( + &mut [IoVecMut::new(&mut buf1), IoVecMut::new(&mut buf2)], + )); + assert_eq!(len, 12); + assert_eq!(&buf1, b"hello "); + assert_eq!(&buf2, b"world!\0"); + } + #[test] fn pair() { let msg1 = b"hello"; diff --git a/src/libstd/sys/unix/ext/process.rs b/src/libstd/sys/unix/ext/process.rs index b487bb889baf..7ace95edef9f 100644 --- a/src/libstd/sys/unix/ext/process.rs +++ b/src/libstd/sys/unix/ext/process.rs @@ -2,11 +2,11 @@ #![stable(feature = "rust1", since = "1.0.0")] -use io; -use os::unix::io::{FromRawFd, RawFd, AsRawFd, IntoRawFd}; -use process; -use sys; -use sys_common::{AsInnerMut, AsInner, FromInner, IntoInner}; +use crate::io; +use crate::os::unix::io::{FromRawFd, RawFd, AsRawFd, IntoRawFd}; +use crate::process; +use crate::sys; +use crate::sys_common::{AsInnerMut, AsInner, FromInner, IntoInner}; /// Unix-specific extensions to the [`process::Command`] builder. /// @@ -209,5 +209,5 @@ impl IntoRawFd for process::ChildStderr { /// Returns the OS-assigned process identifier associated with this process's parent. #[stable(feature = "unix_ppid", since = "1.27.0")] pub fn parent_id() -> u32 { - ::sys::os::getppid() + crate::sys::os::getppid() } diff --git a/src/libstd/sys/unix/ext/raw.rs b/src/libstd/sys/unix/ext/raw.rs index eabb4b025030..75ae54a919ab 100644 --- a/src/libstd/sys/unix/ext/raw.rs +++ b/src/libstd/sys/unix/ext/raw.rs @@ -14,10 +14,10 @@ #[doc(inline)] #[stable(feature = "pthread_t", since = "1.8.0")] -pub use sys::platform::raw::pthread_t; +pub use crate::sys::platform::raw::pthread_t; #[doc(inline)] #[stable(feature = "raw_ext", since = "1.1.0")] -pub use sys::platform::raw::{dev_t, ino_t, mode_t, nlink_t, off_t, blksize_t}; +pub use crate::sys::platform::raw::{dev_t, ino_t, mode_t, nlink_t, off_t, blksize_t}; #[doc(inline)] #[stable(feature = "raw_ext", since = "1.1.0")] -pub use sys::platform::raw::{blkcnt_t, time_t}; +pub use crate::sys::platform::raw::{blkcnt_t, time_t}; diff --git a/src/libstd/sys/unix/ext/thread.rs b/src/libstd/sys/unix/ext/thread.rs index 4b3d5e31848f..759ef6236e80 100644 --- a/src/libstd/sys/unix/ext/thread.rs +++ b/src/libstd/sys/unix/ext/thread.rs @@ -3,9 +3,9 @@ #![stable(feature = "thread_extensions", since = "1.9.0")] #[allow(deprecated)] -use os::unix::raw::pthread_t; -use sys_common::{AsInner, IntoInner}; -use thread::JoinHandle; +use crate::os::unix::raw::pthread_t; +use crate::sys_common::{AsInner, IntoInner}; +use crate::thread::JoinHandle; #[stable(feature = "thread_extensions", since = "1.9.0")] #[allow(deprecated)] diff --git a/src/libstd/sys/unix/fast_thread_local.rs b/src/libstd/sys/unix/fast_thread_local.rs index 742ffd12b883..17478dce4fe5 100644 --- a/src/libstd/sys/unix/fast_thread_local.rs +++ b/src/libstd/sys/unix/fast_thread_local.rs @@ -12,9 +12,8 @@ // Due to rust-lang/rust#18804, make sure this is not generic! #[cfg(any(target_os = "linux", target_os = "fuchsia", target_os = "hermit"))] pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) { - use libc; - use mem; - use sys_common::thread_local::register_dtor_fallback; + use crate::mem; + use crate::sys_common::thread_local::register_dtor_fallback; extern { #[linkage = "extern_weak"] @@ -45,8 +44,8 @@ pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) { // _tlv_atexit. #[cfg(target_os = "macos")] pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) { - use cell::Cell; - use ptr; + use crate::cell::Cell; + use crate::ptr; #[thread_local] static REGISTERED: Cell = Cell::new(false); diff --git a/src/libstd/sys/unix/fd.rs b/src/libstd/sys/unix/fd.rs index 2cbd9536f4da..c274ad26cb1f 100644 --- a/src/libstd/sys/unix/fd.rs +++ b/src/libstd/sys/unix/fd.rs @@ -1,12 +1,13 @@ #![unstable(reason = "not public", issue = "0", feature = "fd")] -use cmp; -use io::{self, Read, Initializer}; -use libc::{self, c_int, c_void, ssize_t}; -use mem; -use sync::atomic::{AtomicBool, Ordering}; -use sys::cvt; -use sys_common::AsInner; +use crate::cmp; +use crate::io::{self, Read, Initializer, IoVec, IoVecMut}; +use crate::mem; +use crate::sync::atomic::{AtomicBool, Ordering}; +use crate::sys::cvt; +use crate::sys_common::AsInner; + +use libc::{c_int, c_void, ssize_t}; #[derive(Debug)] pub struct FileDesc { @@ -52,6 +53,15 @@ impl FileDesc { Ok(ret as usize) } + pub fn read_vectored(&self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + let ret = cvt(unsafe { + libc::readv(self.fd, + bufs.as_ptr() as *const libc::iovec, + cmp::min(bufs.len(), c_int::max_value() as usize) as c_int) + })?; + Ok(ret as usize) + } + pub fn read_to_end(&self, buf: &mut Vec) -> io::Result { let mut me = self; (&mut me).read_to_end(buf) @@ -65,7 +75,7 @@ impl FileDesc { unsafe fn cvt_pread64(fd: c_int, buf: *mut c_void, count: usize, offset: i64) -> io::Result { - use convert::TryInto; + use crate::convert::TryInto; use libc::pread64; // pread64 on emscripten actually takes a 32 bit offset if let Ok(o) = offset.try_into() { @@ -105,6 +115,15 @@ impl FileDesc { Ok(ret as usize) } + pub fn write_vectored(&self, bufs: &[IoVec<'_>]) -> io::Result { + let ret = cvt(unsafe { + libc::writev(self.fd, + bufs.as_ptr() as *const libc::iovec, + cmp::min(bufs.len(), c_int::max_value() as usize) as c_int) + })?; + Ok(ret as usize) + } + pub fn write_at(&self, buf: &[u8], offset: u64) -> io::Result { #[cfg(target_os = "android")] use super::android::cvt_pwrite64; @@ -113,7 +132,7 @@ impl FileDesc { unsafe fn cvt_pwrite64(fd: c_int, buf: *const c_void, count: usize, offset: i64) -> io::Result { - use convert::TryInto; + use crate::convert::TryInto; use libc::pwrite64; // pwrite64 on emscripten actually takes a 32 bit offset if let Ok(o) = offset.try_into() { diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index 5183d6fadd21..3b80b475a93d 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -1,17 +1,18 @@ -use os::unix::prelude::*; +use crate::os::unix::prelude::*; -use ffi::{CString, CStr, OsString, OsStr}; -use fmt; -use io::{self, Error, ErrorKind, SeekFrom}; -use libc::{self, c_int, mode_t}; -use mem; -use path::{Path, PathBuf}; -use ptr; -use sync::Arc; -use sys::fd::FileDesc; -use sys::time::SystemTime; -use sys::{cvt, cvt_r}; -use sys_common::{AsInner, FromInner}; +use crate::ffi::{CString, CStr, OsString, OsStr}; +use crate::fmt; +use crate::io::{self, Error, ErrorKind, SeekFrom}; +use crate::mem; +use crate::path::{Path, PathBuf}; +use crate::ptr; +use crate::sync::Arc; +use crate::sys::fd::FileDesc; +use crate::sys::time::SystemTime; +use crate::sys::{cvt, cvt_r}; +use crate::sys_common::{AsInner, FromInner}; + +use libc::{c_int, mode_t}; #[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "l4re"))] use libc::{stat64, fstat64, lstat64, off64_t, ftruncate64, lseek64, dirent64, readdir64_r, open64}; @@ -217,6 +218,8 @@ impl Iterator for ReadDir { #[cfg(any(target_os = "solaris", target_os = "fuchsia"))] fn next(&mut self) -> Option> { + use crate::slice; + unsafe { loop { // Although readdir_r(3) would be a correct function to use here because @@ -239,8 +242,8 @@ impl Iterator for ReadDir { let ret = DirEntry { entry: *entry_ptr, - name: ::slice::from_raw_parts(name as *const u8, - namelen as usize).to_owned().into_boxed_slice(), + name: slice::from_raw_parts(name as *const u8, + namelen as usize).to_owned().into_boxed_slice(), dir: self.clone() }; if ret.name_bytes() != b"." && ret.name_bytes() != b".." { @@ -365,9 +368,10 @@ impl DirEntry { target_os = "dragonfly", target_os = "bitrig"))] fn name_bytes(&self) -> &[u8] { + use crate::slice; unsafe { - ::slice::from_raw_parts(self.entry.d_name.as_ptr() as *const u8, - self.entry.d_namlen as usize) + slice::from_raw_parts(self.entry.d_name.as_ptr() as *const u8, + self.entry.d_namlen as usize) } } #[cfg(any(target_os = "android", @@ -475,7 +479,7 @@ impl File { // that we support, so we only do this on Linux currently. #[cfg(target_os = "linux")] fn ensure_cloexec(fd: &FileDesc) -> io::Result<()> { - use sync::atomic::{AtomicUsize, Ordering}; + use crate::sync::atomic::{AtomicUsize, Ordering}; const OPEN_CLOEXEC_UNKNOWN: usize = 0; const OPEN_CLOEXEC_SUPPORTED: usize = 1; @@ -542,7 +546,7 @@ impl File { pub fn truncate(&self, size: u64) -> io::Result<()> { #[cfg(target_os = "android")] - return ::sys::android::ftruncate64(self.0.raw(), size); + return crate::sys::android::ftruncate64(self.0.raw(), size); #[cfg(not(target_os = "android"))] return cvt_r(|| unsafe { @@ -825,7 +829,7 @@ pub fn canonicalize(p: &Path) -> io::Result { #[cfg(not(any(target_os = "linux", target_os = "android")))] pub fn copy(from: &Path, to: &Path) -> io::Result { - use fs::File; + use crate::fs::File; if !from.is_file() { return Err(Error::new(ErrorKind::InvalidInput, "the source path is not an existing regular file")) @@ -842,9 +846,9 @@ pub fn copy(from: &Path, to: &Path) -> io::Result { #[cfg(any(target_os = "linux", target_os = "android"))] pub fn copy(from: &Path, to: &Path) -> io::Result { - use cmp; - use fs::File; - use sync::atomic::{AtomicBool, Ordering}; + use crate::cmp; + use crate::fs::File; + use crate::sync::atomic::{AtomicBool, Ordering}; // Kernel prior to 4.5 don't have copy_file_range // We store the availability in a global to avoid unnecessary syscalls diff --git a/src/libstd/sys/unix/io.rs b/src/libstd/sys/unix/io.rs new file mode 100644 index 000000000000..eb3fa470a652 --- /dev/null +++ b/src/libstd/sys/unix/io.rs @@ -0,0 +1,62 @@ +use crate::marker::PhantomData; +use crate::slice; + +use libc::{iovec, c_void}; + +#[repr(transparent)] +pub struct IoVec<'a> { + vec: iovec, + _p: PhantomData<&'a [u8]>, +} + +impl<'a> IoVec<'a> { + #[inline] + pub fn new(buf: &'a [u8]) -> IoVec<'a> { + IoVec { + vec: iovec { + iov_base: buf.as_ptr() as *mut u8 as *mut c_void, + iov_len: buf.len() + }, + _p: PhantomData, + } + } + + #[inline] + pub fn as_slice(&self) -> &[u8] { + unsafe { + slice::from_raw_parts(self.vec.iov_base as *mut u8, self.vec.iov_len) + } + } +} + +pub struct IoVecMut<'a> { + vec: iovec, + _p: PhantomData<&'a mut [u8]>, +} + +impl<'a> IoVecMut<'a> { + #[inline] + pub fn new(buf: &'a mut [u8]) -> IoVecMut<'a> { + IoVecMut { + vec: iovec { + iov_base: buf.as_mut_ptr() as *mut c_void, + iov_len: buf.len() + }, + _p: PhantomData, + } + } + + #[inline] + pub fn as_slice(&self) -> &[u8] { + unsafe { + slice::from_raw_parts(self.vec.iov_base as *mut u8, self.vec.iov_len) + } + } + + #[inline] + pub fn as_mut_slice(&mut self) -> &mut [u8] { + unsafe { + slice::from_raw_parts_mut(self.vec.iov_base as *mut u8, self.vec.iov_len) + } + } +} diff --git a/src/libstd/sys/unix/l4re.rs b/src/libstd/sys/unix/l4re.rs index 48037310c8d3..b9e725371a36 100644 --- a/src/libstd/sys/unix/l4re.rs +++ b/src/libstd/sys/unix/l4re.rs @@ -4,15 +4,15 @@ macro_rules! unimpl { pub mod net { #![allow(warnings)] - use fmt; - use io; - use libc; - use net::{SocketAddr, Shutdown, Ipv4Addr, Ipv6Addr}; - use sys_common::{AsInner, FromInner, IntoInner}; - use sys::fd::FileDesc; - use time::Duration; - use convert::TryFrom; + use crate::fmt; + use crate::io::{self, IoVec, IoVecMut}; + use crate::net::{SocketAddr, Shutdown, Ipv4Addr, Ipv6Addr}; + use crate::sys_common::{AsInner, FromInner, IntoInner}; + use crate::sys::fd::FileDesc; + use crate::time::Duration; + use crate::convert::TryFrom; + #[allow(unused_extern_crates)] pub extern crate libc as netc; pub struct Socket(FileDesc); @@ -46,6 +46,10 @@ pub mod net { unimpl!(); } + pub fn read_vectored(&self, _: &mut [IoVecMut<'_>]) -> io::Result { + unimpl!(); + } + pub fn peek(&self, _: &mut [u8]) -> io::Result { unimpl!(); } @@ -62,6 +66,10 @@ pub mod net { unimpl!(); } + pub fn write_vectored(&self, _: &[IoVec<'_>]) -> io::Result { + unimpl!(); + } + pub fn set_timeout(&self, _: Option, _: libc::c_int) -> io::Result<()> { unimpl!(); } @@ -144,10 +152,18 @@ pub mod net { unimpl!(); } + pub fn read_vectored(&self, _: &mut [IoVecMut<'_>]) -> io::Result { + unimpl!(); + } + pub fn write(&self, _: &[u8]) -> io::Result { unimpl!(); } + pub fn write_vectored(&self, _: &[IoVec<'_>]) -> io::Result { + unimpl!(); + } + pub fn peer_addr(&self) -> io::Result { unimpl!(); } @@ -431,10 +447,10 @@ pub mod net { unsafe impl Send for LookupHost {} - impl<'a> TryFrom<&'a str> for LookupHost { + impl TryFrom<&str> for LookupHost { type Error = io::Error; - fn try_from(_v: &'a str) -> io::Result { + fn try_from(_v: &str) -> io::Result { unimpl!(); } } diff --git a/src/libstd/sys/unix/memchr.rs b/src/libstd/sys/unix/memchr.rs index ec04a22a0d2e..1984678bdde4 100644 --- a/src/libstd/sys/unix/memchr.rs +++ b/src/libstd/sys/unix/memchr.rs @@ -2,8 +2,6 @@ // Copyright 2015 Andrew Gallant, bluss and Nicolas Koch pub fn memchr(needle: u8, haystack: &[u8]) -> Option { - use libc; - let p = unsafe { libc::memchr( haystack.as_ptr() as *const libc::c_void, @@ -21,8 +19,6 @@ pub fn memrchr(needle: u8, haystack: &[u8]) -> Option { #[cfg(target_os = "linux")] fn memrchr_specific(needle: u8, haystack: &[u8]) -> Option { - use libc; - // GNU's memrchr() will - unlike memchr() - error if haystack is empty. if haystack.is_empty() {return None} let p = unsafe { @@ -40,7 +36,7 @@ pub fn memrchr(needle: u8, haystack: &[u8]) -> Option { #[cfg(not(target_os = "linux"))] fn memrchr_specific(needle: u8, haystack: &[u8]) -> Option { - ::core::slice::memchr::memrchr(needle, haystack) + core::slice::memchr::memrchr(needle, haystack) } memrchr_specific(needle, haystack) diff --git a/src/libstd/sys/unix/mod.rs b/src/libstd/sys/unix/mod.rs index b36c117fd09d..fbe3444311e5 100644 --- a/src/libstd/sys/unix/mod.rs +++ b/src/libstd/sys/unix/mod.rs @@ -1,24 +1,23 @@ #![allow(missing_docs, nonstandard_style)] -use io::{self, ErrorKind}; -use libc; +use crate::io::ErrorKind; -#[cfg(any(rustdoc, target_os = "linux"))] pub use os::linux as platform; +#[cfg(any(rustdoc, target_os = "linux"))] pub use crate::os::linux as platform; -#[cfg(all(not(rustdoc), target_os = "android"))] pub use os::android as platform; -#[cfg(all(not(rustdoc), target_os = "bitrig"))] pub use os::bitrig as platform; -#[cfg(all(not(rustdoc), target_os = "dragonfly"))] pub use os::dragonfly as platform; -#[cfg(all(not(rustdoc), target_os = "freebsd"))] pub use os::freebsd as platform; -#[cfg(all(not(rustdoc), target_os = "haiku"))] pub use os::haiku as platform; -#[cfg(all(not(rustdoc), target_os = "ios"))] pub use os::ios as platform; -#[cfg(all(not(rustdoc), target_os = "macos"))] pub use os::macos as platform; -#[cfg(all(not(rustdoc), target_os = "netbsd"))] pub use os::netbsd as platform; -#[cfg(all(not(rustdoc), target_os = "openbsd"))] pub use os::openbsd as platform; -#[cfg(all(not(rustdoc), target_os = "solaris"))] pub use os::solaris as platform; -#[cfg(all(not(rustdoc), target_os = "emscripten"))] pub use os::emscripten as platform; -#[cfg(all(not(rustdoc), target_os = "fuchsia"))] pub use os::fuchsia as platform; -#[cfg(all(not(rustdoc), target_os = "l4re"))] pub use os::linux as platform; -#[cfg(all(not(rustdoc), target_os = "hermit"))] pub use os::hermit as platform; +#[cfg(all(not(rustdoc), target_os = "android"))] pub use crate::os::android as platform; +#[cfg(all(not(rustdoc), target_os = "bitrig"))] pub use crate::os::bitrig as platform; +#[cfg(all(not(rustdoc), target_os = "dragonfly"))] pub use crate::os::dragonfly as platform; +#[cfg(all(not(rustdoc), target_os = "freebsd"))] pub use crate::os::freebsd as platform; +#[cfg(all(not(rustdoc), target_os = "haiku"))] pub use crate::os::haiku as platform; +#[cfg(all(not(rustdoc), target_os = "ios"))] pub use crate::os::ios as platform; +#[cfg(all(not(rustdoc), target_os = "macos"))] pub use crate::os::macos as platform; +#[cfg(all(not(rustdoc), target_os = "netbsd"))] pub use crate::os::netbsd as platform; +#[cfg(all(not(rustdoc), target_os = "openbsd"))] pub use crate::os::openbsd as platform; +#[cfg(all(not(rustdoc), target_os = "solaris"))] pub use crate::os::solaris as platform; +#[cfg(all(not(rustdoc), target_os = "emscripten"))] pub use crate::os::emscripten as platform; +#[cfg(all(not(rustdoc), target_os = "fuchsia"))] pub use crate::os::fuchsia as platform; +#[cfg(all(not(rustdoc), target_os = "l4re"))] pub use crate::os::linux as platform; +#[cfg(all(not(rustdoc), target_os = "hermit"))] pub use crate::os::hermit as platform; pub use self::rand::hashmap_random_keys; pub use libc::strlen; @@ -39,6 +38,7 @@ pub mod fast_thread_local; pub mod fd; pub mod fs; pub mod memchr; +pub mod io; pub mod mutex; #[cfg(not(target_os = "l4re"))] pub mod net; @@ -81,7 +81,7 @@ pub fn init() { } #[cfg(target_os = "android")] -pub use sys::android::signal; +pub use crate::sys::android::signal; #[cfg(not(target_os = "android"))] pub use libc::signal; @@ -126,15 +126,15 @@ macro_rules! impl_is_minus_one { impl_is_minus_one! { i8 i16 i32 i64 isize } -pub fn cvt(t: T) -> io::Result { +pub fn cvt(t: T) -> crate::io::Result { if t.is_minus_one() { - Err(io::Error::last_os_error()) + Err(crate::io::Error::last_os_error()) } else { Ok(t) } } -pub fn cvt_r(mut f: F) -> io::Result +pub fn cvt_r(mut f: F) -> crate::io::Result where T: IsMinusOne, F: FnMut() -> T { @@ -154,5 +154,5 @@ pub fn cvt_r(mut f: F) -> io::Result // instruction" that intrinsics::abort would cause, as intrinsics::abort is // implemented as an illegal instruction. pub unsafe fn abort_internal() -> ! { - ::libc::abort() + libc::abort() } diff --git a/src/libstd/sys/unix/mutex.rs b/src/libstd/sys/unix/mutex.rs index 54429dc84b6b..b6a22e1962ab 100644 --- a/src/libstd/sys/unix/mutex.rs +++ b/src/libstd/sys/unix/mutex.rs @@ -1,6 +1,5 @@ -use cell::UnsafeCell; -use libc; -use mem; +use crate::cell::UnsafeCell; +use crate::mem; pub struct Mutex { inner: UnsafeCell } @@ -74,7 +73,6 @@ impl Mutex { #[inline] #[cfg(target_os = "dragonfly")] pub unsafe fn destroy(&self) { - use libc; let r = libc::pthread_mutex_destroy(self.inner.get()); // On DragonFly pthread_mutex_destroy() returns EINVAL if called on a // mutex that was just initialized with libc::PTHREAD_MUTEX_INITIALIZER. diff --git a/src/libstd/sys/unix/net.rs b/src/libstd/sys/unix/net.rs index d780d71c3769..7712a41ded46 100644 --- a/src/libstd/sys/unix/net.rs +++ b/src/libstd/sys/unix/net.rs @@ -1,16 +1,19 @@ -use ffi::CStr; -use io; -use libc::{self, c_int, c_void, size_t, sockaddr, socklen_t, EAI_SYSTEM, MSG_PEEK}; -use mem; -use net::{SocketAddr, Shutdown}; -use str; -use sys::fd::FileDesc; -use sys_common::{AsInner, FromInner, IntoInner}; -use sys_common::net::{getsockopt, setsockopt, sockaddr_to_addr}; -use time::{Duration, Instant}; -use cmp; +use crate::ffi::CStr; +use crate::io::{self, IoVec, IoVecMut}; +use crate::mem; +use crate::net::{SocketAddr, Shutdown}; +use crate::str; +use crate::sys::fd::FileDesc; +use crate::sys_common::{AsInner, FromInner, IntoInner}; +use crate::sys_common::net::{getsockopt, setsockopt, sockaddr_to_addr}; +use crate::time::{Duration, Instant}; +use crate::cmp; -pub use sys::{cvt, cvt_r}; +use libc::{c_int, c_void, size_t, sockaddr, socklen_t, EAI_SYSTEM, MSG_PEEK}; + +pub use crate::sys::{cvt, cvt_r}; + +#[allow(unused_extern_crates)] pub extern crate libc as netc; pub type wrlen_t = size_t; @@ -241,6 +244,10 @@ impl Socket { self.recv_with_flags(buf, MSG_PEEK) } + pub fn read_vectored(&self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + self.0.read_vectored(bufs) + } + fn recv_from_with_flags(&self, buf: &mut [u8], flags: c_int) -> io::Result<(usize, SocketAddr)> { let mut storage: libc::sockaddr_storage = unsafe { mem::zeroed() }; @@ -269,6 +276,10 @@ impl Socket { self.0.write(buf) } + pub fn write_vectored(&self, bufs: &[IoVec<'_>]) -> io::Result { + self.0.write_vectored(bufs) + } + pub fn set_timeout(&self, dur: Option, kind: libc::c_int) -> io::Result<()> { let timeout = match dur { Some(dur) => { @@ -376,7 +387,7 @@ impl IntoInner for Socket { // believe it's thread-safe). #[cfg(target_env = "gnu")] fn on_resolver_failure() { - use sys; + use crate::sys; // If the version fails to parse, we treat it the same as "not glibc". if let Some(version) = sys::os::glibc_version() { diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index 58ea190fcc00..e16d50d437b2 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -2,25 +2,26 @@ #![allow(unused_imports)] // lots of cfg code here -use os::unix::prelude::*; +use crate::os::unix::prelude::*; -use error::Error as StdError; -use ffi::{CString, CStr, OsString, OsStr}; -use fmt; -use io; -use iter; -use libc::{self, c_int, c_char, c_void}; -use marker::PhantomData; -use mem; -use memchr; -use path::{self, PathBuf}; -use ptr; -use slice; -use str; -use sys_common::mutex::{Mutex, MutexGuard}; -use sys::cvt; -use sys::fd; -use vec; +use crate::error::Error as StdError; +use crate::ffi::{CString, CStr, OsString, OsStr}; +use crate::fmt; +use crate::io; +use crate::iter; +use crate::marker::PhantomData; +use crate::mem; +use crate::memchr; +use crate::path::{self, PathBuf}; +use crate::ptr; +use crate::slice; +use crate::str; +use crate::sys_common::mutex::{Mutex, MutexGuard}; +use crate::sys::cvt; +use crate::sys::fd; +use crate::vec; + +use libc::{c_int, c_char, c_void}; const TMPBUF_SZ: usize = 128; @@ -207,13 +208,13 @@ pub fn current_exe() -> io::Result { libc::KERN_PROC_PATHNAME as c_int, -1 as c_int]; let mut sz = 0; - cvt(libc::sysctl(mib.as_mut_ptr(), mib.len() as ::libc::c_uint, + cvt(libc::sysctl(mib.as_mut_ptr(), mib.len() as libc::c_uint, ptr::null_mut(), &mut sz, ptr::null_mut(), 0))?; if sz == 0 { return Err(io::Error::last_os_error()) } let mut v: Vec = Vec::with_capacity(sz); - cvt(libc::sysctl(mib.as_mut_ptr(), mib.len() as ::libc::c_uint, + cvt(libc::sysctl(mib.as_mut_ptr(), mib.len() as libc::c_uint, v.as_mut_ptr() as *mut libc::c_void, &mut sz, ptr::null_mut(), 0))?; if sz == 0 { @@ -230,7 +231,7 @@ pub fn current_exe() -> io::Result { unsafe { let mib = [libc::CTL_KERN, libc::KERN_PROC_ARGS, -1, libc::KERN_PROC_PATHNAME]; let mut path_len: usize = 0; - cvt(libc::sysctl(mib.as_ptr(), mib.len() as ::libc::c_uint, + cvt(libc::sysctl(mib.as_ptr(), mib.len() as libc::c_uint, ptr::null_mut(), &mut path_len, ptr::null(), 0))?; if path_len <= 1 { @@ -238,7 +239,7 @@ pub fn current_exe() -> io::Result { "KERN_PROC_PATHNAME sysctl returned zero-length string")) } let mut path: Vec = Vec::with_capacity(path_len); - cvt(libc::sysctl(mib.as_ptr(), mib.len() as ::libc::c_uint, + cvt(libc::sysctl(mib.as_ptr(), mib.len() as libc::c_uint, path.as_ptr() as *mut libc::c_void, &mut path_len, ptr::null(), 0))?; path.set_len(path_len - 1); // chop off NUL @@ -248,7 +249,7 @@ pub fn current_exe() -> io::Result { fn procfs() -> io::Result { let curproc_exe = path::Path::new("/proc/curproc/exe"); if curproc_exe.is_file() { - return ::fs::read_link(curproc_exe); + return crate::fs::read_link(curproc_exe); } Err(io::Error::new(io::ErrorKind::Other, "/proc/curproc/exe doesn't point to regular file.")) @@ -277,7 +278,7 @@ pub fn current_exe() -> io::Result { } let argv0 = CStr::from_ptr(argv[0]).to_bytes(); if argv0[0] == b'.' || argv0.iter().any(|b| *b == b'/') { - ::fs::canonicalize(OsStr::from_bytes(argv0)) + crate::fs::canonicalize(OsStr::from_bytes(argv0)) } else { Ok(PathBuf::from(OsStr::from_bytes(argv0))) } @@ -286,7 +287,7 @@ pub fn current_exe() -> io::Result { #[cfg(any(target_os = "linux", target_os = "android", target_os = "emscripten"))] pub fn current_exe() -> io::Result { - match ::fs::read_link("/proc/self/exe") { + match crate::fs::read_link("/proc/self/exe") { Err(ref e) if e.kind() == io::ErrorKind::NotFound => { Err(io::Error::new( io::ErrorKind::Other, @@ -373,7 +374,7 @@ pub fn current_exe() -> io::Result { let result = _get_next_image_info(0, &mut cookie, &mut info, mem::size_of::() as i32); if result != 0 { - use io::ErrorKind; + use crate::io::ErrorKind; Err(io::Error::new(ErrorKind::Other, "Error getting executable path")) } else { let name = CStr::from_ptr(info.name.as_ptr()).to_bytes(); @@ -384,7 +385,7 @@ pub fn current_exe() -> io::Result { #[cfg(any(target_os = "fuchsia", target_os = "l4re", target_os = "hermit"))] pub fn current_exe() -> io::Result { - use io::ErrorKind; + use crate::io::ErrorKind; Err(io::Error::new(ErrorKind::Other, "Not yet implemented!")) } @@ -495,7 +496,7 @@ pub fn page_size() -> usize { } pub fn temp_dir() -> PathBuf { - ::env::var_os("TMPDIR").map(PathBuf::from).unwrap_or_else(|| { + crate::env::var_os("TMPDIR").map(PathBuf::from).unwrap_or_else(|| { if cfg!(target_os = "android") { PathBuf::from("/data/local/tmp") } else { @@ -505,7 +506,7 @@ pub fn temp_dir() -> PathBuf { } pub fn home_dir() -> Option { - return ::env::var_os("HOME").or_else(|| unsafe { + return crate::env::var_os("HOME").or_else(|| unsafe { fallback() }).map(PathBuf::from); diff --git a/src/libstd/sys/unix/os_str.rs b/src/libstd/sys/unix/os_str.rs index 9d5e084feb2d..79b43458d00f 100644 --- a/src/libstd/sys/unix/os_str.rs +++ b/src/libstd/sys/unix/os_str.rs @@ -1,14 +1,15 @@ /// The underlying OsString/OsStr implementation on Unix systems: just /// a `Vec`/`[u8]`. -use borrow::Cow; -use fmt; -use str; -use mem; -use rc::Rc; -use sync::Arc; -use sys_common::{AsInner, IntoInner}; -use sys_common::bytestring::debug_fmt_bytestring; +use crate::borrow::Cow; +use crate::fmt; +use crate::str; +use crate::mem; +use crate::rc::Rc; +use crate::sync::Arc; +use crate::sys_common::{AsInner, IntoInner}; +use crate::sys_common::bytestring::debug_fmt_bytestring; + use core::str::lossy::Utf8Lossy; #[derive(Clone, Hash)] diff --git a/src/libstd/sys/unix/path.rs b/src/libstd/sys/unix/path.rs index 2ef78fb2f86d..5c062e7c97cd 100644 --- a/src/libstd/sys/unix/path.rs +++ b/src/libstd/sys/unix/path.rs @@ -1,5 +1,5 @@ -use path::Prefix; -use ffi::OsStr; +use crate::path::Prefix; +use crate::ffi::OsStr; #[inline] pub fn is_sep_byte(b: u8) -> bool { diff --git a/src/libstd/sys/unix/pipe.rs b/src/libstd/sys/unix/pipe.rs index a746d982c6ca..bc3c026adab8 100644 --- a/src/libstd/sys/unix/pipe.rs +++ b/src/libstd/sys/unix/pipe.rs @@ -1,9 +1,10 @@ -use io; -use libc::{self, c_int}; -use mem; -use sync::atomic::{AtomicBool, Ordering}; -use sys::fd::FileDesc; -use sys::{cvt, cvt_r}; +use crate::io; +use crate::mem; +use crate::sync::atomic::{AtomicBool, Ordering}; +use crate::sys::fd::FileDesc; +use crate::sys::{cvt, cvt_r}; + +use libc::c_int; //////////////////////////////////////////////////////////////////////////////// // Anonymous pipes diff --git a/src/libstd/sys/unix/process/process_common.rs b/src/libstd/sys/unix/process/process_common.rs index 7fa256e59b2d..856d202be03f 100644 --- a/src/libstd/sys/unix/process/process_common.rs +++ b/src/libstd/sys/unix/process/process_common.rs @@ -1,15 +1,16 @@ -use os::unix::prelude::*; +use crate::os::unix::prelude::*; -use ffi::{OsString, OsStr, CString, CStr}; -use fmt; -use io; -use libc::{self, c_int, gid_t, uid_t, c_char, EXIT_SUCCESS, EXIT_FAILURE}; -use ptr; -use sys::fd::FileDesc; -use sys::fs::{File, OpenOptions}; -use sys::pipe::{self, AnonPipe}; -use sys_common::process::{CommandEnv, DefaultEnvKey}; -use collections::BTreeMap; +use crate::ffi::{OsString, OsStr, CString, CStr}; +use crate::fmt; +use crate::io; +use crate::ptr; +use crate::sys::fd::FileDesc; +use crate::sys::fs::{File, OpenOptions}; +use crate::sys::pipe::{self, AnonPipe}; +use crate::sys_common::process::{CommandEnv, DefaultEnvKey}; +use crate::collections::BTreeMap; + +use libc::{c_int, gid_t, uid_t, c_char, EXIT_SUCCESS, EXIT_FAILURE}; //////////////////////////////////////////////////////////////////////////////// // Command @@ -406,11 +407,10 @@ impl ExitCode { mod tests { use super::*; - use ffi::OsStr; - use mem; - use ptr; - use libc; - use sys::cvt; + use crate::ffi::OsStr; + use crate::mem; + use crate::ptr; + use crate::sys::cvt; macro_rules! t { ($e:expr) => { @@ -443,7 +443,7 @@ mod tests { #[cfg(target_os = "android")] unsafe fn sigaddset(set: *mut libc::sigset_t, signum: libc::c_int) -> libc::c_int { - use slice; + use crate::slice; let raw = slice::from_raw_parts_mut(set as *mut u8, mem::size_of::()); let bit = (signum - 1) as usize; diff --git a/src/libstd/sys/unix/process/process_fuchsia.rs b/src/libstd/sys/unix/process/process_fuchsia.rs index 5582310adbf7..7c6be9b0a604 100644 --- a/src/libstd/sys/unix/process/process_fuchsia.rs +++ b/src/libstd/sys/unix/process/process_fuchsia.rs @@ -1,10 +1,11 @@ -use io; -use libc::{self, size_t}; -use mem; -use ptr; +use crate::io; +use crate::mem; +use crate::ptr; -use sys::process::zircon::{Handle, zx_handle_t}; -use sys::process::process_common::*; +use crate::sys::process::zircon::{Handle, zx_handle_t}; +use crate::sys::process::process_common::*; + +use libc::size_t; //////////////////////////////////////////////////////////////////////////////// // Command @@ -44,7 +45,7 @@ impl Command { unsafe fn do_exec(&mut self, stdio: ChildPipes, maybe_envp: Option<&CStringArray>) -> io::Result { - use sys::process::zircon::*; + use crate::sys::process::zircon::*; let envp = match maybe_envp { Some(envp) => envp.as_ptr(), @@ -109,7 +110,7 @@ impl Process { } pub fn kill(&mut self) -> io::Result<()> { - use sys::process::zircon::*; + use crate::sys::process::zircon::*; unsafe { zx_cvt(zx_task_kill(self.handle.raw()))?; } @@ -117,8 +118,8 @@ impl Process { } pub fn wait(&mut self) -> io::Result { - use default::Default; - use sys::process::zircon::*; + use crate::default::Default; + use crate::sys::process::zircon::*; let mut proc_info: zx_info_process_t = Default::default(); let mut actual: size_t = 0; @@ -140,8 +141,8 @@ impl Process { } pub fn try_wait(&mut self) -> io::Result> { - use default::Default; - use sys::process::zircon::*; + use crate::default::Default; + use crate::sys::process::zircon::*; let mut proc_info: zx_info_process_t = Default::default(); let mut actual: size_t = 0; diff --git a/src/libstd/sys/unix/process/process_unix.rs b/src/libstd/sys/unix/process/process_unix.rs index 6fbbbb349b17..220b1fd45313 100644 --- a/src/libstd/sys/unix/process/process_unix.rs +++ b/src/libstd/sys/unix/process/process_unix.rs @@ -1,9 +1,10 @@ -use io::{self, Error, ErrorKind}; -use libc::{self, c_int, gid_t, pid_t, uid_t}; -use ptr; -use sys::cvt; -use sys::process::process_common::*; -use sys; +use crate::io::{self, Error, ErrorKind}; +use crate::ptr; +use crate::sys::cvt; +use crate::sys::process::process_common::*; +use crate::sys; + +use libc::{c_int, gid_t, pid_t, uid_t}; //////////////////////////////////////////////////////////////////////////////// // Command @@ -164,7 +165,7 @@ impl Command { stdio: ChildPipes, maybe_envp: Option<&CStringArray> ) -> io::Error { - use sys::{self, cvt_r}; + use crate::sys::{self, cvt_r}; macro_rules! t { ($e:expr) => (match $e { @@ -207,7 +208,7 @@ impl Command { // emscripten has no signal support. #[cfg(not(any(target_os = "emscripten")))] { - use mem; + use crate::mem; // Reset signal handling so the child process starts in a // standardized state. libstd ignores SIGPIPE, and signal-handling // libraries often set a mask. Child processes inherit ignored @@ -278,8 +279,8 @@ impl Command { fn posix_spawn(&mut self, stdio: &ChildPipes, envp: Option<&CStringArray>) -> io::Result> { - use mem; - use sys; + use crate::mem; + use crate::sys; if self.get_gid().is_some() || self.get_uid().is_some() || @@ -427,7 +428,7 @@ impl Process { } pub fn wait(&mut self) -> io::Result { - use sys::cvt_r; + use crate::sys::cvt_r; if let Some(status) = self.status { return Ok(status) } diff --git a/src/libstd/sys/unix/process/zircon.rs b/src/libstd/sys/unix/process/zircon.rs index 690c745218b6..ec715d5490f6 100644 --- a/src/libstd/sys/unix/process/zircon.rs +++ b/src/libstd/sys/unix/process/zircon.rs @@ -1,9 +1,9 @@ #![allow(non_camel_case_types, unused)] -use convert::TryInto; -use io; -use os::raw::c_char; -use u64; +use crate::convert::TryInto; +use crate::io; +use crate::os::raw::c_char; +use crate::u64; use libc::{c_int, c_void, size_t}; diff --git a/src/libstd/sys/unix/rand.rs b/src/libstd/sys/unix/rand.rs index f2e17c36738f..122f22b37a26 100644 --- a/src/libstd/sys/unix/rand.rs +++ b/src/libstd/sys/unix/rand.rs @@ -1,5 +1,5 @@ -use mem; -use slice; +use crate::mem; +use crate::slice; pub fn hashmap_random_keys() -> (u64, u64) { let mut v = (0, 0); @@ -17,10 +17,8 @@ pub fn hashmap_random_keys() -> (u64, u64) { not(target_os = "freebsd"), not(target_os = "fuchsia")))] mod imp { - use fs::File; - use io::Read; - #[cfg(any(target_os = "linux", target_os = "android"))] - use libc; + use crate::fs::File; + use crate::io::Read; #[cfg(any(target_os = "linux", target_os = "android"))] fn getrandom(buf: &mut [u8]) -> libc::c_long { @@ -34,8 +32,8 @@ mod imp { #[cfg(any(target_os = "linux", target_os = "android"))] fn getrandom_fill_bytes(v: &mut [u8]) -> bool { - use sync::atomic::{AtomicBool, Ordering}; - use sys::os::errno; + use crate::sync::atomic::{AtomicBool, Ordering}; + use crate::sys::os::errno; static GETRANDOM_UNAVAILABLE: AtomicBool = AtomicBool::new(false); if GETRANDOM_UNAVAILABLE.load(Ordering::Relaxed) { @@ -86,8 +84,7 @@ mod imp { #[cfg(target_os = "openbsd")] mod imp { - use libc; - use sys::os::errno; + use crate::sys::os::errno; pub fn fill_bytes(v: &mut [u8]) { // getentropy(2) permits a maximum buffer size of 256 bytes @@ -104,9 +101,9 @@ mod imp { #[cfg(target_os = "ios")] mod imp { - use io; + use crate::io; + use crate::ptr; use libc::{c_int, size_t}; - use ptr; enum SecRandom {} @@ -134,8 +131,7 @@ mod imp { #[cfg(target_os = "freebsd")] mod imp { - use libc; - use ptr; + use crate::ptr; pub fn fill_bytes(v: &mut [u8]) { let mib = [libc::CTL_KERN, libc::KERN_ARND]; diff --git a/src/libstd/sys/unix/rwlock.rs b/src/libstd/sys/unix/rwlock.rs index a068a11993e3..e48bfdae6104 100644 --- a/src/libstd/sys/unix/rwlock.rs +++ b/src/libstd/sys/unix/rwlock.rs @@ -1,6 +1,5 @@ -use libc; -use cell::UnsafeCell; -use sync::atomic::{AtomicUsize, Ordering}; +use crate::cell::UnsafeCell; +use crate::sync::atomic::{AtomicUsize, Ordering}; pub struct RWLock { inner: UnsafeCell, diff --git a/src/libstd/sys/unix/stack_overflow.rs b/src/libstd/sys/unix/stack_overflow.rs index d6a219a6d575..8c60bddc2383 100644 --- a/src/libstd/sys/unix/stack_overflow.rs +++ b/src/libstd/sys/unix/stack_overflow.rs @@ -1,6 +1,5 @@ #![cfg_attr(test, allow(dead_code))] -use libc; use self::imp::{make_handler, drop_handler}; pub use self::imp::cleanup; @@ -34,17 +33,17 @@ impl Drop for Handler { target_os = "openbsd"))] mod imp { use super::Handler; - use mem; - use ptr; + use crate::mem; + use crate::ptr; + use libc::{sigaltstack, SIGSTKSZ, SS_DISABLE}; use libc::{sigaction, SIGBUS, SIG_DFL, SA_SIGINFO, SA_ONSTACK, sighandler_t}; - use libc; use libc::{mmap, munmap}; use libc::{SIGSEGV, PROT_READ, PROT_WRITE, MAP_PRIVATE, MAP_ANON}; use libc::MAP_FAILED; - use sys_common::thread_info; + use crate::sys_common::thread_info; #[cfg(any(target_os = "linux", target_os = "android"))] @@ -87,7 +86,7 @@ mod imp { unsafe extern fn signal_handler(signum: libc::c_int, info: *mut libc::siginfo_t, _data: *mut libc::c_void) { - use sys_common::util::report_overflow; + use crate::sys_common::util::report_overflow; let guard = thread_info::stack_guard().unwrap_or(0..0); let addr = siginfo_si_addr(info); @@ -193,7 +192,7 @@ mod imp { all(target_os = "netbsd", not(target_vendor = "rumprun")), target_os = "openbsd")))] mod imp { - use ptr; + use crate::ptr; pub unsafe fn init() { } diff --git a/src/libstd/sys/unix/stdio.rs b/src/libstd/sys/unix/stdio.rs index 56b75bf9f793..35f163bbdb10 100644 --- a/src/libstd/sys/unix/stdio.rs +++ b/src/libstd/sys/unix/stdio.rs @@ -1,6 +1,5 @@ -use io; -use libc; -use sys::fd::FileDesc; +use crate::io; +use crate::sys::fd::FileDesc; pub struct Stdin(()); pub struct Stdout(()); @@ -57,7 +56,7 @@ pub fn is_ebadf(err: &io::Error) -> bool { err.raw_os_error() == Some(libc::EBADF as i32) } -pub const STDIN_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE; +pub const STDIN_BUF_SIZE: usize = crate::sys_common::io::DEFAULT_BUF_SIZE; pub fn panic_output() -> Option { Stderr::new().ok() diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index e29557f1ba29..feb15e8f585a 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -1,14 +1,13 @@ -use boxed::FnBox; -use cmp; -use ffi::CStr; -use io; -use libc; -use mem; -use ptr; -use sys::os; -use time::Duration; +use crate::boxed::FnBox; +use crate::cmp; +use crate::ffi::CStr; +use crate::io; +use crate::mem; +use crate::ptr; +use crate::sys::os; +use crate::time::Duration; -use sys_common::thread::*; +use crate::sys_common::thread::*; #[cfg(not(target_os = "l4re"))] pub const DEFAULT_MIN_STACK_SIZE: usize = 2 * 1024 * 1024; @@ -118,7 +117,7 @@ impl Thread { #[cfg(target_os = "netbsd")] pub fn set_name(name: &CStr) { - use ffi::CString; + use crate::ffi::CString; let cname = CString::new(&b"%s"[..]).unwrap(); unsafe { libc::pthread_setname_np(libc::pthread_self(), cname.as_ptr(), @@ -197,7 +196,7 @@ impl Drop for Thread { not(target_os = "solaris")))] #[cfg_attr(test, allow(dead_code))] pub mod guard { - use ops::Range; + use crate::ops::Range; pub type Guard = Range; pub unsafe fn current() -> Option { None } pub unsafe fn init() -> Option { None } @@ -213,11 +212,11 @@ pub mod guard { target_os = "solaris"))] #[cfg_attr(test, allow(dead_code))] pub mod guard { - use libc; use libc::{mmap, mprotect}; use libc::{PROT_NONE, PROT_READ, PROT_WRITE, MAP_PRIVATE, MAP_ANON, MAP_FAILED, MAP_FIXED}; - use ops::Range; - use sys::os; + + use crate::ops::Range; + use crate::sys::os; // This is initialized in init() and only read from after static mut PAGE_SIZE: usize = 0; @@ -226,7 +225,7 @@ pub mod guard { #[cfg(target_os = "solaris")] unsafe fn get_stack_start() -> Option<*mut libc::c_void> { - let mut current_stack: libc::stack_t = ::mem::zeroed(); + let mut current_stack: libc::stack_t = crate::mem::zeroed(); assert_eq!(libc::stack_getbounds(&mut current_stack), 0); Some(current_stack.ss_sp) } @@ -240,7 +239,7 @@ pub mod guard { #[cfg(any(target_os = "openbsd", target_os = "bitrig"))] unsafe fn get_stack_start() -> Option<*mut libc::c_void> { - let mut current_stack: libc::stack_t = ::mem::zeroed(); + let mut current_stack: libc::stack_t = crate::mem::zeroed(); assert_eq!(libc::pthread_stackseg_np(libc::pthread_self(), &mut current_stack), 0); @@ -259,14 +258,14 @@ pub mod guard { target_os = "linux", target_os = "netbsd", target_os = "l4re"))] unsafe fn get_stack_start() -> Option<*mut libc::c_void> { let mut ret = None; - let mut attr: libc::pthread_attr_t = ::mem::zeroed(); + let mut attr: libc::pthread_attr_t = crate::mem::zeroed(); assert_eq!(libc::pthread_attr_init(&mut attr), 0); #[cfg(target_os = "freebsd")] let e = libc::pthread_attr_get_np(libc::pthread_self(), &mut attr); #[cfg(not(target_os = "freebsd"))] let e = libc::pthread_getattr_np(libc::pthread_self(), &mut attr); if e == 0 { - let mut stackaddr = ::ptr::null_mut(); + let mut stackaddr = crate::ptr::null_mut(); let mut stacksize = 0; assert_eq!(libc::pthread_attr_getstack(&attr, &mut stackaddr, &mut stacksize), 0); @@ -357,7 +356,7 @@ pub mod guard { target_os = "linux", target_os = "netbsd", target_os = "l4re"))] pub unsafe fn current() -> Option { let mut ret = None; - let mut attr: libc::pthread_attr_t = ::mem::zeroed(); + let mut attr: libc::pthread_attr_t = crate::mem::zeroed(); assert_eq!(libc::pthread_attr_init(&mut attr), 0); #[cfg(target_os = "freebsd")] let e = libc::pthread_attr_get_np(libc::pthread_self(), &mut attr); @@ -369,7 +368,7 @@ pub mod guard { if guardsize == 0 { panic!("there is no guard page"); } - let mut stackaddr = ::ptr::null_mut(); + let mut stackaddr = crate::ptr::null_mut(); let mut size = 0; assert_eq!(libc::pthread_attr_getstack(&attr, &mut stackaddr, &mut size), 0); diff --git a/src/libstd/sys/unix/thread_local.rs b/src/libstd/sys/unix/thread_local.rs index c171fbce237f..ac615b76b362 100644 --- a/src/libstd/sys/unix/thread_local.rs +++ b/src/libstd/sys/unix/thread_local.rs @@ -1,7 +1,6 @@ #![allow(dead_code)] // not used on all platforms -use mem; -use libc; +use crate::mem; pub type Key = libc::pthread_key_t; diff --git a/src/libstd/sys/unix/time.rs b/src/libstd/sys/unix/time.rs index 4a655714f991..cbb0615911ad 100644 --- a/src/libstd/sys/unix/time.rs +++ b/src/libstd/sys/unix/time.rs @@ -1,10 +1,10 @@ -use cmp::Ordering; -use libc; -use time::Duration; +use crate::cmp::Ordering; +use crate::time::Duration; + use core::hash::{Hash, Hasher}; pub use self::inner::{Instant, SystemTime, UNIX_EPOCH}; -use convert::TryInto; +use crate::convert::TryInto; const NSEC_PER_SEC: u64 = 1_000_000_000; @@ -113,12 +113,11 @@ impl Hash for Timespec { #[cfg(any(target_os = "macos", target_os = "ios"))] mod inner { - use fmt; - use libc; - use sync::Once; - use sys::cvt; - use sys_common::mul_div_u64; - use time::Duration; + use crate::fmt; + use crate::sync::Once; + use crate::sys::cvt; + use crate::sys_common::mul_div_u64; + use crate::time::Duration; use super::NSEC_PER_SEC; use super::Timespec; @@ -173,7 +172,7 @@ mod inner { impl SystemTime { pub fn now() -> SystemTime { - use ptr; + use crate::ptr; let mut s = libc::timeval { tv_sec: 0, @@ -249,10 +248,9 @@ mod inner { #[cfg(not(any(target_os = "macos", target_os = "ios")))] mod inner { - use fmt; - use libc; - use sys::cvt; - use time::Duration; + use crate::fmt; + use crate::sys::cvt; + use crate::time::Duration; use super::Timespec; diff --git a/src/libstd/sys/unix/weak.rs b/src/libstd/sys/unix/weak.rs index b60e241f10ce..9a7691e54bc1 100644 --- a/src/libstd/sys/unix/weak.rs +++ b/src/libstd/sys/unix/weak.rs @@ -16,17 +16,15 @@ //! symbol, but that caused Debian to detect an unnecessarily strict versioned //! dependency on libc6 (#23628). -use libc; - -use ffi::CStr; -use marker; -use mem; -use sync::atomic::{AtomicUsize, Ordering}; +use crate::ffi::CStr; +use crate::marker; +use crate::mem; +use crate::sync::atomic::{AtomicUsize, Ordering}; macro_rules! weak { (fn $name:ident($($t:ty),*) -> $ret:ty) => ( - static $name: ::sys::weak::Weak $ret> = - ::sys::weak::Weak::new(concat!(stringify!($name), '\0')); + static $name: crate::sys::weak::Weak $ret> = + crate::sys::weak::Weak::new(concat!(stringify!($name), '\0')); ) } @@ -71,7 +69,6 @@ unsafe fn fetch(name: &str) -> usize { macro_rules! syscall { (fn $name:ident($($arg_name:ident: $t:ty),*) -> $ret:ty) => ( unsafe fn $name($($arg_name: $t),*) -> $ret { - use libc; use super::os; weak! { fn $name($($t),*) -> $ret } diff --git a/src/libstd/sys/wasm/alloc.rs b/src/libstd/sys/wasm/alloc.rs index f082887ce205..b9098548b9c1 100644 --- a/src/libstd/sys/wasm/alloc.rs +++ b/src/libstd/sys/wasm/alloc.rs @@ -16,9 +16,7 @@ //! The crate itself provides a global allocator which on wasm has no //! synchronization as there are no threads! -extern crate dlmalloc; - -use alloc::{GlobalAlloc, Layout, System}; +use crate::alloc::{GlobalAlloc, Layout, System}; static mut DLMALLOC: dlmalloc::Dlmalloc = dlmalloc::DLMALLOC_INIT; @@ -51,8 +49,8 @@ unsafe impl GlobalAlloc for System { #[cfg(target_feature = "atomics")] mod lock { - use arch::wasm32; - use sync::atomic::{AtomicI32, Ordering::SeqCst}; + use crate::arch::wasm32; + use crate::sync::atomic::{AtomicI32, Ordering::SeqCst}; static LOCKED: AtomicI32 = AtomicI32::new(0); diff --git a/src/libstd/sys/wasm/args.rs b/src/libstd/sys/wasm/args.rs index cea56091adcb..b3c77b869956 100644 --- a/src/libstd/sys/wasm/args.rs +++ b/src/libstd/sys/wasm/args.rs @@ -1,7 +1,7 @@ -use ffi::OsString; -use marker::PhantomData; -use vec; -use sys::ArgsSysCall; +use crate::ffi::OsString; +use crate::marker::PhantomData; +use crate::vec; +use crate::sys::ArgsSysCall; pub unsafe fn init(_argc: isize, _argv: *const *const u8) { // On wasm these should always be null, so there's nothing for us to do here diff --git a/src/libstd/sys/wasm/backtrace.rs b/src/libstd/sys/wasm/backtrace.rs index 52d4a63bb638..7d56b298997a 100644 --- a/src/libstd/sys/wasm/backtrace.rs +++ b/src/libstd/sys/wasm/backtrace.rs @@ -1,6 +1,6 @@ -use io; -use sys::unsupported; -use sys_common::backtrace::Frame; +use crate::io; +use crate::sys::unsupported; +use crate::sys_common::backtrace::Frame; pub struct BacktraceContext; diff --git a/src/libstd/sys/wasm/condvar.rs b/src/libstd/sys/wasm/condvar.rs index 22df0f60db5a..9c7cc3c63b15 100644 --- a/src/libstd/sys/wasm/condvar.rs +++ b/src/libstd/sys/wasm/condvar.rs @@ -1,5 +1,5 @@ -use sys::mutex::Mutex; -use time::Duration; +use crate::sys::mutex::Mutex; +use crate::time::Duration; pub struct Condvar { } diff --git a/src/libstd/sys/wasm/condvar_atomics.rs b/src/libstd/sys/wasm/condvar_atomics.rs index 099404c75d42..580d21218445 100644 --- a/src/libstd/sys/wasm/condvar_atomics.rs +++ b/src/libstd/sys/wasm/condvar_atomics.rs @@ -1,9 +1,9 @@ -use arch::wasm32; -use cmp; -use mem; -use sync::atomic::{AtomicUsize, Ordering::SeqCst}; -use sys::mutex::Mutex; -use time::Duration; +use crate::arch::wasm32; +use crate::cmp; +use crate::mem; +use crate::sync::atomic::{AtomicUsize, Ordering::SeqCst}; +use crate::sys::mutex::Mutex; +use crate::time::Duration; pub struct Condvar { cnt: AtomicUsize, diff --git a/src/libstd/sys/wasm/fs.rs b/src/libstd/sys/wasm/fs.rs index 8b1c4476bc41..485d2c87fbd2 100644 --- a/src/libstd/sys/wasm/fs.rs +++ b/src/libstd/sys/wasm/fs.rs @@ -1,10 +1,10 @@ -use ffi::OsString; -use fmt; -use hash::{Hash, Hasher}; -use io::{self, SeekFrom}; -use path::{Path, PathBuf}; -use sys::time::SystemTime; -use sys::{unsupported, Void}; +use crate::ffi::OsString; +use crate::fmt; +use crate::hash::{Hash, Hasher}; +use crate::io::{self, SeekFrom}; +use crate::path::{Path, PathBuf}; +use crate::sys::time::SystemTime; +use crate::sys::{unsupported, Void}; pub struct File(Void); diff --git a/src/libstd/sys/wasm/io.rs b/src/libstd/sys/wasm/io.rs new file mode 100644 index 000000000000..8b02d3fd19d3 --- /dev/null +++ b/src/libstd/sys/wasm/io.rs @@ -0,0 +1,32 @@ +pub struct IoVec<'a>(&'a [u8]); + +impl<'a> IoVec<'a> { + #[inline] + pub fn new(buf: &'a [u8]) -> IoVec<'a> { + IoVec(buf) + } + + #[inline] + pub fn as_slice(&self) -> &[u8] { + self.0 + } +} + +pub struct IoVecMut<'a>(&'a mut [u8]); + +impl<'a> IoVecMut<'a> { + #[inline] + pub fn new(buf: &'a mut [u8]) -> IoVecMut<'a> { + IoVecMut(buf) + } + + #[inline] + pub fn as_slice(&self) -> &[u8] { + self.0 + } + + #[inline] + pub fn as_mut_slice(&mut self) -> &mut [u8] { + self.0 + } +} diff --git a/src/libstd/sys/wasm/mod.rs b/src/libstd/sys/wasm/mod.rs index e21455ec6da7..1828cce4e520 100644 --- a/src/libstd/sys/wasm/mod.rs +++ b/src/libstd/sys/wasm/mod.rs @@ -14,13 +14,12 @@ //! compiling for wasm. That way it's a compile time error for something that's //! guaranteed to be a runtime error! -use io; -use os::raw::c_char; -use ptr; -use sys::os_str::Buf; -use sys_common::{AsInner, FromInner}; -use ffi::{OsString, OsStr}; -use time::Duration; +use crate::os::raw::c_char; +use crate::ptr; +use crate::sys::os_str::Buf; +use crate::sys_common::{AsInner, FromInner}; +use crate::ffi::{OsString, OsStr}; +use crate::time::Duration; pub mod alloc; pub mod args; @@ -29,6 +28,7 @@ pub mod backtrace; pub mod cmath; pub mod env; pub mod fs; +pub mod io; pub mod memchr; pub mod net; pub mod os; @@ -63,17 +63,17 @@ cfg_if! { pub fn init() { } -pub fn unsupported() -> io::Result { +pub fn unsupported() -> crate::io::Result { Err(unsupported_err()) } -pub fn unsupported_err() -> io::Error { - io::Error::new(io::ErrorKind::Other, +pub fn unsupported_err() -> crate::io::Error { + crate::io::Error::new(crate::io::ErrorKind::Other, "operation not supported on wasm yet") } -pub fn decode_error_kind(_code: i32) -> io::ErrorKind { - io::ErrorKind::Other +pub fn decode_error_kind(_code: i32) -> crate::io::ErrorKind { + crate::io::ErrorKind::Other } // This enum is used as the storage for a bunch of types which can't actually @@ -168,7 +168,7 @@ impl ExitSysCall { }; unsafe { syscall(SysCallIndex::Exit, &mut call_record); - ::intrinsics::abort(); + crate::intrinsics::abort(); } } } diff --git a/src/libstd/sys/wasm/mutex.rs b/src/libstd/sys/wasm/mutex.rs index cf0a0a8638b1..9d713e9b4390 100644 --- a/src/libstd/sys/wasm/mutex.rs +++ b/src/libstd/sys/wasm/mutex.rs @@ -1,4 +1,4 @@ -use cell::UnsafeCell; +use crate::cell::UnsafeCell; pub struct Mutex { locked: UnsafeCell, diff --git a/src/libstd/sys/wasm/mutex_atomics.rs b/src/libstd/sys/wasm/mutex_atomics.rs index da03e8fa23f1..0e4f3d80aa93 100644 --- a/src/libstd/sys/wasm/mutex_atomics.rs +++ b/src/libstd/sys/wasm/mutex_atomics.rs @@ -1,8 +1,8 @@ -use arch::wasm32; -use cell::UnsafeCell; -use mem; -use sync::atomic::{AtomicUsize, AtomicU32, Ordering::SeqCst}; -use sys::thread; +use crate::arch::wasm32; +use crate::cell::UnsafeCell; +use crate::mem; +use crate::sync::atomic::{AtomicUsize, AtomicU32, Ordering::SeqCst}; +use crate::sys::thread; pub struct Mutex { locked: AtomicUsize, diff --git a/src/libstd/sys/wasm/net.rs b/src/libstd/sys/wasm/net.rs index 81e4e8255bf5..a2ea2dfbbc03 100644 --- a/src/libstd/sys/wasm/net.rs +++ b/src/libstd/sys/wasm/net.rs @@ -1,9 +1,9 @@ -use fmt; -use io; -use net::{SocketAddr, Shutdown, Ipv4Addr, Ipv6Addr}; -use time::Duration; -use sys::{unsupported, Void}; -use convert::TryFrom; +use crate::fmt; +use crate::io::{self, IoVec, IoVecMut}; +use crate::net::{SocketAddr, Shutdown, Ipv4Addr, Ipv6Addr}; +use crate::time::Duration; +use crate::sys::{unsupported, Void}; +use crate::convert::TryFrom; pub struct TcpStream(Void); @@ -40,10 +40,18 @@ impl TcpStream { match self.0 {} } + pub fn read_vectored(&self, _: &mut [IoVecMut<'_>]) -> io::Result { + match self.0 {} + } + pub fn write(&self, _: &[u8]) -> io::Result { match self.0 {} } + pub fn write_vectored(&self, _: &[IoVec<'_>]) -> io::Result { + match self.0 {} + } + pub fn peer_addr(&self) -> io::Result { match self.0 {} } @@ -290,10 +298,10 @@ impl Iterator for LookupHost { } } -impl<'a> TryFrom<&'a str> for LookupHost { +impl TryFrom<&str> for LookupHost { type Error = io::Error; - fn try_from(_v: &'a str) -> io::Result { + fn try_from(_v: &str) -> io::Result { unsupported() } } diff --git a/src/libstd/sys/wasm/os.rs b/src/libstd/sys/wasm/os.rs index 9b278dfb9f8b..145f9ccd73a8 100644 --- a/src/libstd/sys/wasm/os.rs +++ b/src/libstd/sys/wasm/os.rs @@ -1,10 +1,10 @@ -use error::Error as StdError; -use ffi::{OsString, OsStr}; -use fmt; -use io; -use path::{self, PathBuf}; -use str; -use sys::{unsupported, Void, ExitSysCall, GetEnvSysCall, SetEnvSysCall}; +use crate::error::Error as StdError; +use crate::ffi::{OsString, OsStr}; +use crate::fmt; +use crate::io; +use crate::path::{self, PathBuf}; +use crate::str; +use crate::sys::{unsupported, Void, ExitSysCall, GetEnvSysCall, SetEnvSysCall}; pub fn errno() -> i32 { 0 diff --git a/src/libstd/sys/wasm/os_str.rs b/src/libstd/sys/wasm/os_str.rs index 9d5e084feb2d..79b43458d00f 100644 --- a/src/libstd/sys/wasm/os_str.rs +++ b/src/libstd/sys/wasm/os_str.rs @@ -1,14 +1,15 @@ /// The underlying OsString/OsStr implementation on Unix systems: just /// a `Vec`/`[u8]`. -use borrow::Cow; -use fmt; -use str; -use mem; -use rc::Rc; -use sync::Arc; -use sys_common::{AsInner, IntoInner}; -use sys_common::bytestring::debug_fmt_bytestring; +use crate::borrow::Cow; +use crate::fmt; +use crate::str; +use crate::mem; +use crate::rc::Rc; +use crate::sync::Arc; +use crate::sys_common::{AsInner, IntoInner}; +use crate::sys_common::bytestring::debug_fmt_bytestring; + use core::str::lossy::Utf8Lossy; #[derive(Clone, Hash)] diff --git a/src/libstd/sys/wasm/path.rs b/src/libstd/sys/wasm/path.rs index 2ef78fb2f86d..5c062e7c97cd 100644 --- a/src/libstd/sys/wasm/path.rs +++ b/src/libstd/sys/wasm/path.rs @@ -1,5 +1,5 @@ -use path::Prefix; -use ffi::OsStr; +use crate::path::Prefix; +use crate::ffi::OsStr; #[inline] pub fn is_sep_byte(b: u8) -> bool { diff --git a/src/libstd/sys/wasm/pipe.rs b/src/libstd/sys/wasm/pipe.rs index ac48a6dc0332..2582b993b608 100644 --- a/src/libstd/sys/wasm/pipe.rs +++ b/src/libstd/sys/wasm/pipe.rs @@ -1,5 +1,5 @@ -use io; -use sys::Void; +use crate::io; +use crate::sys::Void; pub struct AnonPipe(Void); diff --git a/src/libstd/sys/wasm/process.rs b/src/libstd/sys/wasm/process.rs index 5357d931c736..c49daaa16320 100644 --- a/src/libstd/sys/wasm/process.rs +++ b/src/libstd/sys/wasm/process.rs @@ -1,10 +1,10 @@ -use ffi::OsStr; -use fmt; -use io; -use sys::fs::File; -use sys::pipe::AnonPipe; -use sys::{unsupported, Void}; -use sys_common::process::{CommandEnv, DefaultEnvKey}; +use crate::ffi::OsStr; +use crate::fmt; +use crate::io; +use crate::sys::fs::File; +use crate::sys::pipe::AnonPipe; +use crate::sys::{unsupported, Void}; +use crate::sys_common::process::{CommandEnv, DefaultEnvKey}; //////////////////////////////////////////////////////////////////////////////// // Command diff --git a/src/libstd/sys/wasm/rwlock.rs b/src/libstd/sys/wasm/rwlock.rs index 9f172859b7e6..a2b07c7fa1fc 100644 --- a/src/libstd/sys/wasm/rwlock.rs +++ b/src/libstd/sys/wasm/rwlock.rs @@ -1,4 +1,4 @@ -use cell::UnsafeCell; +use crate::cell::UnsafeCell; pub struct RWLock { mode: UnsafeCell, diff --git a/src/libstd/sys/wasm/rwlock_atomics.rs b/src/libstd/sys/wasm/rwlock_atomics.rs index 404b33bca41b..c705568cec99 100644 --- a/src/libstd/sys/wasm/rwlock_atomics.rs +++ b/src/libstd/sys/wasm/rwlock_atomics.rs @@ -1,6 +1,6 @@ -use cell::UnsafeCell; -use sys::mutex::Mutex; -use sys::condvar::Condvar; +use crate::cell::UnsafeCell; +use crate::sys::mutex::Mutex; +use crate::sys::condvar::Condvar; pub struct RWLock { lock: Mutex, diff --git a/src/libstd/sys/wasm/stdio.rs b/src/libstd/sys/wasm/stdio.rs index d7540fd815c9..b8899a9c8474 100644 --- a/src/libstd/sys/wasm/stdio.rs +++ b/src/libstd/sys/wasm/stdio.rs @@ -1,5 +1,5 @@ -use io; -use sys::{ReadSysCall, WriteSysCall}; +use crate::io; +use crate::sys::{ReadSysCall, WriteSysCall}; pub struct Stdin; pub struct Stdout; diff --git a/src/libstd/sys/wasm/thread.rs b/src/libstd/sys/wasm/thread.rs index c2322088e8e5..a65c413119f8 100644 --- a/src/libstd/sys/wasm/thread.rs +++ b/src/libstd/sys/wasm/thread.rs @@ -1,8 +1,8 @@ -use boxed::FnBox; -use ffi::CStr; -use io; -use sys::{unsupported, Void}; -use time::Duration; +use crate::boxed::FnBox; +use crate::ffi::CStr; +use crate::io; +use crate::sys::{unsupported, Void}; +use crate::time::Duration; pub struct Thread(Void); @@ -31,8 +31,8 @@ impl Thread { #[cfg(target_feature = "atomics")] pub fn sleep(dur: Duration) { - use arch::wasm32; - use cmp; + use crate::arch::wasm32; + use crate::cmp; // Use an atomic wait to block the current thread artificially with a // timeout listed. Note that we should never be notified (return value @@ -76,7 +76,7 @@ cfg_if! { // you'd like to use them be sure to update that and make sure everyone // agrees what's what. pub fn tcb_get() -> *mut u8 { - use mem; + use crate::mem; assert_eq!(mem::size_of::<*mut u8>(), mem::size_of::()); unsafe { __wbindgen_tcb_get() as *mut u8 } } diff --git a/src/libstd/sys/wasm/thread_local.rs b/src/libstd/sys/wasm/thread_local.rs index c7c385da8c37..29e9854bcfcc 100644 --- a/src/libstd/sys/wasm/thread_local.rs +++ b/src/libstd/sys/wasm/thread_local.rs @@ -1,5 +1,5 @@ -use boxed::Box; -use ptr; +use crate::boxed::Box; +use crate::ptr; pub type Key = usize; diff --git a/src/libstd/sys/wasm/thread_local_atomics.rs b/src/libstd/sys/wasm/thread_local_atomics.rs index d1d0af252c8c..b408ad0d5c1f 100644 --- a/src/libstd/sys/wasm/thread_local_atomics.rs +++ b/src/libstd/sys/wasm/thread_local_atomics.rs @@ -1,5 +1,5 @@ -use sys::thread; -use sync::atomic::{AtomicUsize, Ordering::SeqCst}; +use crate::sys::thread; +use crate::sync::atomic::{AtomicUsize, Ordering::SeqCst}; const MAX_KEYS: usize = 128; static NEXT_KEY: AtomicUsize = AtomicUsize::new(0); diff --git a/src/libstd/sys/wasm/time.rs b/src/libstd/sys/wasm/time.rs index 31798466fed2..c1228a1b75e3 100644 --- a/src/libstd/sys/wasm/time.rs +++ b/src/libstd/sys/wasm/time.rs @@ -1,5 +1,5 @@ -use time::Duration; -use sys::{TimeSysCall, TimeClock}; +use crate::time::Duration; +use crate::sys::{TimeSysCall, TimeClock}; #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)] pub struct Instant(Duration); diff --git a/src/libstd/sys/windows/alloc.rs b/src/libstd/sys/windows/alloc.rs index 0d7f803c7eef..a33c4019a2e6 100644 --- a/src/libstd/sys/windows/alloc.rs +++ b/src/libstd/sys/windows/alloc.rs @@ -1,6 +1,6 @@ -use alloc::{GlobalAlloc, Layout, System}; -use sys::c; -use sys_common::alloc::{MIN_ALIGN, realloc_fallback}; +use crate::alloc::{GlobalAlloc, Layout, System}; +use crate::sys::c; +use crate::sys_common::alloc::{MIN_ALIGN, realloc_fallback}; #[repr(C)] struct Header(*mut u8); diff --git a/src/libstd/sys/windows/args.rs b/src/libstd/sys/windows/args.rs index f67280691097..3f10e6e5983e 100644 --- a/src/libstd/sys/windows/args.rs +++ b/src/libstd/sys/windows/args.rs @@ -1,14 +1,15 @@ #![allow(dead_code)] // runtime init functions not used during testing -use os::windows::prelude::*; -use sys::windows::os::current_exe; -use sys::c; -use ffi::OsString; -use fmt; -use vec; +use crate::os::windows::prelude::*; +use crate::sys::windows::os::current_exe; +use crate::sys::c; +use crate::ffi::OsString; +use crate::fmt; +use crate::vec; +use crate::slice; +use crate::path::PathBuf; + use core::iter; -use slice; -use path::PathBuf; pub unsafe fn init(_argc: isize, _argv: *const *const u8) { } @@ -80,7 +81,7 @@ unsafe fn parse_lp_cmd_line OsString>(lp_cmd_line: *const u16, exe_na // "However, if lpCmdLine starts with any amount of whitespace, CommandLineToArgvW // will consider the first argument to be an empty string. Excess whitespace at the // end of lpCmdLine is ignored." - 0...SPACE => { + 0..=SPACE => { ret_val.push(OsString::new()); &cmd_line[1..] }, @@ -192,8 +193,8 @@ impl ExactSizeIterator for Args { #[cfg(test)] mod tests { - use sys::windows::args::*; - use ffi::OsString; + use crate::sys::windows::args::*; + use crate::ffi::OsString; fn chk(string: &str, parts: &[&str]) { let mut wide: Vec = OsString::from(string).encode_wide().collect(); diff --git a/src/libstd/sys/windows/backtrace/backtrace_gnu.rs b/src/libstd/sys/windows/backtrace/backtrace_gnu.rs index e8aa93997423..7ac1f8122f78 100644 --- a/src/libstd/sys/windows/backtrace/backtrace_gnu.rs +++ b/src/libstd/sys/windows/backtrace/backtrace_gnu.rs @@ -1,10 +1,11 @@ -use io; -use sys::c; +use crate::io; +use crate::sys::c; +use crate::path::PathBuf; +use crate::fs::{OpenOptions, File}; +use crate::sys::ext::fs::OpenOptionsExt; +use crate::sys::handle::Handle; + use libc::c_char; -use path::PathBuf; -use fs::{OpenOptions, File}; -use sys::ext::fs::OpenOptionsExt; -use sys::handle::Handle; use super::super::{fill_utf16_buf, os2path, to_u16s, wide_char_to_multi_byte}; fn query_full_process_image_name() -> io::Result { diff --git a/src/libstd/sys/windows/backtrace/mod.rs b/src/libstd/sys/windows/backtrace/mod.rs index 4bda8ac91da6..c5b0cc872108 100644 --- a/src/libstd/sys/windows/backtrace/mod.rs +++ b/src/libstd/sys/windows/backtrace/mod.rs @@ -14,13 +14,14 @@ #![allow(deprecated)] // dynamic_lib -use io; +use crate::io; +use crate::mem; +use crate::ptr; +use crate::sys::c; +use crate::sys::dynamic_lib::DynamicLibrary; +use crate::sys_common::backtrace::Frame; + use libc::c_void; -use mem; -use ptr; -use sys::c; -use sys::dynamic_lib::DynamicLibrary; -use sys_common::backtrace::Frame; macro_rules! sym { ($lib:expr, $e:expr, $t:ident) => ( diff --git a/src/libstd/sys/windows/backtrace/printing/mod.rs b/src/libstd/sys/windows/backtrace/printing/mod.rs index d44df7e5f248..9497d51ac179 100644 --- a/src/libstd/sys/windows/backtrace/printing/mod.rs +++ b/src/libstd/sys/windows/backtrace/printing/mod.rs @@ -4,11 +4,11 @@ mod printing; #[cfg(target_env = "gnu")] mod printing { - pub use sys_common::gnu::libbacktrace::{foreach_symbol_fileline, resolve_symname}; + pub use crate::sys_common::gnu::libbacktrace::{foreach_symbol_fileline, resolve_symname}; // dummy functions to mirror those present in msvc version. - use sys::dynamic_lib::DynamicLibrary; - use io; + use crate::sys::dynamic_lib::DynamicLibrary; + use crate::io; pub struct PrintingFnsEx {} pub struct PrintingFns64 {} pub fn load_printing_fns_ex(_: &DynamicLibrary) -> io::Result { diff --git a/src/libstd/sys/windows/backtrace/printing/msvc.rs b/src/libstd/sys/windows/backtrace/printing/msvc.rs index b186bb423345..13a1512d0eb3 100644 --- a/src/libstd/sys/windows/backtrace/printing/msvc.rs +++ b/src/libstd/sys/windows/backtrace/printing/msvc.rs @@ -1,12 +1,13 @@ -use ffi::CStr; -use io; +use crate::ffi::CStr; +use crate::io; +use crate::mem; +use crate::sys::backtrace::BacktraceContext; +use crate::sys::backtrace::StackWalkVariant; +use crate::sys::c; +use crate::sys::dynamic_lib::DynamicLibrary; +use crate::sys_common::backtrace::Frame; + use libc::{c_char, c_ulong}; -use mem; -use sys::backtrace::BacktraceContext; -use sys::backtrace::StackWalkVariant; -use sys::c; -use sys::dynamic_lib::DynamicLibrary; -use sys_common::backtrace::Frame; // Structs holding printing functions and loaders for them // Two versions depending on whether dbghelp.dll has StackWalkEx or not @@ -190,7 +191,7 @@ where { unsafe { let mut line: c::IMAGEHLP_LINE64 = mem::zeroed(); - line.SizeOfStruct = ::mem::size_of::() as u32; + line.SizeOfStruct = mem::size_of::() as u32; let ret = line_getter( context.handle, diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs index 28fd4df386e9..518eccf754cf 100644 --- a/src/libstd/sys/windows/c.rs +++ b/src/libstd/sys/windows/c.rs @@ -4,11 +4,12 @@ #![cfg_attr(test, allow(dead_code))] #![unstable(issue = "0", feature = "windows_c")] -use os::raw::{c_int, c_uint, c_ulong, c_long, c_longlong, c_ushort, c_char}; +use crate::os::raw::{c_int, c_uint, c_ulong, c_long, c_longlong, c_ushort, c_char}; #[cfg(target_arch = "x86_64")] -use os::raw::c_ulonglong; +use crate::os::raw::c_ulonglong; +use crate::ptr; + use libc::{wchar_t, size_t, c_void}; -use ptr; pub use self::FILE_INFO_BY_HANDLE_CLASS::*; pub use self::EXCEPTION_DISPOSITION::*; @@ -57,12 +58,15 @@ pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO; pub type LPSTR = *mut CHAR; pub type LPWSTR = *mut WCHAR; pub type LPFILETIME = *mut FILETIME; +pub type LPWSABUF = *mut WSABUF; +pub type LPWSAOVERLAPPED = *mut c_void; +pub type LPWSAOVERLAPPED_COMPLETION_ROUTINE = *mut c_void; pub type PCONDITION_VARIABLE = *mut CONDITION_VARIABLE; pub type PLARGE_INTEGER = *mut c_longlong; pub type PSRWLOCK = *mut SRWLOCK; -pub type SOCKET = ::os::windows::raw::SOCKET; +pub type SOCKET = crate::os::windows::raw::SOCKET; pub type socklen_t = c_int; pub type ADDRESS_FAMILY = USHORT; @@ -324,6 +328,12 @@ pub struct WSADATA { pub szSystemStatus: [u8; WSASYS_STATUS_LEN + 1], } +#[repr(C)] +pub struct WSABUF { + pub len: ULONG, + pub buf: *mut CHAR, +} + #[repr(C)] pub struct WSAPROTOCOL_INFO { pub dwServiceFlags1: DWORD, @@ -441,7 +451,7 @@ pub struct MOUNT_POINT_REPARSE_BUFFER { pub PathBuffer: WCHAR, } -pub type LPPROGRESS_ROUTINE = ::option::Option c_int; + pub fn WSASend(s: SOCKET, + lpBuffers: LPWSABUF, + dwBufferCount: DWORD, + lpNumberOfBytesSent: LPDWORD, + dwFlags: DWORD, + lpOverlapped: LPWSAOVERLAPPED, + lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE) + -> c_int; + pub fn WSARecv(s: SOCKET, + lpBuffers: LPWSABUF, + dwBufferCount: DWORD, + lpNumberOfBytesRecvd: LPDWORD, + lpFlags: LPDWORD, + lpOverlapped: LPWSAOVERLAPPED, + lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE) + -> c_int; pub fn GetCurrentProcessId() -> DWORD; pub fn WSASocketW(af: c_int, kind: c_int, diff --git a/src/libstd/sys/windows/compat.rs b/src/libstd/sys/windows/compat.rs index b6c55344c626..748c1616d1d3 100644 --- a/src/libstd/sys/windows/compat.rs +++ b/src/libstd/sys/windows/compat.rs @@ -11,9 +11,9 @@ //! manner we pay a semi-large one-time cost up front for detecting whether a //! function is available but afterwards it's just a load and a jump. -use ffi::CString; -use sync::atomic::{AtomicUsize, Ordering}; -use sys::c; +use crate::ffi::CString; +use crate::sync::atomic::{AtomicUsize, Ordering}; +use crate::sys::c; pub fn lookup(module: &str, symbol: &str) -> Option { let mut module: Vec = module.encode_utf16().collect(); @@ -44,14 +44,14 @@ macro_rules! compat_fn { )*) => ($( #[allow(unused_variables)] pub unsafe fn $symbol($($argname: $argtype),*) -> $rettype { - use sync::atomic::{AtomicUsize, Ordering}; - use mem; + use crate::sync::atomic::{AtomicUsize, Ordering}; + use crate::mem; type F = unsafe extern "system" fn($($argtype),*) -> $rettype; static PTR: AtomicUsize = AtomicUsize::new(0); fn load() -> usize { - ::sys::compat::store_func(&PTR, + crate::sys::compat::store_func(&PTR, stringify!($module), stringify!($symbol), fallback as usize) diff --git a/src/libstd/sys/windows/condvar.rs b/src/libstd/sys/windows/condvar.rs index 48d8af739130..62835ea7c94f 100644 --- a/src/libstd/sys/windows/condvar.rs +++ b/src/libstd/sys/windows/condvar.rs @@ -1,8 +1,8 @@ -use cell::UnsafeCell; -use sys::c; -use sys::mutex::{self, Mutex}; -use sys::os; -use time::Duration; +use crate::cell::UnsafeCell; +use crate::sys::c; +use crate::sys::mutex::{self, Mutex}; +use crate::sys::os; +use crate::time::Duration; pub struct Condvar { inner: UnsafeCell } diff --git a/src/libstd/sys/windows/dynamic_lib.rs b/src/libstd/sys/windows/dynamic_lib.rs index fa3c5ecb9776..b9d5105cb730 100644 --- a/src/libstd/sys/windows/dynamic_lib.rs +++ b/src/libstd/sys/windows/dynamic_lib.rs @@ -1,8 +1,8 @@ -use os::windows::prelude::*; +use crate::os::windows::prelude::*; -use ffi::{CString, OsStr}; -use io; -use sys::c; +use crate::ffi::{CString, OsStr}; +use crate::io; +use crate::sys::c; pub struct DynamicLibrary { handle: c::HMODULE, diff --git a/src/libstd/sys/windows/ext/ffi.rs b/src/libstd/sys/windows/ext/ffi.rs index 6508c0cf447d..547b1ef796b4 100644 --- a/src/libstd/sys/windows/ext/ffi.rs +++ b/src/libstd/sys/windows/ext/ffi.rs @@ -59,13 +59,13 @@ #![stable(feature = "rust1", since = "1.0.0")] -use ffi::{OsString, OsStr}; -use sys::os_str::Buf; -use sys_common::wtf8::Wtf8Buf; -use sys_common::{FromInner, AsInner}; +use crate::ffi::{OsString, OsStr}; +use crate::sys::os_str::Buf; +use crate::sys_common::wtf8::Wtf8Buf; +use crate::sys_common::{FromInner, AsInner}; #[stable(feature = "rust1", since = "1.0.0")] -pub use sys_common::wtf8::EncodeWide; +pub use crate::sys_common::wtf8::EncodeWide; /// Windows-specific extensions to [`OsString`]. /// diff --git a/src/libstd/sys/windows/ext/fs.rs b/src/libstd/sys/windows/ext/fs.rs index 89038da6295f..268a14ff0aab 100644 --- a/src/libstd/sys/windows/ext/fs.rs +++ b/src/libstd/sys/windows/ext/fs.rs @@ -2,11 +2,11 @@ #![stable(feature = "rust1", since = "1.0.0")] -use fs::{self, OpenOptions, Metadata}; -use io; -use path::Path; -use sys; -use sys_common::{AsInnerMut, AsInner}; +use crate::fs::{self, OpenOptions, Metadata}; +use crate::io; +use crate::path::Path; +use crate::sys; +use crate::sys_common::{AsInnerMut, AsInner}; /// Windows-specific extensions to [`File`]. /// @@ -220,13 +220,27 @@ pub trait OpenOptionsExt { /// the specified value (or combines it with `custom_flags` and `attributes` /// to set the `dwFlagsAndAttributes` for [`CreateFile`]). /// - /// By default, `security_qos_flags` is set to `SECURITY_ANONYMOUS`. For - /// information about possible values, see [Impersonation Levels] on the - /// Windows Dev Center site. + /// By default `security_qos_flags` is not set. It should be specified when + /// opening a named pipe, to control to which degree a server process can + /// act on behalf of a client process (security impersonation level). /// + /// When `security_qos_flags` is not set a malicious program can gain the + /// elevated privileges of a privileged Rust process when it allows opening + /// user-specified paths, by tricking it into opening a named pipe. So + /// arguably `security_qos_flags` should also be set when opening arbitrary + /// paths. However the bits can then conflict with other flags, specifically + /// `FILE_FLAG_OPEN_NO_RECALL`. + /// + /// For information about possible values, see [Impersonation Levels] on the + /// Windows Dev Center site. The `SECURITY_SQOS_PRESENT` flag is set + /// automatically when using this method. + /// # Examples /// /// ```no_run + /// # #[cfg(for_demonstration_only)] + /// extern crate winapi; + /// # mod winapi { pub const SECURITY_IDENTIFICATION: u32 = 0; } /// use std::fs::OpenOptions; /// use std::os::windows::prelude::*; /// @@ -235,9 +249,9 @@ pub trait OpenOptionsExt { /// .create(true) /// /// // Sets the flag value to `SecurityIdentification`. - /// .security_qos_flags(1) + /// .security_qos_flags(winapi::SECURITY_IDENTIFICATION) /// - /// .open("foo.txt"); + /// .open(r"\\.\pipe\MyPipe"); /// ``` /// /// [`CreateFile`]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858.aspx diff --git a/src/libstd/sys/windows/ext/io.rs b/src/libstd/sys/windows/ext/io.rs index fbe0426ce5a8..1a7d734b89e4 100644 --- a/src/libstd/sys/windows/ext/io.rs +++ b/src/libstd/sys/windows/ext/io.rs @@ -1,12 +1,12 @@ #![stable(feature = "rust1", since = "1.0.0")] -use fs; -use os::windows::raw; -use net; -use sys_common::{self, AsInner, FromInner, IntoInner}; -use sys; -use io; -use sys::c; +use crate::fs; +use crate::os::windows::raw; +use crate::net; +use crate::sys_common::{self, AsInner, FromInner, IntoInner}; +use crate::sys; +use crate::sys::c; +use crate::io; /// Raw HANDLEs. #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/sys/windows/ext/process.rs b/src/libstd/sys/windows/ext/process.rs index 15f0fd4e11f4..b2e6cdead4f3 100644 --- a/src/libstd/sys/windows/ext/process.rs +++ b/src/libstd/sys/windows/ext/process.rs @@ -2,10 +2,10 @@ #![stable(feature = "process_extensions", since = "1.2.0")] -use os::windows::io::{FromRawHandle, RawHandle, AsRawHandle, IntoRawHandle}; -use process; -use sys; -use sys_common::{AsInnerMut, AsInner, FromInner, IntoInner}; +use crate::os::windows::io::{FromRawHandle, RawHandle, AsRawHandle, IntoRawHandle}; +use crate::process; +use crate::sys; +use crate::sys_common::{AsInnerMut, AsInner, FromInner, IntoInner}; #[stable(feature = "process_extensions", since = "1.2.0")] impl FromRawHandle for process::Stdio { diff --git a/src/libstd/sys/windows/ext/raw.rs b/src/libstd/sys/windows/ext/raw.rs index 77428d9e7747..d2bab2720369 100644 --- a/src/libstd/sys/windows/ext/raw.rs +++ b/src/libstd/sys/windows/ext/raw.rs @@ -2,7 +2,7 @@ #![stable(feature = "raw_ext", since = "1.1.0")] -use os::raw::c_void; +use crate::os::raw::c_void; #[stable(feature = "raw_ext", since = "1.1.0")] pub type HANDLE = *mut c_void; #[cfg(target_pointer_width = "32")] diff --git a/src/libstd/sys/windows/ext/thread.rs b/src/libstd/sys/windows/ext/thread.rs index 29d612fedc0f..fdc7e7fa32f0 100644 --- a/src/libstd/sys/windows/ext/thread.rs +++ b/src/libstd/sys/windows/ext/thread.rs @@ -2,9 +2,9 @@ #![stable(feature = "thread_extensions", since = "1.9.0")] -use os::windows::io::{RawHandle, AsRawHandle, IntoRawHandle}; -use thread; -use sys_common::{AsInner, IntoInner}; +use crate::os::windows::io::{RawHandle, AsRawHandle, IntoRawHandle}; +use crate::thread; +use crate::sys_common::{AsInner, IntoInner}; #[stable(feature = "thread_extensions", since = "1.9.0")] impl AsRawHandle for thread::JoinHandle { diff --git a/src/libstd/sys/windows/fast_thread_local.rs b/src/libstd/sys/windows/fast_thread_local.rs index f8b936b48103..0ccc67e3fd54 100644 --- a/src/libstd/sys/windows/fast_thread_local.rs +++ b/src/libstd/sys/windows/fast_thread_local.rs @@ -1,7 +1,7 @@ #![unstable(feature = "thread_local_internals", issue = "0")] #![cfg(target_thread_local)] -pub use sys_common::thread_local::register_dtor_fallback as register_dtor; +pub use crate::sys_common::thread_local::register_dtor_fallback as register_dtor; pub fn requires_move_before_drop() -> bool { false diff --git a/src/libstd/sys/windows/fs.rs b/src/libstd/sys/windows/fs.rs index 533b8ae9ba2c..daf8aae24dde 100644 --- a/src/libstd/sys/windows/fs.rs +++ b/src/libstd/sys/windows/fs.rs @@ -1,17 +1,17 @@ -use os::windows::prelude::*; +use crate::os::windows::prelude::*; -use ffi::OsString; -use fmt; -use io::{self, Error, SeekFrom}; -use mem; -use path::{Path, PathBuf}; -use ptr; -use slice; -use sync::Arc; -use sys::handle::Handle; -use sys::time::SystemTime; -use sys::{c, cvt}; -use sys_common::FromInner; +use crate::ffi::OsString; +use crate::fmt; +use crate::io::{self, Error, SeekFrom}; +use crate::mem; +use crate::path::{Path, PathBuf}; +use crate::ptr; +use crate::slice; +use crate::sync::Arc; +use crate::sys::handle::Handle; +use crate::sys::time::SystemTime; +use crate::sys::{c, cvt}; +use crate::sys_common::FromInner; use super::to_u16s; @@ -191,7 +191,11 @@ impl OpenOptions { pub fn access_mode(&mut self, access_mode: u32) { self.access_mode = Some(access_mode); } pub fn share_mode(&mut self, share_mode: u32) { self.share_mode = share_mode; } pub fn attributes(&mut self, attrs: u32) { self.attributes = attrs; } - pub fn security_qos_flags(&mut self, flags: u32) { self.security_qos_flags = flags; } + pub fn security_qos_flags(&mut self, flags: u32) { + // We have to set `SECURITY_SQOS_PRESENT` here, because one of the valid flags we can + // receive is `SECURITY_ANONYMOUS = 0x0`, which we can't check for later on. + self.security_qos_flags = flags | c::SECURITY_SQOS_PRESENT; + } pub fn security_attributes(&mut self, attrs: c::LPSECURITY_ATTRIBUTES) { self.security_attributes = attrs as usize; } @@ -239,7 +243,6 @@ impl OpenOptions { self.custom_flags | self.attributes | self.security_qos_flags | - if self.security_qos_flags != 0 { c::SECURITY_SQOS_PRESENT } else { 0 } | if self.create_new { c::FILE_FLAG_OPEN_REPARSE_POINT } else { 0 } } } diff --git a/src/libstd/sys/windows/handle.rs b/src/libstd/sys/windows/handle.rs index 855efbd3eb5d..02549088c870 100644 --- a/src/libstd/sys/windows/handle.rs +++ b/src/libstd/sys/windows/handle.rs @@ -1,13 +1,12 @@ #![unstable(issue = "0", feature = "windows_handle")] -use cmp; -use io::{ErrorKind, Read}; -use io; -use mem; -use ops::Deref; -use ptr; -use sys::c; -use sys::cvt; +use crate::cmp; +use crate::io::{self, ErrorKind, Read}; +use crate::mem; +use crate::ops::Deref; +use crate::ptr; +use crate::sys::c; +use crate::sys::cvt; /// An owned container for `HANDLE` object, closing them on Drop. /// diff --git a/src/libstd/sys/windows/io.rs b/src/libstd/sys/windows/io.rs new file mode 100644 index 000000000000..54dd271c9d66 --- /dev/null +++ b/src/libstd/sys/windows/io.rs @@ -0,0 +1,63 @@ +use crate::marker::PhantomData; +use crate::slice; +use crate::sys::c; + +#[repr(transparent)] +pub struct IoVec<'a> { + vec: c::WSABUF, + _p: PhantomData<&'a [u8]>, +} + +impl<'a> IoVec<'a> { + #[inline] + pub fn new(buf: &'a [u8]) -> IoVec<'a> { + assert!(buf.len() <= c::ULONG::max_value() as usize); + IoVec { + vec: c::WSABUF { + len: buf.len() as c::ULONG, + buf: buf.as_ptr() as *mut u8 as *mut c::CHAR, + }, + _p: PhantomData, + } + } + + #[inline] + pub fn as_slice(&self) -> &[u8] { + unsafe { + slice::from_raw_parts(self.vec.buf as *mut u8, self.vec.len as usize) + } + } +} + +pub struct IoVecMut<'a> { + vec: c::WSABUF, + _p: PhantomData<&'a mut [u8]>, +} + +impl<'a> IoVecMut<'a> { + #[inline] + pub fn new(buf: &'a mut [u8]) -> IoVecMut<'a> { + assert!(buf.len() <= c::ULONG::max_value() as usize); + IoVecMut { + vec: c::WSABUF { + len: buf.len() as c::ULONG, + buf: buf.as_mut_ptr() as *mut c::CHAR, + }, + _p: PhantomData, + } + } + + #[inline] + pub fn as_slice(&self) -> &[u8] { + unsafe { + slice::from_raw_parts(self.vec.buf as *mut u8, self.vec.len as usize) + } + } + + #[inline] + pub fn as_mut_slice(&mut self) -> &mut [u8] { + unsafe { + slice::from_raw_parts_mut(self.vec.buf as *mut u8, self.vec.len as usize) + } + } +} diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs index e97e436efbf7..1425254a2e12 100644 --- a/src/libstd/sys/windows/mod.rs +++ b/src/libstd/sys/windows/mod.rs @@ -1,11 +1,11 @@ #![allow(missing_docs, nonstandard_style)] -use ptr; -use ffi::{OsStr, OsString}; -use io::{self, ErrorKind}; -use os::windows::ffi::{OsStrExt, OsStringExt}; -use path::PathBuf; -use time::Duration; +use crate::ptr; +use crate::ffi::{OsStr, OsString}; +use crate::io::ErrorKind; +use crate::os::windows::ffi::{OsStrExt, OsStringExt}; +use crate::path::PathBuf; +use crate::time::Duration; pub use libc::strlen; pub use self::rand::hashmap_random_keys; @@ -26,6 +26,7 @@ pub mod ext; pub mod fast_thread_local; pub mod fs; pub mod handle; +pub mod io; pub mod memchr; pub mod mutex; pub mod net; @@ -75,12 +76,12 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind { } } -pub fn to_u16s>(s: S) -> io::Result> { - fn inner(s: &OsStr) -> io::Result> { +pub fn to_u16s>(s: S) -> crate::io::Result> { + fn inner(s: &OsStr) -> crate::io::Result> { let mut maybe_result: Vec = s.encode_wide().collect(); if maybe_result.iter().any(|&u| u == 0) { - return Err(io::Error::new(io::ErrorKind::InvalidInput, - "strings passed to WinAPI cannot contain NULs")); + return Err(crate::io::Error::new(ErrorKind::InvalidInput, + "strings passed to WinAPI cannot contain NULs")); } maybe_result.push(0); Ok(maybe_result) @@ -102,7 +103,7 @@ pub fn to_u16s>(s: S) -> io::Result> { // Once the syscall has completed (errors bail out early) the second closure is // yielded the data which has been read from the syscall. The return value // from this closure is then the return value of the function. -fn fill_utf16_buf(mut f1: F1, f2: F2) -> io::Result +fn fill_utf16_buf(mut f1: F1, f2: F2) -> crate::io::Result where F1: FnMut(*mut u16, c::DWORD) -> c::DWORD, F2: FnOnce(&[u16]) -> T { @@ -134,7 +135,7 @@ fn fill_utf16_buf(mut f1: F1, f2: F2) -> io::Result c::SetLastError(0); let k = match f1(buf.as_mut_ptr(), n as c::DWORD) { 0 if c::GetLastError() == 0 => 0, - 0 => return Err(io::Error::last_os_error()), + 0 => return Err(crate::io::Error::last_os_error()), n => n, } as usize; if k == n && c::GetLastError() == c::ERROR_INSUFFICIENT_BUFFER { @@ -157,7 +158,7 @@ fn wide_char_to_multi_byte(code_page: u32, flags: u32, s: &[u16], no_default_char: bool) - -> io::Result> { + -> crate::io::Result> { unsafe { let mut size = c::WideCharToMultiByte(code_page, flags, @@ -168,7 +169,7 @@ fn wide_char_to_multi_byte(code_page: u32, ptr::null(), ptr::null_mut()); if size == 0 { - return Err(io::Error::last_os_error()); + return Err(crate::io::Error::last_os_error()); } let mut buf = Vec::with_capacity(size as usize); @@ -185,10 +186,10 @@ fn wide_char_to_multi_byte(code_page: u32, if no_default_char { &mut used_default_char } else { ptr::null_mut() }); if size == 0 { - return Err(io::Error::last_os_error()); + return Err(crate::io::Error::last_os_error()); } if no_default_char && used_default_char == c::TRUE { - return Err(io::Error::new(io::ErrorKind::InvalidData, + return Err(crate::io::Error::new(crate::io::ErrorKind::InvalidData, "string cannot be converted to requested code page")); } @@ -220,9 +221,9 @@ macro_rules! impl_is_zero { impl_is_zero! { i8 i16 i32 i64 isize u8 u16 u32 u64 usize } -pub fn cvt(i: I) -> io::Result { +pub fn cvt(i: I) -> crate::io::Result { if i.is_zero() { - Err(io::Error::last_os_error()) + Err(crate::io::Error::last_os_error()) } else { Ok(i) } @@ -262,7 +263,7 @@ pub unsafe fn abort_internal() -> ! { #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { asm!("int $$0x29" :: "{ecx}"(7) ::: volatile); // 7 is FAST_FAIL_FATAL_APP_EXIT - ::intrinsics::unreachable(); + crate::intrinsics::unreachable(); } - ::intrinsics::abort(); + crate::intrinsics::abort(); } diff --git a/src/libstd/sys/windows/mutex.rs b/src/libstd/sys/windows/mutex.rs index f690580ae38b..1aa910f05c9c 100644 --- a/src/libstd/sys/windows/mutex.rs +++ b/src/libstd/sys/windows/mutex.rs @@ -19,11 +19,11 @@ //! CriticalSection is used and we keep track of who's holding the mutex to //! detect recursive locks. -use cell::UnsafeCell; -use mem::{self, MaybeUninit}; -use sync::atomic::{AtomicUsize, Ordering}; -use sys::c; -use sys::compat; +use crate::cell::UnsafeCell; +use crate::mem::{self, MaybeUninit}; +use crate::sync::atomic::{AtomicUsize, Ordering}; +use crate::sys::c; +use crate::sys::compat; pub struct Mutex { lock: AtomicUsize, diff --git a/src/libstd/sys/windows/net.rs b/src/libstd/sys/windows/net.rs index acda81dcde57..1231fd55e252 100644 --- a/src/libstd/sys/windows/net.rs +++ b/src/libstd/sys/windows/net.rs @@ -1,26 +1,27 @@ #![unstable(issue = "0", feature = "windows_net")] -use cmp; -use io::{self, Read}; +use crate::cmp; +use crate::io::{self, Read, IoVec, IoVecMut}; +use crate::mem; +use crate::net::{SocketAddr, Shutdown}; +use crate::ptr; +use crate::sync::Once; +use crate::sys::c; +use crate::sys; +use crate::sys_common::{self, AsInner, FromInner, IntoInner}; +use crate::sys_common::net; +use crate::time::Duration; + use libc::{c_int, c_void, c_ulong, c_long}; -use mem; -use net::{SocketAddr, Shutdown}; -use ptr; -use sync::Once; -use sys::c; -use sys; -use sys_common::{self, AsInner, FromInner, IntoInner}; -use sys_common::net; -use time::Duration; pub type wrlen_t = i32; pub mod netc { - pub use sys::c::*; - pub use sys::c::SOCKADDR as sockaddr; - pub use sys::c::SOCKADDR_STORAGE_LH as sockaddr_storage; - pub use sys::c::ADDRINFOA as addrinfo; - pub use sys::c::ADDRESS_FAMILY as sa_family_t; + pub use crate::sys::c::*; + pub use crate::sys::c::SOCKADDR as sockaddr; + pub use crate::sys::c::SOCKADDR_STORAGE_LH as sockaddr_storage; + pub use crate::sys::c::ADDRINFOA as addrinfo; + pub use crate::sys::c::ADDRESS_FAMILY as sa_family_t; } pub struct Socket(c::SOCKET); @@ -207,6 +208,30 @@ impl Socket { self.recv_with_flags(buf, 0) } + pub fn read_vectored(&self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + // On unix when a socket is shut down all further reads return 0, so we + // do the same on windows to map a shut down socket to returning EOF. + let len = cmp::min(bufs.len(), c::DWORD::max_value() as usize) as c::DWORD; + let mut nread = 0; + let mut flags = 0; + unsafe { + let ret = c::WSARecv( + self.0, + bufs.as_mut_ptr() as *mut c::WSABUF, + len, + &mut nread, + &mut flags, + ptr::null_mut(), + ptr::null_mut(), + ); + match ret { + 0 => Ok(nread as usize), + _ if c::WSAGetLastError() == c::WSAESHUTDOWN => Ok(0), + _ => Err(last_error()), + } + } + } + pub fn peek(&self, buf: &mut [u8]) -> io::Result { self.recv_with_flags(buf, c::MSG_PEEK) } @@ -243,6 +268,23 @@ impl Socket { self.recv_from_with_flags(buf, c::MSG_PEEK) } + pub fn write_vectored(&self, bufs: &[IoVec<'_>]) -> io::Result { + let len = cmp::min(bufs.len(), c::DWORD::max_value() as usize) as c::DWORD; + let mut nwritten = 0; + unsafe { + cvt(c::WSASend( + self.0, + bufs.as_ptr() as *const c::WSABUF as *mut c::WSABUF, + len, + &mut nwritten, + 0, + ptr::null_mut(), + ptr::null_mut(), + ))?; + } + Ok(nwritten as usize) + } + pub fn set_timeout(&self, dur: Option, kind: c_int) -> io::Result<()> { let timeout = match dur { diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs index 7399dd41a41c..5b433ddfb4a3 100644 --- a/src/libstd/sys/windows/os.rs +++ b/src/libstd/sys/windows/os.rs @@ -2,18 +2,18 @@ #![allow(nonstandard_style)] -use os::windows::prelude::*; +use crate::os::windows::prelude::*; -use error::Error as StdError; -use ffi::{OsString, OsStr}; -use fmt; -use io; -use os::windows::ffi::EncodeWide; -use path::{self, PathBuf}; -use ptr; -use slice; -use sys::{c, cvt}; -use sys::handle::Handle; +use crate::error::Error as StdError; +use crate::ffi::{OsString, OsStr}; +use crate::fmt; +use crate::io; +use crate::os::windows::ffi::EncodeWide; +use crate::path::{self, PathBuf}; +use crate::ptr; +use crate::slice; +use crate::sys::{c, cvt}; +use crate::sys::handle::Handle; use super::to_u16s; @@ -285,8 +285,8 @@ pub fn temp_dir() -> PathBuf { } pub fn home_dir() -> Option { - ::env::var_os("HOME").or_else(|| { - ::env::var_os("USERPROFILE") + crate::env::var_os("HOME").or_else(|| { + crate::env::var_os("USERPROFILE") }).map(PathBuf::from).or_else(|| unsafe { let me = c::GetCurrentProcess(); let mut token = ptr::null_mut(); @@ -314,8 +314,8 @@ pub fn getpid() -> u32 { #[cfg(test)] mod tests { - use io::Error; - use sys::c; + use crate::io::Error; + use crate::sys::c; // tests `error_string` above #[test] diff --git a/src/libstd/sys/windows/os_str.rs b/src/libstd/sys/windows/os_str.rs index 7e4bcd990b1e..8befa66ecdc9 100644 --- a/src/libstd/sys/windows/os_str.rs +++ b/src/libstd/sys/windows/os_str.rs @@ -1,13 +1,13 @@ /// The underlying OsString/OsStr implementation on Windows is a /// wrapper around the "WTF-8" encoding; see the `wtf8` module for more. -use borrow::Cow; -use fmt; -use sys_common::wtf8::{Wtf8, Wtf8Buf}; -use mem; -use rc::Rc; -use sync::Arc; -use sys_common::{AsInner, IntoInner, FromInner}; +use crate::borrow::Cow; +use crate::fmt; +use crate::sys_common::wtf8::{Wtf8, Wtf8Buf}; +use crate::mem; +use crate::rc::Rc; +use crate::sync::Arc; +use crate::sys_common::{AsInner, IntoInner, FromInner}; #[derive(Clone, Hash)] pub struct Buf { diff --git a/src/libstd/sys/windows/path.rs b/src/libstd/sys/windows/path.rs index ad1759e84c32..b8532ca9b0d4 100644 --- a/src/libstd/sys/windows/path.rs +++ b/src/libstd/sys/windows/path.rs @@ -1,6 +1,6 @@ -use path::Prefix; -use ffi::OsStr; -use mem; +use crate::path::Prefix; +use crate::ffi::OsStr; +use crate::mem; fn os_str_as_u8_slice(s: &OsStr) -> &[u8] { unsafe { mem::transmute(s) } @@ -20,7 +20,7 @@ pub fn is_verbatim_sep(b: u8) -> bool { } pub fn parse_prefix<'a>(path: &'a OsStr) -> Option { - use path::Prefix::*; + use crate::path::Prefix::*; unsafe { // The unsafety here stems from converting between &OsStr and &[u8] // and back. This is safe to do because (1) we only look at ASCII diff --git a/src/libstd/sys/windows/pipe.rs b/src/libstd/sys/windows/pipe.rs index d3b102268f63..07f4f5f0e58c 100644 --- a/src/libstd/sys/windows/pipe.rs +++ b/src/libstd/sys/windows/pipe.rs @@ -1,17 +1,17 @@ -use os::windows::prelude::*; +use crate::os::windows::prelude::*; -use ffi::OsStr; -use io; -use mem; -use path::Path; -use ptr; -use slice; -use sync::atomic::Ordering::SeqCst; -use sync::atomic::AtomicUsize; -use sys::c; -use sys::fs::{File, OpenOptions}; -use sys::handle::Handle; -use sys::hashmap_random_keys; +use crate::ffi::OsStr; +use crate::io; +use crate::mem; +use crate::path::Path; +use crate::ptr; +use crate::slice; +use crate::sync::atomic::Ordering::SeqCst; +use crate::sync::atomic::AtomicUsize; +use crate::sys::c; +use crate::sys::fs::{File, OpenOptions}; +use crate::sys::handle::Handle; +use crate::sys::hashmap_random_keys; //////////////////////////////////////////////////////////////////////////////// // Anonymous pipes diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs index 2527168a968c..95f061d22bd4 100644 --- a/src/libstd/sys/windows/process.rs +++ b/src/libstd/sys/windows/process.rs @@ -1,27 +1,28 @@ #![unstable(feature = "process_internals", issue = "0")] -use collections::BTreeMap; -use env::split_paths; -use env; -use ffi::{OsString, OsStr}; -use fmt; -use fs; -use io::{self, Error, ErrorKind}; +use crate::collections::BTreeMap; +use crate::env::split_paths; +use crate::env; +use crate::ffi::{OsString, OsStr}; +use crate::fmt; +use crate::fs; +use crate::io::{self, Error, ErrorKind}; +use crate::mem; +use crate::os::windows::ffi::OsStrExt; +use crate::path::Path; +use crate::ptr; +use crate::sys::mutex::Mutex; +use crate::sys::c; +use crate::sys::fs::{OpenOptions, File}; +use crate::sys::handle::Handle; +use crate::sys::pipe::{self, AnonPipe}; +use crate::sys::stdio; +use crate::sys::cvt; +use crate::sys_common::{AsInner, FromInner, IntoInner}; +use crate::sys_common::process::{CommandEnv, EnvKey}; +use crate::borrow::Borrow; + use libc::{c_void, EXIT_SUCCESS, EXIT_FAILURE}; -use mem; -use os::windows::ffi::OsStrExt; -use path::Path; -use ptr; -use sys::mutex::Mutex; -use sys::c; -use sys::fs::{OpenOptions, File}; -use sys::handle::Handle; -use sys::pipe::{self, AnonPipe}; -use sys::stdio; -use sys::cvt; -use sys_common::{AsInner, FromInner, IntoInner}; -use sys_common::process::{CommandEnv, EnvKey}; -use borrow::Borrow; //////////////////////////////////////////////////////////////////////////////// // Command @@ -537,7 +538,7 @@ fn make_dirp(d: Option<&OsString>) -> io::Result<(*const u16, Vec)> { #[cfg(test)] mod tests { - use ffi::{OsStr, OsString}; + use crate::ffi::{OsStr, OsString}; use super::make_command_line; #[test] diff --git a/src/libstd/sys/windows/rand.rs b/src/libstd/sys/windows/rand.rs index 4f000dceb2f1..0193f4defa1f 100644 --- a/src/libstd/sys/windows/rand.rs +++ b/src/libstd/sys/windows/rand.rs @@ -1,6 +1,6 @@ -use io; -use mem; -use sys::c; +use crate::io; +use crate::mem; +use crate::sys::c; pub fn hashmap_random_keys() -> (u64, u64) { let mut v = (0, 0); diff --git a/src/libstd/sys/windows/rwlock.rs b/src/libstd/sys/windows/rwlock.rs index 3cd19470101a..ef57562fc3a0 100644 --- a/src/libstd/sys/windows/rwlock.rs +++ b/src/libstd/sys/windows/rwlock.rs @@ -1,5 +1,5 @@ -use cell::UnsafeCell; -use sys::c; +use crate::cell::UnsafeCell; +use crate::sys::c; pub struct RWLock { inner: UnsafeCell } diff --git a/src/libstd/sys/windows/stack_overflow.rs b/src/libstd/sys/windows/stack_overflow.rs index 0c7de0bc9e8f..d5b7765f9ff5 100644 --- a/src/libstd/sys/windows/stack_overflow.rs +++ b/src/libstd/sys/windows/stack_overflow.rs @@ -1,7 +1,7 @@ #![cfg_attr(test, allow(dead_code))] -use sys_common::util::report_overflow; -use sys::c; +use crate::sys_common::util::report_overflow; +use crate::sys::c; pub struct Handler; diff --git a/src/libstd/sys/windows/stdio.rs b/src/libstd/sys/windows/stdio.rs index 99445f4e0d45..b1e76b3b755d 100644 --- a/src/libstd/sys/windows/stdio.rs +++ b/src/libstd/sys/windows/stdio.rs @@ -1,13 +1,13 @@ #![unstable(issue = "0", feature = "windows_stdio")] -use char::decode_utf16; -use cmp; -use io; -use ptr; -use str; -use sys::c; -use sys::cvt; -use sys::handle::Handle; +use crate::char::decode_utf16; +use crate::cmp; +use crate::io; +use crate::ptr; +use crate::str; +use crate::sys::c; +use crate::sys::cvt; +use crate::sys::handle::Handle; // Don't cache handles but get them fresh for every read/write. This allows us to track changes to // the value over time (such as if a process calls `SetStdHandle` while it's running). See #40490. @@ -201,7 +201,7 @@ fn read_u16s(handle: c::HANDLE, buf: &mut [u16]) -> io::Result { const CTRL_Z: u16 = 0x1A; const CTRL_Z_MASK: c::ULONG = 1 << CTRL_Z; let mut input_control = c::CONSOLE_READCONSOLE_CONTROL { - nLength: ::mem::size_of::() as c::ULONG, + nLength: crate::mem::size_of::() as c::ULONG, nInitialChars: 0, dwCtrlWakeupMask: CTRL_Z_MASK, dwControlKeyState: 0, diff --git a/src/libstd/sys/windows/thread.rs b/src/libstd/sys/windows/thread.rs index bd7cb673a0db..1b0a811f13b7 100644 --- a/src/libstd/sys/windows/thread.rs +++ b/src/libstd/sys/windows/thread.rs @@ -1,13 +1,14 @@ -use boxed::FnBox; -use io; -use ffi::CStr; -use mem; +use crate::boxed::FnBox; +use crate::io; +use crate::ffi::CStr; +use crate::mem; +use crate::ptr; +use crate::sys::c; +use crate::sys::handle::Handle; +use crate::sys_common::thread::*; +use crate::time::Duration; + use libc::c_void; -use ptr; -use sys::c; -use sys::handle::Handle; -use sys_common::thread::*; -use time::Duration; use super::to_u16s; diff --git a/src/libstd/sys/windows/thread_local.rs b/src/libstd/sys/windows/thread_local.rs index 50bbd5476b36..4c9734fa0aa6 100644 --- a/src/libstd/sys/windows/thread_local.rs +++ b/src/libstd/sys/windows/thread_local.rs @@ -1,8 +1,8 @@ -use mem; -use ptr; -use sync::atomic::AtomicPtr; -use sync::atomic::Ordering::SeqCst; -use sys::c; +use crate::mem; +use crate::ptr; +use crate::sync::atomic::AtomicPtr; +use crate::sync::atomic::Ordering::SeqCst; +use crate::sys::c; pub type Key = c::DWORD; pub type Dtor = unsafe extern fn(*mut u8); @@ -211,7 +211,7 @@ unsafe extern "system" fn on_tls_callback(h: c::LPVOID, #[cfg(target_env = "msvc")] unsafe fn reference_tls_used() { extern { static _tls_used: u8; } - ::intrinsics::volatile_load(&_tls_used); + crate::intrinsics::volatile_load(&_tls_used); } #[cfg(not(target_env = "msvc"))] unsafe fn reference_tls_used() {} diff --git a/src/libstd/sys/windows/time.rs b/src/libstd/sys/windows/time.rs index 8a8159af2f1a..2c99bca70095 100644 --- a/src/libstd/sys/windows/time.rs +++ b/src/libstd/sys/windows/time.rs @@ -1,9 +1,10 @@ -use cmp::Ordering; -use fmt; -use mem; -use sys::c; -use time::Duration; -use convert::TryInto; +use crate::cmp::Ordering; +use crate::fmt; +use crate::mem; +use crate::sys::c; +use crate::time::Duration; +use crate::convert::TryInto; + use core::hash::{Hash, Hasher}; const NANOS_PER_SEC: u64 = 1_000_000_000; @@ -172,11 +173,11 @@ fn intervals2dur(intervals: u64) -> Duration { mod perf_counter { use super::{NANOS_PER_SEC}; - use sync::Once; - use sys_common::mul_div_u64; - use sys::c; - use sys::cvt; - use time::Duration; + use crate::sync::Once; + use crate::sys_common::mul_div_u64; + use crate::sys::c; + use crate::sys::cvt; + use crate::time::Duration; pub struct PerformanceCounterInstant { ts: c::LARGE_INTEGER diff --git a/src/libstd/sys_common/alloc.rs b/src/libstd/sys_common/alloc.rs index eac6bb454c0c..978a70bee098 100644 --- a/src/libstd/sys_common/alloc.rs +++ b/src/libstd/sys_common/alloc.rs @@ -1,8 +1,8 @@ #![allow(dead_code)] -use alloc::{GlobalAlloc, Layout, System}; -use cmp; -use ptr; +use crate::alloc::{GlobalAlloc, Layout, System}; +use crate::cmp; +use crate::ptr; // The minimum alignment guaranteed by the architecture. This value is used to // add fast paths for low alignment values. diff --git a/src/libstd/sys_common/at_exit_imp.rs b/src/libstd/sys_common/at_exit_imp.rs index cd2d176c2a5c..1181b8616119 100644 --- a/src/libstd/sys_common/at_exit_imp.rs +++ b/src/libstd/sys_common/at_exit_imp.rs @@ -2,10 +2,10 @@ //! //! Documentation can be found on the `rt::at_exit` function. -use boxed::FnBox; -use ptr; -use mem; -use sys_common::mutex::Mutex; +use crate::boxed::FnBox; +use crate::ptr; +use crate::mem; +use crate::sys_common::mutex::Mutex; type Queue = Vec>; diff --git a/src/libstd/sys_common/backtrace.rs b/src/libstd/sys_common/backtrace.rs index 347244b0e0d4..1a80908779e1 100644 --- a/src/libstd/sys_common/backtrace.rs +++ b/src/libstd/sys_common/backtrace.rs @@ -1,17 +1,18 @@ /// Common code for printing the backtrace in the same way across the different /// supported platforms. -use env; -use io::prelude::*; -use io; -use path::{self, Path}; -use ptr; -use rustc_demangle::demangle; -use str; -use sync::atomic::{self, Ordering}; -use sys::mutex::Mutex; +use crate::env; +use crate::io::prelude::*; +use crate::io; +use crate::path::{self, Path}; +use crate::ptr; +use crate::str; +use crate::sync::atomic::{self, Ordering}; +use crate::sys::mutex::Mutex; -pub use sys::backtrace::{ +use rustc_demangle::demangle; + +pub use crate::sys::backtrace::{ unwind_backtrace, resolve_symname, foreach_symbol_fileline, diff --git a/src/libstd/sys_common/bytestring.rs b/src/libstd/sys_common/bytestring.rs index 915c17374ca0..273d586a5a0b 100644 --- a/src/libstd/sys_common/bytestring.rs +++ b/src/libstd/sys_common/bytestring.rs @@ -1,6 +1,6 @@ #![allow(dead_code)] -use fmt::{Formatter, Result, Write}; +use crate::fmt::{Formatter, Result, Write}; use core::str::lossy::{Utf8Lossy, Utf8LossyChunk}; pub fn debug_fmt_bytestring(slice: &[u8], f: &mut Formatter) -> Result { @@ -25,7 +25,7 @@ pub fn debug_fmt_bytestring(slice: &[u8], f: &mut Formatter) -> Result { #[cfg(test)] mod tests { use super::*; - use fmt::{Formatter, Result, Debug}; + use crate::fmt::{Formatter, Result, Debug}; #[test] fn smoke() { diff --git a/src/libstd/sys_common/condvar.rs b/src/libstd/sys_common/condvar.rs index ad95879f0735..fc59c8356f46 100644 --- a/src/libstd/sys_common/condvar.rs +++ b/src/libstd/sys_common/condvar.rs @@ -1,6 +1,6 @@ -use time::Duration; -use sys_common::mutex::{self, Mutex}; -use sys::condvar as imp; +use crate::time::Duration; +use crate::sys_common::mutex::{self, Mutex}; +use crate::sys::condvar as imp; /// An OS-based condition variable. /// diff --git a/src/libstd/sys_common/gnu/libbacktrace.rs b/src/libstd/sys_common/gnu/libbacktrace.rs index 188eb4e4b86b..6cd050242dd9 100644 --- a/src/libstd/sys_common/gnu/libbacktrace.rs +++ b/src/libstd/sys_common/gnu/libbacktrace.rs @@ -1,12 +1,11 @@ -use libc; -use backtrace_sys::{self, backtrace_state}; +use backtrace_sys::backtrace_state; -use ffi::CStr; -use io; -use mem; -use ptr; -use sys::backtrace::BacktraceContext; -use sys_common::backtrace::Frame; +use crate::ffi::CStr; +use crate::io; +use crate::mem; +use crate::ptr; +use crate::sys::backtrace::BacktraceContext; +use crate::sys_common::backtrace::Frame; pub fn foreach_symbol_fileline(frame: Frame, mut f: F, @@ -153,7 +152,7 @@ unsafe fn init_state() -> *mut backtrace_state { static mut STATE: *mut backtrace_state = ptr::null_mut(); if !STATE.is_null() { return STATE } - let filename = match ::sys::backtrace::gnu::get_executable_filename() { + let filename = match crate::sys::backtrace::gnu::get_executable_filename() { Ok((filename, file)) => { // filename is purposely leaked here since libbacktrace requires // it to stay allocated permanently, file is also leaked so that diff --git a/src/libstd/sys_common/io.rs b/src/libstd/sys_common/io.rs index b9071c69b7ce..44b0963302dd 100644 --- a/src/libstd/sys_common/io.rs +++ b/src/libstd/sys_common/io.rs @@ -3,10 +3,10 @@ pub const DEFAULT_BUF_SIZE: usize = 8 * 1024; #[cfg(test)] #[allow(dead_code)] // not used on emscripten pub mod test { - use path::{Path, PathBuf}; - use env; - use rand::{self, RngCore}; - use fs; + use crate::path::{Path, PathBuf}; + use crate::env; + use crate::fs; + use rand::RngCore; pub struct TempDir(PathBuf); diff --git a/src/libstd/sys_common/mod.rs b/src/libstd/sys_common/mod.rs index c18b603a6356..1fc32365408b 100644 --- a/src/libstd/sys_common/mod.rs +++ b/src/libstd/sys_common/mod.rs @@ -15,11 +15,11 @@ #![allow(missing_docs)] #![allow(missing_debug_implementations)] -use sync::Once; -use sys; +use crate::sync::Once; +use crate::sys; macro_rules! rtabort { - ($($t:tt)*) => (::sys_common::util::abort(format_args!($($t)*))) + ($($t:tt)*) => (crate::sys_common::util::abort(format_args!($($t)*))) } macro_rules! rtassert { @@ -52,7 +52,7 @@ cfg_if! { target_os = "redox", all(target_arch = "wasm32", not(target_os = "emscripten")), all(target_vendor = "fortanix", target_env = "sgx")))] { - pub use sys::net; + pub use crate::sys::net; } else { pub mod net; } diff --git a/src/libstd/sys_common/mutex.rs b/src/libstd/sys_common/mutex.rs index b47d8698c605..4b58cac7941b 100644 --- a/src/libstd/sys_common/mutex.rs +++ b/src/libstd/sys_common/mutex.rs @@ -1,4 +1,4 @@ -use sys::mutex as imp; +use crate::sys::mutex as imp; /// An OS-based mutual exclusion lock. /// diff --git a/src/libstd/sys_common/net.rs b/src/libstd/sys_common/net.rs index f75df3ea695c..b9505aaa69ba 100644 --- a/src/libstd/sys_common/net.rs +++ b/src/libstd/sys_common/net.rs @@ -1,37 +1,38 @@ -use cmp; -use ffi::CString; -use fmt; -use io::{self, Error, ErrorKind}; +use crate::cmp; +use crate::ffi::CString; +use crate::fmt; +use crate::io::{self, Error, ErrorKind, IoVec, IoVecMut}; +use crate::mem; +use crate::net::{SocketAddr, Shutdown, Ipv4Addr, Ipv6Addr}; +use crate::ptr; +use crate::sys::net::{cvt, cvt_r, cvt_gai, Socket, init, wrlen_t}; +use crate::sys::net::netc as c; +use crate::sys_common::{AsInner, FromInner, IntoInner}; +use crate::time::Duration; +use crate::convert::{TryFrom, TryInto}; + use libc::{c_int, c_void}; -use mem; -use net::{SocketAddr, Shutdown, Ipv4Addr, Ipv6Addr}; -use ptr; -use sys::net::{cvt, cvt_r, cvt_gai, Socket, init, wrlen_t}; -use sys::net::netc as c; -use sys_common::{AsInner, FromInner, IntoInner}; -use time::Duration; -use convert::{TryFrom, TryInto}; #[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "ios", target_os = "macos", target_os = "openbsd", target_os = "netbsd", target_os = "solaris", target_os = "haiku", target_os = "l4re"))] -use sys::net::netc::IPV6_JOIN_GROUP as IPV6_ADD_MEMBERSHIP; +use crate::sys::net::netc::IPV6_JOIN_GROUP as IPV6_ADD_MEMBERSHIP; #[cfg(not(any(target_os = "dragonfly", target_os = "freebsd", target_os = "ios", target_os = "macos", target_os = "openbsd", target_os = "netbsd", target_os = "solaris", target_os = "haiku", target_os = "l4re")))] -use sys::net::netc::IPV6_ADD_MEMBERSHIP; +use crate::sys::net::netc::IPV6_ADD_MEMBERSHIP; #[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "ios", target_os = "macos", target_os = "openbsd", target_os = "netbsd", target_os = "solaris", target_os = "haiku", target_os = "l4re"))] -use sys::net::netc::IPV6_LEAVE_GROUP as IPV6_DROP_MEMBERSHIP; +use crate::sys::net::netc::IPV6_LEAVE_GROUP as IPV6_DROP_MEMBERSHIP; #[cfg(not(any(target_os = "dragonfly", target_os = "freebsd", target_os = "ios", target_os = "macos", target_os = "openbsd", target_os = "netbsd", target_os = "solaris", target_os = "haiku", target_os = "l4re")))] -use sys::net::netc::IPV6_DROP_MEMBERSHIP; +use crate::sys::net::netc::IPV6_DROP_MEMBERSHIP; #[cfg(any(target_os = "linux", target_os = "android", target_os = "dragonfly", target_os = "freebsd", @@ -109,8 +110,8 @@ fn to_ipv6mr_interface(value: u32) -> c_int { } #[cfg(not(target_os = "android"))] -fn to_ipv6mr_interface(value: u32) -> ::libc::c_uint { - value as ::libc::c_uint +fn to_ipv6mr_interface(value: u32) -> libc::c_uint { + value as libc::c_uint } //////////////////////////////////////////////////////////////////////////////// @@ -156,7 +157,7 @@ impl Drop for LookupHost { } } -impl<'a> TryFrom<&'a str> for LookupHost { +impl TryFrom<&str> for LookupHost { type Error = io::Error; fn try_from(s: &str) -> io::Result { @@ -255,6 +256,10 @@ impl TcpStream { self.inner.read(buf) } + pub fn read_vectored(&self, bufs: &mut [IoVecMut<'_>]) -> io::Result { + self.inner.read_vectored(bufs) + } + pub fn write(&self, buf: &[u8]) -> io::Result { let len = cmp::min(buf.len(), ::max_value() as usize) as wrlen_t; let ret = cvt(unsafe { @@ -266,6 +271,10 @@ impl TcpStream { Ok(ret as usize) } + pub fn write_vectored(&self, bufs: &[IoVec<'_>]) -> io::Result { + self.inner.write_vectored(bufs) + } + pub fn peer_addr(&self) -> io::Result { sockname(|buf, len| unsafe { c::getpeername(*self.inner.as_inner(), buf, len) @@ -645,7 +654,7 @@ impl fmt::Debug for UdpSocket { #[cfg(test)] mod tests { use super::*; - use collections::HashMap; + use crate::collections::HashMap; #[test] fn no_lookup_host_duplicates() { diff --git a/src/libstd/sys_common/poison.rs b/src/libstd/sys_common/poison.rs index 1358916ef993..d22942356664 100644 --- a/src/libstd/sys_common/poison.rs +++ b/src/libstd/sys_common/poison.rs @@ -1,7 +1,7 @@ -use error::{Error}; -use fmt; -use sync::atomic::{AtomicBool, Ordering}; -use thread; +use crate::error::{Error}; +use crate::fmt; +use crate::sync::atomic::{AtomicBool, Ordering}; +use crate::thread; pub struct Flag { failed: AtomicBool } diff --git a/src/libstd/sys_common/process.rs b/src/libstd/sys_common/process.rs index 3384ffeb64e9..4d40dec97245 100644 --- a/src/libstd/sys_common/process.rs +++ b/src/libstd/sys_common/process.rs @@ -1,10 +1,10 @@ #![allow(dead_code)] #![unstable(feature = "process_internals", issue = "0")] -use ffi::{OsStr, OsString}; -use env; -use collections::BTreeMap; -use borrow::Borrow; +use crate::ffi::{OsStr, OsString}; +use crate::env; +use crate::collections::BTreeMap; +use crate::borrow::Borrow; pub trait EnvKey: From + Into + diff --git a/src/libstd/sys_common/remutex.rs b/src/libstd/sys_common/remutex.rs index 596e5d534c29..2aec361d7a49 100644 --- a/src/libstd/sys_common/remutex.rs +++ b/src/libstd/sys_common/remutex.rs @@ -1,9 +1,9 @@ -use fmt; -use marker; -use ops::Deref; -use sys_common::poison::{self, TryLockError, TryLockResult, LockResult}; -use sys::mutex as sys; -use panic::{UnwindSafe, RefUnwindSafe}; +use crate::fmt; +use crate::marker; +use crate::ops::Deref; +use crate::sys_common::poison::{self, TryLockError, TryLockResult, LockResult}; +use crate::sys::mutex as sys; +use crate::panic::{UnwindSafe, RefUnwindSafe}; /// A re-entrant mutual exclusion /// @@ -159,10 +159,10 @@ impl Drop for ReentrantMutexGuard<'_, T> { #[cfg(all(test, not(target_os = "emscripten")))] mod tests { - use sys_common::remutex::{ReentrantMutex, ReentrantMutexGuard}; - use cell::RefCell; - use sync::Arc; - use thread; + use crate::sys_common::remutex::{ReentrantMutex, ReentrantMutexGuard}; + use crate::cell::RefCell; + use crate::sync::Arc; + use crate::thread; #[test] fn smoke() { diff --git a/src/libstd/sys_common/rwlock.rs b/src/libstd/sys_common/rwlock.rs index 0aa0284539a8..0b1a092de542 100644 --- a/src/libstd/sys_common/rwlock.rs +++ b/src/libstd/sys_common/rwlock.rs @@ -1,4 +1,4 @@ -use sys::rwlock as imp; +use crate::sys::rwlock as imp; /// An OS-based reader-writer lock. /// diff --git a/src/libstd/sys_common/thread.rs b/src/libstd/sys_common/thread.rs index fe9ad7623b7d..b2142e753085 100644 --- a/src/libstd/sys_common/thread.rs +++ b/src/libstd/sys_common/thread.rs @@ -1,8 +1,8 @@ -use boxed::FnBox; -use env; -use sync::atomic::{self, Ordering}; -use sys::stack_overflow; -use sys::thread as imp; +use crate::boxed::FnBox; +use crate::env; +use crate::sync::atomic::{self, Ordering}; +use crate::sys::stack_overflow; +use crate::sys::thread as imp; #[allow(dead_code)] pub unsafe fn start_thread(main: *mut u8) { diff --git a/src/libstd/sys_common/thread_info.rs b/src/libstd/sys_common/thread_info.rs index b4bca72b09d1..b3c21ec508a9 100644 --- a/src/libstd/sys_common/thread_info.rs +++ b/src/libstd/sys_common/thread_info.rs @@ -1,8 +1,8 @@ #![allow(dead_code)] // stack_guard isn't used right now on all platforms -use cell::RefCell; -use sys::thread::guard::Guard; -use thread::Thread; +use crate::cell::RefCell; +use crate::sys::thread::guard::Guard; +use crate::thread::Thread; struct ThreadInfo { stack_guard: Option, diff --git a/src/libstd/sys_common/thread_local.rs b/src/libstd/sys_common/thread_local.rs index 874e58dcfeee..bdf79002e906 100644 --- a/src/libstd/sys_common/thread_local.rs +++ b/src/libstd/sys_common/thread_local.rs @@ -48,10 +48,10 @@ #![unstable(feature = "thread_local_internals", issue = "0")] #![allow(dead_code)] // sys isn't exported yet -use ptr; -use sync::atomic::{self, AtomicUsize, Ordering}; -use sys::thread_local as imp; -use sys_common::mutex::Mutex; +use crate::ptr; +use crate::sync::atomic::{self, AtomicUsize, Ordering}; +use crate::sys::thread_local as imp; +use crate::sys_common::mutex::Mutex; /// A type for TLS keys that are statically allocated. /// diff --git a/src/libstd/sys_common/util.rs b/src/libstd/sys_common/util.rs index 7dec22be9780..206443a67369 100644 --- a/src/libstd/sys_common/util.rs +++ b/src/libstd/sys_common/util.rs @@ -1,7 +1,7 @@ -use fmt; -use io::prelude::*; -use sys::stdio::panic_output; -use thread; +use crate::fmt; +use crate::io::prelude::*; +use crate::sys::stdio::panic_output; +use crate::thread; pub fn dumb_print(args: fmt::Arguments) { if let Some(mut out) = panic_output() { @@ -11,12 +11,12 @@ pub fn dumb_print(args: fmt::Arguments) { // Other platforms should use the appropriate platform-specific mechanism for // aborting the process. If no platform-specific mechanism is available, -// ::intrinsics::abort() may be used instead. The above implementations cover +// crate::intrinsics::abort() may be used instead. The above implementations cover // all targets currently supported by libstd. pub fn abort(args: fmt::Arguments) -> ! { dumb_print(format_args!("fatal runtime error: {}\n", args)); - unsafe { ::sys::abort_internal(); } + unsafe { crate::sys::abort_internal(); } } #[allow(dead_code)] // stack overflow detection not enabled on all platforms diff --git a/src/libstd/sys_common/wtf8.rs b/src/libstd/sys_common/wtf8.rs index 6d4594fe295c..b15239e8d877 100644 --- a/src/libstd/sys_common/wtf8.rs +++ b/src/libstd/sys_common/wtf8.rs @@ -17,18 +17,18 @@ use core::str::next_code_point; -use borrow::Cow; -use char; -use fmt; -use hash::{Hash, Hasher}; -use iter::FromIterator; -use mem; -use ops; -use rc::Rc; -use slice; -use str; -use sync::Arc; -use sys_common::AsInner; +use crate::borrow::Cow; +use crate::char; +use crate::fmt; +use crate::hash::{Hash, Hasher}; +use crate::iter::FromIterator; +use crate::mem; +use crate::ops; +use crate::rc::Rc; +use crate::slice; +use crate::str; +use crate::sync::Arc; +use crate::sys_common::AsInner; const UTF8_REPLACEMENT_CHARACTER: &str = "\u{FFFD}"; @@ -413,7 +413,7 @@ impl AsInner<[u8]> for Wtf8 { impl fmt::Debug for Wtf8 { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn write_str_escaped(f: &mut fmt::Formatter, s: &str) -> fmt::Result { - use fmt::Write; + use crate::fmt::Write; for c in s.chars().flat_map(|c| c.escape_debug()) { f.write_char(c)? } @@ -871,7 +871,7 @@ impl Wtf8 { #[cfg(test)] mod tests { - use borrow::Cow; + use crate::borrow::Cow; use super::*; #[test] diff --git a/src/libstd/tests/env.rs b/src/libstd/tests/env.rs index e985c3899af4..06fb5533afdd 100644 --- a/src/libstd/tests/env.rs +++ b/src/libstd/tests/env.rs @@ -1,5 +1,3 @@ -extern crate rand; - use std::env::*; use std::ffi::{OsString, OsStr}; diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs index 8207709e1f9f..7ad6b124e3a3 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs @@ -2,10 +2,10 @@ #![unstable(feature = "thread_local_internals", issue = "0")] -use cell::UnsafeCell; -use fmt; -use hint; -use mem; +use crate::cell::UnsafeCell; +use crate::fmt; +use crate::hint; +use crate::mem; /// A thread local storage key which owns its contents. /// @@ -40,13 +40,16 @@ use mem; /// }); /// /// // each thread starts out with the initial value of 1 -/// thread::spawn(move|| { +/// let t = thread::spawn(move|| { /// FOO.with(|f| { /// assert_eq!(*f.borrow(), 1); /// *f.borrow_mut() = 3; /// }); /// }); /// +/// // wait for the thread to complete and bail out on panic +/// t.join().unwrap(); +/// /// // we retain our original value of 2 despite the child thread /// FOO.with(|f| { /// assert_eq!(*f.borrow(), 2); @@ -126,8 +129,7 @@ impl fmt::Debug for LocalKey { /// [`std::thread::LocalKey`]: ../std/thread/struct.LocalKey.html #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] -#[cfg_attr(stage0, allow_internal_unstable)] -#[cfg_attr(not(stage0), allow_internal_unstable(thread_local_internals))] +#[allow_internal_unstable(thread_local_internals)] macro_rules! thread_local { // empty (base case for the recursion) () => {}; @@ -149,10 +151,7 @@ macro_rules! thread_local { reason = "should not be necessary", issue = "0")] #[macro_export] -#[cfg_attr(stage0, allow_internal_unstable)] -#[cfg_attr(not(stage0), allow_internal_unstable( - thread_local_internals, cfg_target_thread_local, thread_local, -))] +#[allow_internal_unstable(thread_local_internals, cfg_target_thread_local, thread_local)] #[allow_internal_unsafe] macro_rules! __thread_local_inner { (@key $(#[$attr:meta])* $vis:vis $name:ident, $t:ty, $init:expr) => { @@ -310,14 +309,14 @@ impl LocalKey { #[doc(hidden)] #[cfg(all(target_arch = "wasm32", not(target_feature = "atomics")))] pub mod statik { - use cell::UnsafeCell; - use fmt; + use crate::cell::UnsafeCell; + use crate::fmt; pub struct Key { inner: UnsafeCell>, } - unsafe impl ::marker::Sync for Key { } + unsafe impl Sync for Key { } impl fmt::Debug for Key { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -341,11 +340,11 @@ pub mod statik { #[doc(hidden)] #[cfg(target_thread_local)] pub mod fast { - use cell::{Cell, UnsafeCell}; - use fmt; - use mem; - use ptr; - use sys::fast_thread_local::{register_dtor, requires_move_before_drop}; + use crate::cell::{Cell, UnsafeCell}; + use crate::fmt; + use crate::mem; + use crate::ptr; + use crate::sys::fast_thread_local::{register_dtor, requires_move_before_drop}; pub struct Key { inner: UnsafeCell>, @@ -412,11 +411,11 @@ pub mod fast { #[doc(hidden)] pub mod os { - use cell::{Cell, UnsafeCell}; - use fmt; - use marker; - use ptr; - use sys_common::thread_local::StaticKey as OsStaticKey; + use crate::cell::{Cell, UnsafeCell}; + use crate::fmt; + use crate::marker; + use crate::ptr; + use crate::sys_common::thread_local::StaticKey as OsStaticKey; pub struct Key { // OS-TLS key that we'll use to key off. @@ -430,7 +429,7 @@ pub mod os { } } - unsafe impl ::marker::Sync for Key { } + unsafe impl Sync for Key { } struct Value { key: &'static Key, @@ -484,9 +483,9 @@ pub mod os { #[cfg(all(test, not(target_os = "emscripten")))] mod tests { - use sync::mpsc::{channel, Sender}; - use cell::{Cell, UnsafeCell}; - use thread; + use crate::sync::mpsc::{channel, Sender}; + use crate::cell::{Cell, UnsafeCell}; + use crate::thread; struct Foo(Sender<()>); @@ -632,8 +631,8 @@ mod tests { #[cfg(test)] mod dynamic_tests { - use cell::RefCell; - use collections::HashMap; + use crate::cell::RefCell; + use crate::collections::HashMap; #[test] fn smoke() { diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index 438ea3aa3f6a..08f0aa2f0d20 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -156,25 +156,25 @@ #![stable(feature = "rust1", since = "1.0.0")] -use any::Any; -use boxed::FnBox; -use cell::UnsafeCell; -use ffi::{CStr, CString}; -use fmt; -use io; -use mem; -use panic; -use panicking; -use str; -use sync::{Mutex, Condvar, Arc}; -use sync::atomic::AtomicUsize; -use sync::atomic::Ordering::SeqCst; -use sys::thread as imp; -use sys_common::mutex; -use sys_common::thread_info; -use sys_common::thread; -use sys_common::{AsInner, IntoInner}; -use time::Duration; +use crate::any::Any; +use crate::boxed::FnBox; +use crate::cell::UnsafeCell; +use crate::ffi::{CStr, CString}; +use crate::fmt; +use crate::io; +use crate::mem; +use crate::panic; +use crate::panicking; +use crate::str; +use crate::sync::{Mutex, Condvar, Arc}; +use crate::sync::atomic::AtomicUsize; +use crate::sync::atomic::Ordering::SeqCst; +use crate::sys::thread as imp; +use crate::sys_common::mutex; +use crate::sys_common::thread_info; +use crate::sys_common::thread; +use crate::sys_common::{AsInner, IntoInner}; +use crate::time::Duration; //////////////////////////////////////////////////////////////////////////////// // Thread-local storage @@ -466,7 +466,7 @@ impl Builder { thread_info::set(imp::guard::current(), their_thread); #[cfg(feature = "backtrace")] let try_result = panic::catch_unwind(panic::AssertUnwindSafe(|| { - ::sys_common::backtrace::__rust_begin_short_backtrace(f) + crate::sys_common::backtrace::__rust_begin_short_backtrace(f) })); #[cfg(not(feature = "backtrace"))] let try_result = panic::catch_unwind(panic::AssertUnwindSafe(f)); @@ -1051,7 +1051,7 @@ impl ThreadId { // If we somehow use up all our bits, panic so that we're not // covering up subtle bugs of IDs being reused. - if COUNTER == ::u64::MAX { + if COUNTER == crate::u64::MAX { panic!("failed to generate unique thread ID: bitspace exhausted"); } @@ -1290,7 +1290,7 @@ impl fmt::Debug for Thread { /// /// [`Result`]: ../../std/result/enum.Result.html #[stable(feature = "rust1", since = "1.0.0")] -pub type Result = ::result::Result>; +pub type Result = crate::result::Result>; // This packet is used to communicate the return value between the child thread // and the parent thread. Memory is shared through the `Arc` within and there's @@ -1482,13 +1482,13 @@ fn _assert_sync_and_send() { #[cfg(all(test, not(target_os = "emscripten")))] mod tests { - use any::Any; - use sync::mpsc::{channel, Sender}; - use result; - use super::{Builder}; - use thread; - use time::Duration; - use u32; + use super::Builder; + use crate::any::Any; + use crate::sync::mpsc::{channel, Sender}; + use crate::result; + use crate::thread; + use crate::time::Duration; + use crate::u32; // !!! These tests are dangerous. If something is buggy, they will hang, !!! // !!! instead of exiting cleanly. This might wedge the buildbots. !!! diff --git a/src/libstd/time.rs b/src/libstd/time.rs index e1f5e1fcb938..6d7093ac33ea 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -12,13 +12,13 @@ #![stable(feature = "time", since = "1.3.0")] -use cmp; -use error::Error; -use fmt; -use ops::{Add, Sub, AddAssign, SubAssign}; -use sys::time; -use sys_common::FromInner; -use sys_common::mutex::Mutex; +use crate::cmp; +use crate::error::Error; +use crate::fmt; +use crate::ops::{Add, Sub, AddAssign, SubAssign}; +use crate::sys::time; +use crate::sys_common::FromInner; +use crate::sys_common::mutex::Mutex; #[stable(feature = "time", since = "1.3.0")] pub use core::time::Duration; @@ -713,7 +713,7 @@ mod tests { assert_almost_eq!(a.checked_sub(second).unwrap().checked_add(second).unwrap(), a); // A difference of 80 and 800 years cannot fit inside a 32-bit time_t - if !(cfg!(unix) && ::mem::size_of::<::libc::time_t>() <= 4) { + if !(cfg!(unix) && crate::mem::size_of::() <= 4) { let eighty_years = second * 60 * 60 * 24 * 365 * 80; assert_almost_eq!(a - eighty_years + eighty_years, a); assert_almost_eq!(a - (eighty_years * 10) + (eighty_years * 10), a); diff --git a/src/libsyntax/Cargo.toml b/src/libsyntax/Cargo.toml index 4a0bb0302ffb..71c2ab82f65c 100644 --- a/src/libsyntax/Cargo.toml +++ b/src/libsyntax/Cargo.toml @@ -13,7 +13,7 @@ crate-type = ["dylib"] bitflags = "1.0" serialize = { path = "../libserialize" } log = "0.4" -scoped-tls = "0.1" +scoped-tls = "1.0" syntax_pos = { path = "../libsyntax_pos" } errors = { path = "../librustc_errors", package = "rustc_errors" } rustc_data_structures = { path = "../librustc_data_structures" } diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 9c4945d74dbf..a01a5bb0a363 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1643,6 +1643,8 @@ pub enum TyKind { Mac(Mac), /// Placeholder for a kind that has failed to be defined. Err, + /// Placeholder for a `va_list`. + CVarArgs, } impl TyKind { @@ -1802,7 +1804,7 @@ impl Arg { pub struct FnDecl { pub inputs: Vec, pub output: FunctionRetTy, - pub variadic: bool, + pub c_variadic: bool, } impl FnDecl { @@ -2216,7 +2218,7 @@ impl Item { #[derive(Clone, Copy, RustcEncodable, RustcDecodable, Debug)] pub struct FnHeader { pub unsafety: Unsafety, - pub asyncness: IsAsync, + pub asyncness: Spanned, pub constness: Spanned, pub abi: Abi, } @@ -2225,7 +2227,7 @@ impl Default for FnHeader { fn default() -> FnHeader { FnHeader { unsafety: Unsafety::Normal, - asyncness: IsAsync::NotAsync, + asyncness: dummy_spanned(IsAsync::NotAsync), constness: dummy_spanned(Constness::NotConst), abi: Abi::Rust, } diff --git a/src/libsyntax/attr/builtin.rs b/src/libsyntax/attr/builtin.rs index e84adc01cf04..f7a000935caf 100644 --- a/src/libsyntax/attr/builtin.rs +++ b/src/libsyntax/attr/builtin.rs @@ -7,7 +7,7 @@ use crate::parse::ParseSess; use errors::{Applicability, Handler}; use syntax_pos::{symbol::Symbol, Span}; -use super::{list_contains_name, mark_used, MetaItemKind}; +use super::{mark_used, MetaItemKind}; enum AttrError { MultipleItem(Name), @@ -79,40 +79,26 @@ pub enum UnwindAttr { /// Determine what `#[unwind]` attribute is present in `attrs`, if any. pub fn find_unwind_attr(diagnostic: Option<&Handler>, attrs: &[Attribute]) -> Option { - let syntax_error = |attr: &Attribute| { - mark_used(attr); - diagnostic.map(|d| { - span_err!(d, attr.span, E0633, "malformed `#[unwind]` attribute"); - }); - None - }; - attrs.iter().fold(None, |ia, attr| { - if attr.path != "unwind" { - return ia; - } - let meta = match attr.meta() { - Some(meta) => meta.node, - None => return ia, - }; - match meta { - MetaItemKind::Word => { - syntax_error(attr) - } - MetaItemKind::List(ref items) => { - mark_used(attr); - if items.len() != 1 { - syntax_error(attr) - } else if list_contains_name(&items[..], "allowed") { - Some(UnwindAttr::Allowed) - } else if list_contains_name(&items[..], "aborts") { - Some(UnwindAttr::Aborts) - } else { - syntax_error(attr) + if attr.check_name("unwind") { + if let Some(meta) = attr.meta() { + if let MetaItemKind::List(items) = meta.node { + if items.len() == 1 { + if items[0].check_name("allowed") { + return Some(UnwindAttr::Allowed); + } else if items[0].check_name("aborts") { + return Some(UnwindAttr::Aborts); + } + } + + diagnostic.map(|d| { + span_err!(d, attr.span, E0633, "malformed `#[unwind]` attribute"); + }); } } - _ => ia, } + + ia }) } diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 27b0cfb16307..e95f05894491 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -985,7 +985,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { P(ast::FnDecl { inputs, output, - variadic: false + c_variadic: false }) } @@ -1017,7 +1017,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { ast::ItemKind::Fn(self.fn_decl(inputs, ast::FunctionRetTy::Ty(output)), ast::FnHeader { unsafety: ast::Unsafety::Normal, - asyncness: ast::IsAsync::NotAsync, + asyncness: dummy_spanned(ast::IsAsync::NotAsync), constness: dummy_spanned(ast::Constness::NotConst), abi: Abi::Rust, }, diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index fe1cffb092b1..1a419e7fadaa 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -761,7 +761,7 @@ pub fn parse( else if bb_items.is_empty() && next_items.is_empty() { return Failure( parser.span, - parser.token, + parser.token.clone(), "no rules expected this token in macro call", ); } diff --git a/src/libsyntax/ext/tt/quoted.rs b/src/libsyntax/ext/tt/quoted.rs index 255795f28c7a..b24edb57e527 100644 --- a/src/libsyntax/ext/tt/quoted.rs +++ b/src/libsyntax/ext/tt/quoted.rs @@ -475,11 +475,13 @@ where // #1 is a separator and #2 should be a KleepeOp. // (N.B. We need to advance the input iterator.) match parse_kleene_op(input, span) { - // #2 is `?`, which is not allowed as a Kleene op in 2015 edition. + // #2 is `?`, which is not allowed as a Kleene op in 2015 edition, + // but is allowed in the 2018 edition. Ok(Ok((op, op2_span))) if op == KleeneOp::ZeroOrOne => { sess.span_diagnostic .struct_span_err(op2_span, "expected `*` or `+`") - .note("`?` is not a macro repetition operator") + .note("`?` is not a macro repetition operator in the 2015 edition, \ + but is accepted in the 2018 edition") .emit(); // Return a dummy @@ -507,10 +509,12 @@ where Err(_) => op1_span, } } else { - // `?` is not allowed as a Kleene op in 2015 + // `?` is not allowed as a Kleene op in 2015, + // but is allowed in the 2018 edition sess.span_diagnostic .struct_span_err(op1_span, "expected `*` or `+`") - .note("`?` is not a macro repetition operator") + .note("`?` is not a macro repetition operator in the 2015 edition, \ + but is accepted in the 2018 edition") .emit(); // Return a dummy @@ -520,11 +524,13 @@ where // #1 is a separator followed by #2, a KleeneOp Ok(Err((tok, span))) => match parse_kleene_op(input, span) { - // #2 is a `?`, which is not allowed as a Kleene op in 2015 edition. + // #2 is a `?`, which is not allowed as a Kleene op in 2015 edition, + // but is allowed in the 2018 edition Ok(Ok((op, op2_span))) if op == KleeneOp::ZeroOrOne => { sess.span_diagnostic .struct_span_err(op2_span, "expected `*` or `+`") - .note("`?` is not a macro repetition operator") + .note("`?` is not a macro repetition operator in the 2015 edition, \ + but is accepted in the 2018 edition") .emit(); // Return a dummy diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index c9b441193b76..279e2089f5d7 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -21,8 +21,9 @@ use crate::early_buffered_lints::BufferedEarlyLintId; use crate::source_map::Spanned; use crate::edition::{ALL_EDITIONS, Edition}; use crate::visit::{self, FnKind, Visitor}; -use crate::parse::ParseSess; +use crate::parse::{token, ParseSess}; use crate::symbol::Symbol; +use crate::tokenstream::TokenTree; use errors::{DiagnosticBuilder, Handler}; use rustc_data_structures::fx::FxHashMap; @@ -232,8 +233,8 @@ declare_features! ( // Allows `#[unwind(..)]`. // - // rustc internal for rust runtime - (active, unwind_attributes, "1.4.0", None, None), + // Permits specifying whether a function should permit unwinding or abort on unwind. + (active, unwind_attributes, "1.4.0", Some(58760), None), // Allows the use of `#[naked]` on functions. (active, naked_functions, "1.9.0", Some(32408), None), @@ -431,9 +432,6 @@ declare_features! ( // Added for testing E0705; perma-unstable. (active, test_2018_feature, "1.31.0", Some(0), Some(Edition::Edition2018)), - // support for arbitrary delimited token streams in non-macro attributes - (active, unrestricted_attribute_tokens, "1.30.0", Some(55208), None), - // Allows unsized rvalues at arguments and parameters. (active, unsized_locals, "1.30.0", Some(48055), None), @@ -473,6 +471,9 @@ declare_features! ( // #[repr(align(X))] on enums (active, repr_align_enum, "1.34.0", Some(57996), None), + + // Allows the use of C-variadics + (active, c_variadic, "1.34.0", Some(44930), None), ); declare_features! ( @@ -700,6 +701,8 @@ declare_features! ( (accepted, cfg_target_vendor, "1.33.0", Some(29718), None), // `extern crate self as foo;` puts local crate root into extern prelude under name `foo`. (accepted, extern_crate_self, "1.34.0", Some(56409), None), + // support for arbitrary delimited token streams in non-macro attributes + (accepted, unrestricted_attribute_tokens, "1.34.0", Some(55208), None), ); // If you change this, please modify `src/doc/unstable-book` as well. You must @@ -1173,7 +1176,7 @@ pub const BUILTIN_ATTRIBUTES: &[(&str, AttributeType, AttributeTemplate, Attribu "dropck_eyepatch", "may_dangle has unstable semantics and may be removed in the future", cfg_fn!(dropck_eyepatch))), - ("unwind", Whitelisted, template!(List: "allowed"), Gated(Stability::Unstable, + ("unwind", Whitelisted, template!(List: "allowed|aborts"), Gated(Stability::Unstable, "unwind_attributes", "#[unwind] is experimental", cfg_fn!(unwind_attributes))), @@ -1660,13 +1663,9 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { match BUILTIN_ATTRIBUTES.iter().find(|(name, ..)| attr.path == name) { Some(&(name, _, template, _)) => self.check_builtin_attribute(attr, name, template), - None => if !self.context.features.unrestricted_attribute_tokens { - // Unfortunately, `parse_meta` cannot be called speculatively - // because it can report errors by itself, so we have to call it - // only if the feature is disabled. - if let Err(mut err) = attr.parse_meta(self.context.parse_sess) { - err.help("try enabling `#![feature(unrestricted_attribute_tokens)]`").emit() - } + None => if let Some(TokenTree::Token(_, token::Eq)) = attr.tokens.trees().next() { + // All key-value attributes are restricted to meta-item syntax. + attr.parse_meta(self.context.parse_sess).map_err(|mut err| err.emit()).ok(); } } } @@ -1902,9 +1901,14 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { match fn_kind { FnKind::ItemFn(_, header, _, _) => { // Check for const fn and async fn declarations. - if header.asyncness.is_async() { + if header.asyncness.node.is_async() { gate_feature_post!(&self, async_await, span, "async fn is unstable"); } + + if fn_decl.c_variadic { + gate_feature_post!(&self, c_variadic, span, + "C-varaidic functions are unstable"); + } // Stability of const fn methods are covered in // `visit_trait_item` and `visit_impl_item` below; this is // because default methods don't pass through this point. @@ -1933,6 +1937,10 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { if block.is_none() { self.check_abi(sig.header.abi, ti.span); } + if sig.decl.c_variadic { + gate_feature_post!(&self, c_variadic, ti.span, + "C-varaidic functions are unstable"); + } if sig.header.constness.node == ast::Constness::Const { gate_feature_post!(&self, const_fn, ti.span, "const fn is unstable"); } diff --git a/src/libsyntax/mut_visit.rs b/src/libsyntax/mut_visit.rs index 86849f580d08..802b78086959 100644 --- a/src/libsyntax/mut_visit.rs +++ b/src/libsyntax/mut_visit.rs @@ -21,6 +21,7 @@ use syntax_pos::Span; use rustc_data_structures::sync::Lrc; use std::ops::DerefMut; +use std::{panic, process, ptr}; pub trait ExpectOne { fn expect_one(self, err: &'static str) -> A::Item; @@ -305,11 +306,18 @@ pub trait MutVisitor: Sized { /// Use a map-style function (`FnOnce(T) -> T`) to overwrite a `&mut T`. Useful /// when using a `flat_map_*` or `filter_map_*` method within a `visit_` -/// method. +/// method. Abort the program if the closure panics. // // No `noop_` prefix because there isn't a corresponding method in `MutVisitor`. pub fn visit_clobber(t: &mut T, f: F) where F: FnOnce(T) -> T { - unsafe { std::ptr::write(t, f(std::ptr::read(t))); } + unsafe { + // Safe because `t` is used in a read-only fashion by `read()` before + // being overwritten by `write()`. + let old_t = ptr::read(t); + let new_t = panic::catch_unwind(panic::AssertUnwindSafe(|| f(old_t))) + .unwrap_or_else(|_| process::abort()); + ptr::write(t, new_t); + } } // No `noop_` prefix because there isn't a corresponding method in `MutVisitor`. @@ -401,7 +409,8 @@ pub fn noop_visit_ty(ty: &mut P, vis: &mut T) { let Ty { id, node, span } = ty.deref_mut(); vis.visit_id(id); match node { - TyKind::Infer | TyKind::ImplicitSelf | TyKind::Err | TyKind::Never => {} + TyKind::Infer | TyKind::ImplicitSelf | TyKind::Err | + TyKind::Never | TyKind::CVarArgs => {} TyKind::Slice(ty) => vis.visit_ty(ty), TyKind::Ptr(mt) => vis.visit_mt(mt), TyKind::Rptr(lt, mt) => { @@ -672,7 +681,7 @@ pub fn noop_visit_asyncness(asyncness: &mut IsAsync, vis: &mut T) } pub fn noop_visit_fn_decl(decl: &mut P, vis: &mut T) { - let FnDecl { inputs, output, variadic: _ } = decl.deref_mut(); + let FnDecl { inputs, output, c_variadic: _ } = decl.deref_mut(); visit_vec(inputs, |input| vis.visit_arg(input)); match output { FunctionRetTy::Default(span) => vis.visit_span(span), @@ -926,7 +935,7 @@ pub fn noop_flat_map_impl_item(mut item: ImplItem, visitor: &mut pub fn noop_visit_fn_header(header: &mut FnHeader, vis: &mut T) { let FnHeader { unsafety: _, asyncness, constness: _, abi: _ } = header; - vis.visit_asyncness(asyncness); + vis.visit_asyncness(&mut asyncness.node); } pub fn noop_visit_mod(Mod { inner, items, inline: _ }: &mut Mod, vis: &mut T) { diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index 9020c8c6a2dc..e93e15f9012a 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -158,11 +158,21 @@ impl<'a> Parser<'a> { self.parse_token_tree().into() } else if self.eat(&token::Eq) { let eq = TokenTree::Token(self.prev_span, token::Eq); - let tree = match self.token { - token::CloseDelim(_) | token::Eof => self.unexpected()?, - _ => self.parse_token_tree(), + let mut is_interpolated_expr = false; + if let token::Interpolated(nt) = &self.token { + if let token::NtExpr(..) = **nt { + is_interpolated_expr = true; + } + } + let tokens = if is_interpolated_expr { + // We need to accept arbitrary interpolated expressions to continue + // supporting things like `doc = $expr` that work on stable. + // Non-literal interpolated expressions are rejected after expansion. + self.parse_token_tree().into() + } else { + self.parse_unsuffixed_lit()?.tokens() }; - TokenStream::new(vec![eq.into(), tree.into()]) + TokenStream::from_streams(vec![eq.into(), tokens]) } else { TokenStream::empty() }; @@ -275,8 +285,8 @@ impl<'a> Parser<'a> { } let found = self.this_token_to_string(); - let msg = format!("expected unsuffixed literal or identifier, found {}", found); - Err(self.diagnostic().struct_span_err(lo, &msg)) + let msg = format!("expected unsuffixed literal or identifier, found `{}`", found); + Err(self.diagnostic().struct_span_err(self.span, &msg)) } /// matches meta_seq = ( COMMASEP(meta_item_inner) ) diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index a7cde5fbb92c..01e3b2929031 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -1423,15 +1423,17 @@ impl<'a> StringReader<'a> { // If the character is an ident start not followed by another single // quote, then this is a lifetime name: - if ident_start(Some(c2)) && !self.ch_is('\'') { + if (ident_start(Some(c2)) || c2.is_numeric()) && !self.ch_is('\'') { while ident_continue(self.ch) { self.bump(); } // lifetimes shouldn't end with a single quote // if we find one, then this is an invalid character literal if self.ch_is('\'') { - self.err_span_(start_with_quote, self.next_pos, - "character literal may only contain one codepoint"); + self.err_span_( + start_with_quote, + self.next_pos, + "character literal may only contain one codepoint"); self.bump(); return Ok(token::Literal(token::Err(Symbol::intern("??")), None)) @@ -1444,6 +1446,15 @@ impl<'a> StringReader<'a> { self.mk_ident(&format!("'{}", lifetime_name)) }); + if c2.is_numeric() { + // this is a recovered lifetime written `'1`, error but accept it + self.err_span_( + start_with_quote, + self.pos, + "lifetimes cannot start with a number", + ); + } + return Ok(token::Lifetime(ident)); } @@ -1873,6 +1884,7 @@ fn is_block_doc_comment(s: &str) -> bool { res } +/// Determine whether `c` is a valid start for an ident. fn ident_start(c: Option) -> bool { let c = match c { Some(c) => c, @@ -1920,7 +1932,7 @@ mod tests { false, false); ParseSess { - span_diagnostic: errors::Handler::with_emitter(true, false, Box::new(emitter)), + span_diagnostic: errors::Handler::with_emitter(true, None, Box::new(emitter)), unstable_features: UnstableFeatures::from_environment(), config: CrateConfig::default(), included_mod_stack: Lock::new(Vec::new()), diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index b2d4d97d57d8..371e8fe5cf66 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -6,6 +6,7 @@ use crate::source_map::{SourceMap, FilePathMapping}; use crate::feature_gate::UnstableFeatures; use crate::parse::parser::Parser; use crate::symbol::Symbol; +use crate::syntax::parse::parser::emit_unclosed_delims; use crate::tokenstream::{TokenStream, TokenTree}; use crate::diagnostics::plugin::ErrorMap; use crate::print::pprust::token_to_string; @@ -53,7 +54,7 @@ impl ParseSess { let cm = Lrc::new(SourceMap::new(file_path_mapping)); let handler = Handler::with_tty_emitter(ColorConfig::Auto, true, - false, + None, Some(cm.clone())); ParseSess::with_span_handler(handler, cm) } @@ -141,8 +142,14 @@ pub fn parse_stream_from_source_str( source: String, sess: &ParseSess, override_span: Option, -) -> (TokenStream, Vec) { - source_file_to_stream(sess, sess.source_map().new_source_file(name, source), override_span) +) -> TokenStream { + let (stream, mut errors) = source_file_to_stream( + sess, + sess.source_map().new_source_file(name, source), + override_span, + ); + emit_unclosed_delims(&mut errors, &sess.span_diagnostic); + stream } /// Creates a new parser from a source string. @@ -178,7 +185,7 @@ pub fn maybe_new_parser_from_file<'a>(sess: &'a ParseSess, path: &Path) /// Given a session, a crate config, a path, and a span, add /// the file at the given path to the source_map, and return a parser. /// On an error, use the given span as the source of the problem. -crate fn new_sub_parser_from_file<'a>(sess: &'a ParseSess, +pub fn new_sub_parser_from_file<'a>(sess: &'a ParseSess, path: &Path, directory_ownership: DirectoryOwnership, module_name: Option, diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 7e900dfeb1ee..fe31311094b8 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -46,7 +46,7 @@ use crate::ThinVec; use crate::tokenstream::{self, DelimSpan, TokenTree, TokenStream, TreeAndJoint}; use crate::symbol::{Symbol, keywords}; -use errors::{Applicability, DiagnosticBuilder, DiagnosticId}; +use errors::{Applicability, DiagnosticBuilder, DiagnosticId, FatalError}; use rustc_target::spec::abi::{self, Abi}; use syntax_pos::{Span, MultiSpan, BytePos, FileName}; use log::{debug, trace}; @@ -256,8 +256,15 @@ pub struct Parser<'a> { /// it gets removed from here. Every entry left at the end gets emitted as an independent /// error. crate unclosed_delims: Vec, + last_unexpected_token_span: Option, } +impl<'a> Drop for Parser<'a> { + fn drop(&mut self) { + let diag = self.diagnostic(); + emit_unclosed_delims(&mut self.unclosed_delims, diag); + } +} #[derive(Clone)] struct TokenCursor { @@ -582,6 +589,7 @@ impl<'a> Parser<'a> { unmatched_angle_bracket_count: 0, max_angle_bracket_count: 0, unclosed_delims: Vec::new(), + last_unexpected_token_span: None, }; let tok = parser.next_tok(); @@ -775,6 +783,8 @@ impl<'a> Parser<'a> { } else if inedible.contains(&self.token) { // leave it in the input Ok(false) + } else if self.last_unexpected_token_span == Some(self.span) { + FatalError.raise(); } else { let mut expected = edible.iter() .map(|x| TokenType::Token(x.clone())) @@ -802,6 +812,7 @@ impl<'a> Parser<'a> { (self.sess.source_map().next_point(self.prev_span), format!("expected {} here", expect))) }; + self.last_unexpected_token_span = Some(self.span); let mut err = self.fatal(&msg_exp); if self.token.is_ident_named("and") { err.span_suggestion_short( @@ -1457,12 +1468,12 @@ impl<'a> Parser<'a> { }; self.expect_keyword(keywords::Fn)?; - let (inputs, variadic) = self.parse_fn_args(false, true)?; + let (inputs, c_variadic) = self.parse_fn_args(false, true)?; let ret_ty = self.parse_ret_ty(false)?; let decl = P(FnDecl { inputs, output: ret_ty, - variadic, + c_variadic, }); Ok(TyKind::BareFn(P(BareFnTy { abi, @@ -1497,9 +1508,13 @@ impl<'a> Parser<'a> { pub fn parse_trait_item(&mut self, at_end: &mut bool) -> PResult<'a, TraitItem> { maybe_whole!(self, NtTraitItem, |x| x); let attrs = self.parse_outer_attributes()?; + let mut unclosed_delims = vec![]; let (mut item, tokens) = self.collect_tokens(|this| { - this.parse_trait_item_(at_end, attrs) + let item = this.parse_trait_item_(at_end, attrs); + unclosed_delims.append(&mut this.unclosed_delims); + item })?; + self.unclosed_delims.append(&mut unclosed_delims); // See `parse_item` for why this clause is here. if !item.attrs.iter().any(|attr| attr.style == AttrStyle::Inner) { item.tokens = Some(tokens); @@ -1543,7 +1558,7 @@ impl<'a> Parser<'a> { // definition... // We don't allow argument names to be left off in edition 2018. - p.parse_arg_general(p.span.rust_2018(), true) + p.parse_arg_general(p.span.rust_2018(), true, false) })?; generics.where_clause = self.parse_where_clause()?; @@ -1613,7 +1628,7 @@ impl<'a> Parser<'a> { /// Parses an optional return type `[ -> TY ]` in a function declaration. fn parse_ret_ty(&mut self, allow_plus: bool) -> PResult<'a, FunctionRetTy> { if self.eat(&token::RArrow) { - Ok(FunctionRetTy::Ty(self.parse_ty_common(allow_plus, true)?)) + Ok(FunctionRetTy::Ty(self.parse_ty_common(allow_plus, true, false)?)) } else { Ok(FunctionRetTy::Default(self.span.shrink_to_lo())) } @@ -1621,7 +1636,7 @@ impl<'a> Parser<'a> { /// Parses a type. pub fn parse_ty(&mut self) -> PResult<'a, P> { - self.parse_ty_common(true, true) + self.parse_ty_common(true, true, false) } /// Parses a type in restricted contexts where `+` is not permitted. @@ -1631,11 +1646,11 @@ impl<'a> Parser<'a> { /// Example 2: `value1 as TYPE + value2` /// `+` is prohibited to avoid interactions with expression grammar. fn parse_ty_no_plus(&mut self) -> PResult<'a, P> { - self.parse_ty_common(false, true) + self.parse_ty_common(false, true, false) } - fn parse_ty_common(&mut self, allow_plus: bool, allow_qpath_recovery: bool) - -> PResult<'a, P> { + fn parse_ty_common(&mut self, allow_plus: bool, allow_qpath_recovery: bool, + allow_c_variadic: bool) -> PResult<'a, P> { maybe_whole!(self, NtTy, |x| x); let lo = self.span; @@ -1772,6 +1787,15 @@ impl<'a> Parser<'a> { TyKind::Path(None, path) } } + } else if self.check(&token::DotDotDot) { + if allow_c_variadic { + self.eat(&token::DotDotDot); + TyKind::CVarArgs + } else { + return Err(self.fatal( + "only foreign functions are allowed to be C-variadic" + )); + } } else { let msg = format!("expected type, found {}", self.this_token_descr()); return Err(self.fatal(&msg)); @@ -1794,7 +1818,7 @@ impl<'a> Parser<'a> { let mut bounds = vec![GenericBound::Trait(poly_trait_ref, TraitBoundModifier::None)]; if parse_plus { self.eat_plus(); // `+`, or `+=` gets split and `+` is discarded - bounds.append(&mut self.parse_generic_bounds(None)?); + bounds.append(&mut self.parse_generic_bounds(Some(self.prev_span))?); } Ok(TyKind::TraitObject(bounds, TraitObjectSyntax::None)) } @@ -1959,7 +1983,8 @@ impl<'a> Parser<'a> { } /// This version of parse arg doesn't necessarily require identifier names. - fn parse_arg_general(&mut self, require_name: bool, is_trait_item: bool) -> PResult<'a, Arg> { + fn parse_arg_general(&mut self, require_name: bool, is_trait_item: bool, + allow_c_variadic: bool) -> PResult<'a, Arg> { maybe_whole!(self, NtArg, |x| x); if let Ok(Some(_)) = self.parse_self_arg() { @@ -2008,12 +2033,12 @@ impl<'a> Parser<'a> { } self.eat_incorrect_doc_comment("a method argument's type"); - (pat, self.parse_ty()?) + (pat, self.parse_ty_common(true, true, allow_c_variadic)?) } else { debug!("parse_arg_general ident_to_pat"); let parser_snapshot_before_ty = self.clone(); self.eat_incorrect_doc_comment("a method argument's type"); - let mut ty = self.parse_ty(); + let mut ty = self.parse_ty_common(true, true, allow_c_variadic); if ty.is_ok() && self.token != token::Comma && self.token != token::CloseDelim(token::Paren) { // This wasn't actually a type, but a pattern looking like a type, @@ -2032,6 +2057,11 @@ impl<'a> Parser<'a> { (pat, ty) } Err(mut err) => { + // If this is a C-variadic argument and we hit an error, return the + // error. + if self.token == token::DotDotDot { + return Err(err); + } // Recover from attempting to parse the argument as a type without pattern. err.cancel(); mem::replace(self, parser_snapshot_before_ty); @@ -2068,7 +2098,7 @@ impl<'a> Parser<'a> { /// Parses a single function argument. crate fn parse_arg(&mut self) -> PResult<'a, Arg> { - self.parse_arg_general(true, false) + self.parse_arg_general(true, false, false) } /// Parses an argument in a lambda header (e.g., `|arg, arg|`). @@ -2406,7 +2436,7 @@ impl<'a> Parser<'a> { } let span = lo.to(self.prev_span); let output = if self.eat(&token::RArrow) { - Some(self.parse_ty_common(false, false)?) + Some(self.parse_ty_common(false, false, false)?) } else { None }; @@ -5001,6 +5031,11 @@ impl<'a> Parser<'a> { ) } + fn is_async_fn(&mut self) -> bool { + self.token.is_keyword(keywords::Async) && + self.look_ahead(1, |t| t.is_keyword(keywords::Fn)) + } + fn is_do_catch_block(&mut self) -> bool { self.token.is_keyword(keywords::Do) && self.look_ahead(1, |t| t.is_keyword(keywords::Catch)) && @@ -5133,7 +5168,8 @@ impl<'a> Parser<'a> { !self.is_union_item() && !self.is_crate_vis() && !self.is_existential_type_decl() && - !self.is_auto_trait_item() { + !self.is_auto_trait_item() && + !self.is_async_fn() { let pth = self.parse_path(PathStyle::Expr)?; if !self.eat(&token::Not) { @@ -5502,6 +5538,7 @@ impl<'a> Parser<'a> { let mut bounds = Vec::new(); let mut negative_bounds = Vec::new(); let mut last_plus_span = None; + let mut was_negative = false; loop { // This needs to be synchronized with `Token::can_begin_bound`. let is_bound_start = self.check_path() || self.check_lifetime() || @@ -5546,9 +5583,10 @@ impl<'a> Parser<'a> { } let poly_span = lo.to(self.prev_span); if is_negative { - negative_bounds.push( - last_plus_span.or(colon_span).unwrap() - .to(poly_span)); + was_negative = true; + if let Some(sp) = last_plus_span.or(colon_span) { + negative_bounds.push(sp.to(poly_span)); + } } else { let poly_trait = PolyTraitRef::new(lifetime_defs, path, poly_span); let modifier = if question.is_some() { @@ -5570,26 +5608,28 @@ impl<'a> Parser<'a> { } } - if !negative_bounds.is_empty() { + if !negative_bounds.is_empty() || was_negative { let plural = negative_bounds.len() > 1; let mut err = self.struct_span_err(negative_bounds, "negative trait bounds are not supported"); - let bound_list = colon_span.unwrap().to(self.prev_span); - let mut new_bound_list = String::new(); - if !bounds.is_empty() { - let mut snippets = bounds.iter().map(|bound| bound.span()) - .map(|span| self.sess.source_map().span_to_snippet(span)); - while let Some(Ok(snippet)) = snippets.next() { - new_bound_list.push_str(" + "); - new_bound_list.push_str(&snippet); + if let Some(bound_list) = colon_span { + let bound_list = bound_list.to(self.prev_span); + let mut new_bound_list = String::new(); + if !bounds.is_empty() { + let mut snippets = bounds.iter().map(|bound| bound.span()) + .map(|span| self.sess.source_map().span_to_snippet(span)); + while let Some(Ok(snippet)) = snippets.next() { + new_bound_list.push_str(" + "); + new_bound_list.push_str(&snippet); + } + new_bound_list = new_bound_list.replacen(" +", ":", 1); } - new_bound_list = new_bound_list.replacen(" +", ":", 1); + err.span_suggestion_short(bound_list, + &format!("remove the trait bound{}", + if plural { "s" } else { "" }), + new_bound_list, + Applicability::MachineApplicable); } - err.span_suggestion_short(bound_list, - &format!("remove the trait bound{}", - if plural { "s" } else { "" }), - new_bound_list, - Applicability::MachineApplicable); err.emit(); } @@ -5625,7 +5665,7 @@ impl<'a> Parser<'a> { // Parse optional colon and param bounds. let bounds = if self.eat(&token::Colon) { - self.parse_generic_bounds(None)? + self.parse_generic_bounds(Some(self.prev_span))? } else { Vec::new() }; @@ -6070,7 +6110,7 @@ impl<'a> Parser<'a> { // or with mandatory equality sign and the second type. let ty = self.parse_ty()?; if self.eat(&token::Colon) { - let bounds = self.parse_generic_bounds(None)?; + let bounds = self.parse_generic_bounds(Some(self.prev_span))?; where_clause.predicates.push(ast::WherePredicate::BoundPredicate( ast::WhereBoundPredicate { span: lo.to(self.prev_span), @@ -6107,55 +6147,49 @@ impl<'a> Parser<'a> { Ok(where_clause) } - fn parse_fn_args(&mut self, named_args: bool, allow_variadic: bool) + fn parse_fn_args(&mut self, named_args: bool, allow_c_variadic: bool) -> PResult<'a, (Vec , bool)> { self.expect(&token::OpenDelim(token::Paren))?; let sp = self.span; - let mut variadic = false; + let mut c_variadic = false; let (args, recovered): (Vec>, bool) = self.parse_seq_to_before_end( &token::CloseDelim(token::Paren), SeqSep::trailing_allowed(token::Comma), |p| { - if p.token == token::DotDotDot { - p.bump(); - variadic = true; - if allow_variadic { - if p.token != token::CloseDelim(token::Paren) { - let span = p.span; - p.span_err(span, - "`...` must be last in argument list for variadic function"); - } - Ok(None) - } else { - let span = p.prev_span; - if p.token == token::CloseDelim(token::Paren) { - // continue parsing to present any further errors - p.struct_span_err( - span, - "only foreign functions are allowed to be variadic" - ).emit(); - Ok(Some(dummy_arg(span))) - } else { - // this function definition looks beyond recovery, stop parsing - p.span_err(span, - "only foreign functions are allowed to be variadic"); - Ok(None) - } - } + // If the argument is a C-variadic argument we should not + // enforce named arguments. + let enforce_named_args = if p.token == token::DotDotDot { + false } else { - match p.parse_arg_general(named_args, false) { - Ok(arg) => Ok(Some(arg)), - Err(mut e) => { - e.emit(); - let lo = p.prev_span; - // Skip every token until next possible arg or end. - p.eat_to_tokens(&[&token::Comma, &token::CloseDelim(token::Paren)]); - // Create a placeholder argument for proper arg count (#34264). - let span = lo.to(p.prev_span); - Ok(Some(dummy_arg(span))) + named_args + }; + match p.parse_arg_general(enforce_named_args, false, + allow_c_variadic) { + Ok(arg) => { + if let TyKind::CVarArgs = arg.ty.node { + c_variadic = true; + if p.token != token::CloseDelim(token::Paren) { + let span = p.span; + p.span_err(span, + "`...` must be the last argument of a C-variadic function"); + Ok(None) + } else { + Ok(Some(arg)) + } + } else { + Ok(Some(arg)) } + }, + Err(mut e) => { + e.emit(); + let lo = p.prev_span; + // Skip every token until next possible arg or end. + p.eat_to_tokens(&[&token::Comma, &token::CloseDelim(token::Paren)]); + // Create a placeholder argument for proper arg count (issue #34264). + let span = lo.to(p.prev_span); + Ok(Some(dummy_arg(span))) } } } @@ -6167,24 +6201,24 @@ impl<'a> Parser<'a> { let args: Vec<_> = args.into_iter().filter_map(|x| x).collect(); - if variadic && args.is_empty() { + if c_variadic && args.is_empty() { self.span_err(sp, - "variadic function must be declared with at least one named argument"); + "C-variadic function must be declared with at least one named argument"); } - Ok((args, variadic)) + Ok((args, c_variadic)) } /// Parses the argument list and result type of a function declaration. - fn parse_fn_decl(&mut self, allow_variadic: bool) -> PResult<'a, P> { + fn parse_fn_decl(&mut self, allow_c_variadic: bool) -> PResult<'a, P> { - let (args, variadic) = self.parse_fn_args(true, allow_variadic)?; + let (args, c_variadic) = self.parse_fn_args(true, allow_c_variadic)?; let ret_ty = self.parse_ret_ty(true)?; Ok(P(FnDecl { inputs: args, output: ret_ty, - variadic, + c_variadic, })) } @@ -6318,7 +6352,10 @@ impl<'a> Parser<'a> { fn_inputs.append(&mut input); (fn_inputs, recovered) } else { - return self.unexpected(); + match self.expect_one_of(&[], &[]) { + Err(err) => return Err(err), + Ok(recovered) => (vec![self_arg], recovered), + } } } else { self.parse_seq_to_before_end(&token::CloseDelim(token::Paren), sep, parse_arg_fn)? @@ -6331,7 +6368,7 @@ impl<'a> Parser<'a> { Ok(P(FnDecl { inputs: fn_inputs, output: self.parse_ret_ty(true)?, - variadic: false + c_variadic: false })) } @@ -6357,7 +6394,7 @@ impl<'a> Parser<'a> { Ok(P(FnDecl { inputs: inputs_captures, output, - variadic: false + c_variadic: false })) } @@ -6384,12 +6421,13 @@ impl<'a> Parser<'a> { /// Parses an item-position function declaration. fn parse_item_fn(&mut self, unsafety: Unsafety, - asyncness: IsAsync, + asyncness: Spanned, constness: Spanned, abi: Abi) -> PResult<'a, ItemInfo> { let (ident, mut generics) = self.parse_fn_header()?; - let decl = self.parse_fn_decl(false)?; + let allow_c_variadic = abi == Abi::C && unsafety == Unsafety::Unsafe; + let decl = self.parse_fn_decl(allow_c_variadic)?; generics.where_clause = self.parse_where_clause()?; let (inner_attrs, body) = self.parse_inner_attrs_and_block()?; let header = FnHeader { unsafety, asyncness, constness, abi }; @@ -6416,7 +6454,7 @@ impl<'a> Parser<'a> { -> PResult<'a, ( Spanned, Unsafety, - IsAsync, + Spanned, Abi )> { @@ -6424,6 +6462,7 @@ impl<'a> Parser<'a> { let const_span = self.prev_span; let unsafety = self.parse_unsafety(); let asyncness = self.parse_asyncness(); + let asyncness = respan(self.prev_span, asyncness); let (constness, unsafety, abi) = if is_const_fn { (respan(const_span, Constness::Const), unsafety, Abi::Rust) } else { @@ -6442,9 +6481,13 @@ impl<'a> Parser<'a> { pub fn parse_impl_item(&mut self, at_end: &mut bool) -> PResult<'a, ImplItem> { maybe_whole!(self, NtImplItem, |x| x); let attrs = self.parse_outer_attributes()?; + let mut unclosed_delims = vec![]; let (mut item, tokens) = self.collect_tokens(|this| { - this.parse_impl_item_(at_end, attrs) + let item = this.parse_impl_item_(at_end, attrs); + unclosed_delims.append(&mut this.unclosed_delims); + item })?; + self.unclosed_delims.append(&mut unclosed_delims); // See `parse_item` for why this clause is here. if !item.attrs.iter().any(|attr| attr.style == AttrStyle::Inner) { @@ -7626,7 +7669,7 @@ impl<'a> Parser<'a> { tps.where_clause = self.parse_where_clause()?; let alias = if existential { self.expect(&token::Colon)?; - let bounds = self.parse_generic_bounds(None)?; + let bounds = self.parse_generic_bounds(Some(self.prev_span))?; AliasKind::Existential(bounds) } else { self.expect(&token::Eq)?; @@ -7764,9 +7807,13 @@ impl<'a> Parser<'a> { macros_allowed: bool, attributes_allowed: bool, ) -> PResult<'a, Option>> { + let mut unclosed_delims = vec![]; let (ret, tokens) = self.collect_tokens(|this| { - this.parse_item_implementation(attrs, macros_allowed, attributes_allowed) + let item = this.parse_item_implementation(attrs, macros_allowed, attributes_allowed); + unclosed_delims.append(&mut this.unclosed_delims); + item })?; + self.unclosed_delims.append(&mut unclosed_delims); // Once we've parsed an item and recorded the tokens we got while // parsing we may want to store `tokens` into the item we're about to @@ -7834,7 +7881,7 @@ impl<'a> Parser<'a> { let abi = opt_abi.unwrap_or(Abi::C); let (ident, item_, extra_attrs) = self.parse_item_fn(Unsafety::Normal, - IsAsync::NotAsync, + respan(fn_span, IsAsync::NotAsync), respan(fn_span, Constness::NotConst), abi)?; let prev_span = self.prev_span; @@ -7878,7 +7925,7 @@ impl<'a> Parser<'a> { self.bump(); let (ident, item_, extra_attrs) = self.parse_item_fn(unsafety, - IsAsync::NotAsync, + respan(const_span, IsAsync::NotAsync), respan(const_span, Constness::Const), Abi::Rust)?; let prev_span = self.prev_span; @@ -7926,14 +7973,15 @@ impl<'a> Parser<'a> { // ASYNC FUNCTION ITEM let unsafety = self.parse_unsafety(); self.expect_keyword(keywords::Async)?; + let async_span = self.prev_span; self.expect_keyword(keywords::Fn)?; let fn_span = self.prev_span; let (ident, item_, extra_attrs) = self.parse_item_fn(unsafety, - IsAsync::Async { + respan(async_span, IsAsync::Async { closure_id: ast::DUMMY_NODE_ID, return_impl_trait_id: ast::DUMMY_NODE_ID, - }, + }), respan(fn_span, Constness::NotConst), Abi::Rust)?; let prev_span = self.prev_span; @@ -7942,6 +7990,13 @@ impl<'a> Parser<'a> { item_, visibility, maybe_append(attrs, extra_attrs)); + if self.span.rust_2015() { + self.diagnostic().struct_span_err_with_code( + async_span, + "`async fn` is not permitted in the 2015 edition", + DiagnosticId::Error("E0670".into()) + ).emit(); + } return Ok(Some(item)); } if self.check_keyword(keywords::Unsafe) && @@ -7989,7 +8044,7 @@ impl<'a> Parser<'a> { let fn_span = self.prev_span; let (ident, item_, extra_attrs) = self.parse_item_fn(Unsafety::Normal, - IsAsync::NotAsync, + respan(fn_span, IsAsync::NotAsync), respan(fn_span, Constness::NotConst), Abi::Rust)?; let prev_span = self.prev_span; @@ -8015,7 +8070,7 @@ impl<'a> Parser<'a> { let fn_span = self.prev_span; let (ident, item_, extra_attrs) = self.parse_item_fn(Unsafety::Unsafe, - IsAsync::NotAsync, + respan(fn_span, IsAsync::NotAsync), respan(fn_span, Constness::NotConst), abi)?; let prev_span = self.prev_span; @@ -8282,7 +8337,8 @@ impl<'a> Parser<'a> { lo: Span, visibility: Visibility ) -> PResult<'a, Option>> { - if macros_allowed && self.token.is_path_start() { + if macros_allowed && self.token.is_path_start() && + !(self.is_async_fn() && self.span.rust_2015()) { // MACRO INVOCATION ITEM let prev_span = self.prev_span; @@ -8337,7 +8393,8 @@ impl<'a> Parser<'a> { fn parse_assoc_macro_invoc(&mut self, item_kind: &str, vis: Option<&Visibility>, at_end: &mut bool) -> PResult<'a, Option> { - if self.token.is_path_start() { + if self.token.is_path_start() && + !(self.is_async_fn() && self.span.rust_2015()) { let prev_span = self.prev_span; let lo = self.span; let pth = self.parse_path(PathStyle::Mod)?; @@ -8512,8 +8569,6 @@ impl<'a> Parser<'a> { module: self.parse_mod_items(&token::Eof, lo)?, span: lo.to(self.span), }); - emit_unclosed_delims(&self.unclosed_delims, self.diagnostic()); - self.unclosed_delims.clear(); krate } @@ -8544,8 +8599,8 @@ impl<'a> Parser<'a> { } } -pub fn emit_unclosed_delims(unclosed_delims: &[UnmatchedBrace], handler: &errors::Handler) { - for unmatched in unclosed_delims { +pub fn emit_unclosed_delims(unclosed_delims: &mut Vec, handler: &errors::Handler) { + for unmatched in unclosed_delims.iter() { let mut err = handler.struct_span_err(unmatched.found_span, &format!( "incorrect close delimiter: `{}`", pprust::token_to_string(&token::Token::CloseDelim(unmatched.found_delim)), @@ -8559,4 +8614,5 @@ pub fn emit_unclosed_delims(unclosed_delims: &[UnmatchedBrace], handler: &errors } err.emit(); } + unclosed_delims.clear(); } diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index eec422d6266c..2fa4f5263fbc 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -10,7 +10,6 @@ use crate::print::pprust; use crate::ptr::P; use crate::symbol::keywords; use crate::syntax::parse::parse_stream_from_source_str; -use crate::syntax::parse::parser::emit_unclosed_delims; use crate::tokenstream::{self, DelimSpan, TokenStream, TokenTree}; use syntax_pos::symbol::{self, Symbol}; @@ -675,9 +674,7 @@ impl Nonterminal { // FIXME(#43081): Avoid this pretty-print + reparse hack let source = pprust::nonterminal_to_string(self); let filename = FileName::macro_expansion_source_code(&source); - let (tokens_for_real, errors) = - parse_stream_from_source_str(filename, source, sess, Some(span)); - emit_unclosed_delims(&errors, &sess.span_diagnostic); + let tokens_for_real = parse_stream_from_source_str(filename, source, sess, Some(span)); // During early phases of the compiler the AST could get modified // directly (e.g., attributes added or removed) and the internal cache @@ -740,13 +737,7 @@ fn prepend_attrs(sess: &ParseSess, let source = pprust::attr_to_string(attr); let macro_filename = FileName::macro_expansion_source_code(&source); if attr.is_sugared_doc { - let (stream, errors) = parse_stream_from_source_str( - macro_filename, - source, - sess, - Some(span), - ); - emit_unclosed_delims(&errors, &sess.span_diagnostic); + let stream = parse_stream_from_source_str(macro_filename, source, sess, Some(span)); builder.push(stream); continue } @@ -763,13 +754,7 @@ fn prepend_attrs(sess: &ParseSess, // ... and for more complicated paths, fall back to a reparse hack that // should eventually be removed. } else { - let (stream, errors) = parse_stream_from_source_str( - macro_filename, - source, - sess, - Some(span), - ); - emit_unclosed_delims(&errors, &sess.span_diagnostic); + let stream = parse_stream_from_source_str(macro_filename, source, sess, Some(span)); brackets.push(stream); } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index dcf9815f6d1b..49e3fad4af0f 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1118,6 +1118,9 @@ impl<'a> State<'a> { ast::TyKind::Mac(ref m) => { self.print_mac(m)?; } + ast::TyKind::CVarArgs => { + self.s.word("...")?; + } } self.end() } @@ -2811,9 +2814,6 @@ impl<'a> State<'a> { -> io::Result<()> { self.popen()?; self.commasep(Inconsistent, &decl.inputs, |s, arg| s.print_arg(arg, false))?; - if decl.variadic { - self.s.word(", ...")?; - } self.pclose()?; self.print_fn_output(decl) @@ -3195,7 +3195,7 @@ impl<'a> State<'a> { ast::Constness::Const => self.word_nbsp("const")? } - self.print_asyncness(header.asyncness)?; + self.print_asyncness(header.asyncness.node)?; self.print_unsafety(header.unsafety)?; if header.abi != Abi::Rust { @@ -3238,7 +3238,7 @@ mod tests { let decl = ast::FnDecl { inputs: Vec::new(), output: ast::FunctionRetTy::Default(syntax_pos::DUMMY_SP), - variadic: false + c_variadic: false }; let generics = ast::Generics::default(); assert_eq!( @@ -3247,7 +3247,7 @@ mod tests { ast::FnHeader { unsafety: ast::Unsafety::Normal, constness: source_map::dummy_spanned(ast::Constness::NotConst), - asyncness: ast::IsAsync::NotAsync, + asyncness: source_map::dummy_spanned(ast::IsAsync::NotAsync), abi: Abi::Rust, }, abba_ident, diff --git a/src/libsyntax/ptr.rs b/src/libsyntax/ptr.rs index bc43630ae59b..9afcb7c4621c 100644 --- a/src/libsyntax/ptr.rs +++ b/src/libsyntax/ptr.rs @@ -29,7 +29,7 @@ use std::fmt::{self, Display, Debug}; use std::iter::FromIterator; use std::ops::{Deref, DerefMut}; -use std::{mem, ptr, slice, vec}; +use std::{slice, vec}; use serialize::{Encodable, Decodable, Encoder, Decoder}; @@ -66,45 +66,18 @@ impl P { pub fn map(mut self, f: F) -> P where F: FnOnce(T) -> T, { - let p: *mut T = &mut *self.ptr; + let x = f(*self.ptr); + *self.ptr = x; - // Leak self in case of panic. - // FIXME(eddyb) Use some sort of "free guard" that - // only deallocates, without dropping the pointee, - // in case the call the `f` below ends in a panic. - mem::forget(self); - - unsafe { - ptr::write(p, f(ptr::read(p))); - - // Recreate self from the raw pointer. - P { ptr: Box::from_raw(p) } - } + self } /// Optionally produce a new `P` from `self` without reallocating. pub fn filter_map(mut self, f: F) -> Option> where F: FnOnce(T) -> Option, { - let p: *mut T = &mut *self.ptr; - - // Leak self in case of panic. - // FIXME(eddyb) Use some sort of "free guard" that - // only deallocates, without dropping the pointee, - // in case the call the `f` below ends in a panic. - mem::forget(self); - - unsafe { - if let Some(v) = f(ptr::read(p)) { - ptr::write(p, v); - - // Recreate self from the raw pointer. - Some(P { ptr: Box::from_raw(p) }) - } else { - drop(Box::from_raw(p)); - None - } - } + *self.ptr = f(*self.ptr)?; + Some(self) } } diff --git a/src/libsyntax/test_snippet.rs b/src/libsyntax/test_snippet.rs index cf39090e1888..2b3d18835d54 100644 --- a/src/libsyntax/test_snippet.rs +++ b/src/libsyntax/test_snippet.rs @@ -58,7 +58,7 @@ fn test_harness(file_text: &str, span_labels: Vec, expected_output: & Some(source_map.clone()), false, false); - let handler = Handler::with_emitter(true, false, Box::new(emitter)); + let handler = Handler::with_emitter(true, None, Box::new(emitter)); handler.span_err(msp, "foo"); assert!(expected_output.chars().next() == Some('\n'), diff --git a/src/libsyntax/tokenstream.rs b/src/libsyntax/tokenstream.rs index 283679e758b5..4ce308d015c0 100644 --- a/src/libsyntax/tokenstream.rs +++ b/src/libsyntax/tokenstream.rs @@ -254,7 +254,7 @@ impl TokenStream { } } - fn from_streams(mut streams: Vec) -> TokenStream { + pub(crate) fn from_streams(mut streams: Vec) -> TokenStream { match streams.len() { 0 => TokenStream::empty(), 1 => streams.pop().unwrap(), diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index a002394c710f..6b3a30ccb54b 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -22,7 +22,7 @@ use syntax_pos::Span; #[derive(Copy, Clone)] pub enum FnKind<'a> { /// fn foo() or extern "Abi" fn foo() - ItemFn(Ident, FnHeader, &'a Visibility, &'a Block), + ItemFn(Ident, &'a FnHeader, &'a Visibility, &'a Block), /// fn foo(&self) Method(Ident, &'a MethodSig, Option<&'a Visibility>, &'a Block), @@ -149,6 +149,9 @@ pub trait Visitor<'ast>: Sized { fn visit_fn_ret_ty(&mut self, ret_ty: &'ast FunctionRetTy) { walk_fn_ret_ty(self, ret_ty) } + fn visit_fn_header(&mut self, _header: &'ast FnHeader) { + // Nothing to do + } } #[macro_export] @@ -225,8 +228,9 @@ pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) { visitor.visit_ty(typ); visitor.visit_expr(expr); } - ItemKind::Fn(ref declaration, header, ref generics, ref body) => { + ItemKind::Fn(ref declaration, ref header, ref generics, ref body) => { visitor.visit_generics(generics); + visitor.visit_fn_header(header); visitor.visit_fn(FnKind::ItemFn(item.ident, header, &item.vis, body), declaration, @@ -315,7 +319,7 @@ pub fn walk_ty<'a, V: Visitor<'a>>(visitor: &mut V, typ: &'a Ty) { walk_list!(visitor, visit_lifetime, opt_lifetime); visitor.visit_ty(&mutable_type.ty) } - TyKind::Never => {}, + TyKind::Never | TyKind::CVarArgs => {} TyKind::Tup(ref tuple_element_types) => { walk_list!(visitor, visit_ty, tuple_element_types); } @@ -539,11 +543,13 @@ pub fn walk_fn<'a, V>(visitor: &mut V, kind: FnKind<'a>, declaration: &'a FnDecl where V: Visitor<'a>, { match kind { - FnKind::ItemFn(_, _, _, body) => { + FnKind::ItemFn(_, header, _, body) => { + visitor.visit_fn_header(header); walk_fn_decl(visitor, declaration); visitor.visit_block(body); } - FnKind::Method(_, _, _, body) => { + FnKind::Method(_, sig, _, body) => { + visitor.visit_fn_header(&sig.header); walk_fn_decl(visitor, declaration); visitor.visit_block(body); } @@ -564,6 +570,7 @@ pub fn walk_trait_item<'a, V: Visitor<'a>>(visitor: &mut V, trait_item: &'a Trai walk_list!(visitor, visit_expr, default); } TraitItemKind::Method(ref sig, None) => { + visitor.visit_fn_header(&sig.header); walk_fn_decl(visitor, &sig.decl); } TraitItemKind::Method(ref sig, Some(ref body)) => { diff --git a/src/libsyntax_ext/proc_macro_server.rs b/src/libsyntax_ext/proc_macro_server.rs index 4c4b33c04422..a7ac95ba9ef5 100644 --- a/src/libsyntax_ext/proc_macro_server.rs +++ b/src/libsyntax_ext/proc_macro_server.rs @@ -12,7 +12,6 @@ use syntax::ast; use syntax::ext::base::ExtCtxt; use syntax::parse::lexer::comments; use syntax::parse::{self, token, ParseSess}; -use syntax::parse::parser::emit_unclosed_delims; use syntax::tokenstream::{self, DelimSpan, IsJoint::*, TokenStream, TreeAndJoint}; use syntax_pos::hygiene::{SyntaxContext, Transparency}; use syntax_pos::symbol::{keywords, Symbol}; @@ -410,14 +409,12 @@ impl server::TokenStream for Rustc<'_> { stream.is_empty() } fn from_str(&mut self, src: &str) -> Self::TokenStream { - let (tokens, errors) = parse::parse_stream_from_source_str( + parse::parse_stream_from_source_str( FileName::proc_macro_source_code(src.clone()), src.to_string(), self.sess, Some(self.call_site), - ); - emit_unclosed_delims(&errors, &self.sess.span_diagnostic); - tokens + ) } fn to_string(&mut self, stream: &Self::TokenStream) -> String { stream.to_string() diff --git a/src/libsyntax_ext/test.rs b/src/libsyntax_ext/test.rs index 371862465487..f4b625f8ea2c 100644 --- a/src/libsyntax_ext/test.rs +++ b/src/libsyntax_ext/test.rs @@ -257,7 +257,7 @@ fn has_test_signature(cx: &ExtCtxt<'_>, i: &ast::Item) -> bool { ); return false } - if header.asyncness.is_async() { + if header.asyncness.node.is_async() { sd.span_err( i.span, "async functions cannot be used for tests" diff --git a/src/libsyntax_pos/Cargo.toml b/src/libsyntax_pos/Cargo.toml index 5658451c54f7..691abffbbc1a 100644 --- a/src/libsyntax_pos/Cargo.toml +++ b/src/libsyntax_pos/Cargo.toml @@ -13,6 +13,6 @@ crate-type = ["dylib"] serialize = { path = "../libserialize" } rustc_data_structures = { path = "../librustc_data_structures" } arena = { path = "../libarena" } -scoped-tls = { version = "0.1.1", features = ["nightly"] } +scoped-tls = "1.0" unicode-width = "0.1.4" cfg-if = "0.1.2" diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 5c7fb1b80446..ea821a1d9392 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -366,6 +366,7 @@ pub struct TestOpts { pub list: bool, pub filter: Option, pub filter_exact: bool, + pub exclude_should_panic: bool, pub run_ignored: RunIgnored, pub run_tests: bool, pub bench_benchmarks: bool, @@ -385,6 +386,7 @@ impl TestOpts { list: false, filter: None, filter_exact: false, + exclude_should_panic: false, run_ignored: RunIgnored::No, run_tests: false, bench_benchmarks: false, @@ -406,6 +408,7 @@ fn optgroups() -> getopts::Options { let mut opts = getopts::Options::new(); opts.optflag("", "include-ignored", "Run ignored and not ignored tests") .optflag("", "ignored", "Run only ignored tests") + .optflag("", "exclude-should-panic", "Excludes tests marked as should_panic") .optflag("", "test", "Run tests and not benchmarks") .optflag("", "bench", "Run benchmarks instead of tests") .optflag("", "list", "List all tests and benchmarks") @@ -558,6 +561,13 @@ pub fn parse_opts(args: &[String]) -> Option { None }; + let exclude_should_panic = matches.opt_present("exclude-should-panic"); + if !allow_unstable && exclude_should_panic { + return Some(Err( + "The \"exclude-should-panic\" flag is only accepted on the nightly compiler".into(), + )); + } + let include_ignored = matches.opt_present("include-ignored"); if !allow_unstable && include_ignored { return Some(Err( @@ -648,6 +658,7 @@ pub fn parse_opts(args: &[String]) -> Option { list, filter, filter_exact: exact, + exclude_should_panic, run_ignored, run_tests, bench_benchmarks, @@ -1365,6 +1376,11 @@ pub fn filter_tests(opts: &TestOpts, tests: Vec) -> Vec { @@ -1983,6 +1999,29 @@ mod tests { assert!(!filtered[1].desc.ignore); } + #[test] + pub fn exclude_should_panic_option() { + let mut opts = TestOpts::new(); + opts.run_tests = true; + opts.exclude_should_panic = true; + + let mut tests = one_ignored_one_unignored_test(); + tests.push(TestDescAndFn { + desc: TestDesc { + name: StaticTestName("3"), + ignore: false, + should_panic: ShouldPanic::Yes, + allow_fail: false, + }, + testfn: DynTestFn(Box::new(move || {})), + }); + + let filtered = filter_tests(&opts, tests); + + assert_eq!(filtered.len(), 2); + assert!(filtered.iter().all(|test| test.desc.should_panic == ShouldPanic::No)); + } + #[test] pub fn exact_filter_match() { fn tests() -> Vec { diff --git a/src/llvm-project b/src/llvm-project index 73a75d35b977..38ad31bde8ff 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit 73a75d35b9776d56160fa3200aca4a970ae49b60 +Subproject commit 38ad31bde8ff681d862dc0f96930a5dd9b7a472e diff --git a/src/rustc/rustc.rs b/src/rustc/rustc.rs index fef6b830040b..626fceb58143 100644 --- a/src/rustc/rustc.rs +++ b/src/rustc/rustc.rs @@ -1,14 +1,3 @@ -#![feature(link_args)] - -// Set the stack size at link time on Windows. See rustc_driver::in_rustc_thread -// for the rationale. -#[allow(unused_attributes)] -#[cfg_attr(all(windows, target_env = "msvc"), link_args = "/STACK:16777216")] -// We only build for msvc and gnu now, but we use a exhaustive condition here -// so we can expect either the stack size to be set or the build fails. -#[cfg_attr(all(windows, not(target_env = "msvc")), link_args = "-Wl,--stack,16777216")] -// Also, don't forget to set this for rustdoc. -extern {} fn main() { // Pull in jemalloc when enabled. diff --git a/src/stage0.txt b/src/stage0.txt index a93ee6bc604a..274c0f90442f 100644 --- a/src/stage0.txt +++ b/src/stage0.txt @@ -12,7 +12,7 @@ # source tarball for a stable release you'll likely see `1.x.0` for rustc and # `0.x.0` for Cargo where they were released on `date`. -date: 2019-02-17 +date: 2019-02-27 rustc: beta cargo: beta diff --git a/src/stdsimd b/src/stdsimd index 9a6069704408..359845eb7cae 160000 --- a/src/stdsimd +++ b/src/stdsimd @@ -1 +1 @@ -Subproject commit 9a60697044088f6704a40da78dee25eb6d55fd6f +Subproject commit 359845eb7cae85799dc2ec81f2fb05da0aa6276d diff --git a/src/test/codegen/c-variadic-opt.rs b/src/test/codegen/c-variadic-opt.rs new file mode 100644 index 000000000000..8594d309b0a5 --- /dev/null +++ b/src/test/codegen/c-variadic-opt.rs @@ -0,0 +1,19 @@ +// compile-flags: -C opt-level=3 + +#![crate_type = "lib"] +#![feature(c_variadic)] +#![no_std] +use core::ffi::VaList; + +extern "C" { + fn vprintf(fmt: *const i8, ap: VaList) -> i32; +} + +// Ensure that `va_start` and `va_end` are properly injected even +// when the "spoofed" `VaList` is not used. +#[no_mangle] +pub unsafe extern "C" fn c_variadic_no_use(fmt: *const i8, mut ap: ...) -> i32 { + // CHECK: call void @llvm.va_start + vprintf(fmt, ap) + // CHECK: call void @llvm.va_end +} diff --git a/src/test/codegen/c-variadic.rs b/src/test/codegen/c-variadic.rs new file mode 100644 index 000000000000..09c18ed90b21 --- /dev/null +++ b/src/test/codegen/c-variadic.rs @@ -0,0 +1,69 @@ +// compile-flags: -C no-prepopulate-passes + +#![crate_type = "lib"] +#![feature(c_variadic)] +#![no_std] +use core::ffi::VaList; + +extern "C" { + fn foreign_c_variadic_0(_: i32, ...); + fn foreign_c_variadic_1(_: VaList, ...); +} + +pub unsafe extern "C" fn use_foreign_c_variadic_0() { + // Ensure that we correctly call foreign C-variadic functions. + // CHECK: invoke void (i32, ...) @foreign_c_variadic_0(i32 0) + foreign_c_variadic_0(0); + // CHECK: invoke void (i32, ...) @foreign_c_variadic_0(i32 0, i32 42) + foreign_c_variadic_0(0, 42i32); + // CHECK: invoke void (i32, ...) @foreign_c_variadic_0(i32 0, i32 42, i32 1024) + foreign_c_variadic_0(0, 42i32, 1024i32); + // CHECK: invoke void (i32, ...) @foreign_c_variadic_0(i32 0, i32 42, i32 1024, i32 0) + foreign_c_variadic_0(0, 42i32, 1024i32, 0i32); +} + +// Ensure that we do not remove the `va_list` passed to the foreign function when +// removing the "spoofed" `VaList` that is used by Rust defined C-variadics. +pub unsafe extern "C" fn use_foreign_c_variadic_1_0(ap: VaList) { + // CHECK: invoke void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap) + foreign_c_variadic_1(ap); +} + +pub unsafe extern "C" fn use_foreign_c_variadic_1_1(ap: VaList) { + // CHECK: invoke void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, i32 42) + foreign_c_variadic_1(ap, 42i32); +} +pub unsafe extern "C" fn use_foreign_c_variadic_1_2(ap: VaList) { + // CHECK: invoke void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, i32 2, i32 42) + foreign_c_variadic_1(ap, 2i32, 42i32); +} + +pub unsafe extern "C" fn use_foreign_c_variadic_1_3(ap: VaList) { + // CHECK: invoke void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, i32 2, i32 42, i32 0) + foreign_c_variadic_1(ap, 2i32, 42i32, 0i32); +} + +// Ensure that `va_start` and `va_end` are properly injected. +#[no_mangle] +pub unsafe extern "C" fn c_variadic(n: i32, mut ap: ...) -> i32 { + // CHECK: call void @llvm.va_start + let mut sum = 0; + for _ in 0..n { + sum += ap.arg::(); + } + sum + // CHECK: call void @llvm.va_end +} + +// Ensure that we generate the correct `call` signature when calling a Rust +// defined C-variadic. +pub unsafe fn test_c_variadic_call() { + // CHECK: call i32 (i32, ...) @c_variadic(i32 0) + c_variadic(0); + // CHECK: call i32 (i32, ...) @c_variadic(i32 0, i32 42) + c_variadic(0, 42i32); + // CHECK: call i32 (i32, ...) @c_variadic(i32 0, i32 42, i32 1024) + c_variadic(0, 42i32, 1024i32); + // CHECK: call i32 (i32, ...) @c_variadic(i32 0, i32 42, i32 1024, i32 0) + c_variadic(0, 42i32, 1024i32, 0i32); +} diff --git a/src/test/debuginfo/empty-string.rs b/src/test/debuginfo/empty-string.rs new file mode 100644 index 000000000000..8c5f67a66043 --- /dev/null +++ b/src/test/debuginfo/empty-string.rs @@ -0,0 +1,35 @@ +// ignore-windows failing on win32 bot +// ignore-android: FIXME(#10381) +// compile-flags:-g +// min-gdb-version: 7.7 +// min-lldb-version: 310 + +// === GDB TESTS =================================================================================== + +// gdb-command: run + +// gdb-command: print empty_string +// gdb-check:$1 = "" + +// gdb-command: print empty_str +// gdb-check:$2 = "" + +// === LLDB TESTS ================================================================================== + +// lldb-command: run + +// lldb-command: fr v empty_string +// lldb-check:[...]empty_string = "" + +// lldb-command: fr v empty_str +// lldb-check:[...]empty_str = "" + +fn main() { + let empty_string = String::new(); + + let empty_str = ""; + + zzz(); // #break +} + +fn zzz() {} diff --git a/src/test/debuginfo/generators.rs b/src/test/debuginfo/generators.rs index b56d222e0e01..35a67217f167 100644 --- a/src/test/debuginfo/generators.rs +++ b/src/test/debuginfo/generators.rs @@ -7,6 +7,8 @@ // gdb-command:run // gdb-command:print a // gdb-check:$1 = 5 +// gdb-command:print d +// gdb-check:$2 = 6 // === LLDB TESTS ================================================================================== @@ -14,8 +16,11 @@ // lldb-command:print a // lldbg-check:(int) $0 = 5 // lldbr-check:(int) a = 5 +// lldb-command:print d +// lldbg-check:(int) $1 = 6 +// lldbr-check:(int) d = 6 -#![feature(omit_gdb_pretty_printer_section, generators, generator_trait, pin)] +#![feature(omit_gdb_pretty_printer_section, generators, generator_trait)] #![omit_gdb_pretty_printer_section] use std::ops::Generator; @@ -24,9 +29,10 @@ use std::pin::Pin; fn main() { let mut a = 5; let mut b = || { + let d = 6; yield; _zzz(); // #break - a = 6; + a = d; }; Pin::new(&mut b).resume(); Pin::new(&mut b).resume(); diff --git a/src/test/incremental/cyclic-trait-hierarchy.rs b/src/test/incremental/cyclic-trait-hierarchy.rs new file mode 100644 index 000000000000..4102eb32580f --- /dev/null +++ b/src/test/incremental/cyclic-trait-hierarchy.rs @@ -0,0 +1,14 @@ +// Adapated from rust-lang/rust#58813 + +// revisions: rpass1 cfail2 + +#[cfg(rpass1)] +pub trait T2 { } +#[cfg(cfail2)] +pub trait T2: T1 { } +//[cfail2]~^ ERROR cycle detected when computing the supertraits of `T2` +//[cfail2]~| ERROR cycle detected when computing the supertraits of `T2` + +pub trait T1: T2 { } + +fn main() { } diff --git a/src/test/mir-opt/inline-closure-borrows-arg.rs b/src/test/mir-opt/inline-closure-borrows-arg.rs index 9f925e891c0d..d09ddce09c54 100644 --- a/src/test/mir-opt/inline-closure-borrows-arg.rs +++ b/src/test/mir-opt/inline-closure-borrows-arg.rs @@ -20,7 +20,7 @@ fn foo(_t: T, q: &i32) -> i32 { // ... // bb0: { // ... -// _3 = [closure@NodeId(53)]; +// _3 = [closure@HirId { owner: DefIndex(0:4), local_id: 27 }]; // ... // _4 = &_3; // ... diff --git a/src/test/mir-opt/inline-closure.rs b/src/test/mir-opt/inline-closure.rs index 68c88da9c029..436a8c20e2b4 100644 --- a/src/test/mir-opt/inline-closure.rs +++ b/src/test/mir-opt/inline-closure.rs @@ -16,7 +16,7 @@ fn foo(_t: T, q: i32) -> i32 { // ... // bb0: { // ... -// _3 = [closure@NodeId(39)]; +// _3 = [closure@HirId { owner: DefIndex(0:4), local_id: 11 }]; // ... // _4 = &_3; // ... diff --git a/src/test/mir-opt/retag.rs b/src/test/mir-opt/retag.rs index bb794409ae01..cdf635567378 100644 --- a/src/test/mir-opt/retag.rs +++ b/src/test/mir-opt/retag.rs @@ -98,7 +98,7 @@ fn main() { // } // END rustc.main.EraseRegions.after.mir // START rustc.main-{{closure}}.EraseRegions.after.mir -// fn main::{{closure}}(_1: &[closure@NodeId(124)], _2: &i32) -> &i32 { +// fn main::{{closure}}(_1: &[closure@HirId { owner: DefIndex(0:7), local_id: 70 }], _2: &i32) -> &i32 { // ... // bb0: { // Retag([fn entry] _1); diff --git a/src/test/pretty/fn-variadic.rs b/src/test/pretty/fn-variadic.rs new file mode 100644 index 000000000000..d499be424603 --- /dev/null +++ b/src/test/pretty/fn-variadic.rs @@ -0,0 +1,15 @@ +// Check that `fn foo(x: i32, ...)` does not print as `fn foo(x: i32, ..., ...)`. +// See issue #58853. + +// pp-exact +#![feature(c_variadic)] + +extern "C" { + pub fn foo(x: i32, ...); +} + +pub unsafe extern "C" fn bar(_: i32, mut ap: ...) -> usize { + ap.arg::() +} + +fn main() { } diff --git a/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/checkrust.rs b/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/checkrust.rs index d55aac1e40f4..96a238afaec0 100644 --- a/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/checkrust.rs +++ b/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/checkrust.rs @@ -18,8 +18,10 @@ macro_rules! continue_if { unsafe fn compare_c_str(ptr: *const c_char, val: &str) -> bool { let cstr0 = CStr::from_ptr(ptr); - let cstr1 = CString::new(val).unwrap(); - &*cstr1 == cstr0 + match CString::new(val) { + Ok(cstr1) => &*cstr1 == cstr0, + Err(_) => false, + } } #[no_mangle] @@ -68,3 +70,24 @@ pub unsafe extern "C" fn check_list_copy_0(mut ap: VaList) -> usize { } }) } + +#[no_mangle] +pub unsafe extern "C" fn check_varargs_0(_: c_int, mut ap: ...) -> usize { + continue_if!(ap.arg::() == 42); + continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Hello, World!")); + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn check_varargs_1(_: c_int, mut ap: ...) -> usize { + continue_if!(ap.arg::().floor() == 3.14f64.floor()); + continue_if!(ap.arg::() == 12); + continue_if!(ap.arg::() == 'A' as c_char); + continue_if!(ap.arg::() == 1); + 0 +} + +#[no_mangle] +pub unsafe extern "C" fn check_varargs_2(_: c_int, mut ap: ...) -> usize { + 0 +} diff --git a/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/test.c b/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/test.c index 95cf0ef46ca1..91b060dce26f 100644 --- a/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/test.c +++ b/src/test/run-make-fulldeps/c-link-to-rust-va-list-fn/test.c @@ -8,6 +8,9 @@ extern size_t check_list_0(va_list ap); extern size_t check_list_1(va_list ap); extern size_t check_list_2(va_list ap); extern size_t check_list_copy_0(va_list ap); +extern size_t check_varargs_0(int fixed, ...); +extern size_t check_varargs_1(int fixed, ...); +extern size_t check_varargs_2(int fixed, ...); int test_rust(size_t (*fn)(va_list), ...) { size_t ret = 0; @@ -26,5 +29,12 @@ int main(int argc, char* argv[]) { assert(test_rust(check_list_2, 3.14, 12l, 'a', 6.28, "Hello", 42, "World") == 0); assert(test_rust(check_list_copy_0, 6.28, 16, 'A', "Skip Me!", "Correct") == 0); + + assert(check_varargs_0(0, 42, "Hello, World!") == 0); + + assert(check_varargs_1(0, 3.14, 12l, 'A', 0x1LL) == 0); + + assert(check_varargs_2(0, "All", "of", "these", "are", "ignored", ".") == 0); + return 0; } diff --git a/src/test/run-make-fulldeps/cross-lang-lto-clang/Makefile b/src/test/run-make-fulldeps/cross-lang-lto-clang/Makefile index b3c5fb2d7964..3f74a17e0bb9 100644 --- a/src/test/run-make-fulldeps/cross-lang-lto-clang/Makefile +++ b/src/test/run-make-fulldeps/cross-lang-lto-clang/Makefile @@ -9,17 +9,17 @@ all: cpp-executable rust-executable cpp-executable: $(RUSTC) -Clinker-plugin-lto=on -o $(TMPDIR)/librustlib-xlto.a -Copt-level=2 -Ccodegen-units=1 ./rustlib.rs - $(CLANG) -flto=thin -fuse-ld=lld -L $(TMPDIR) -lrustlib-xlto -o $(TMPDIR)/cmain ./cmain.c -O3 + $(LD_LIB_PATH_ENVVAR)=$(REAL_LD_LIBRARY_PATH) $(CLANG) -flto=thin -fuse-ld=lld -L $(TMPDIR) -lrustlib-xlto -o $(TMPDIR)/cmain ./cmain.c -O3 # Make sure we don't find a call instruction to the function we expect to # always be inlined. - llvm-objdump -d $(TMPDIR)/cmain | $(CGREP) -v -e "call.*rust_always_inlined" + $(LD_LIB_PATH_ENVVAR)=$(REAL_LD_LIBRARY_PATH) llvm-objdump -d $(TMPDIR)/cmain | $(CGREP) -v -e "call.*rust_always_inlined" # As a sanity check, make sure we do find a call instruction to a # non-inlined function - llvm-objdump -d $(TMPDIR)/cmain | $(CGREP) -e "call.*rust_never_inlined" + $(LD_LIB_PATH_ENVVAR)=$(REAL_LD_LIBRARY_PATH) llvm-objdump -d $(TMPDIR)/cmain | $(CGREP) -e "call.*rust_never_inlined" rust-executable: - $(CLANG) ./clib.c -flto=thin -c -o $(TMPDIR)/clib.o -O2 + $(LD_LIB_PATH_ENVVAR)=$(REAL_LD_LIBRARY_PATH) $(CLANG) ./clib.c -flto=thin -c -o $(TMPDIR)/clib.o -O2 (cd $(TMPDIR); $(AR) crus ./libxyz.a ./clib.o) $(RUSTC) -Clinker-plugin-lto=on -L$(TMPDIR) -Copt-level=2 -Clinker=$(CLANG) -Clink-arg=-fuse-ld=lld ./main.rs -o $(TMPDIR)/rsmain - llvm-objdump -d $(TMPDIR)/rsmain | $(CGREP) -e "call.*c_never_inlined" - llvm-objdump -d $(TMPDIR)/rsmain | $(CGREP) -v -e "call.*c_always_inlined" + $(LD_LIB_PATH_ENVVAR)=$(REAL_LD_LIBRARY_PATH) llvm-objdump -d $(TMPDIR)/rsmain | $(CGREP) -e "call.*c_never_inlined" + $(LD_LIB_PATH_ENVVAR)=$(REAL_LD_LIBRARY_PATH) llvm-objdump -d $(TMPDIR)/rsmain | $(CGREP) -v -e "call.*c_always_inlined" diff --git a/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs b/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs index 51891ed53877..641ff18d37e9 100644 --- a/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs +++ b/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs @@ -7,12 +7,13 @@ extern crate rustc_codegen_utils; use std::any::Any; use std::sync::mpsc; use syntax::symbol::Symbol; -use rustc::session::{Session, CompileIncomplete}; +use rustc::session::Session; use rustc::session::config::OutputFilenames; use rustc::ty::TyCtxt; use rustc::ty::query::Providers; use rustc::middle::cstore::MetadataLoader; use rustc::dep_graph::DepGraph; +use rustc::util::common::ErrorReported; use rustc_codegen_utils::codegen_backend::{CodegenBackend, MetadataOnlyCodegenBackend}; struct TheBackend(Box); @@ -46,7 +47,7 @@ impl CodegenBackend for TheBackend { sess: &Session, _dep_graph: &DepGraph, outputs: &OutputFilenames, - ) -> Result<(), CompileIncomplete> { + ) -> Result<(), ErrorReported> { use std::io::Write; use rustc::session::config::CrateType; use rustc_codegen_utils::link::out_filename; diff --git a/src/test/run-make-fulldeps/issue-19371/foo.rs b/src/test/run-make-fulldeps/issue-19371/foo.rs index b8461c568c86..0cbdf40e2f90 100644 --- a/src/test/run-make-fulldeps/issue-19371/foo.rs +++ b/src/test/run-make-fulldeps/issue-19371/foo.rs @@ -1,24 +1,16 @@ #![feature(rustc_private)] extern crate rustc; -extern crate rustc_driver; -extern crate rustc_lint; -extern crate rustc_metadata; -extern crate rustc_errors; -extern crate rustc_codegen_utils; +extern crate rustc_interface; extern crate syntax; -use rustc::session::{build_session, Session}; +use rustc::session::DiagnosticOutput; use rustc::session::config::{Input, Options, OutputType, OutputTypes}; -use rustc_driver::driver::{self, compile_input, CompileController}; -use rustc_metadata::cstore::CStore; -use rustc_errors::registry::Registry; +use rustc_interface::interface; use syntax::source_map::FileName; -use rustc_codegen_utils::codegen_backend::CodegenBackend; use std::path::PathBuf; -use std::rc::Rc; fn main() { let src = r#" @@ -42,39 +34,33 @@ fn main() { compile(src.to_string(), tmpdir.join("out"), sysroot.clone()); } -fn basic_sess(opts: Options) -> (Session, Rc, Box) { - let descriptions = Registry::new(&rustc::DIAGNOSTICS); - let sess = build_session(opts, None, descriptions); - let codegen_backend = rustc_driver::get_codegen_backend(&sess); - let cstore = Rc::new(CStore::new(codegen_backend.metadata_loader())); - rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess)); - (sess, cstore, codegen_backend) -} - fn compile(code: String, output: PathBuf, sysroot: PathBuf) { - syntax::with_globals(|| { - let mut opts = Options::default(); - opts.output_types = OutputTypes::new(&[(OutputType::Exe, None)]); - opts.maybe_sysroot = Some(sysroot); - if let Ok(linker) = std::env::var("RUSTC_LINKER") { - opts.cg.linker = Some(linker.into()); - } - driver::spawn_thread_pool(opts, |opts| { - let (sess, cstore, codegen_backend) = basic_sess(opts); - let control = CompileController::basic(); - let name = FileName::anon_source_code(&code); - let input = Input::Str { name, input: code }; - let _ = compile_input( - codegen_backend, - &sess, - &cstore, - &None, - &input, - &None, - &Some(output), - None, - &control - ); - }); + let mut opts = Options::default(); + opts.output_types = OutputTypes::new(&[(OutputType::Exe, None)]); + opts.maybe_sysroot = Some(sysroot); + + if let Ok(linker) = std::env::var("RUSTC_LINKER") { + opts.cg.linker = Some(linker.into()); + } + + let name = FileName::anon_source_code(&code); + let input = Input::Str { name, input: code }; + + let config = interface::Config { + opts, + crate_cfg: Default::default(), + input, + input_path: None, + output_file: Some(output), + output_dir: None, + file_loader: None, + diagnostic_output: DiagnosticOutput::Default, + stderr: None, + crate_name: None, + lint_caps: Default::default(), + }; + + interface::run_compiler(config, |compiler| { + compiler.compile().ok(); }); } diff --git a/src/test/run-make-fulldeps/treat-err-as-bug/Makefile b/src/test/run-make-fulldeps/treat-err-as-bug/Makefile index f99e4611174c..9b3bcef2faf3 100644 --- a/src/test/run-make-fulldeps/treat-err-as-bug/Makefile +++ b/src/test/run-make-fulldeps/treat-err-as-bug/Makefile @@ -2,4 +2,4 @@ all: $(RUSTC) err.rs -Z treat-err-as-bug 2>&1 \ - | $(CGREP) "panicked at 'encountered error with \`-Z treat_err_as_bug'" + | $(CGREP) "panicked at 'aborting due to \`-Z treat-err-as-bug=1\`'" diff --git a/src/test/run-pass-fulldeps/compiler-calls.rs b/src/test/run-pass-fulldeps/compiler-calls.rs index d3a328300ba0..b4731bbaeb5c 100644 --- a/src/test/run-pass-fulldeps/compiler-calls.rs +++ b/src/test/run-pass-fulldeps/compiler-calls.rs @@ -1,91 +1,30 @@ -// Test that the CompilerCalls interface to the compiler works. +// Test that the Callbacks interface to the compiler works. // ignore-cross-compile // ignore-stage1 #![feature(rustc_private)] -extern crate getopts; -extern crate rustc; extern crate rustc_driver; -extern crate rustc_codegen_utils; -extern crate syntax; -extern crate rustc_errors as errors; -extern crate rustc_metadata; +extern crate rustc_interface; -use rustc::session::Session; -use rustc::session::config::{self, Input}; -use rustc_driver::{driver, CompilerCalls, Compilation}; -use rustc_codegen_utils::codegen_backend::CodegenBackend; -use rustc_metadata::cstore::CStore; -use syntax::ast; - -use std::path::PathBuf; +use rustc_interface::interface; struct TestCalls<'a> { count: &'a mut u32 } -impl<'a> CompilerCalls<'a> for TestCalls<'a> { - fn early_callback(&mut self, - _: &getopts::Matches, - _: &config::Options, - _: &ast::CrateConfig, - _: &errors::registry::Registry, - _: config::ErrorOutputType) - -> Compilation { +impl rustc_driver::Callbacks for TestCalls<'_> { + fn config(&mut self, _config: &mut interface::Config) { *self.count *= 2; - Compilation::Continue - } - - fn late_callback(&mut self, - _: &CodegenBackend, - _: &getopts::Matches, - _: &Session, - _: &CStore, - _: &Input, - _: &Option, - _: &Option) - -> Compilation { - *self.count *= 3; - Compilation::Stop - } - - fn some_input(&mut self, input: Input, input_path: Option) - -> (Input, Option) { - *self.count *= 5; - (input, input_path) - } - - fn no_input(&mut self, - _: &getopts::Matches, - _: &config::Options, - _: &ast::CrateConfig, - _: &Option, - _: &Option, - _: &errors::registry::Registry) - -> Option<(Input, Option)> { - panic!("This shouldn't happen"); - } - - fn build_controller(self: Box, - _: &Session, - _: &getopts::Matches) - -> driver::CompileController<'a> { - panic!("This shouldn't be called"); } } - fn main() { let mut count = 1; - { - let tc = TestCalls { count: &mut count }; - // we should never get use this filename, but lets make sure they are valid args. - let args = vec!["compiler-calls".to_string(), "foo.rs".to_string()]; - syntax::with_globals(|| { - rustc_driver::run_compiler(&args, Box::new(tc), None, None); - }); - } - assert_eq!(count, 30); + let args = vec!["compiler-calls".to_string(), "foo.rs".to_string()]; + rustc_driver::report_ices_to_stderr_if_any(|| { + rustc_driver::run_compiler(&args, &mut TestCalls { count: &mut count }, None, None).ok(); + }).ok(); + assert_eq!(count, 2); } diff --git a/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs b/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs index 956bc5ad862c..80e0b0102af7 100644 --- a/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs +++ b/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs @@ -112,7 +112,7 @@ fn iter_exprs(depth: usize, f: &mut FnMut(P)) { let decl = P(FnDecl { inputs: vec![], output: FunctionRetTy::Default(DUMMY_SP), - variadic: false, + c_variadic: false, }); iter_exprs(depth - 1, &mut |e| g( ExprKind::Closure(CaptureBy::Value, diff --git a/src/test/run-pass/consts/const-ptr-nonnull.rs b/src/test/run-pass/consts/const-ptr-nonnull.rs new file mode 100644 index 000000000000..91624e92fbe7 --- /dev/null +++ b/src/test/run-pass/consts/const-ptr-nonnull.rs @@ -0,0 +1,17 @@ +// run-pass + +#![feature(const_ptr_nonnull)] + +use std::ptr::NonNull; + +const DANGLING: NonNull = NonNull::dangling(); +const CASTED: NonNull = NonNull::cast(NonNull::::dangling()); + +fn ident(ident: T) -> T { + ident +} + +pub fn main() { + assert_eq!(DANGLING, ident(NonNull::dangling())); + assert_eq!(CASTED, ident(NonNull::dangling())); +} diff --git a/src/test/run-pass/consts/const-ptr-unique.rs b/src/test/run-pass/consts/const-ptr-unique.rs new file mode 100644 index 000000000000..eb371ab18416 --- /dev/null +++ b/src/test/run-pass/consts/const-ptr-unique.rs @@ -0,0 +1,15 @@ +// run-pass + +#![feature(ptr_internals)] + +use std::ptr::Unique; + +const PTR: *mut u32 = Unique::empty().as_ptr(); + +fn ident(ident: T) -> T { + ident +} + +pub fn main() { + assert_eq!(PTR, ident(Unique::::empty().as_ptr())); +} diff --git a/src/test/run-pass/generator/issue-57084.rs b/src/test/run-pass/generator/issue-57084.rs new file mode 100644 index 000000000000..8aaa6a0e427d --- /dev/null +++ b/src/test/run-pass/generator/issue-57084.rs @@ -0,0 +1,28 @@ +// This issue reproduces an ICE on compile (E.g. fails on 2018-12-19 nightly). +// "cannot relate bound region: ReLateBound(DebruijnIndex(1), BrAnon(1)) <= '_#1r" +// run-pass +// edition:2018 +#![feature(generators,generator_trait)] +use std::ops::Generator; + +fn with(f: F) -> impl Generator +where F: Fn() -> () +{ + move || { + loop { + match f() { + _ => yield, + } + } + } +} + +fn main() { + let data = &vec![1]; + || { + let _to_pin = with(move || println!("{:p}", data)); + loop { + yield + } + }; +} diff --git a/src/test/run-pass/generator/issue-58888.rs b/src/test/run-pass/generator/issue-58888.rs new file mode 100644 index 000000000000..43b37a9afc2c --- /dev/null +++ b/src/test/run-pass/generator/issue-58888.rs @@ -0,0 +1,27 @@ +// run-pass +// compile-flags: -g + +#![feature(generators, generator_trait)] + +use std::ops::Generator; + +struct Database; + +impl Database { + fn get_connection(&self) -> impl Iterator { + Some(()).into_iter() + } + + fn check_connection(&self) -> impl Generator + '_ { + move || { + let iter = self.get_connection(); + for i in iter { + yield i + } + } + } +} + +fn main() { + Database.check_connection(); +} diff --git a/src/test/run-pass/issues/issue-58212.rs b/src/test/run-pass/issues/issue-58212.rs new file mode 100644 index 000000000000..76437630309a --- /dev/null +++ b/src/test/run-pass/issues/issue-58212.rs @@ -0,0 +1,13 @@ +trait FromUnchecked { + unsafe fn from_unchecked(); +} + +impl FromUnchecked for [u8; 1] { + unsafe fn from_unchecked() { + let mut array: Self = std::mem::uninitialized(); + let _ptr = &mut array as *mut [u8] as *mut u8; + } +} + +fn main() { +} diff --git a/src/test/run-pass/issues/issue-58435-ice-with-assoc-const.rs b/src/test/run-pass/issues/issue-58435-ice-with-assoc-const.rs new file mode 100644 index 000000000000..94e2b2563df5 --- /dev/null +++ b/src/test/run-pass/issues/issue-58435-ice-with-assoc-const.rs @@ -0,0 +1,17 @@ +// The const-evaluator was at one point ICE'ing while trying to +// evaluate the body of `fn id` during the `s.id()` call in main. + +struct S(T); + +impl S { + const ID: fn(&S) -> &S = |s| s; + pub fn id(&self) -> &Self { + Self::ID(self) // This, plus call below ... + } +} + +fn main() { + let s = S(10u32); + assert!(S::::ID(&s).0 == 10); // Works fine + assert!(s.id().0 == 10); // ... causes compiler to panic +} diff --git a/src/test/run-pass/proc-macro/derive-b.rs b/src/test/run-pass/proc-macro/derive-b.rs index af48cabca99e..da67534364b6 100644 --- a/src/test/run-pass/proc-macro/derive-b.rs +++ b/src/test/run-pass/proc-macro/derive-b.rs @@ -1,7 +1,5 @@ // aux-build:derive-b.rs -#![feature(unrestricted_attribute_tokens)] - extern crate derive_b; #[derive(Debug, PartialEq, derive_b::B, Eq, Copy, Clone)] diff --git a/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcollections.rs b/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcollections.rs index 812cf89751ef..fd53bb607f79 100644 --- a/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcollections.rs +++ b/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcollections.rs @@ -53,6 +53,7 @@ fn main() { is_sync_send!(BTreeSet::::new(), union(&BTreeSet::::new())); all_sync_send!(HashMap::::new(), iter, iter_mut, drain, into_iter, keys, values); + is_sync_send!(HashMap::::new(), entry(0)); all_sync_send!(HashSet::::new(), iter, drain, into_iter); is_sync_send!(HashSet::::new(), difference(&HashSet::::new())); is_sync_send!(HashSet::::new(), symmetric_difference(&HashSet::::new())); diff --git a/src/test/run-pass/try-from-int-error-partial-eq.rs b/src/test/run-pass/try-from-int-error-partial-eq.rs index 83ede6759257..e9b53f2d1c8d 100644 --- a/src/test/run-pass/try-from-int-error-partial-eq.rs +++ b/src/test/run-pass/try-from-int-error-partial-eq.rs @@ -1,4 +1,3 @@ -#![feature(try_from)] #![allow(unused_must_use)] use std::convert::TryFrom; diff --git a/src/test/run-pass/try_from.rs b/src/test/run-pass/try_from.rs index 4522ce3a8d61..e42f2c3e3930 100644 --- a/src/test/run-pass/try_from.rs +++ b/src/test/run-pass/try_from.rs @@ -4,9 +4,9 @@ // This test was added to show the motivation for doing this // over `TryFrom` being blanket impl for all `T: From` -#![feature(try_from, never_type)] +#![feature(never_type)] -use std::convert::TryInto; +use std::convert::{TryInto, Infallible}; struct Foo { t: T, @@ -32,6 +32,6 @@ impl Into> for Foo { } pub fn main() { - let _: Result, !> = Foo { t: 10 }.try_into(); + let _: Result, Infallible> = Foo { t: 10 }.try_into(); } diff --git a/src/test/rustdoc-js/alias-1.js b/src/test/rustdoc-js-std/alias-1.js similarity index 100% rename from src/test/rustdoc-js/alias-1.js rename to src/test/rustdoc-js-std/alias-1.js diff --git a/src/test/rustdoc-js/alias-2.js b/src/test/rustdoc-js-std/alias-2.js similarity index 100% rename from src/test/rustdoc-js/alias-2.js rename to src/test/rustdoc-js-std/alias-2.js diff --git a/src/test/rustdoc-js/alias-3.js b/src/test/rustdoc-js-std/alias-3.js similarity index 100% rename from src/test/rustdoc-js/alias-3.js rename to src/test/rustdoc-js-std/alias-3.js diff --git a/src/test/rustdoc-js/alias.js b/src/test/rustdoc-js-std/alias.js similarity index 100% rename from src/test/rustdoc-js/alias.js rename to src/test/rustdoc-js-std/alias.js diff --git a/src/test/rustdoc-js-std/basic.js b/src/test/rustdoc-js-std/basic.js new file mode 100644 index 000000000000..824cac710833 --- /dev/null +++ b/src/test/rustdoc-js-std/basic.js @@ -0,0 +1,15 @@ +const QUERY = 'String'; + +const EXPECTED = { + 'others': [ + { 'path': 'std::string', 'name': 'String' }, + { 'path': 'std::ffi', 'name': 'CString' }, + { 'path': 'std::ffi', 'name': 'OsString' }, + ], + 'in_args': [ + { 'path': 'std::str', 'name': 'eq' }, + ], + 'returned': [ + { 'path': 'std::string::String', 'name': 'add' }, + ], +}; diff --git a/src/test/rustdoc-js/deduplication.js b/src/test/rustdoc-js-std/deduplication.js similarity index 100% rename from src/test/rustdoc-js/deduplication.js rename to src/test/rustdoc-js-std/deduplication.js diff --git a/src/test/rustdoc-js/enum-option.js b/src/test/rustdoc-js-std/enum-option.js similarity index 100% rename from src/test/rustdoc-js/enum-option.js rename to src/test/rustdoc-js-std/enum-option.js diff --git a/src/test/rustdoc-js/filter-crate.js b/src/test/rustdoc-js-std/filter-crate.js similarity index 100% rename from src/test/rustdoc-js/filter-crate.js rename to src/test/rustdoc-js-std/filter-crate.js diff --git a/src/test/rustdoc-js/fn-forget.js b/src/test/rustdoc-js-std/fn-forget.js similarity index 100% rename from src/test/rustdoc-js/fn-forget.js rename to src/test/rustdoc-js-std/fn-forget.js diff --git a/src/test/rustdoc-js/from_u.js b/src/test/rustdoc-js-std/from_u.js similarity index 100% rename from src/test/rustdoc-js/from_u.js rename to src/test/rustdoc-js-std/from_u.js diff --git a/src/test/rustdoc-js/keyword.js b/src/test/rustdoc-js-std/keyword.js similarity index 100% rename from src/test/rustdoc-js/keyword.js rename to src/test/rustdoc-js-std/keyword.js diff --git a/src/test/rustdoc-js/macro-check.js b/src/test/rustdoc-js-std/macro-check.js similarity index 100% rename from src/test/rustdoc-js/macro-check.js rename to src/test/rustdoc-js-std/macro-check.js diff --git a/src/test/rustdoc-js/macro-print.js b/src/test/rustdoc-js-std/macro-print.js similarity index 100% rename from src/test/rustdoc-js/macro-print.js rename to src/test/rustdoc-js-std/macro-print.js diff --git a/src/test/rustdoc-js/multi-query.js b/src/test/rustdoc-js-std/multi-query.js similarity index 100% rename from src/test/rustdoc-js/multi-query.js rename to src/test/rustdoc-js-std/multi-query.js diff --git a/src/test/rustdoc-js/never.js b/src/test/rustdoc-js-std/never.js similarity index 100% rename from src/test/rustdoc-js/never.js rename to src/test/rustdoc-js-std/never.js diff --git a/src/test/rustdoc-js/quoted.js b/src/test/rustdoc-js-std/quoted.js similarity index 100% rename from src/test/rustdoc-js/quoted.js rename to src/test/rustdoc-js-std/quoted.js diff --git a/src/test/rustdoc-js/should-fail.js b/src/test/rustdoc-js-std/should-fail.js similarity index 100% rename from src/test/rustdoc-js/should-fail.js rename to src/test/rustdoc-js-std/should-fail.js diff --git a/src/test/rustdoc-js/string-from_ut.js b/src/test/rustdoc-js-std/string-from_ut.js similarity index 100% rename from src/test/rustdoc-js/string-from_ut.js rename to src/test/rustdoc-js-std/string-from_ut.js diff --git a/src/test/rustdoc-js/struct-vec.js b/src/test/rustdoc-js-std/struct-vec.js similarity index 100% rename from src/test/rustdoc-js/struct-vec.js rename to src/test/rustdoc-js-std/struct-vec.js diff --git a/src/test/rustdoc-js/vec-new.js b/src/test/rustdoc-js-std/vec-new.js similarity index 100% rename from src/test/rustdoc-js/vec-new.js rename to src/test/rustdoc-js-std/vec-new.js diff --git a/src/test/rustdoc-js/basic.js b/src/test/rustdoc-js/basic.js index 824cac710833..d99b23468b60 100644 --- a/src/test/rustdoc-js/basic.js +++ b/src/test/rustdoc-js/basic.js @@ -1,15 +1,7 @@ -const QUERY = 'String'; +const QUERY = 'Fo'; const EXPECTED = { 'others': [ - { 'path': 'std::string', 'name': 'String' }, - { 'path': 'std::ffi', 'name': 'CString' }, - { 'path': 'std::ffi', 'name': 'OsString' }, - ], - 'in_args': [ - { 'path': 'std::str', 'name': 'eq' }, - ], - 'returned': [ - { 'path': 'std::string::String', 'name': 'add' }, + { 'path': 'basic', 'name': 'Foo' }, ], }; diff --git a/src/test/rustdoc-js/basic.rs b/src/test/rustdoc-js/basic.rs new file mode 100644 index 000000000000..1b4963fcebea --- /dev/null +++ b/src/test/rustdoc-js/basic.rs @@ -0,0 +1,2 @@ +/// Foo +pub struct Foo; diff --git a/src/test/rustdoc-ui/coverage/basic.rs b/src/test/rustdoc-ui/coverage/basic.rs new file mode 100644 index 000000000000..4247fdf98955 --- /dev/null +++ b/src/test/rustdoc-ui/coverage/basic.rs @@ -0,0 +1,50 @@ +// compile-flags:-Z unstable-options --show-coverage +// compile-pass + +#![feature(extern_types)] + +//! Make sure to have some docs on your crate root + +/// This struct is documented, but its fields are not. +/// +/// However, one field is private, so it shouldn't show in the total. +pub struct SomeStruct { + pub some_field: usize, + other_field: usize, +} + +impl SomeStruct { + /// Method with docs + pub fn this_fn(&self) {} + + // Method without docs + pub fn other_method(&self) {} +} + +// struct without docs +pub struct OtherStruct; + +// function with no docs +pub fn some_fn() {} + +/// Function with docs +pub fn other_fn() {} + +pub enum SomeEnum { + /// Some of these variants are documented... + VarOne, + /// ...but some of them are not. + VarTwo, + // (like this one) + VarThree, +} + +/// There's a macro here, too +#[macro_export] +macro_rules! some_macro { + () => {}; +} + +extern { + pub type ExternType; +} diff --git a/src/test/rustdoc-ui/coverage/basic.stdout b/src/test/rustdoc-ui/coverage/basic.stdout new file mode 100644 index 000000000000..3e9166063162 --- /dev/null +++ b/src/test/rustdoc-ui/coverage/basic.stdout @@ -0,0 +1,7 @@ ++-------------------------------------+------------+------------+------------+ +| File | Documented | Total | Percentage | ++-------------------------------------+------------+------------+------------+ +| ...est/rustdoc-ui/coverage/basic.rs | 7 | 14 | 50.0% | ++-------------------------------------+------------+------------+------------+ +| Total | 7 | 14 | 50.0% | ++-------------------------------------+------------+------------+------------+ diff --git a/src/test/rustdoc-ui/coverage/empty.rs b/src/test/rustdoc-ui/coverage/empty.rs new file mode 100644 index 000000000000..463617a1143d --- /dev/null +++ b/src/test/rustdoc-ui/coverage/empty.rs @@ -0,0 +1,4 @@ +// compile-flags:-Z unstable-options --show-coverage +// compile-pass + +// an empty crate still has one item to document: the crate root diff --git a/src/test/rustdoc-ui/coverage/empty.stdout b/src/test/rustdoc-ui/coverage/empty.stdout new file mode 100644 index 000000000000..11b514fbfeae --- /dev/null +++ b/src/test/rustdoc-ui/coverage/empty.stdout @@ -0,0 +1,7 @@ ++-------------------------------------+------------+------------+------------+ +| File | Documented | Total | Percentage | ++-------------------------------------+------------+------------+------------+ +| ...est/rustdoc-ui/coverage/empty.rs | 0 | 1 | 0.0% | ++-------------------------------------+------------+------------+------------+ +| Total | 0 | 1 | 0.0% | ++-------------------------------------+------------+------------+------------+ diff --git a/src/test/rustdoc-ui/coverage/enums.rs b/src/test/rustdoc-ui/coverage/enums.rs new file mode 100644 index 000000000000..5cd7f490d1a9 --- /dev/null +++ b/src/test/rustdoc-ui/coverage/enums.rs @@ -0,0 +1,22 @@ +// compile-flags:-Z unstable-options --show-coverage +// compile-pass + +//! (remember the crate root is still a module) + +/// so check out this enum here +pub enum ThisEnum { + /// this variant has some weird stuff going on + VarOne { + /// like, it has some named fields inside + field_one: usize, + // (these show up as struct fields) + field_two: usize, + }, + /// here's another variant for you + VarTwo(String), + // but not all of them need to be documented as thoroughly + VarThree, +} + +/// uninhabited enums? sure, let's throw one of those around +pub enum OtherEnum {} diff --git a/src/test/rustdoc-ui/coverage/enums.stdout b/src/test/rustdoc-ui/coverage/enums.stdout new file mode 100644 index 000000000000..87e2ad9f20df --- /dev/null +++ b/src/test/rustdoc-ui/coverage/enums.stdout @@ -0,0 +1,7 @@ ++-------------------------------------+------------+------------+------------+ +| File | Documented | Total | Percentage | ++-------------------------------------+------------+------------+------------+ +| ...est/rustdoc-ui/coverage/enums.rs | 6 | 8 | 75.0% | ++-------------------------------------+------------+------------+------------+ +| Total | 6 | 8 | 75.0% | ++-------------------------------------+------------+------------+------------+ diff --git a/src/test/rustdoc-ui/coverage/exotic.rs b/src/test/rustdoc-ui/coverage/exotic.rs new file mode 100644 index 000000000000..b4adf45b90b8 --- /dev/null +++ b/src/test/rustdoc-ui/coverage/exotic.rs @@ -0,0 +1,15 @@ +// compile-flags:-Z unstable-options --show-coverage +// compile-pass + +#![feature(doc_keyword)] + +//! the features only used in std also have entries in the table, so make sure those get pulled out +//! properly as well + +/// woo, check it out, we can write our own primitive docs lol +#[doc(primitive="unit")] +mod prim_unit {} + +/// keywords? sure, pile them on +#[doc(keyword="where")] +mod where_keyword {} diff --git a/src/test/rustdoc-ui/coverage/exotic.stdout b/src/test/rustdoc-ui/coverage/exotic.stdout new file mode 100644 index 000000000000..2bacfcfcecab --- /dev/null +++ b/src/test/rustdoc-ui/coverage/exotic.stdout @@ -0,0 +1,8 @@ ++-------------------------------------+------------+------------+------------+ +| File | Documented | Total | Percentage | ++-------------------------------------+------------+------------+------------+ +| ...st/rustdoc-ui/coverage/exotic.rs | 1 | 1 | 100.0% | +| | 2 | 2 | 100.0% | ++-------------------------------------+------------+------------+------------+ +| Total | 3 | 3 | 100.0% | ++-------------------------------------+------------+------------+------------+ diff --git a/src/test/rustdoc-ui/coverage/private.rs b/src/test/rustdoc-ui/coverage/private.rs new file mode 100644 index 000000000000..9024185856da --- /dev/null +++ b/src/test/rustdoc-ui/coverage/private.rs @@ -0,0 +1,21 @@ +// compile-flags:-Z unstable-options --show-coverage --document-private-items +// compile-pass + +#![allow(unused)] + +//! when `--document-private-items` is passed, nothing is safe. everything must have docs or your +//! score will suffer the consequences + +mod this_mod { + fn private_fn() {} +} + +/// See, our public items have docs! +pub struct SomeStruct { + /// Look, all perfectly documented! + pub field: usize, + other: usize, +} + +/// Nothing shady going on here. Just a bunch of well-documented code. (cough) +pub fn public_fn() {} diff --git a/src/test/rustdoc-ui/coverage/private.stdout b/src/test/rustdoc-ui/coverage/private.stdout new file mode 100644 index 000000000000..0d4c7c68fd05 --- /dev/null +++ b/src/test/rustdoc-ui/coverage/private.stdout @@ -0,0 +1,7 @@ ++-------------------------------------+------------+------------+------------+ +| File | Documented | Total | Percentage | ++-------------------------------------+------------+------------+------------+ +| ...t/rustdoc-ui/coverage/private.rs | 4 | 7 | 57.1% | ++-------------------------------------+------------+------------+------------+ +| Total | 4 | 7 | 57.1% | ++-------------------------------------+------------+------------+------------+ diff --git a/src/test/rustdoc-ui/coverage/statics-consts.rs b/src/test/rustdoc-ui/coverage/statics-consts.rs new file mode 100644 index 000000000000..3c1dd35dfe1a --- /dev/null +++ b/src/test/rustdoc-ui/coverage/statics-consts.rs @@ -0,0 +1,23 @@ +// compile-flags:-Z unstable-options --show-coverage +// compile-pass + +//! gotta make sure we can count statics and consts correctly, too + +/// static like electricity, right? +pub static THIS_STATIC: usize = 0; + +/// (it's not electricity, is it) +pub const THIS_CONST: usize = 1; + +/// associated consts show up separately, but let's throw them in as well +pub trait SomeTrait { + /// just like that, yeah + const ASSOC_CONST: usize; +} + +pub struct SomeStruct; + +impl SomeStruct { + /// wait, structs can have them too, can't forget those + pub const ASSOC_CONST: usize = 100; +} diff --git a/src/test/rustdoc-ui/coverage/statics-consts.stdout b/src/test/rustdoc-ui/coverage/statics-consts.stdout new file mode 100644 index 000000000000..8459f90ae7b3 --- /dev/null +++ b/src/test/rustdoc-ui/coverage/statics-consts.stdout @@ -0,0 +1,7 @@ ++-------------------------------------+------------+------------+------------+ +| File | Documented | Total | Percentage | ++-------------------------------------+------------+------------+------------+ +| ...oc-ui/coverage/statics-consts.rs | 6 | 7 | 85.7% | ++-------------------------------------+------------+------------+------------+ +| Total | 6 | 7 | 85.7% | ++-------------------------------------+------------+------------+------------+ diff --git a/src/test/rustdoc-ui/coverage/traits.rs b/src/test/rustdoc-ui/coverage/traits.rs new file mode 100644 index 000000000000..5f32d5b0cccc --- /dev/null +++ b/src/test/rustdoc-ui/coverage/traits.rs @@ -0,0 +1,37 @@ +// compile-flags:-Z unstable-options --show-coverage +// compile-pass + +#![feature(trait_alias)] + +/// look at this trait right here +pub trait ThisTrait { + /// that's a trait all right + fn right_here(&self); + + /// even the provided functions show up as trait methods + fn aww_yeah(&self) {} + + /// gotta check those associated types, they're slippery + type SomeType; +} + +/// so what happens if we take some struct... +pub struct SomeStruct; + +/// ...and slap this trait on it? +impl ThisTrait for SomeStruct { + /// nothing! trait impls are totally ignored in this calculation, sorry. + fn right_here(&self) {} + + type SomeType = String; +} + +/// but what about those aliases? i hear they're pretty exotic +pub trait MyAlias = ThisTrait + Send + Sync; + +// FIXME(58624): once rustdoc can process existential types, we need to make sure they're counted +// /// woah, getting all existential in here +// pub existential type ThisExists: ThisTrait; +// +// /// why don't we get a little more concrete +// pub fn defines() -> ThisExists { SomeStruct {} } diff --git a/src/test/rustdoc-ui/coverage/traits.stdout b/src/test/rustdoc-ui/coverage/traits.stdout new file mode 100644 index 000000000000..e347a4da0b97 --- /dev/null +++ b/src/test/rustdoc-ui/coverage/traits.stdout @@ -0,0 +1,7 @@ ++-------------------------------------+------------+------------+------------+ +| File | Documented | Total | Percentage | ++-------------------------------------+------------+------------+------------+ +| ...st/rustdoc-ui/coverage/traits.rs | 6 | 7 | 85.7% | ++-------------------------------------+------------+------------+------------+ +| Total | 6 | 7 | 85.7% | ++-------------------------------------+------------+------------+------------+ diff --git a/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr b/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr index e18b9909f586..e0e45d55a9e7 100644 --- a/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr +++ b/src/test/rustdoc-ui/deny-intra-link-resolution-failure.stderr @@ -1,7 +1,7 @@ error: `[v2]` cannot be resolved, ignoring it... --> $DIR/deny-intra-link-resolution-failure.rs:3:6 | -LL | /// [v2] //~ ERROR +LL | /// [v2] | ^^ cannot be resolved, ignoring | note: lint level defined here @@ -11,3 +11,5 @@ LL | #![deny(intra_doc_link_resolution_failure)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` +error: aborting due to previous error + diff --git a/src/test/rustdoc-ui/deny-missing-docs-crate.stderr b/src/test/rustdoc-ui/deny-missing-docs-crate.stderr index 1cfd6092cb3a..9cd50d26766e 100644 --- a/src/test/rustdoc-ui/deny-missing-docs-crate.stderr +++ b/src/test/rustdoc-ui/deny-missing-docs-crate.stderr @@ -1,22 +1,22 @@ error: missing documentation for crate --> $DIR/deny-missing-docs-crate.rs:1:1 | -LL | / #![deny(missing_docs)] //~ ERROR +LL | / #![deny(missing_docs)] LL | | -LL | | pub struct Foo; //~ ERROR +LL | | pub struct Foo; | |_______________^ | note: lint level defined here --> $DIR/deny-missing-docs-crate.rs:1:9 | -LL | #![deny(missing_docs)] //~ ERROR +LL | #![deny(missing_docs)] | ^^^^^^^^^^^^ error: missing documentation for a struct --> $DIR/deny-missing-docs-crate.rs:3:1 | -LL | pub struct Foo; //~ ERROR +LL | pub struct Foo; | ^^^^^^^^^^^^^^^ -error: Compilation failed, aborting rustdoc +error: aborting due to 2 previous errors diff --git a/src/test/rustdoc-ui/deny-missing-docs-macro.stderr b/src/test/rustdoc-ui/deny-missing-docs-macro.stderr index b87e60d8269e..ef15bf05d54e 100644 --- a/src/test/rustdoc-ui/deny-missing-docs-macro.stderr +++ b/src/test/rustdoc-ui/deny-missing-docs-macro.stderr @@ -1,7 +1,7 @@ error: missing documentation for macro --> $DIR/deny-missing-docs-macro.rs:6:1 | -LL | macro_rules! foo { //~ ERROR +LL | macro_rules! foo { | ^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -10,5 +10,5 @@ note: lint level defined here LL | #![deny(missing_docs)] | ^^^^^^^^^^^^ -error: Compilation failed, aborting rustdoc +error: aborting due to previous error diff --git a/src/test/rustdoc-ui/doc-without-codeblock.stderr b/src/test/rustdoc-ui/doc-without-codeblock.stderr index c07965a6ab96..208bdedf24dd 100644 --- a/src/test/rustdoc-ui/doc-without-codeblock.stderr +++ b/src/test/rustdoc-ui/doc-without-codeblock.stderr @@ -24,3 +24,5 @@ error: Missing code example in this documentation LL | /// Or maybe not because she saved herself! | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +error: aborting due to 4 previous errors + diff --git a/src/test/rustdoc-ui/failed-doctest-output.stdout b/src/test/rustdoc-ui/failed-doctest-output.stdout index b7617ec556d2..c9f59405ce01 100644 --- a/src/test/rustdoc-ui/failed-doctest-output.stdout +++ b/src/test/rustdoc-ui/failed-doctest-output.stdout @@ -12,7 +12,10 @@ error[E0425]: cannot find value `no` in this scope 3 | no | ^^ not found in this scope -thread '$DIR/failed-doctest-output.rs - OtherStruct (line 17)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:351:13 +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0425`. +thread '$DIR/failed-doctest-output.rs - OtherStruct (line 17)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:310:13 note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace. ---- $DIR/failed-doctest-output.rs - SomeStruct (line 11) stdout ---- @@ -21,7 +24,7 @@ thread '$DIR/failed-doctest-output.rs - SomeStruct (line 11)' panicked at 'test thread 'main' panicked at 'oh no', $DIR/failed-doctest-output.rs:3:1 note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace. -', src/librustdoc/test.rs:372:17 +', src/librustdoc/test.rs:332:17 failures: diff --git a/src/test/rustdoc-ui/intra-doc-alias-ice.stderr b/src/test/rustdoc-ui/intra-doc-alias-ice.stderr index ced56897e2a2..d273ec019752 100644 --- a/src/test/rustdoc-ui/intra-doc-alias-ice.stderr +++ b/src/test/rustdoc-ui/intra-doc-alias-ice.stderr @@ -1,7 +1,7 @@ error: `[TypeAlias::hoge]` cannot be resolved, ignoring it... --> $DIR/intra-doc-alias-ice.rs:5:30 | -LL | /// [broken cross-reference](TypeAlias::hoge) //~ ERROR +LL | /// [broken cross-reference](TypeAlias::hoge) | ^^^^^^^^^^^^^^^ cannot be resolved, ignoring | note: lint level defined here @@ -11,3 +11,5 @@ LL | #![deny(intra_doc_link_resolution_failure)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` +error: aborting due to previous error + diff --git a/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr b/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr index 4eb186106287..93c05a0c4dd2 100644 --- a/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr +++ b/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr @@ -11,3 +11,5 @@ LL | #![deny(intra_doc_link_resolution_failure)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` +error: aborting due to previous error + diff --git a/src/test/rustdoc-ui/intra-links-warning.stderr b/src/test/rustdoc-ui/intra-links-warning.stderr index e5409c042056..60fc131dbda1 100644 --- a/src/test/rustdoc-ui/intra-links-warning.stderr +++ b/src/test/rustdoc-ui/intra-links-warning.stderr @@ -105,8 +105,8 @@ LL | | /// [error] | = note: the link appears in this line: - [error] - ^^^^^ + [error] + ^^^^^ = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` warning: `[error1]` cannot be resolved, ignoring it... diff --git a/src/test/rustdoc-ui/issue-58473-2.rs b/src/test/rustdoc-ui/issue-58473-2.rs new file mode 100644 index 000000000000..5e5ddebe1088 --- /dev/null +++ b/src/test/rustdoc-ui/issue-58473-2.rs @@ -0,0 +1,12 @@ +// compile-pass + +#![deny(private_doc_tests)] + +mod foo { + /** + Does nothing, returns `()` + + yadda-yadda-yadda + */ + fn foo() {} +} diff --git a/src/test/rustdoc-ui/issue-58473.rs b/src/test/rustdoc-ui/issue-58473.rs new file mode 100644 index 000000000000..0e5be3292c05 --- /dev/null +++ b/src/test/rustdoc-ui/issue-58473.rs @@ -0,0 +1,10 @@ +// compile-pass + +pub trait Foo { + /** + Does nothing, returns `()` + + yadda-yadda-yadda + */ + fn foo() {} +} diff --git a/src/test/rustdoc-ui/lint-group.stderr b/src/test/rustdoc-ui/lint-group.stderr index 48ae7910b0f1..76a9133147ea 100644 --- a/src/test/rustdoc-ui/lint-group.stderr +++ b/src/test/rustdoc-ui/lint-group.stderr @@ -42,3 +42,5 @@ LL | #![deny(rustdoc)] | ^^^^^^^ = note: #[deny(missing_doc_code_examples)] implied by #[deny(rustdoc)] +error: aborting due to 3 previous errors + diff --git a/src/test/rustdoc-ui/private-item-doc-test.stderr b/src/test/rustdoc-ui/private-item-doc-test.stderr index 38062758e92c..20f3eb8b1202 100644 --- a/src/test/rustdoc-ui/private-item-doc-test.stderr +++ b/src/test/rustdoc-ui/private-item-doc-test.stderr @@ -14,3 +14,5 @@ note: lint level defined here LL | #![deny(private_doc_tests)] | ^^^^^^^^^^^^^^^^^ +error: aborting due to previous error + diff --git a/src/test/rustdoc/variadic.rs b/src/test/rustdoc/variadic.rs index bd8f1775b3d0..5af2aea21fca 100644 --- a/src/test/rustdoc/variadic.rs +++ b/src/test/rustdoc/variadic.rs @@ -1,4 +1,4 @@ extern "C" { - // @has variadic/fn.foo.html //pre 'pub unsafe extern "C" fn foo(x: i32, ...)' + // @has variadic/fn.foo.html //pre 'pub unsafe extern "C" fn foo(x: i32, _: ...)' pub fn foo(x: i32, ...); } diff --git a/src/test/ui-fulldeps/auxiliary/lint_tool_test.rs b/src/test/ui-fulldeps/auxiliary/lint_tool_test.rs index 1a9bd9e66dba..d25a5ea37462 100644 --- a/src/test/ui-fulldeps/auxiliary/lint_tool_test.rs +++ b/src/test/ui-fulldeps/auxiliary/lint_tool_test.rs @@ -13,7 +13,11 @@ use rustc::lint::{EarlyContext, LintContext, LintPass, EarlyLintPass, use rustc_plugin::Registry; use syntax::ast; declare_tool_lint!(pub clippy::TEST_LINT, Warn, "Warn about stuff"); -declare_tool_lint!(pub clippy::TEST_GROUP, Warn, "Warn about other stuff"); +declare_tool_lint!( + /// Some docs + pub clippy::TEST_GROUP, + Warn, "Warn about other stuff" +); struct Pass; diff --git a/src/test/ui-fulldeps/dropck_tarena_cycle_checked.stderr b/src/test/ui-fulldeps/dropck_tarena_cycle_checked.stderr index 34d026e957d6..37d8b964c242 100644 --- a/src/test/ui-fulldeps/dropck_tarena_cycle_checked.stderr +++ b/src/test/ui-fulldeps/dropck_tarena_cycle_checked.stderr @@ -3,7 +3,7 @@ error[E0597]: `arena` does not live long enough | LL | f(&arena); | ^^^^^ borrowed value does not live long enough -LL | } //~^ ERROR `arena` does not live long enough +LL | } | - `arena` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui-fulldeps/dropck_tarena_unsound_drop.stderr b/src/test/ui-fulldeps/dropck_tarena_unsound_drop.stderr index 47754da8b78d..c791b8b451e5 100644 --- a/src/test/ui-fulldeps/dropck_tarena_unsound_drop.stderr +++ b/src/test/ui-fulldeps/dropck_tarena_unsound_drop.stderr @@ -3,7 +3,7 @@ error[E0597]: `arena` does not live long enough | LL | f(&arena); | ^^^^^ borrowed value does not live long enough -LL | } //~^ ERROR `arena` does not live long enough +LL | } | - `arena` dropped here while still borrowed | = note: values in a scope are dropped in the opposite order they are created diff --git a/src/test/ui-fulldeps/hash-stable-is-unstable.rs b/src/test/ui-fulldeps/hash-stable-is-unstable.rs new file mode 100644 index 000000000000..9f67f642df1c --- /dev/null +++ b/src/test/ui-fulldeps/hash-stable-is-unstable.rs @@ -0,0 +1,15 @@ +// ignore-stage1 + +extern crate rustc_data_structures; +//~^ use of unstable library feature 'rustc_private' +extern crate rustc; +//~^ use of unstable library feature 'rustc_private' +extern crate rustc_macros; +//~^ use of unstable library feature 'rustc_private' + +use rustc_macros::HashStable; +//~^ use of unstable library feature 'rustc_private' + +#[derive(HashStable)] +//~^ use of unstable library feature 'rustc_private' +struct Test; diff --git a/src/test/ui-fulldeps/hash-stable-is-unstable.stderr b/src/test/ui-fulldeps/hash-stable-is-unstable.stderr new file mode 100644 index 000000000000..e7007204d389 --- /dev/null +++ b/src/test/ui-fulldeps/hash-stable-is-unstable.stderr @@ -0,0 +1,48 @@ +error[E0601]: `main` function not found in crate `hash_stable_is_unstable` + | + = note: consider adding a `main` function to `$DIR/hash-stable-is-unstable.rs` + +error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812) + --> $DIR/hash-stable-is-unstable.rs:3:1 + | +LL | extern crate rustc_data_structures; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(rustc_private)] to the crate attributes to enable + +error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812) + --> $DIR/hash-stable-is-unstable.rs:5:1 + | +LL | extern crate rustc; + | ^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(rustc_private)] to the crate attributes to enable + +error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812) + --> $DIR/hash-stable-is-unstable.rs:7:1 + | +LL | extern crate rustc_macros; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(rustc_private)] to the crate attributes to enable + +error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812) + --> $DIR/hash-stable-is-unstable.rs:10:5 + | +LL | use rustc_macros::HashStable; + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(rustc_private)] to the crate attributes to enable + +error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812) + --> $DIR/hash-stable-is-unstable.rs:13:10 + | +LL | #[derive(HashStable)] + | ^^^^^^^^^^ + | + = help: add #![feature(rustc_private)] to the crate attributes to enable + +error: aborting due to 6 previous errors + +Some errors occurred: E0601, E0658. +For more information about an error, try `rustc --explain E0601`. diff --git a/src/test/ui-fulldeps/issue-15778-fail.stderr b/src/test/ui-fulldeps/issue-15778-fail.stderr index 8eafd1cefa6c..d68928617764 100644 --- a/src/test/ui-fulldeps/issue-15778-fail.stderr +++ b/src/test/ui-fulldeps/issue-15778-fail.stderr @@ -1,7 +1,7 @@ error: crate is not marked with #![crate_okay] --> $DIR/issue-15778-fail.rs:5:1 | -LL | / #![feature(plugin)] //~ ERROR crate is not marked with #![crate_okay] +LL | / #![feature(plugin)] LL | | #![plugin(lint_for_crate)] LL | | LL | | pub fn main() { } diff --git a/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr b/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr index 9b629ca6778e..cd0bff92bf11 100644 --- a/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr +++ b/src/test/ui-fulldeps/lint-group-plugin-deny-cmdline.stderr @@ -1,7 +1,7 @@ error: item is named 'lintme' --> $DIR/lint-group-plugin-deny-cmdline.rs:8:1 | -LL | fn lintme() { } //~ ERROR item is named 'lintme' +LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | = note: `-D test-lint` implied by `-D lint-me` @@ -9,7 +9,7 @@ LL | fn lintme() { } //~ ERROR item is named 'lintme' error: item is named 'pleaselintme' --> $DIR/lint-group-plugin-deny-cmdline.rs:10:1 | -LL | fn pleaselintme() { } //~ ERROR item is named 'pleaselintme' +LL | fn pleaselintme() { } | ^^^^^^^^^^^^^^^^^^^^^ | = note: `-D please-lint` implied by `-D lint-me` diff --git a/src/test/ui-fulldeps/lint-group-plugin.stderr b/src/test/ui-fulldeps/lint-group-plugin.stderr index b566048c75ee..8ccf9700b9fc 100644 --- a/src/test/ui-fulldeps/lint-group-plugin.stderr +++ b/src/test/ui-fulldeps/lint-group-plugin.stderr @@ -1,7 +1,7 @@ warning: item is named 'lintme' --> $DIR/lint-group-plugin.rs:9:1 | -LL | fn lintme() { } //~ WARNING item is named 'lintme' +LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | = note: #[warn(test_lint)] on by default @@ -9,7 +9,7 @@ LL | fn lintme() { } //~ WARNING item is named 'lintme' warning: item is named 'pleaselintme' --> $DIR/lint-group-plugin.rs:10:1 | -LL | fn pleaselintme() { } //~ WARNING item is named 'pleaselintme' +LL | fn pleaselintme() { } | ^^^^^^^^^^^^^^^^^^^^^ | = note: #[warn(please_lint)] on by default diff --git a/src/test/ui-fulldeps/lint-plugin-cmdline-load.stderr b/src/test/ui-fulldeps/lint-plugin-cmdline-load.stderr index 1beb5b7816cb..0b2dbad884c5 100644 --- a/src/test/ui-fulldeps/lint-plugin-cmdline-load.stderr +++ b/src/test/ui-fulldeps/lint-plugin-cmdline-load.stderr @@ -1,7 +1,7 @@ warning: item is named 'lintme' --> $DIR/lint-plugin-cmdline-load.rs:8:1 | -LL | fn lintme() { } //~ WARNING item is named 'lintme' +LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | = note: #[warn(test_lint)] on by default diff --git a/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr b/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr index 81fee10e56ff..5bfde8551ed3 100644 --- a/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr +++ b/src/test/ui-fulldeps/lint-plugin-deny-attr.stderr @@ -1,7 +1,7 @@ error: item is named 'lintme' --> $DIR/lint-plugin-deny-attr.rs:8:1 | -LL | fn lintme() { } //~ ERROR item is named 'lintme' +LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr index 9b84abf704c7..e4257dfde6f9 100644 --- a/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr +++ b/src/test/ui-fulldeps/lint-plugin-deny-cmdline.stderr @@ -1,7 +1,7 @@ error: item is named 'lintme' --> $DIR/lint-plugin-deny-cmdline.rs:8:1 | -LL | fn lintme() { } //~ ERROR item is named 'lintme' +LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | = note: requested on the command line with `-D test-lint` diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr index 11dd75621bf5..092d0eb7a81a 100644 --- a/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr +++ b/src/test/ui-fulldeps/lint-plugin-forbid-attrs.stderr @@ -10,7 +10,7 @@ LL | #[allow(test_lint)] error: item is named 'lintme' --> $DIR/lint-plugin-forbid-attrs.rs:8:1 | -LL | fn lintme() { } //~ ERROR item is named 'lintme' +LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr index b03051250fca..fc2906da5f5f 100644 --- a/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr +++ b/src/test/ui-fulldeps/lint-plugin-forbid-cmdline.stderr @@ -1,7 +1,7 @@ error[E0453]: allow(test_lint) overruled by outer forbid(test_lint) --> $DIR/lint-plugin-forbid-cmdline.rs:10:9 | -LL | #[allow(test_lint)] //~ ERROR allow(test_lint) overruled by outer forbid(test_lint) +LL | #[allow(test_lint)] | ^^^^^^^^^ overruled by previous forbid | = note: `forbid` lint level was set on command line @@ -9,7 +9,7 @@ LL | #[allow(test_lint)] //~ ERROR allow(test_lint) overruled by outer forbid(te error: item is named 'lintme' --> $DIR/lint-plugin-forbid-cmdline.rs:8:1 | -LL | fn lintme() { } //~ ERROR item is named 'lintme' +LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | = note: requested on the command line with `-F test-lint` diff --git a/src/test/ui-fulldeps/lint-plugin.stderr b/src/test/ui-fulldeps/lint-plugin.stderr index 11e3222a1a51..94791e369fc3 100644 --- a/src/test/ui-fulldeps/lint-plugin.stderr +++ b/src/test/ui-fulldeps/lint-plugin.stderr @@ -1,7 +1,7 @@ warning: item is named 'lintme' --> $DIR/lint-plugin.rs:8:1 | -LL | fn lintme() { } //~ WARNING item is named 'lintme' +LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | = note: #[warn(test_lint)] on by default diff --git a/src/test/ui-fulldeps/lint_tool_test.stderr b/src/test/ui-fulldeps/lint_tool_test.stderr index 95db7ec455db..cec8800a25c7 100644 --- a/src/test/ui-fulldeps/lint_tool_test.stderr +++ b/src/test/ui-fulldeps/lint_tool_test.stderr @@ -21,7 +21,7 @@ LL | #[allow(test_group)] warning: unknown lint: `this_lint_does_not_exist` --> $DIR/lint_tool_test.rs:27:8 | -LL | #[deny(this_lint_does_not_exist)] //~ WARNING unknown lint: `this_lint_does_not_exist` +LL | #[deny(this_lint_does_not_exist)] | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: #[warn(unknown_lints)] on by default @@ -35,7 +35,7 @@ LL | #![cfg_attr(foo, warn(test_lint))] error: item is named 'lintme' --> $DIR/lint_tool_test.rs:14:1 | -LL | fn lintme() { } //~ ERROR item is named 'lintme' +LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | note: lint level defined here @@ -48,7 +48,7 @@ LL | #![deny(clippy_group)] error: item is named 'lintmetoo' --> $DIR/lint_tool_test.rs:22:5 | -LL | fn lintmetoo() { } //~ ERROR item is named 'lintmetoo' +LL | fn lintmetoo() { } | ^^^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui-fulldeps/plugin-as-extern-crate.stderr b/src/test/ui-fulldeps/plugin-as-extern-crate.stderr index 4a5a53980eb8..ccc9580a60c2 100644 --- a/src/test/ui-fulldeps/plugin-as-extern-crate.stderr +++ b/src/test/ui-fulldeps/plugin-as-extern-crate.stderr @@ -1,7 +1,7 @@ error: compiler plugin used as an ordinary library --> $DIR/plugin-as-extern-crate.rs:10:1 | -LL | extern crate attr_plugin_test; //~ ERROR compiler plugin used as an ordinary library +LL | extern crate attr_plugin_test; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/E0508.nll.stderr b/src/test/ui/E0508.nll.stderr index 82fdce2112ec..983062e450ea 100644 --- a/src/test/ui/E0508.nll.stderr +++ b/src/test/ui/E0508.nll.stderr @@ -1,7 +1,7 @@ error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array --> $DIR/E0508.rs:5:18 | -LL | let _value = array[0]; //~ ERROR [E0508] +LL | let _value = array[0]; | ^^^^^^^^ | | | cannot move out of here diff --git a/src/test/ui/E0508.stderr b/src/test/ui/E0508.stderr index 1e7b4071d5d7..ba6cff80416f 100644 --- a/src/test/ui/E0508.stderr +++ b/src/test/ui/E0508.stderr @@ -1,7 +1,7 @@ error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array --> $DIR/E0508.rs:5:18 | -LL | let _value = array[0]; //~ ERROR [E0508] +LL | let _value = array[0]; | ^^^^^^^^ | | | cannot move out of here diff --git a/src/test/ui/E0583.stderr b/src/test/ui/E0583.stderr index 33b584ccefeb..ef7a48bc8a48 100644 --- a/src/test/ui/E0583.stderr +++ b/src/test/ui/E0583.stderr @@ -1,7 +1,7 @@ error[E0583]: file not found for module `module_that_doesnt_exist` --> $DIR/E0583.rs:1:5 | -LL | mod module_that_doesnt_exist; //~ ERROR E0583 +LL | mod module_that_doesnt_exist; | ^^^^^^^^^^^^^^^^^^^^^^^^ | = help: name the file either module_that_doesnt_exist.rs or module_that_doesnt_exist/mod.rs inside the directory "$DIR" diff --git a/src/test/ui/E0642.stderr b/src/test/ui/E0642.stderr index 4c82a6cbd21b..da255143494d 100644 --- a/src/test/ui/E0642.stderr +++ b/src/test/ui/E0642.stderr @@ -1,31 +1,31 @@ error[E0642]: patterns aren't allowed in methods without bodies --> $DIR/E0642.rs:5:12 | -LL | fn foo((x, y): (i32, i32)); //~ ERROR patterns aren't allowed in methods without bodies +LL | fn foo((x, y): (i32, i32)); | ^^^^^^ help: give this argument a name or use an underscore to ignore it | -LL | fn foo(_: (i32, i32)); //~ ERROR patterns aren't allowed in methods without bodies +LL | fn foo(_: (i32, i32)); | ^ error[E0642]: patterns aren't allowed in methods without bodies --> $DIR/E0642.rs:7:12 | -LL | fn bar((x, y): (i32, i32)) {} //~ ERROR patterns aren't allowed in methods without bodies +LL | fn bar((x, y): (i32, i32)) {} | ^^^^^^ help: give this argument a name or use an underscore to ignore it | -LL | fn bar(_: (i32, i32)) {} //~ ERROR patterns aren't allowed in methods without bodies +LL | fn bar(_: (i32, i32)) {} | ^ error[E0642]: patterns aren't allowed in methods without bodies --> $DIR/E0642.rs:9:15 | -LL | fn method(S { .. }: S) {} //~ ERROR patterns aren't allowed in methods without bodies +LL | fn method(S { .. }: S) {} | ^^^^^^^^ help: give this argument a name or use an underscore to ignore it | -LL | fn method(_: S) {} //~ ERROR patterns aren't allowed in methods without bodies +LL | fn method(_: S) {} | ^ error: aborting due to 3 previous errors diff --git a/src/test/ui/E0662.stderr b/src/test/ui/E0662.stderr index 2156b43973fc..5dea744998d8 100644 --- a/src/test/ui/E0662.stderr +++ b/src/test/ui/E0662.stderr @@ -1,7 +1,7 @@ error[E0662]: input operand constraint contains '=' --> $DIR/E0662.rs:6:12 | -LL | : "=test"("a") //~ ERROR E0662 +LL | : "=test"("a") | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/E0663.stderr b/src/test/ui/E0663.stderr index 66667a6dc884..01bf89ec79af 100644 --- a/src/test/ui/E0663.stderr +++ b/src/test/ui/E0663.stderr @@ -1,7 +1,7 @@ error[E0663]: input operand constraint contains '+' --> $DIR/E0663.rs:6:12 | -LL | : "+test"("a") //~ ERROR E0663 +LL | : "+test"("a") | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/E0664.stderr b/src/test/ui/E0664.stderr index 972b10379d43..9c9f65ee6a96 100644 --- a/src/test/ui/E0664.stderr +++ b/src/test/ui/E0664.stderr @@ -1,7 +1,7 @@ error[E0664]: clobber should not be surrounded by braces --> $DIR/E0664.rs:7:12 | -LL | : "{eax}" //~ ERROR E0664 +LL | : "{eax}" | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/E0665.stderr b/src/test/ui/E0665.stderr index e044d6065312..2c2b498e39a4 100644 --- a/src/test/ui/E0665.stderr +++ b/src/test/ui/E0665.stderr @@ -1,7 +1,7 @@ error[E0665]: `Default` cannot be derived for enums, only structs --> $DIR/E0665.rs:1:10 | -LL | #[derive(Default)] //~ ERROR E0665 +LL | #[derive(Default)] | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/absolute-paths-in-nested-use-groups.stderr b/src/test/ui/absolute-paths-in-nested-use-groups.stderr index 72ad0509e46a..e41590ac45ee 100644 --- a/src/test/ui/absolute-paths-in-nested-use-groups.stderr +++ b/src/test/ui/absolute-paths-in-nested-use-groups.stderr @@ -1,19 +1,19 @@ error[E0433]: failed to resolve: crate root in paths can only be used in start position --> $DIR/absolute-paths-in-nested-use-groups.rs:6:5 | -LL | ::bar, //~ ERROR crate root in paths can only be used in start position +LL | ::bar, | ^ crate root in paths can only be used in start position error[E0433]: failed to resolve: `super` in paths can only be used in start position --> $DIR/absolute-paths-in-nested-use-groups.rs:7:5 | -LL | super::bar, //~ ERROR `super` in paths can only be used in start position +LL | super::bar, | ^^^^^ `super` in paths can only be used in start position error[E0433]: failed to resolve: `self` in paths can only be used in start position --> $DIR/absolute-paths-in-nested-use-groups.rs:8:5 | -LL | self::bar, //~ ERROR `self` in paths can only be used in start position +LL | self::bar, | ^^^^ `self` in paths can only be used in start position error: aborting due to 3 previous errors diff --git a/src/test/ui/access-mode-in-closures.nll.stderr b/src/test/ui/access-mode-in-closures.nll.stderr index 0c9a62351d20..713eeba54597 100644 --- a/src/test/ui/access-mode-in-closures.nll.stderr +++ b/src/test/ui/access-mode-in-closures.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/access-mode-in-closures.rs:8:15 | -LL | match *s { S(v) => v } //~ ERROR cannot move out +LL | match *s { S(v) => v } | ^^ - data moved here | | | cannot move out of borrowed content @@ -10,7 +10,7 @@ LL | match *s { S(v) => v } //~ ERROR cannot move out note: move occurs because `v` has type `std::vec::Vec`, which does not implement the `Copy` trait --> $DIR/access-mode-in-closures.rs:8:22 | -LL | match *s { S(v) => v } //~ ERROR cannot move out +LL | match *s { S(v) => v } | ^ error: aborting due to previous error diff --git a/src/test/ui/access-mode-in-closures.stderr b/src/test/ui/access-mode-in-closures.stderr index 0423c713531f..9976dfe946fd 100644 --- a/src/test/ui/access-mode-in-closures.stderr +++ b/src/test/ui/access-mode-in-closures.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/access-mode-in-closures.rs:8:15 | -LL | match *s { S(v) => v } //~ ERROR cannot move out +LL | match *s { S(v) => v } | ^^ - hint: to prevent move, use `ref v` or `ref mut v` | | | cannot move out of borrowed content diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr index 8efbf7f78d91..34e09da45ad5 100644 --- a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr +++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr @@ -1,13 +1,13 @@ error: return type should be `!` --> $DIR/alloc-error-handler-bad-signature-1.rs:12:6 | -LL | ) -> () //~ ERROR return type should be `!` +LL | ) -> () | ^^ error: argument should be `Layout` --> $DIR/alloc-error-handler-bad-signature-1.rs:11:11 | -LL | info: &Layout, //~ ERROR argument should be `Layout` +LL | info: &Layout, | ^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr index 95ef9a0522c3..85544b0c3849 100644 --- a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr +++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr @@ -1,13 +1,13 @@ error: return type should be `!` --> $DIR/alloc-error-handler-bad-signature-2.rs:12:3 | -LL | ) { //~ ERROR return type should be `!` +LL | ) { | ^ error: argument should be `Layout` --> $DIR/alloc-error-handler-bad-signature-2.rs:11:11 | -LL | info: Layout, //~ ERROR argument should be `Layout` +LL | info: Layout, | ^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr index 284802f21b9d..8575e7508f12 100644 --- a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr +++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr @@ -1,7 +1,7 @@ error: function should have one argument --> $DIR/alloc-error-handler-bad-signature-3.rs:10:1 | -LL | fn oom() -> ! { //~ ERROR function should have one argument +LL | fn oom() -> ! { | ^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/allocator-submodule.stderr b/src/test/ui/allocator-submodule.stderr index 32c7211cd164..26d7aa80eee1 100644 --- a/src/test/ui/allocator-submodule.stderr +++ b/src/test/ui/allocator-submodule.stderr @@ -1,7 +1,7 @@ error: `global_allocator` cannot be used in submodules --> $DIR/allocator-submodule.rs:27:5 | -LL | static MY_HEAP: MyAlloc = MyAlloc; //~ ERROR global_allocator +LL | static MY_HEAP: MyAlloc = MyAlloc; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/allocator/function-allocator.stderr b/src/test/ui/allocator/function-allocator.stderr index ecb6e4d4ecde..5e47b0f0cc7a 100644 --- a/src/test/ui/allocator/function-allocator.stderr +++ b/src/test/ui/allocator/function-allocator.stderr @@ -1,7 +1,7 @@ error: allocators must be statics --> $DIR/function-allocator.rs:2:1 | -LL | fn foo() {} //~ ERROR: allocators must be statics +LL | fn foo() {} | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/always-inhabited-union-ref.stderr b/src/test/ui/always-inhabited-union-ref.stderr index 212f5d7c525f..792ab6f59a43 100644 --- a/src/test/ui/always-inhabited-union-ref.stderr +++ b/src/test/ui/always-inhabited-union-ref.stderr @@ -4,11 +4,7 @@ error[E0004]: non-exhaustive patterns: type `&'static !` is non-empty LL | match uninhab_ref() { | ^^^^^^^^^^^^^ | -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - --> $DIR/always-inhabited-union-ref.rs:23:11 - | -LL | match uninhab_ref() { - | ^^^^^^^^^^^^^ + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: type `Foo` is non-empty --> $DIR/always-inhabited-union-ref.rs:27:11 @@ -16,11 +12,7 @@ error[E0004]: non-exhaustive patterns: type `Foo` is non-empty LL | match uninhab_union() { | ^^^^^^^^^^^^^^^ | -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - --> $DIR/always-inhabited-union-ref.rs:27:11 - | -LL | match uninhab_union() { - | ^^^^^^^^^^^^^^^ + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to 2 previous errors diff --git a/src/test/ui/anon-params-denied-2018.stderr b/src/test/ui/anon-params-denied-2018.stderr index dd9e933542fa..1ec0cf323e99 100644 --- a/src/test/ui/anon-params-denied-2018.stderr +++ b/src/test/ui/anon-params-denied-2018.stderr @@ -1,7 +1,7 @@ error: expected one of `:` or `@`, found `)` --> $DIR/anon-params-denied-2018.rs:6:15 | -LL | fn foo(i32); //~ expected one of `:` or `@`, found `)` +LL | fn foo(i32); | ---^ expected one of `:` or `@` here | | | help: explicitly ignore parameter: `_: i32` diff --git a/src/test/ui/anon-params-deprecated.stderr b/src/test/ui/anon-params-deprecated.stderr index 691c3159a526..e97dbc15f9cd 100644 --- a/src/test/ui/anon-params-deprecated.stderr +++ b/src/test/ui/anon-params-deprecated.stderr @@ -1,7 +1,7 @@ warning: anonymous parameters are deprecated and will be removed in the next edition. --> $DIR/anon-params-deprecated.rs:9:12 | -LL | fn foo(i32); //~ WARNING anonymous parameters are deprecated +LL | fn foo(i32); | ^^^ help: Try naming the parameter or explicitly ignoring it: `_: i32` | note: lint level defined here diff --git a/src/test/ui/anonymous-higher-ranked-lifetime.stderr b/src/test/ui/anonymous-higher-ranked-lifetime.stderr index 378f352cb922..9e84b1495096 100644 --- a/src/test/ui/anonymous-higher-ranked-lifetime.stderr +++ b/src/test/ui/anonymous-higher-ranked-lifetime.stderr @@ -1,7 +1,7 @@ error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:2:5 | -LL | f1(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | f1(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'r, 's> fn(&'r (), &'s ()) -> _` @@ -15,7 +15,7 @@ LL | fn f1(_: F) where F: Fn(&(), &()) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:2:5 | -LL | f1(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | f1(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `fn(&(), &()) -> _` @@ -29,7 +29,7 @@ LL | fn f1(_: F) where F: Fn(&(), &()) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:4:5 | -LL | f2(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | f2(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'a, 'r> fn(&'a (), &'r ()) -> _` @@ -43,7 +43,7 @@ LL | fn f2(_: F) where F: for<'a> Fn(&'a (), &()) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:4:5 | -LL | f2(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | f2(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `fn(&'a (), &()) -> _` @@ -57,7 +57,7 @@ LL | fn f2(_: F) where F: for<'a> Fn(&'a (), &()) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:6:5 | -LL | f3(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | f3(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'r> fn(&(), &'r ()) -> _` @@ -71,7 +71,7 @@ LL | fn f3<'a, F>(_: F) where F: Fn(&'a (), &()) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:6:5 | -LL | f3(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | f3(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `fn(&(), &()) -> _` @@ -85,7 +85,7 @@ LL | fn f3<'a, F>(_: F) where F: Fn(&'a (), &()) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:8:5 | -LL | f4(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | f4(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'s, 'r> fn(&'s (), &'r ()) -> _` @@ -99,7 +99,7 @@ LL | fn f4(_: F) where F: for<'r> Fn(&(), &'r ()) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:8:5 | -LL | f4(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | f4(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `fn(&(), &'r ()) -> _` @@ -113,7 +113,7 @@ LL | fn f4(_: F) where F: for<'r> Fn(&(), &'r ()) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:10:5 | -LL | f5(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | f5(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'r> fn(&'r (), &'r ()) -> _` @@ -127,7 +127,7 @@ LL | fn f5(_: F) where F: for<'r> Fn(&'r (), &'r ()) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:10:5 | -LL | f5(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | f5(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `fn(&'r (), &'r ()) -> _` @@ -141,7 +141,7 @@ LL | fn f5(_: F) where F: for<'r> Fn(&'r (), &'r ()) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:12:5 | -LL | g1(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | g1(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'r> fn(&'r (), std::boxed::Box<(dyn for<'s> std::ops::Fn(&'s ()) + 'static)>) -> _` @@ -155,7 +155,7 @@ LL | fn g1(_: F) where F: Fn(&(), Box) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:12:5 | -LL | g1(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | g1(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `fn(&(), std::boxed::Box<(dyn for<'r> std::ops::Fn(&'r ()) + 'static)>) -> _` @@ -169,7 +169,7 @@ LL | fn g1(_: F) where F: Fn(&(), Box) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:14:5 | -LL | g2(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | g2(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'r> fn(&'r (), for<'s> fn(&'s ())) -> _` @@ -183,7 +183,7 @@ LL | fn g2(_: F) where F: Fn(&(), fn(&())) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:14:5 | -LL | g2(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | g2(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `fn(&(), for<'r> fn(&'r ())) -> _` @@ -197,7 +197,7 @@ LL | fn g2(_: F) where F: Fn(&(), fn(&())) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:16:5 | -LL | g3(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | g3(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'s> fn(&'s (), std::boxed::Box<(dyn for<'r> std::ops::Fn(&'r ()) + 'static)>) -> _` @@ -211,7 +211,7 @@ LL | fn g3(_: F) where F: for<'s> Fn(&'s (), Box) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:16:5 | -LL | g3(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | g3(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `fn(&'s (), std::boxed::Box<(dyn for<'r> std::ops::Fn(&'r ()) + 'static)>) -> _` @@ -225,7 +225,7 @@ LL | fn g3(_: F) where F: for<'s> Fn(&'s (), Box) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:18:5 | -LL | g4(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | g4(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `for<'s> fn(&'s (), for<'r> fn(&'r ())) -> _` @@ -239,7 +239,7 @@ LL | fn g4(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:18:5 | -LL | g4(|_: (), _: ()| {}); //~ ERROR type mismatch +LL | g4(|_: (), _: ()| {}); | ^^ -------------- found signature of `fn((), ()) -> _` | | | expected signature of `fn(&(), for<'r> fn(&'r ())) -> _` @@ -253,7 +253,7 @@ LL | fn g4(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:20:5 | -LL | h1(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch +LL | h1(|_: (), _: (), _: (), _: ()| {}); | ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _` | | | expected signature of `for<'r, 's> fn(&'r (), std::boxed::Box<(dyn for<'t0> std::ops::Fn(&'t0 ()) + 'static)>, &'s (), for<'t0, 't1> fn(&'t0 (), &'t1 ())) -> _` @@ -267,7 +267,7 @@ LL | fn h1(_: F) where F: Fn(&(), Box, &(), fn(&(), &())) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:20:5 | -LL | h1(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch +LL | h1(|_: (), _: (), _: (), _: ()| {}); | ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _` | | | expected signature of `fn(&(), std::boxed::Box<(dyn for<'r> std::ops::Fn(&'r ()) + 'static)>, &(), for<'r, 's> fn(&'r (), &'s ())) -> _` @@ -281,7 +281,7 @@ LL | fn h1(_: F) where F: Fn(&(), Box, &(), fn(&(), &())) {} error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:22:5 | -LL | h2(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch +LL | h2(|_: (), _: (), _: (), _: ()| {}); | ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _` | | | expected signature of `for<'r, 't0> fn(&'r (), std::boxed::Box<(dyn for<'s> std::ops::Fn(&'s ()) + 'static)>, &'t0 (), for<'s, 't1> fn(&'s (), &'t1 ())) -> _` @@ -295,7 +295,7 @@ LL | fn h2(_: F) where F: for<'t0> Fn(&(), Box, &'t0 (), fn(&(), &() error[E0631]: type mismatch in closure arguments --> $DIR/anonymous-higher-ranked-lifetime.rs:22:5 | -LL | h2(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch +LL | h2(|_: (), _: (), _: (), _: ()| {}); | ^^ ---------------------------- found signature of `fn((), (), (), ()) -> _` | | | expected signature of `fn(&(), std::boxed::Box<(dyn for<'r> std::ops::Fn(&'r ()) + 'static)>, &'t0 (), for<'r, 's> fn(&'r (), &'s ())) -> _` diff --git a/src/test/ui/array-break-length.stderr b/src/test/ui/array-break-length.stderr index bba475304610..1cbf77a99f87 100644 --- a/src/test/ui/array-break-length.stderr +++ b/src/test/ui/array-break-length.stderr @@ -1,13 +1,13 @@ error[E0268]: `break` outside of loop --> $DIR/array-break-length.rs:3:17 | -LL | |_: [_; break]| {} //~ ERROR: `break` outside of loop +LL | |_: [_; break]| {} | ^^^^^ cannot break outside of a loop error[E0268]: `continue` outside of loop --> $DIR/array-break-length.rs:7:17 | -LL | |_: [_; continue]| {} //~ ERROR: `continue` outside of loop +LL | |_: [_; continue]| {} | ^^^^^^^^ cannot break outside of a loop error: aborting due to 2 previous errors diff --git a/src/test/ui/asm/asm-in-bad-modifier.stderr b/src/test/ui/asm/asm-in-bad-modifier.stderr index 339875390185..21e80fb98027 100644 --- a/src/test/ui/asm/asm-in-bad-modifier.stderr +++ b/src/test/ui/asm/asm-in-bad-modifier.stderr @@ -1,13 +1,13 @@ error[E0662]: input operand constraint contains '=' --> $DIR/asm-in-bad-modifier.rs:23:39 | -LL | asm!("mov $1, $0" : "=r"(x) : "=r"(5)); //~ ERROR operand constraint contains '=' +LL | asm!("mov $1, $0" : "=r"(x) : "=r"(5)); | ^^^^ error[E0663]: input operand constraint contains '+' --> $DIR/asm-in-bad-modifier.rs:24:39 | -LL | asm!("mov $1, $0" : "=r"(y) : "+r"(5)); //~ ERROR operand constraint contains '+' +LL | asm!("mov $1, $0" : "=r"(y) : "+r"(5)); | ^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/asm/asm-out-no-modifier.stderr b/src/test/ui/asm/asm-out-no-modifier.stderr index 12a33e451fb0..99134ceba332 100644 --- a/src/test/ui/asm/asm-out-no-modifier.stderr +++ b/src/test/ui/asm/asm-out-no-modifier.stderr @@ -1,7 +1,7 @@ error[E0661]: output operand constraint lacks '=' or '+' --> $DIR/asm-out-no-modifier.rs:22:29 | -LL | asm!("mov $1, $0" : "r"(x) : "r"(5)); //~ ERROR output operand constraint lacks '=' +LL | asm!("mov $1, $0" : "r"(x) : "r"(5)); | ^^^ error: aborting due to previous error diff --git a/src/test/ui/asm/asm-parse-errors.stderr b/src/test/ui/asm/asm-parse-errors.stderr index 37b61b80b2b8..9fe59d12e12c 100644 --- a/src/test/ui/asm/asm-parse-errors.stderr +++ b/src/test/ui/asm/asm-parse-errors.stderr @@ -1,67 +1,67 @@ error: macro requires a string literal as an argument --> $DIR/asm-parse-errors.rs:4:5 | -LL | asm!(); //~ ERROR requires a string literal as an argument +LL | asm!(); | ^^^^^^^ string literal required error: expected string literal --> $DIR/asm-parse-errors.rs:5:18 | -LL | asm!("nop" : struct); //~ ERROR expected string literal +LL | asm!("nop" : struct); | ^^^^^^ expected string literal error: expected string literal --> $DIR/asm-parse-errors.rs:6:30 | -LL | asm!("mov %eax, $$0x2" : struct); //~ ERROR expected string literal +LL | asm!("mov %eax, $$0x2" : struct); | ^^^^^^ expected string literal error: expected `(`, found keyword `struct` --> $DIR/asm-parse-errors.rs:7:39 | -LL | asm!("mov %eax, $$0x2" : "={eax}" struct); //~ ERROR expected `(` +LL | asm!("mov %eax, $$0x2" : "={eax}" struct); | ^^^^^^ expected `(` error: expected expression, found keyword `struct` --> $DIR/asm-parse-errors.rs:8:39 | -LL | asm!("mov %eax, $$0x2" : "={eax}"(struct)); //~ ERROR expected expression +LL | asm!("mov %eax, $$0x2" : "={eax}"(struct)); | ^^^^^^ expected expression error: expected string literal --> $DIR/asm-parse-errors.rs:9:44 | -LL | asm!("in %dx, %al" : "={al}"(result) : struct); //~ ERROR expected string literal +LL | asm!("in %dx, %al" : "={al}"(result) : struct); | ^^^^^^ expected string literal error: expected `(`, found keyword `struct` --> $DIR/asm-parse-errors.rs:10:51 | -LL | asm!("in %dx, %al" : "={al}"(result) : "{dx}" struct); //~ ERROR expected `(` +LL | asm!("in %dx, %al" : "={al}"(result) : "{dx}" struct); | ^^^^^^ expected `(` error: expected expression, found keyword `struct` --> $DIR/asm-parse-errors.rs:11:51 | -LL | asm!("in %dx, %al" : "={al}"(result) : "{dx}"(struct)); //~ ERROR expected expression +LL | asm!("in %dx, %al" : "={al}"(result) : "{dx}"(struct)); | ^^^^^^ expected expression error: expected string literal --> $DIR/asm-parse-errors.rs:12:36 | -LL | asm!("mov $$0x200, %eax" : : : struct); //~ ERROR expected string literal +LL | asm!("mov $$0x200, %eax" : : : struct); | ^^^^^^ expected string literal error: expected string literal --> $DIR/asm-parse-errors.rs:13:45 | -LL | asm!("mov eax, 2" : "={eax}"(foo) : : : struct); //~ ERROR expected string literal +LL | asm!("mov eax, 2" : "={eax}"(foo) : : : struct); | ^^^^^^ expected string literal error: inline assembly must be a string literal --> $DIR/asm-parse-errors.rs:14:10 | -LL | asm!(123); //~ ERROR inline assembly must be a string literal +LL | asm!(123); | ^^^ error: aborting due to 11 previous errors diff --git a/src/test/ui/assign-to-method.stderr b/src/test/ui/assign-to-method.stderr index f79f0750d890..feceadb67220 100644 --- a/src/test/ui/assign-to-method.stderr +++ b/src/test/ui/assign-to-method.stderr @@ -1,7 +1,7 @@ error[E0615]: attempted to take value of method `speak` on type `Cat` --> $DIR/assign-to-method.rs:20:8 | -LL | nyan.speak = || println!("meow"); //~ ERROR attempted to take value of method +LL | nyan.speak = || println!("meow"); | ^^^^^ | = help: methods are immutable and cannot be assigned to @@ -9,7 +9,7 @@ LL | nyan.speak = || println!("meow"); //~ ERROR attempted to take value of me error[E0615]: attempted to take value of method `speak` on type `Cat` --> $DIR/assign-to-method.rs:21:8 | -LL | nyan.speak += || println!("meow"); //~ ERROR attempted to take value of method +LL | nyan.speak += || println!("meow"); | ^^^^^ | = help: methods are immutable and cannot be assigned to diff --git a/src/test/ui/assignment-operator-unimplemented.stderr b/src/test/ui/assignment-operator-unimplemented.stderr index 1d7adb129d0e..5304b09de5ef 100644 --- a/src/test/ui/assignment-operator-unimplemented.stderr +++ b/src/test/ui/assignment-operator-unimplemented.stderr @@ -1,7 +1,7 @@ error[E0368]: binary assignment operation `+=` cannot be applied to type `Foo` --> $DIR/assignment-operator-unimplemented.rs:6:3 | -LL | a += *b; //~ Error: binary assignment operation `+=` cannot be applied to type `Foo` +LL | a += *b; | -^^^^^^ | | | cannot use `+=` on type `Foo` diff --git a/src/test/ui/assoc-inherent.stderr b/src/test/ui/assoc-inherent.stderr index f438ac8df4a0..f9ea3365cb8d 100644 --- a/src/test/ui/assoc-inherent.stderr +++ b/src/test/ui/assoc-inherent.stderr @@ -1,7 +1,7 @@ error[E0202]: associated types are not yet supported in inherent impls (see #8995) --> $DIR/assoc-inherent.rs:6:5 | -LL | type Bar = isize; //~ERROR associated types are not yet supported in inherent impls (see #8995) +LL | type Bar = isize; | ^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/associated-const/associated-const-ambiguity-report.stderr b/src/test/ui/associated-const/associated-const-ambiguity-report.stderr index 47748609b162..5f2b9c47e8c2 100644 --- a/src/test/ui/associated-const/associated-const-ambiguity-report.stderr +++ b/src/test/ui/associated-const/associated-const-ambiguity-report.stderr @@ -1,7 +1,7 @@ error[E0034]: multiple applicable items in scope --> $DIR/associated-const-ambiguity-report.rs:17:16 | -LL | const X: i32 = ::ID; //~ ERROR E0034 +LL | const X: i32 = ::ID; | ^^^^^^^^^ multiple `ID` found | note: candidate #1 is defined in an impl of the trait `Foo` for the type `i32` diff --git a/src/test/ui/associated-const/associated-const-generic-obligations.rs b/src/test/ui/associated-const/associated-const-generic-obligations.rs index e0b502edaa15..498e315b5c83 100644 --- a/src/test/ui/associated-const/associated-const-generic-obligations.rs +++ b/src/test/ui/associated-const/associated-const-generic-obligations.rs @@ -12,7 +12,7 @@ trait Bar: Foo { impl Bar for T { const FROM: &'static str = "foo"; - //~^ ERROR the trait bound `T: Foo` is not satisfied [E0277] + //~^ ERROR implemented const `FROM` has an incompatible type for trait [E0326] } fn main() {} diff --git a/src/test/ui/associated-const/associated-const-generic-obligations.stderr b/src/test/ui/associated-const/associated-const-generic-obligations.stderr index e4b86d84cafc..eeee26a75671 100644 --- a/src/test/ui/associated-const/associated-const-generic-obligations.stderr +++ b/src/test/ui/associated-const/associated-const-generic-obligations.stderr @@ -1,11 +1,15 @@ -error[E0277]: the trait bound `T: Foo` is not satisfied - --> $DIR/associated-const-generic-obligations.rs:14:5 +error[E0326]: implemented const `FROM` has an incompatible type for trait + --> $DIR/associated-const-generic-obligations.rs:14:17 | +LL | const FROM: Self::Out; + | --------- type in trait +... LL | const FROM: &'static str = "foo"; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `T` + | ^^^^^^^^^^^^ expected associated type, found reference | - = help: consider adding a `where T: Foo` bound + = note: expected type `::Out` + found type `&'static str` error: aborting due to previous error -For more information about this error, try `rustc --explain E0277`. +For more information about this error, try `rustc --explain E0326`. diff --git a/src/test/ui/associated-const/associated-const-trait-bound.rs b/src/test/ui/associated-const/associated-const-trait-bound.rs new file mode 100644 index 000000000000..0ce46d312afe --- /dev/null +++ b/src/test/ui/associated-const/associated-const-trait-bound.rs @@ -0,0 +1,21 @@ +// compile-pass + +trait ConstDefault { + const DEFAULT: Self; +} + +trait Foo: Sized {} + +trait FooExt: Foo { + type T: ConstDefault; +} + +trait Bar { + const T: F::T; +} + +impl Bar for () { + const T: F::T = ::DEFAULT; +} + +fn main() {} diff --git a/src/test/ui/associated-item/associated-item-duplicate-names-2.stderr b/src/test/ui/associated-item/associated-item-duplicate-names-2.stderr index 6cc63de35d74..ea475ffc5547 100644 --- a/src/test/ui/associated-item/associated-item-duplicate-names-2.stderr +++ b/src/test/ui/associated-item/associated-item-duplicate-names-2.stderr @@ -3,7 +3,7 @@ error[E0201]: duplicate definitions with name `bar`: | LL | const bar: bool = true; | ----------------------- previous definition of `bar` here -LL | fn bar() {} //~ ERROR duplicate definitions +LL | fn bar() {} | ^^^^^^^^^^^ duplicate definition error: aborting due to previous error diff --git a/src/test/ui/associated-item/associated-item-duplicate-names-3.stderr b/src/test/ui/associated-item/associated-item-duplicate-names-3.stderr index 07ce5e621a62..57495863c989 100644 --- a/src/test/ui/associated-item/associated-item-duplicate-names-3.stderr +++ b/src/test/ui/associated-item/associated-item-duplicate-names-3.stderr @@ -3,7 +3,7 @@ error[E0201]: duplicate definitions with name `Bar`: | LL | type Bar = i16; | --------------- previous definition of `Bar` here -LL | type Bar = u16; //~ ERROR duplicate definitions +LL | type Bar = u16; | ^^^^^^^^^^^^^^^ duplicate definition error: aborting due to previous error diff --git a/src/test/ui/associated-item/associated-item-duplicate-names.stderr b/src/test/ui/associated-item/associated-item-duplicate-names.stderr index 2bbe91252145..f4af9e029395 100644 --- a/src/test/ui/associated-item/associated-item-duplicate-names.stderr +++ b/src/test/ui/associated-item/associated-item-duplicate-names.stderr @@ -3,7 +3,7 @@ error[E0201]: duplicate definitions with name `Ty`: | LL | type Ty = (); | ------------- previous definition of `Ty` here -LL | type Ty = usize; //~ ERROR duplicate definitions +LL | type Ty = usize; | ^^^^^^^^^^^^^^^^ duplicate definition error[E0201]: duplicate definitions with name `BAR`: @@ -11,7 +11,7 @@ error[E0201]: duplicate definitions with name `BAR`: | LL | const BAR: u32 = 7; | ------------------- previous definition of `BAR` here -LL | const BAR: u32 = 8; //~ ERROR duplicate definitions +LL | const BAR: u32 = 8; | ^^^^^^^^^^^^^^^^^^^ duplicate definition error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-path-shl.stderr b/src/test/ui/associated-path-shl.stderr index 3b62b1b01f48..e1a1e6363727 100644 --- a/src/test/ui/associated-path-shl.stderr +++ b/src/test/ui/associated-path-shl.stderr @@ -1,37 +1,37 @@ error[E0412]: cannot find type `A` in this scope --> $DIR/associated-path-shl.rs:4:14 | -LL | let _: <
::B>::C; //~ ERROR cannot find type `A` in this scope +LL | let _: <::B>::C; | ^ not found in this scope error[E0412]: cannot find type `A` in this scope --> $DIR/associated-path-shl.rs:5:15 | -LL | let _ = <::B>::C; //~ ERROR cannot find type `A` in this scope +LL | let _ = <::B>::C; | ^ not found in this scope error[E0412]: cannot find type `A` in this scope --> $DIR/associated-path-shl.rs:6:11 | -LL | let <::B>::C; //~ ERROR cannot find type `A` in this scope +LL | let <::B>::C; | ^ not found in this scope error[E0412]: cannot find type `A` in this scope --> $DIR/associated-path-shl.rs:7:17 | -LL | let 0 ..= <::B>::C; //~ ERROR cannot find type `A` in this scope +LL | let 0 ..= <::B>::C; | ^ not found in this scope error[E0412]: cannot find type `A` in this scope --> $DIR/associated-path-shl.rs:9:7 | -LL | <::B>::C; //~ ERROR cannot find type `A` in this scope +LL | <::B>::C; | ^ not found in this scope error[E0029]: only char and numeric types are allowed in range patterns --> $DIR/associated-path-shl.rs:7:15 | -LL | let 0 ..= <::B>::C; //~ ERROR cannot find type `A` in this scope +LL | let 0 ..= <::B>::C; | ^^^^^^^^^^^ ranges require char or numeric types | = note: start type: {integer} diff --git a/src/test/ui/associated-type/associated-type-projection-from-supertrait.stderr b/src/test/ui/associated-type/associated-type-projection-from-supertrait.stderr index 8c7b4a1333c1..06f1a1cc64c4 100644 --- a/src/test/ui/associated-type/associated-type-projection-from-supertrait.stderr +++ b/src/test/ui/associated-type/associated-type-projection-from-supertrait.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/associated-type-projection-from-supertrait.rs:33:23 | -LL | fn b() { dent(ModelT, Blue); } //~ ERROR mismatched types +LL | fn b() { dent(ModelT, Blue); } | ^^^^ expected struct `Black`, found struct `Blue` | = note: expected type `Black` @@ -10,7 +10,7 @@ LL | fn b() { dent(ModelT, Blue); } //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/associated-type-projection-from-supertrait.rs:34:23 | -LL | fn c() { dent(ModelU, Black); } //~ ERROR mismatched types +LL | fn c() { dent(ModelU, Black); } | ^^^^^ expected struct `Blue`, found struct `Black` | = note: expected type `Blue` @@ -19,7 +19,7 @@ LL | fn c() { dent(ModelU, Black); } //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/associated-type-projection-from-supertrait.rs:40:28 | -LL | fn f() { ModelT.chip_paint(Blue); } //~ ERROR mismatched types +LL | fn f() { ModelT.chip_paint(Blue); } | ^^^^ expected struct `Black`, found struct `Blue` | = note: expected type `Black` @@ -28,7 +28,7 @@ LL | fn f() { ModelT.chip_paint(Blue); } //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/associated-type-projection-from-supertrait.rs:41:28 | -LL | fn g() { ModelU.chip_paint(Black); } //~ ERROR mismatched types +LL | fn g() { ModelU.chip_paint(Black); } | ^^^^^ expected struct `Blue`, found struct `Black` | = note: expected type `Blue` diff --git a/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr b/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr index 126fb572d992..4b548604983d 100644 --- a/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr +++ b/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr @@ -1,7 +1,7 @@ error[E0271]: type mismatch resolving `::Color == Blue` --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:37:10 | -LL | fn b() { blue_car(ModelT); } //~ ERROR type mismatch +LL | fn b() { blue_car(ModelT); } | ^^^^^^^^ expected struct `Black`, found struct `Blue` | = note: expected type `Black` @@ -15,7 +15,7 @@ LL | fn blue_car>(c: C) { error[E0271]: type mismatch resolving `::Color == Black` --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:38:10 | -LL | fn c() { black_car(ModelU); } //~ ERROR type mismatch +LL | fn c() { black_car(ModelU); } | ^^^^^^^^^ expected struct `Blue`, found struct `Black` | = note: expected type `Blue` diff --git a/src/test/ui/associated-types/associated-types-bound-failure.stderr b/src/test/ui/associated-types/associated-types-bound-failure.stderr index 784a53f106a9..502fb4f1c303 100644 --- a/src/test/ui/associated-types/associated-types-bound-failure.stderr +++ b/src/test/ui/associated-types/associated-types-bound-failure.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `::R: ToInt` is not satisfied --> $DIR/associated-types-bound-failure.rs:17:5 | -LL | ToInt::to_int(&g.get()) //~ ERROR E0277 +LL | ToInt::to_int(&g.get()) | ^^^^^^^^^^^^^ the trait `ToInt` is not implemented for `::R` | = help: consider adding a `where ::R: ToInt` bound diff --git a/src/test/ui/associated-types/associated-types-eq-1.stderr b/src/test/ui/associated-types/associated-types-eq-1.stderr index 0935d6ae3e61..aa987316801a 100644 --- a/src/test/ui/associated-types/associated-types-eq-1.stderr +++ b/src/test/ui/associated-types/associated-types-eq-1.stderr @@ -1,7 +1,7 @@ error[E0412]: cannot find type `A` in this scope --> $DIR/associated-types-eq-1.rs:10:12 | -LL | let _: A = x.boo(); //~ ERROR cannot find type `A` in this scope +LL | let _: A = x.boo(); | ^ help: a type parameter with a similar name exists: `I` error: aborting due to previous error diff --git a/src/test/ui/associated-types/associated-types-eq-hr.stderr b/src/test/ui/associated-types/associated-types-eq-hr.stderr index 3721b6989887..82d15b92b55f 100644 --- a/src/test/ui/associated-types/associated-types-eq-hr.stderr +++ b/src/test/ui/associated-types/associated-types-eq-hr.stderr @@ -1,7 +1,7 @@ error[E0271]: type mismatch resolving `for<'x> >::A == &'x isize` --> $DIR/associated-types-eq-hr.rs:82:5 | -LL | foo::(); //~ ERROR type mismatch +LL | foo::(); | ^^^^^^^^^^^^^^^^^ expected usize, found isize | = note: expected type `&usize` @@ -19,7 +19,7 @@ LL | | } error[E0271]: type mismatch resolving `for<'x> >::A == &'x usize` --> $DIR/associated-types-eq-hr.rs:86:5 | -LL | bar::(); //~ ERROR type mismatch +LL | bar::(); | ^^^^^^^^^^^^^^^^ expected isize, found usize | = note: expected type `&isize` diff --git a/src/test/ui/associated-types/associated-types-issue-17359.stderr b/src/test/ui/associated-types/associated-types-issue-17359.stderr index e05da8c4e4e8..575a072c558b 100644 --- a/src/test/ui/associated-types/associated-types-issue-17359.stderr +++ b/src/test/ui/associated-types/associated-types-issue-17359.stderr @@ -4,7 +4,7 @@ error[E0046]: not all trait items implemented, missing: `Type` LL | type Type; | ---------- `Type` from trait ... -LL | impl Trait for isize {} //~ ERROR missing: `Type` +LL | impl Trait for isize {} | ^^^^^^^^^^^^^^^^^^^^ missing `Type` in implementation error: aborting due to previous error diff --git a/src/test/ui/associated-types/associated-types-issue-20346.stderr b/src/test/ui/associated-types/associated-types-issue-20346.stderr index 27b5b1e00f9e..7d5b16c6e62d 100644 --- a/src/test/ui/associated-types/associated-types-issue-20346.stderr +++ b/src/test/ui/associated-types/associated-types-issue-20346.stderr @@ -1,7 +1,7 @@ error[E0271]: type mismatch resolving ` as Iterator>::Item == std::option::Option` --> $DIR/associated-types-issue-20346.rs:34:5 | -LL | is_iterator_of::, _>(&adapter); //~ ERROR type mismatch +LL | is_iterator_of::, _>(&adapter); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter, found enum `std::option::Option` | = note: expected type `T` diff --git a/src/test/ui/associated-types/associated-types-multiple-types-one-trait.stderr b/src/test/ui/associated-types/associated-types-multiple-types-one-trait.stderr index ec8852d9f186..2926bdae0525 100644 --- a/src/test/ui/associated-types/associated-types-multiple-types-one-trait.stderr +++ b/src/test/ui/associated-types/associated-types-multiple-types-one-trait.stderr @@ -1,7 +1,7 @@ error[E0271]: type mismatch resolving `::Y == i32` --> $DIR/associated-types-multiple-types-one-trait.rs:13:5 | -LL | want_y(t); //~ ERROR type mismatch +LL | want_y(t); | ^^^^^^ expected associated type, found i32 | = note: expected type `::Y` @@ -15,7 +15,7 @@ LL | fn want_y>(t: &T) { } error[E0271]: type mismatch resolving `::X == u32` --> $DIR/associated-types-multiple-types-one-trait.rs:18:5 | -LL | want_x(t); //~ ERROR type mismatch +LL | want_x(t); | ^^^^^^ expected associated type, found u32 | = note: expected type `::X` diff --git a/src/test/ui/associated-types/associated-types-outlives.nll.stderr b/src/test/ui/associated-types/associated-types-outlives.nll.stderr index c58dc314e8a9..840e33b4b8a8 100644 --- a/src/test/ui/associated-types/associated-types-outlives.nll.stderr +++ b/src/test/ui/associated-types/associated-types-outlives.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | 's: loop { y = denormalise(&x); break } | -- borrow of `x` occurs here -LL | drop(x); //~ ERROR cannot move out of `x` because it is borrowed +LL | drop(x); | ^ move out of `x` occurs here LL | return f(y); | - borrow later used here diff --git a/src/test/ui/associated-types/associated-types-outlives.stderr b/src/test/ui/associated-types/associated-types-outlives.stderr index 4cf3e473cf19..e35862d718f4 100644 --- a/src/test/ui/associated-types/associated-types-outlives.stderr +++ b/src/test/ui/associated-types/associated-types-outlives.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | 's: loop { y = denormalise(&x); break } | - borrow of `x` occurs here -LL | drop(x); //~ ERROR cannot move out of `x` because it is borrowed +LL | drop(x); | ^ move out of `x` occurs here error: aborting due to previous error diff --git a/src/test/ui/associated-types/associated-types-overridden-binding.stderr b/src/test/ui/associated-types/associated-types-overridden-binding.stderr index b54d2037f5d2..a26ee23894f6 100644 --- a/src/test/ui/associated-types/associated-types-overridden-binding.stderr +++ b/src/test/ui/associated-types/associated-types-overridden-binding.stderr @@ -1,7 +1,7 @@ error[E0284]: type annotations required: cannot resolve `::Item == i32` --> $DIR/associated-types-overridden-binding.rs:4:1 | -LL | trait Bar: Foo {} //~ ERROR type annotations required +LL | trait Bar: Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: required by `Foo` diff --git a/src/test/ui/associated-types/associated-types-path-1.stderr b/src/test/ui/associated-types/associated-types-path-1.stderr index 5f5fb7a273bf..b6d3b53ba59b 100644 --- a/src/test/ui/associated-types/associated-types-path-1.stderr +++ b/src/test/ui/associated-types/associated-types-path-1.stderr @@ -1,7 +1,7 @@ error[E0220]: associated type `A` not found for `T` --> $DIR/associated-types-path-1.rs:10:23 | -LL | pub fn f1(a: T, x: T::A) {} //~ERROR associated type `A` not found +LL | pub fn f1(a: T, x: T::A) {} | ^^^^ associated type `A` not found error[E0221]: ambiguous associated type `A` in bounds of `T` @@ -13,7 +13,7 @@ LL | type A; LL | type A; | ------- ambiguous `A` from `Bar` ... -LL | pub fn f2(a: T, x: T::A) {} //~ERROR ambiguous associated type `A` +LL | pub fn f2(a: T, x: T::A) {} | ^^^^ ambiguous associated type `A` error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-types/associated-types-subtyping-1.stderr b/src/test/ui/associated-types/associated-types-subtyping-1.stderr index 77914dbae795..58ceec9040b9 100644 --- a/src/test/ui/associated-types/associated-types-subtyping-1.stderr +++ b/src/test/ui/associated-types/associated-types-subtyping-1.stderr @@ -4,7 +4,7 @@ error[E0623]: lifetime mismatch LL | fn method2<'a,'b,T>(x: &'a T, y: &'b T) | ----- ----- these two types are declared with different lifetimes... ... -LL | let _c: >::Type = a; //~ ERROR E0623 +LL | let _c: >::Type = a; | ^ ...but data from `y` flows into `x` here error[E0623]: lifetime mismatch @@ -13,7 +13,7 @@ error[E0623]: lifetime mismatch LL | fn method3<'a,'b,T>(x: &'a T, y: &'b T) | ----- ----- these two types are declared with different lifetimes... ... -LL | let _c: >::Type = b; //~ ERROR E0623 +LL | let _c: >::Type = b; | ^ ...but data from `y` flows into `x` here error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-types/associated-types-unsized.stderr b/src/test/ui/associated-types/associated-types-unsized.stderr index c83b14374f71..b5db9743932e 100644 --- a/src/test/ui/associated-types/associated-types-unsized.stderr +++ b/src/test/ui/associated-types/associated-types-unsized.stderr @@ -1,7 +1,7 @@ error[E0277]: the size for values of type `::Value` cannot be known at compilation time --> $DIR/associated-types-unsized.rs:7:9 | -LL | let x = t.get(); //~ ERROR the size for values of type +LL | let x = t.get(); | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `::Value` diff --git a/src/test/ui/attempted-access-non-fatal.stderr b/src/test/ui/attempted-access-non-fatal.stderr index 2fee49acdf4b..5b7db0e9d6fb 100644 --- a/src/test/ui/attempted-access-non-fatal.stderr +++ b/src/test/ui/attempted-access-non-fatal.stderr @@ -1,13 +1,13 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:4:15 | -LL | let _ = x.foo; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610] +LL | let _ = x.foo; | ^^^ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:5:15 | -LL | let _ = x.bar; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610] +LL | let _ = x.bar; | ^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/attr-eq-token-tree.rs b/src/test/ui/attr-eq-token-tree.rs index f28f76db9389..6aacb9d572ae 100644 --- a/src/test/ui/attr-eq-token-tree.rs +++ b/src/test/ui/attr-eq-token-tree.rs @@ -1,6 +1,4 @@ -// compile-pass +#![feature(custom_attribute)] -#![feature(custom_attribute, unrestricted_attribute_tokens)] - -#[my_attr = !] // OK under feature gate +#[my_attr = !] //~ ERROR unexpected token: `!` fn main() {} diff --git a/src/test/ui/attr-eq-token-tree.stderr b/src/test/ui/attr-eq-token-tree.stderr new file mode 100644 index 000000000000..aae25b2721e4 --- /dev/null +++ b/src/test/ui/attr-eq-token-tree.stderr @@ -0,0 +1,8 @@ +error: unexpected token: `!` + --> $DIR/attr-eq-token-tree.rs:3:11 + | +LL | #[my_attr = !] + | ^ + +error: aborting due to previous error + diff --git a/src/test/ui/attr-usage-inline.stderr b/src/test/ui/attr-usage-inline.stderr index 3030a2f8f1d6..d8d7f6adb82b 100644 --- a/src/test/ui/attr-usage-inline.stderr +++ b/src/test/ui/attr-usage-inline.stderr @@ -1,7 +1,7 @@ error[E0518]: attribute should be applied to function or closure --> $DIR/attr-usage-inline.rs:6:1 | -LL | #[inline] //~ ERROR: attribute should be applied to function or closure +LL | #[inline] | ^^^^^^^^^ LL | struct S; | --------- not a function or closure diff --git a/src/test/ui/attr-usage-repr.stderr b/src/test/ui/attr-usage-repr.stderr index abb8685e4cef..f8ad7eec454c 100644 --- a/src/test/ui/attr-usage-repr.stderr +++ b/src/test/ui/attr-usage-repr.stderr @@ -1,7 +1,7 @@ error[E0517]: attribute should be applied to struct, enum or union --> $DIR/attr-usage-repr.rs:4:8 | -LL | #[repr(C)] //~ ERROR: attribute should be applied to struct, enum or union +LL | #[repr(C)] | ^ LL | fn f() {} | --------- not a struct, enum or union @@ -9,7 +9,7 @@ LL | fn f() {} error[E0517]: attribute should be applied to enum --> $DIR/attr-usage-repr.rs:16:8 | -LL | #[repr(i8)] //~ ERROR: attribute should be applied to enum +LL | #[repr(i8)] | ^^ LL | struct SInt(f64, f64); | ---------------------- not an enum @@ -17,7 +17,7 @@ LL | struct SInt(f64, f64); error[E0517]: attribute should be applied to struct or union --> $DIR/attr-usage-repr.rs:25:8 | -LL | #[repr(packed)] //~ ERROR: attribute should be applied to struct +LL | #[repr(packed)] | ^^^^^^ LL | enum EPacked { A, B } | --------------------- not a struct or union @@ -25,7 +25,7 @@ LL | enum EPacked { A, B } error[E0517]: attribute should be applied to struct --> $DIR/attr-usage-repr.rs:28:8 | -LL | #[repr(simd)] //~ ERROR: attribute should be applied to struct +LL | #[repr(simd)] | ^^^^ LL | enum ESimd { A, B } | ------------------- not a struct diff --git a/src/test/ui/attribute-with-no-generics-in-parameter-list.stderr b/src/test/ui/attribute-with-no-generics-in-parameter-list.stderr index f08f107a62ff..4c5964715db7 100644 --- a/src/test/ui/attribute-with-no-generics-in-parameter-list.stderr +++ b/src/test/ui/attribute-with-no-generics-in-parameter-list.stderr @@ -1,7 +1,7 @@ error: attribute without generic parameters --> $DIR/attribute-with-no-generics-in-parameter-list.rs:1:8 | -LL | fn foo<#[attr]>() {} //~ ERROR attribute without generic parameters +LL | fn foo<#[attr]>() {} | ^^^^^^^ attributes are only permitted when preceding parameters error: aborting due to previous error diff --git a/src/test/ui/augmented-assignments.nll.stderr b/src/test/ui/augmented-assignments.nll.stderr index 33c94d6e3a59..08f06e90162b 100644 --- a/src/test/ui/augmented-assignments.nll.stderr +++ b/src/test/ui/augmented-assignments.nll.stderr @@ -1,14 +1,14 @@ error[E0505]: cannot move out of `x` because it is borrowed --> $DIR/augmented-assignments.rs:16:5 | -LL | x //~ error: use of moved value: `x` +LL | x | - | | | _____borrow of `x` occurs here | | -LL | | //~^ value used here after move +LL | | LL | | += -LL | | x; //~ value moved here +LL | | x; | | ^ | | | | |_____move out of `x` occurs here @@ -20,7 +20,7 @@ error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable LL | let y = Int(2); | - help: consider changing this to be mutable: `mut y` ... -LL | y //~ error: cannot borrow immutable local variable `y` as mutable +LL | y | ^ cannot borrow as mutable error: aborting due to 2 previous errors diff --git a/src/test/ui/augmented-assignments.stderr b/src/test/ui/augmented-assignments.stderr index 73de315e542a..e429bf2a594f 100644 --- a/src/test/ui/augmented-assignments.stderr +++ b/src/test/ui/augmented-assignments.stderr @@ -4,16 +4,16 @@ error[E0596]: cannot borrow immutable local variable `y` as mutable LL | let y = Int(2); | - help: make this binding mutable: `mut y` ... -LL | y //~ error: cannot borrow immutable local variable `y` as mutable +LL | y | ^ cannot borrow mutably error[E0382]: use of moved value: `x` --> $DIR/augmented-assignments.rs:13:5 | -LL | x //~ error: use of moved value: `x` +LL | x | ^ value used here after move ... -LL | x; //~ value moved here +LL | x; | - value moved here | = note: move occurs because `x` has type `Int`, which does not implement the `Copy` trait diff --git a/src/test/ui/auto-ref-slice-plus-ref.stderr b/src/test/ui/auto-ref-slice-plus-ref.stderr index 356e24d18a78..97b9cd961a02 100644 --- a/src/test/ui/auto-ref-slice-plus-ref.stderr +++ b/src/test/ui/auto-ref-slice-plus-ref.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `test_mut` found for type `std::vec::Vec<{integer}>` in the current scope --> $DIR/auto-ref-slice-plus-ref.rs:7:7 | -LL | a.test_mut(); //~ ERROR no method named `test_mut` found +LL | a.test_mut(); | ^^^^^^^^ help: did you mean: `get_mut` | = help: items from traits can only be used if the trait is implemented and in scope @@ -11,7 +11,7 @@ LL | a.test_mut(); //~ ERROR no method named `test_mut` found error[E0599]: no method named `test` found for type `std::vec::Vec<{integer}>` in the current scope --> $DIR/auto-ref-slice-plus-ref.rs:8:7 | -LL | a.test(); //~ ERROR no method named `test` found +LL | a.test(); | ^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -21,7 +21,7 @@ LL | a.test(); //~ ERROR no method named `test` found error[E0599]: no method named `test` found for type `[{integer}; 1]` in the current scope --> $DIR/auto-ref-slice-plus-ref.rs:10:11 | -LL | ([1]).test(); //~ ERROR no method named `test` found +LL | ([1]).test(); | ^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -31,7 +31,7 @@ LL | ([1]).test(); //~ ERROR no method named `test` found error[E0599]: no method named `test` found for type `&[{integer}; 1]` in the current scope --> $DIR/auto-ref-slice-plus-ref.rs:11:12 | -LL | (&[1]).test(); //~ ERROR no method named `test` found +LL | (&[1]).test(); | ^^^^ | = help: items from traits can only be used if the trait is implemented and in scope diff --git a/src/test/ui/await-keyword/2018-edition-error.stderr b/src/test/ui/await-keyword/2018-edition-error.stderr index 9ddb27916d18..19bf11a67d1c 100644 --- a/src/test/ui/await-keyword/2018-edition-error.stderr +++ b/src/test/ui/await-keyword/2018-edition-error.stderr @@ -1,37 +1,37 @@ error[E0721]: `await` is a keyword in the 2018 edition --> $DIR/2018-edition-error.rs:5:13 | -LL | pub mod await { //~ ERROR `await` is a keyword +LL | pub mod await { | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` error[E0721]: `await` is a keyword in the 2018 edition --> $DIR/2018-edition-error.rs:6:20 | -LL | pub struct await; //~ ERROR `await` is a keyword +LL | pub struct await; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` error[E0721]: `await` is a keyword in the 2018 edition --> $DIR/2018-edition-error.rs:9:22 | -LL | use self::outer_mod::await::await; //~ ERROR `await` is a keyword +LL | use self::outer_mod::await::await; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` error[E0721]: `await` is a keyword in the 2018 edition --> $DIR/2018-edition-error.rs:9:29 | -LL | use self::outer_mod::await::await; //~ ERROR `await` is a keyword +LL | use self::outer_mod::await::await; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` error[E0721]: `await` is a keyword in the 2018 edition --> $DIR/2018-edition-error.rs:13:11 | -LL | match await { await => () } //~ ERROR `await` is a keyword +LL | match await { await => () } | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` error[E0721]: `await` is a keyword in the 2018 edition --> $DIR/2018-edition-error.rs:13:19 | -LL | match await { await => () } //~ ERROR `await` is a keyword +LL | match await { await => () } | ^^^^^ help: you can use a raw identifier to stay compatible: `r#await` error: aborting due to 6 previous errors diff --git a/src/test/ui/bad/bad-expr-lhs.stderr b/src/test/ui/bad/bad-expr-lhs.stderr index 590d73bc3f5e..3e41b7e65855 100644 --- a/src/test/ui/bad/bad-expr-lhs.stderr +++ b/src/test/ui/bad/bad-expr-lhs.stderr @@ -1,31 +1,31 @@ error[E0070]: invalid left-hand side expression --> $DIR/bad-expr-lhs.rs:2:5 | -LL | 1 = 2; //~ ERROR invalid left-hand side expression +LL | 1 = 2; | ^^^^^ left-hand of expression not valid error[E0067]: invalid left-hand side expression --> $DIR/bad-expr-lhs.rs:3:5 | -LL | 1 += 2; //~ ERROR invalid left-hand side expression +LL | 1 += 2; | ^ invalid expression for left-hand side error[E0070]: invalid left-hand side expression --> $DIR/bad-expr-lhs.rs:4:5 | -LL | (1, 2) = (3, 4); //~ ERROR invalid left-hand side expression +LL | (1, 2) = (3, 4); | ^^^^^^^^^^^^^^^ left-hand of expression not valid error[E0070]: invalid left-hand side expression --> $DIR/bad-expr-lhs.rs:7:5 | -LL | (a, b) = (3, 4); //~ ERROR invalid left-hand side expression +LL | (a, b) = (3, 4); | ^^^^^^^^^^^^^^^ left-hand of expression not valid error[E0070]: invalid left-hand side expression --> $DIR/bad-expr-lhs.rs:9:5 | -LL | None = Some(3); //~ ERROR invalid left-hand side expression +LL | None = Some(3); | ^^^^^^^^^^^^^^ left-hand of expression not valid error: aborting due to 5 previous errors diff --git a/src/test/ui/bad/bad-expr-path.stderr b/src/test/ui/bad/bad-expr-path.stderr index 71ac9a16ba62..6dec74efd718 100644 --- a/src/test/ui/bad/bad-expr-path.stderr +++ b/src/test/ui/bad/bad-expr-path.stderr @@ -19,7 +19,7 @@ LL | log(debug, m1::arguments); error[E0580]: main function has wrong type --> $DIR/bad-expr-path.rs:3:1 | -LL | fn main(arguments: Vec) { //~ ERROR main function has wrong type +LL | fn main(arguments: Vec) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters | = note: expected type `fn()` diff --git a/src/test/ui/bad/bad-expr-path2.stderr b/src/test/ui/bad/bad-expr-path2.stderr index 343de94182e9..8212b2392c4a 100644 --- a/src/test/ui/bad/bad-expr-path2.stderr +++ b/src/test/ui/bad/bad-expr-path2.stderr @@ -19,7 +19,7 @@ LL | log(debug, m1::arguments); error[E0580]: main function has wrong type --> $DIR/bad-expr-path2.rs:5:1 | -LL | fn main(arguments: Vec) { //~ ERROR main function has wrong type +LL | fn main(arguments: Vec) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters | = note: expected type `fn()` diff --git a/src/test/ui/bad/bad-extern-link-attrs.stderr b/src/test/ui/bad/bad-extern-link-attrs.stderr index 6732e8553f3f..5baba599e741 100644 --- a/src/test/ui/bad/bad-extern-link-attrs.stderr +++ b/src/test/ui/bad/bad-extern-link-attrs.stderr @@ -1,19 +1,19 @@ error[E0459]: #[link(...)] specified without `name = "foo"` --> $DIR/bad-extern-link-attrs.rs:1:1 | -LL | #[link()] //~ ERROR: specified without `name = +LL | #[link()] | ^^^^^^^^^ missing `name` argument error[E0454]: #[link(name = "")] given with empty name --> $DIR/bad-extern-link-attrs.rs:2:1 | -LL | #[link(name = "")] //~ ERROR: with empty name +LL | #[link(name = "")] | ^^^^^^^^^^^^^^^^^^ empty name given error[E0458]: unknown kind: `bar` --> $DIR/bad-extern-link-attrs.rs:4:1 | -LL | #[link(name = "foo", kind = "bar")] //~ ERROR: unknown kind +LL | #[link(name = "foo", kind = "bar")] | ^^^^^^^^^^^^^^^^^^^^^------------^^ | | | unknown kind diff --git a/src/test/ui/bad/bad-lint-cap2.stderr b/src/test/ui/bad/bad-lint-cap2.stderr index d7ec41489d15..f6e67e6d78df 100644 --- a/src/test/ui/bad/bad-lint-cap2.stderr +++ b/src/test/ui/bad/bad-lint-cap2.stderr @@ -1,7 +1,7 @@ error: unused import: `std::option` --> $DIR/bad-lint-cap2.rs:6:5 | -LL | use std::option; //~ ERROR +LL | use std::option; | ^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/bad/bad-lint-cap3.stderr b/src/test/ui/bad/bad-lint-cap3.stderr index 5bf0b089afa2..a1ea3f774b40 100644 --- a/src/test/ui/bad/bad-lint-cap3.stderr +++ b/src/test/ui/bad/bad-lint-cap3.stderr @@ -1,7 +1,7 @@ warning: unused import: `std::option` --> $DIR/bad-lint-cap3.rs:7:5 | -LL | use std::option; //~ WARN +LL | use std::option; | ^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/bad/bad-main.stderr b/src/test/ui/bad/bad-main.stderr index 1a9c11f7b42a..c7f15e7a4fa5 100644 --- a/src/test/ui/bad/bad-main.stderr +++ b/src/test/ui/bad/bad-main.stderr @@ -1,7 +1,7 @@ error[E0580]: main function has wrong type --> $DIR/bad-main.rs:1:1 | -LL | fn main(x: isize) { } //~ ERROR: main function has wrong type [E0580] +LL | fn main(x: isize) { } | ^^^^^^^^^^^^^^^^^ incorrect number of function parameters | = note: expected type `fn()` diff --git a/src/test/ui/bad/bad-method-typaram-kind.stderr b/src/test/ui/bad/bad-method-typaram-kind.stderr index 8232bdd23a64..c72b96523600 100644 --- a/src/test/ui/bad/bad-method-typaram-kind.stderr +++ b/src/test/ui/bad/bad-method-typaram-kind.stderr @@ -1,7 +1,7 @@ error[E0277]: `T` cannot be sent between threads safely --> $DIR/bad-method-typaram-kind.rs:2:7 | -LL | 1.bar::(); //~ ERROR `T` cannot be sent between threads safely +LL | 1.bar::(); | ^^^ `T` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `T` diff --git a/src/test/ui/bad/bad-type-env-capture.stderr b/src/test/ui/bad/bad-type-env-capture.stderr index ce803e96801f..a459c00634a1 100644 --- a/src/test/ui/bad/bad-type-env-capture.stderr +++ b/src/test/ui/bad/bad-type-env-capture.stderr @@ -3,7 +3,7 @@ error[E0401]: can't use generic parameters from outer function | LL | fn foo() { | - type variable from outer function -LL | fn bar(b: T) { } //~ ERROR can't use generic parameters from outer +LL | fn bar(b: T) { } | --- ^ use of generic parameter from outer function | | | help: try using a local generic parameter instead: `bar` diff --git a/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-2.stderr b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-2.stderr index 427b1a722d99..9157fe0b070d 100644 --- a/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-2.stderr +++ b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-2.stderr @@ -1,7 +1,7 @@ error[E0009]: cannot bind by-move and by-ref in the same pattern --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-2.rs:12:23 | -LL | Some((ref _y, _z)) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern +LL | Some((ref _y, _z)) => { }, | ------ ^^ by-move pattern here | | | both by-ref and by-move used diff --git a/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-4.stderr b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-4.stderr index 9ebbedcfe600..267a9dff926a 100644 --- a/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-4.stderr +++ b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-4.stderr @@ -1,7 +1,7 @@ error[E0009]: cannot bind by-move and by-ref in the same pattern --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-4.rs:12:15 | -LL | Some((_y, ref _z)) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern +LL | Some((_y, ref _z)) => { }, | ^^ ------ both by-ref and by-move used | | | by-move pattern here diff --git a/src/test/ui/binop/binop-consume-args.nll.stderr b/src/test/ui/binop/binop-consume-args.nll.stderr index 59b5aba93cad..5751af27fcb4 100644 --- a/src/test/ui/binop/binop-consume-args.nll.stderr +++ b/src/test/ui/binop/binop-consume-args.nll.stderr @@ -7,7 +7,7 @@ LL | fn add, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs + rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -19,8 +19,8 @@ LL | fn add, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs + rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -32,7 +32,7 @@ LL | fn sub, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs - rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -44,8 +44,8 @@ LL | fn sub, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs - rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -57,7 +57,7 @@ LL | fn mul, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs * rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -69,8 +69,8 @@ LL | fn mul, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs * rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -82,7 +82,7 @@ LL | fn div, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs / rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -94,8 +94,8 @@ LL | fn div, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs / rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -107,7 +107,7 @@ LL | fn rem, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs % rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -119,8 +119,8 @@ LL | fn rem, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs % rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -132,7 +132,7 @@ LL | fn bitand, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs & rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -144,8 +144,8 @@ LL | fn bitand, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs & rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -157,7 +157,7 @@ LL | fn bitor, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs | rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -169,8 +169,8 @@ LL | fn bitor, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs | rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -182,7 +182,7 @@ LL | fn bitxor, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs ^ rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -194,8 +194,8 @@ LL | fn bitxor, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs ^ rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -207,7 +207,7 @@ LL | fn shl, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs << rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -219,8 +219,8 @@ LL | fn shl, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs << rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error[E0382]: use of moved value: `lhs` @@ -232,7 +232,7 @@ LL | fn shr, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs >> rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move error[E0382]: use of moved value: `rhs` @@ -244,8 +244,8 @@ LL | fn shr, B>(lhs: A, rhs: B) { | consider adding a `Copy` constraint to this type argument LL | lhs >> rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move error: aborting due to 20 previous errors diff --git a/src/test/ui/binop/binop-consume-args.stderr b/src/test/ui/binop/binop-consume-args.stderr index 0b5d2200b9ff..9246c116709d 100644 --- a/src/test/ui/binop/binop-consume-args.stderr +++ b/src/test/ui/binop/binop-consume-args.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `lhs` | LL | lhs + rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move | = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait @@ -13,8 +13,8 @@ error[E0382]: use of moved value: `rhs` | LL | lhs + rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move | = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait @@ -24,7 +24,7 @@ error[E0382]: use of moved value: `lhs` | LL | lhs - rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move | = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait @@ -34,8 +34,8 @@ error[E0382]: use of moved value: `rhs` | LL | lhs - rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move | = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait @@ -45,7 +45,7 @@ error[E0382]: use of moved value: `lhs` | LL | lhs * rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move | = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait @@ -55,8 +55,8 @@ error[E0382]: use of moved value: `rhs` | LL | lhs * rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move | = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait @@ -66,7 +66,7 @@ error[E0382]: use of moved value: `lhs` | LL | lhs / rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move | = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait @@ -76,8 +76,8 @@ error[E0382]: use of moved value: `rhs` | LL | lhs / rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move | = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait @@ -87,7 +87,7 @@ error[E0382]: use of moved value: `lhs` | LL | lhs % rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move | = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait @@ -97,8 +97,8 @@ error[E0382]: use of moved value: `rhs` | LL | lhs % rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move | = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait @@ -108,7 +108,7 @@ error[E0382]: use of moved value: `lhs` | LL | lhs & rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move | = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait @@ -118,8 +118,8 @@ error[E0382]: use of moved value: `rhs` | LL | lhs & rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move | = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait @@ -129,7 +129,7 @@ error[E0382]: use of moved value: `lhs` | LL | lhs | rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move | = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait @@ -139,8 +139,8 @@ error[E0382]: use of moved value: `rhs` | LL | lhs | rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move | = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait @@ -150,7 +150,7 @@ error[E0382]: use of moved value: `lhs` | LL | lhs ^ rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move | = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait @@ -160,8 +160,8 @@ error[E0382]: use of moved value: `rhs` | LL | lhs ^ rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move | = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait @@ -171,7 +171,7 @@ error[E0382]: use of moved value: `lhs` | LL | lhs << rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move | = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait @@ -181,8 +181,8 @@ error[E0382]: use of moved value: `rhs` | LL | lhs << rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move | = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait @@ -192,7 +192,7 @@ error[E0382]: use of moved value: `lhs` | LL | lhs >> rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` +LL | drop(lhs); | ^^^ value used here after move | = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait @@ -202,8 +202,8 @@ error[E0382]: use of moved value: `rhs` | LL | lhs >> rhs; | --- value moved here -LL | drop(lhs); //~ ERROR use of moved value: `lhs` -LL | drop(rhs); //~ ERROR use of moved value: `rhs` +LL | drop(lhs); +LL | drop(rhs); | ^^^ value used here after move | = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait diff --git a/src/test/ui/binop/binop-move-semantics.nll.stderr b/src/test/ui/binop/binop-move-semantics.nll.stderr index 7c84e8833a9e..7d54de655bf5 100644 --- a/src/test/ui/binop/binop-move-semantics.nll.stderr +++ b/src/test/ui/binop/binop-move-semantics.nll.stderr @@ -8,7 +8,7 @@ LL | fn double_move>(x: T) { LL | x | - value moved here LL | + -LL | x; //~ ERROR: use of moved value +LL | x; | ^ value used here after move error[E0382]: borrow of moved value: `x` @@ -21,7 +21,7 @@ LL | fn move_then_borrow + Clone>(x: T) { LL | x | - value moved here LL | + -LL | x.clone(); //~ ERROR: use of moved value +LL | x.clone(); | ^ value borrowed here after move error[E0505]: cannot move out of `x` because it is borrowed @@ -30,7 +30,7 @@ error[E0505]: cannot move out of `x` because it is borrowed LL | let m = &x; | -- borrow of `x` occurs here ... -LL | x //~ ERROR: cannot move out of `x` because it is borrowed +LL | x | ^ move out of `x` occurs here ... LL | use_mut(n); use_imm(m); @@ -42,7 +42,7 @@ error[E0505]: cannot move out of `y` because it is borrowed LL | let n = &mut y; | ------ borrow of `y` occurs here ... -LL | y; //~ ERROR: cannot move out of `y` because it is borrowed +LL | y; | ^ move out of `y` occurs here LL | use_mut(n); use_imm(m); | - borrow later used here @@ -50,13 +50,13 @@ LL | use_mut(n); use_imm(m); error[E0507]: cannot move out of borrowed content --> $DIR/binop-move-semantics.rs:30:5 | -LL | *m //~ ERROR: cannot move out of borrowed content +LL | *m | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/binop-move-semantics.rs:32:5 | -LL | *n; //~ ERROR: cannot move out of borrowed content +LL | *n; | ^^ cannot move out of borrowed content error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable @@ -68,7 +68,7 @@ LL | &mut f | _____mutable borrow occurs here | | LL | | + -LL | | &f; //~ ERROR: cannot borrow `f` as immutable because it is also borrowed as mutable +LL | | &f; | | ^- | |_____|| | |mutable borrow later used here @@ -83,7 +83,7 @@ LL | &f | _____immutable borrow occurs here | | LL | | + -LL | | &mut f; //~ ERROR: cannot borrow `f` as mutable because it is also borrowed as immutable +LL | | &mut f; | | ^^^^^- | |_____|____| | | immutable borrow later used here diff --git a/src/test/ui/binop/binop-move-semantics.stderr b/src/test/ui/binop/binop-move-semantics.stderr index b1dc70d379d4..acc2620681b6 100644 --- a/src/test/ui/binop/binop-move-semantics.stderr +++ b/src/test/ui/binop/binop-move-semantics.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `x` LL | x | - value moved here LL | + -LL | x; //~ ERROR: use of moved value +LL | x; | ^ value used here after move | = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait @@ -15,7 +15,7 @@ error[E0382]: use of moved value: `x` LL | x | - value moved here LL | + -LL | x.clone(); //~ ERROR: use of moved value +LL | x.clone(); | ^ value used here after move | = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait @@ -26,7 +26,7 @@ error[E0505]: cannot move out of `x` because it is borrowed LL | let m = &x; | - borrow of `x` occurs here ... -LL | x //~ ERROR: cannot move out of `x` because it is borrowed +LL | x | ^ move out of `x` occurs here error[E0505]: cannot move out of `y` because it is borrowed @@ -35,19 +35,19 @@ error[E0505]: cannot move out of `y` because it is borrowed LL | let n = &mut y; | - borrow of `y` occurs here ... -LL | y; //~ ERROR: cannot move out of `y` because it is borrowed +LL | y; | ^ move out of `y` occurs here error[E0507]: cannot move out of borrowed content --> $DIR/binop-move-semantics.rs:30:5 | -LL | *m //~ ERROR: cannot move out of borrowed content +LL | *m | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/binop-move-semantics.rs:32:5 | -LL | *n; //~ ERROR: cannot move out of borrowed content +LL | *n; | ^^ cannot move out of borrowed content error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable @@ -56,7 +56,7 @@ error[E0502]: cannot borrow `f` as immutable because it is also borrowed as muta LL | &mut f | - mutable borrow occurs here LL | + -LL | &f; //~ ERROR: cannot borrow `f` as immutable because it is also borrowed as mutable +LL | &f; | ^ | | | immutable borrow occurs here @@ -68,7 +68,7 @@ error[E0502]: cannot borrow `f` as mutable because it is also borrowed as immuta LL | &f | - immutable borrow occurs here LL | + -LL | &mut f; //~ ERROR: cannot borrow `f` as mutable because it is also borrowed as immutable +LL | &mut f; | ^ | | | mutable borrow occurs here diff --git a/src/test/ui/block-expression-remove-semicolon.rs b/src/test/ui/block-expression-remove-semicolon.rs new file mode 100644 index 000000000000..afa10b38b914 --- /dev/null +++ b/src/test/ui/block-expression-remove-semicolon.rs @@ -0,0 +1,10 @@ +fn foo() -> i32 { + 0 +} + +fn main() { + let x: i32 = { + //~^ ERROR mismatched types + foo(); //~ HELP consider removing this semicolon + }; +} diff --git a/src/test/ui/block-expression-remove-semicolon.stderr b/src/test/ui/block-expression-remove-semicolon.stderr new file mode 100644 index 000000000000..51942f3d920f --- /dev/null +++ b/src/test/ui/block-expression-remove-semicolon.stderr @@ -0,0 +1,17 @@ +error[E0308]: mismatched types + --> $DIR/block-expression-remove-semicolon.rs:6:18 + | +LL | let x: i32 = { + | __________________^ +LL | | +LL | | foo(); + | | - help: consider removing this semicolon +LL | | }; + | |_____^ expected i32, found () + | + = note: expected type `i32` + found type `()` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/block-result/block-must-not-have-result-do.stderr b/src/test/ui/block-result/block-must-not-have-result-do.stderr index 151315d34f27..5981b8b60794 100644 --- a/src/test/ui/block-result/block-must-not-have-result-do.stderr +++ b/src/test/ui/block-result/block-must-not-have-result-do.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/block-must-not-have-result-do.rs:3:9 | -LL | true //~ ERROR mismatched types +LL | true | ^^^^ expected (), found bool | = note: expected type `()` diff --git a/src/test/ui/block-result/block-must-not-have-result-res.stderr b/src/test/ui/block-result/block-must-not-have-result-res.stderr index 29885cac234f..8a41f8b8e3df 100644 --- a/src/test/ui/block-result/block-must-not-have-result-res.stderr +++ b/src/test/ui/block-result/block-must-not-have-result-res.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | fn drop(&mut self) { | - expected `()` because of default return type -LL | true //~ ERROR mismatched types +LL | true | ^^^^ expected (), found bool | = note: expected type `()` diff --git a/src/test/ui/block-result/block-must-not-have-result-while.stderr b/src/test/ui/block-result/block-must-not-have-result-while.stderr index d41eae1a4329..302d2972f7de 100644 --- a/src/test/ui/block-result/block-must-not-have-result-while.stderr +++ b/src/test/ui/block-result/block-must-not-have-result-while.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/block-must-not-have-result-while.rs:3:9 | -LL | true //~ ERROR mismatched types +LL | true | ^^^^ expected (), found bool | = note: expected type `()` diff --git a/src/test/ui/block-result/consider-removing-last-semi.stderr b/src/test/ui/block-result/consider-removing-last-semi.stderr index 1bf17db21ac5..618d020ce08b 100644 --- a/src/test/ui/block-result/consider-removing-last-semi.stderr +++ b/src/test/ui/block-result/consider-removing-last-semi.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/consider-removing-last-semi.rs:1:11 | -LL | fn f() -> String { //~ ERROR mismatched types +LL | fn f() -> String { | - ^^^^^^ expected struct `std::string::String`, found () | | | this function's body doesn't return @@ -15,7 +15,7 @@ LL | "bla".to_string(); error[E0308]: mismatched types --> $DIR/consider-removing-last-semi.rs:6:11 | -LL | fn g() -> String { //~ ERROR mismatched types +LL | fn g() -> String { | - ^^^^^^ expected struct `std::string::String`, found () | | | this function's body doesn't return diff --git a/src/test/ui/block-result/issue-11714.stderr b/src/test/ui/block-result/issue-11714.stderr index 2c13b2876694..d73489a602df 100644 --- a/src/test/ui/block-result/issue-11714.stderr +++ b/src/test/ui/block-result/issue-11714.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-11714.rs:1:14 | -LL | fn blah() -> i32 { //~ ERROR mismatched types +LL | fn blah() -> i32 { | ---- ^^^ expected i32, found () | | | this function's body doesn't return diff --git a/src/test/ui/block-result/issue-13428.stderr b/src/test/ui/block-result/issue-13428.stderr index 91e926eb5a73..18adb15c9615 100644 --- a/src/test/ui/block-result/issue-13428.stderr +++ b/src/test/ui/block-result/issue-13428.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-13428.rs:3:13 | -LL | fn foo() -> String { //~ ERROR mismatched types +LL | fn foo() -> String { | --- ^^^^^^ expected struct `std::string::String`, found () | | | this function's body doesn't return @@ -15,7 +15,7 @@ LL | ; error[E0308]: mismatched types --> $DIR/issue-13428.rs:11:13 | -LL | fn bar() -> String { //~ ERROR mismatched types +LL | fn bar() -> String { | --- ^^^^^^ expected struct `std::string::String`, found () | | | this function's body doesn't return diff --git a/src/test/ui/block-result/issue-20862.stderr b/src/test/ui/block-result/issue-20862.stderr index fce06f5b45d2..fb4feff37134 100644 --- a/src/test/ui/block-result/issue-20862.stderr +++ b/src/test/ui/block-result/issue-20862.stderr @@ -14,7 +14,7 @@ error[E0618]: expected function, found `()` | LL | / fn foo(x: i32) { LL | | |y| x + y -LL | | //~^ ERROR: mismatched types +LL | | LL | | } | |_- `foo` defined here returns `()` ... diff --git a/src/test/ui/block-result/issue-22645.stderr b/src/test/ui/block-result/issue-22645.stderr index 9cb1a6c5d7d5..e1e6428eda25 100644 --- a/src/test/ui/block-result/issue-22645.stderr +++ b/src/test/ui/block-result/issue-22645.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `{integer}: Scalar` is not satisfied --> $DIR/issue-22645.rs:15:5 | -LL | b + 3 //~ ERROR E0277 +LL | b + 3 | ^ the trait `Scalar` is not implemented for `{integer}` | = help: the following implementations were found: @@ -14,7 +14,7 @@ error[E0308]: mismatched types LL | fn main() { | - expected `()` because of default return type LL | let b = Bob + 3.5; -LL | b + 3 //~ ERROR E0277 +LL | b + 3 | ^^^^^ expected (), found struct `Bob` | = note: expected type `()` diff --git a/src/test/ui/block-result/issue-5500.stderr b/src/test/ui/block-result/issue-5500.stderr index 0d9c9d8143d3..6a13b31fe932 100644 --- a/src/test/ui/block-result/issue-5500.stderr +++ b/src/test/ui/block-result/issue-5500.stderr @@ -4,7 +4,10 @@ error[E0308]: mismatched types LL | fn main() { | - expected `()` because of default return type LL | &panic!() - | ^^^^^^^^^ expected (), found reference + | ^^^^^^^^^ + | | + | expected (), found reference + | help: consider removing the borrow: `panic!()` | = note: expected type `()` found type `&_` diff --git a/src/test/ui/block-result/unexpected-return-on-unit.stderr b/src/test/ui/block-result/unexpected-return-on-unit.stderr index 50af4734202d..3ceff81ec4d6 100644 --- a/src/test/ui/block-result/unexpected-return-on-unit.stderr +++ b/src/test/ui/block-result/unexpected-return-on-unit.stderr @@ -1,14 +1,14 @@ error[E0308]: mismatched types --> $DIR/unexpected-return-on-unit.rs:9:5 | -LL | foo() //~ ERROR mismatched types +LL | foo() | ^^^^^ expected (), found usize | = note: expected type `()` found type `usize` help: try adding a semicolon | -LL | foo(); //~ ERROR mismatched types +LL | foo(); | ^ help: try adding a return type | diff --git a/src/test/ui/borrowck/assign_mutable_fields.stderr b/src/test/ui/borrowck/assign_mutable_fields.stderr index 9024e7cf01cb..904d2ed97de8 100644 --- a/src/test/ui/borrowck/assign_mutable_fields.stderr +++ b/src/test/ui/borrowck/assign_mutable_fields.stderr @@ -1,19 +1,19 @@ error[E0381]: use of possibly uninitialized variable: `x.0` --> $DIR/assign_mutable_fields.rs:11:10 | -LL | drop(x.0); //~ ERROR +LL | drop(x.0); | ^^^ use of possibly uninitialized `x.0` error[E0381]: use of possibly uninitialized variable: `x.1` --> $DIR/assign_mutable_fields.rs:12:10 | -LL | drop(x.1); //~ ERROR +LL | drop(x.1); | ^^^ use of possibly uninitialized `x.1` error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/assign_mutable_fields.rs:19:10 | -LL | drop(x); //~ ERROR +LL | drop(x); | ^ use of possibly uninitialized `x` error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.nll.stderr b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.nll.stderr index 9174a6976113..af45c8a980df 100644 --- a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.nll.stderr +++ b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.nll.stderr @@ -1,73 +1,73 @@ error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:15:27 | -LL | let _f = to_fn(|| x = 42); //~ ERROR cannot assign +LL | let _f = to_fn(|| x = 42); | ^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` --> $DIR/borrow-immutable-upvar-mutation.rs:15:24 | -LL | let _f = to_fn(|| x = 42); //~ ERROR cannot assign +LL | let _f = to_fn(|| x = 42); | ^^^^^^^^^ error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:18:31 | -LL | let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow +LL | let _g = to_fn(|| set(&mut y)); | ^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` --> $DIR/borrow-immutable-upvar-mutation.rs:18:24 | -LL | let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow +LL | let _g = to_fn(|| set(&mut y)); | ^^^^^^^^^^^^^^ error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:21:55 | -LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign +LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); | ^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` --> $DIR/borrow-immutable-upvar-mutation.rs:21:52 | -LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign +LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); | ^^^^^^^^^ error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:27:32 | -LL | let _f = to_fn(move || x = 42); //~ ERROR cannot assign +LL | let _f = to_fn(move || x = 42); | ^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` --> $DIR/borrow-immutable-upvar-mutation.rs:27:24 | -LL | let _f = to_fn(move || x = 42); //~ ERROR cannot assign +LL | let _f = to_fn(move || x = 42); | ^^^^^^^^^^^^^^ error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:30:36 | -LL | let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow +LL | let _g = to_fn(move || set(&mut y)); | ^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` --> $DIR/borrow-immutable-upvar-mutation.rs:30:24 | -LL | let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow +LL | let _g = to_fn(move || set(&mut y)); | ^^^^^^^^^^^^^^^^^^^ error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:33:65 | -LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign +LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); | ^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` --> $DIR/borrow-immutable-upvar-mutation.rs:33:57 | -LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign +LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); | ^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr index 505604ab597d..09adb350e00d 100644 --- a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr +++ b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr @@ -1,75 +1,75 @@ error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:15:27 | -LL | let _f = to_fn(|| x = 42); //~ ERROR cannot assign +LL | let _f = to_fn(|| x = 42); | ^^^^^^ | help: consider changing this closure to take self by mutable reference --> $DIR/borrow-immutable-upvar-mutation.rs:15:24 | -LL | let _f = to_fn(|| x = 42); //~ ERROR cannot assign +LL | let _f = to_fn(|| x = 42); | ^^^^^^^^^ error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:18:36 | -LL | let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow +LL | let _g = to_fn(|| set(&mut y)); | ^ | help: consider changing this closure to take self by mutable reference --> $DIR/borrow-immutable-upvar-mutation.rs:18:24 | -LL | let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow +LL | let _g = to_fn(|| set(&mut y)); | ^^^^^^^^^^^^^^ error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:21:55 | -LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign +LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); | ^^^^^^ | help: consider changing this closure to take self by mutable reference --> $DIR/borrow-immutable-upvar-mutation.rs:21:52 | -LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign +LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); | ^^^^^^^^^ error[E0594]: cannot assign to captured outer variable in an `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:27:32 | -LL | let _f = to_fn(move || x = 42); //~ ERROR cannot assign +LL | let _f = to_fn(move || x = 42); | ^^^^^^ | = note: `Fn` closures cannot capture their enclosing environment for modifications help: consider changing this closure to take self by mutable reference --> $DIR/borrow-immutable-upvar-mutation.rs:27:24 | -LL | let _f = to_fn(move || x = 42); //~ ERROR cannot assign +LL | let _f = to_fn(move || x = 42); | ^^^^^^^^^^^^^^ error[E0596]: cannot borrow captured outer variable in an `Fn` closure as mutable --> $DIR/borrow-immutable-upvar-mutation.rs:30:41 | -LL | let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow +LL | let _g = to_fn(move || set(&mut y)); | ^ | help: consider changing this closure to take self by mutable reference --> $DIR/borrow-immutable-upvar-mutation.rs:30:24 | -LL | let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow +LL | let _g = to_fn(move || set(&mut y)); | ^^^^^^^^^^^^^^^^^^^ error[E0594]: cannot assign to captured outer variable in an `Fn` closure --> $DIR/borrow-immutable-upvar-mutation.rs:33:65 | -LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign +LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); | ^^^^^^ | = note: `Fn` closures cannot capture their enclosing environment for modifications help: consider changing this closure to take self by mutable reference --> $DIR/borrow-immutable-upvar-mutation.rs:33:57 | -LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign +LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); | ^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/borrowck/borrow-tuple-fields.nll.stderr b/src/test/ui/borrowck/borrow-tuple-fields.nll.stderr index 72a29b864a4f..5c40555c501c 100644 --- a/src/test/ui/borrowck/borrow-tuple-fields.nll.stderr +++ b/src/test/ui/borrowck/borrow-tuple-fields.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | let r = &x.0; | ---- borrow of `x.0` occurs here -LL | let y = x; //~ ERROR cannot move out of `x` because it is borrowed +LL | let y = x; | ^ move out of `x` occurs here LL | LL | r.use_ref(); @@ -14,7 +14,7 @@ error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immu | LL | let a = &x.0; | ---- immutable borrow occurs here -LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as +LL | let b = &mut x.0; | ^^^^^^^^ mutable borrow occurs here LL | a.use_ref(); | - immutable borrow later used here @@ -24,7 +24,7 @@ error[E0499]: cannot borrow `x.0` as mutable more than once at a time | LL | let a = &mut x.0; | -------- first mutable borrow occurs here -LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time +LL | let b = &mut x.0; | ^^^^^^^^ second mutable borrow occurs here LL | a.use_ref(); | - first borrow later used here @@ -34,7 +34,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | let r = &x.0; | ---- borrow of `x.0` occurs here -LL | let y = x; //~ ERROR cannot move out of `x` because it is borrowed +LL | let y = x; | ^ move out of `x` occurs here LL | r.use_ref(); | - borrow later used here @@ -44,7 +44,7 @@ error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immu | LL | let a = &x.0; | ---- immutable borrow occurs here -LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as +LL | let b = &mut x.0; | ^^^^^^^^ mutable borrow occurs here LL | a.use_ref(); | - immutable borrow later used here @@ -54,7 +54,7 @@ error[E0499]: cannot borrow `x.0` as mutable more than once at a time | LL | let a = &mut x.0; | -------- first mutable borrow occurs here -LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time +LL | let b = &mut x.0; | ^^^^^^^^ second mutable borrow occurs here LL | a.use_mut(); | - first borrow later used here diff --git a/src/test/ui/borrowck/borrow-tuple-fields.stderr b/src/test/ui/borrowck/borrow-tuple-fields.stderr index a62e7287e683..f7fc06e1b4fb 100644 --- a/src/test/ui/borrowck/borrow-tuple-fields.stderr +++ b/src/test/ui/borrowck/borrow-tuple-fields.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | let r = &x.0; | --- borrow of `x.0` occurs here -LL | let y = x; //~ ERROR cannot move out of `x` because it is borrowed +LL | let y = x; | ^ move out of `x` occurs here error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable @@ -11,7 +11,7 @@ error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immu | LL | let a = &x.0; | --- immutable borrow occurs here -LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as +LL | let b = &mut x.0; | ^^^ mutable borrow occurs here ... LL | } @@ -22,7 +22,7 @@ error[E0499]: cannot borrow `x.0` as mutable more than once at a time | LL | let a = &mut x.0; | --- first mutable borrow occurs here -LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time +LL | let b = &mut x.0; | ^^^ second mutable borrow occurs here ... LL | } @@ -33,7 +33,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | let r = &x.0; | --- borrow of `x.0` occurs here -LL | let y = x; //~ ERROR cannot move out of `x` because it is borrowed +LL | let y = x; | ^ move out of `x` occurs here error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable @@ -41,7 +41,7 @@ error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immu | LL | let a = &x.0; | --- immutable borrow occurs here -LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as +LL | let b = &mut x.0; | ^^^ mutable borrow occurs here ... LL | } @@ -52,7 +52,7 @@ error[E0499]: cannot borrow `x.0` as mutable more than once at a time | LL | let a = &mut x.0; | --- first mutable borrow occurs here -LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time +LL | let b = &mut x.0; | ^^^ second mutable borrow occurs here LL | a.use_mut(); LL | } diff --git a/src/test/ui/borrowck/borrowck-and-init.nll.stderr b/src/test/ui/borrowck/borrowck-and-init.nll.stderr index b4b02cf208ae..2db075194810 100644 --- a/src/test/ui/borrowck/borrowck-and-init.nll.stderr +++ b/src/test/ui/borrowck/borrowck-and-init.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `i` --> $DIR/borrowck-and-init.rs:5:20 | -LL | println!("{}", i); //~ ERROR use of possibly uninitialized variable: `i` +LL | println!("{}", i); | ^ use of possibly uninitialized `i` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-and-init.stderr b/src/test/ui/borrowck/borrowck-and-init.stderr index 42b658871dfa..13696ac8347b 100644 --- a/src/test/ui/borrowck/borrowck-and-init.stderr +++ b/src/test/ui/borrowck/borrowck-and-init.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `i` --> $DIR/borrowck-and-init.rs:5:20 | -LL | println!("{}", i); //~ ERROR use of possibly uninitialized variable: `i` +LL | println!("{}", i); | ^ use of possibly uninitialized `i` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-anon-fields-struct.nll.stderr b/src/test/ui/borrowck/borrowck-anon-fields-struct.nll.stderr index 43c74988f9ea..7a959fb6ec62 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-struct.nll.stderr +++ b/src/test/ui/borrowck/borrowck-anon-fields-struct.nll.stderr @@ -4,7 +4,7 @@ error[E0499]: cannot borrow `y.0` as mutable more than once at a time LL | Y(ref mut a, _) => a | --------- first mutable borrow occurs here ... -LL | Y(ref mut b, _) => b //~ ERROR cannot borrow +LL | Y(ref mut b, _) => b | ^^^^^^^^^ second mutable borrow occurs here ... LL | *a += 1; diff --git a/src/test/ui/borrowck/borrowck-anon-fields-struct.stderr b/src/test/ui/borrowck/borrowck-anon-fields-struct.stderr index 9c36a9fe875f..efe94dee2e7c 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-struct.stderr +++ b/src/test/ui/borrowck/borrowck-anon-fields-struct.stderr @@ -4,7 +4,7 @@ error[E0499]: cannot borrow `y.0` as mutable more than once at a time LL | Y(ref mut a, _) => a | --------- first mutable borrow occurs here ... -LL | Y(ref mut b, _) => b //~ ERROR cannot borrow +LL | Y(ref mut b, _) => b | ^^^^^^^^^ second mutable borrow occurs here ... LL | } diff --git a/src/test/ui/borrowck/borrowck-anon-fields-tuple.nll.stderr b/src/test/ui/borrowck/borrowck-anon-fields-tuple.nll.stderr index 15859040f060..88a8867f5ee0 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-tuple.nll.stderr +++ b/src/test/ui/borrowck/borrowck-anon-fields-tuple.nll.stderr @@ -4,7 +4,7 @@ error[E0499]: cannot borrow `y.0` as mutable more than once at a time LL | (ref mut a, _) => a | --------- first mutable borrow occurs here ... -LL | (ref mut b, _) => b //~ ERROR cannot borrow +LL | (ref mut b, _) => b | ^^^^^^^^^ second mutable borrow occurs here ... LL | *a += 1; diff --git a/src/test/ui/borrowck/borrowck-anon-fields-tuple.stderr b/src/test/ui/borrowck/borrowck-anon-fields-tuple.stderr index 4b823f396afc..40f96cb712c0 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-tuple.stderr +++ b/src/test/ui/borrowck/borrowck-anon-fields-tuple.stderr @@ -4,7 +4,7 @@ error[E0499]: cannot borrow `y.0` as mutable more than once at a time LL | (ref mut a, _) => a | --------- first mutable borrow occurs here ... -LL | (ref mut b, _) => b //~ ERROR cannot borrow +LL | (ref mut b, _) => b | ^^^^^^^^^ second mutable borrow occurs here ... LL | } diff --git a/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr b/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr index 2f4cf7dd800e..6c8a32ee3916 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr +++ b/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr @@ -19,7 +19,7 @@ error[E0503]: cannot use `y` because it was mutably borrowed LL | Foo::Y(ref mut a, _) => a, | --------- borrow of `y.0` occurs here ... -LL | Foo::Y(ref mut b, _) => b, //~ ERROR cannot borrow +LL | Foo::Y(ref mut b, _) => b, | ^^^^^^^^^^^^^^^^^^^^ use of borrowed `y.0` ... LL | *a += 1; @@ -31,7 +31,7 @@ error[E0499]: cannot borrow `y.0` as mutable more than once at a time LL | Foo::Y(ref mut a, _) => a, | --------- first mutable borrow occurs here ... -LL | Foo::Y(ref mut b, _) => b, //~ ERROR cannot borrow +LL | Foo::Y(ref mut b, _) => b, | ^^^^^^^^^ second mutable borrow occurs here ... LL | *a += 1; diff --git a/src/test/ui/borrowck/borrowck-anon-fields-variant.stderr b/src/test/ui/borrowck/borrowck-anon-fields-variant.stderr index 1e94cdebaec6..2835cab9092f 100644 --- a/src/test/ui/borrowck/borrowck-anon-fields-variant.stderr +++ b/src/test/ui/borrowck/borrowck-anon-fields-variant.stderr @@ -4,7 +4,7 @@ error[E0499]: cannot borrow `y.0` as mutable more than once at a time LL | Foo::Y(ref mut a, _) => a, | --------- first mutable borrow occurs here ... -LL | Foo::Y(ref mut b, _) => b, //~ ERROR cannot borrow +LL | Foo::Y(ref mut b, _) => b, | ^^^^^^^^^ second mutable borrow occurs here ... LL | } diff --git a/src/test/ui/borrowck/borrowck-argument.nll.stderr b/src/test/ui/borrowck/borrowck-argument.nll.stderr index 9e7f0930ee57..cf1583314092 100644 --- a/src/test/ui/borrowck/borrowck-argument.nll.stderr +++ b/src/test/ui/borrowck/borrowck-argument.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable | LL | fn func(arg: S) { | --- help: consider changing this to be mutable: `mut arg` -LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument +LL | arg.mutate(); | ^^^ cannot borrow as mutable error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable @@ -11,7 +11,7 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable | LL | fn method(&self, arg: S) { | --- help: consider changing this to be mutable: `mut arg` -LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument +LL | arg.mutate(); | ^^^ cannot borrow as mutable error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable @@ -19,13 +19,13 @@ error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable | LL | fn default(&self, arg: S) { | --- help: consider changing this to be mutable: `mut arg` -LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument +LL | arg.mutate(); | ^^^ cannot borrow as mutable error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable --> $DIR/borrowck-argument.rs:32:17 | -LL | (|arg: S| { arg.mutate() })(s); //~ ERROR: cannot borrow immutable argument +LL | (|arg: S| { arg.mutate() })(s); | --- ^^^ cannot borrow as mutable | | | help: consider changing this to be mutable: `mut arg` diff --git a/src/test/ui/borrowck/borrowck-argument.stderr b/src/test/ui/borrowck/borrowck-argument.stderr index fa82b1c00cc7..6c9c411cbcf0 100644 --- a/src/test/ui/borrowck/borrowck-argument.stderr +++ b/src/test/ui/borrowck/borrowck-argument.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable argument `arg` as mutable | LL | fn func(arg: S) { | --- help: make this binding mutable: `mut arg` -LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument +LL | arg.mutate(); | ^^^ cannot borrow mutably error[E0596]: cannot borrow immutable argument `arg` as mutable @@ -11,7 +11,7 @@ error[E0596]: cannot borrow immutable argument `arg` as mutable | LL | fn method(&self, arg: S) { | --- help: make this binding mutable: `mut arg` -LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument +LL | arg.mutate(); | ^^^ cannot borrow mutably error[E0596]: cannot borrow immutable argument `arg` as mutable @@ -19,13 +19,13 @@ error[E0596]: cannot borrow immutable argument `arg` as mutable | LL | fn default(&self, arg: S) { | --- help: make this binding mutable: `mut arg` -LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument +LL | arg.mutate(); | ^^^ cannot borrow mutably error[E0596]: cannot borrow immutable argument `arg` as mutable --> $DIR/borrowck-argument.rs:32:17 | -LL | (|arg: S| { arg.mutate() })(s); //~ ERROR: cannot borrow immutable argument +LL | (|arg: S| { arg.mutate() })(s); | --- ^^^ cannot borrow mutably | | | help: make this binding mutable: `mut arg` diff --git a/src/test/ui/borrowck/borrowck-assign-comp-idx.nll.stderr b/src/test/ui/borrowck/borrowck-assign-comp-idx.nll.stderr index 71f36c2b045a..93f1d8c52586 100644 --- a/src/test/ui/borrowck/borrowck-assign-comp-idx.nll.stderr +++ b/src/test/ui/borrowck/borrowck-assign-comp-idx.nll.stderr @@ -4,7 +4,7 @@ error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immuta LL | let q: &isize = &p[0]; | - immutable borrow occurs here LL | -LL | p[0] = 5; //~ ERROR cannot borrow +LL | p[0] = 5; | ^ mutable borrow occurs here LL | LL | println!("{}", *q); @@ -17,7 +17,7 @@ LL | borrow( | ------ immutable borrow later used by call LL | &p, | -- immutable borrow occurs here -LL | || p[0] = 5); //~ ERROR cannot borrow `p` as mutable +LL | || p[0] = 5); | ^^ - second borrow occurs due to use of `p` in closure | | | mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr b/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr index 9997aa4190e3..0d092e6812d9 100644 --- a/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr +++ b/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr @@ -4,7 +4,7 @@ error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immuta LL | let q: &isize = &p[0]; | - immutable borrow occurs here LL | -LL | p[0] = 5; //~ ERROR cannot borrow +LL | p[0] = 5; | ^ mutable borrow occurs here ... LL | } @@ -15,7 +15,7 @@ error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immuta | LL | &p, | - immutable borrow occurs here -LL | || p[0] = 5); //~ ERROR cannot borrow `p` as mutable +LL | || p[0] = 5); | ^^ - - immutable borrow ends here | | | | | borrow occurs due to use of `p` in closure diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.nll.stderr b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.nll.stderr index 469199d69b91..d8ccf36852a5 100644 --- a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.nll.stderr +++ b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.nll.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `*s.pointer` which is behind a `&` reference | LL | fn a(s: &S) { | -- help: consider changing this to be a mutable reference: `&mut S<'_>` -LL | *s.pointer += 1; //~ ERROR cannot assign +LL | *s.pointer += 1; | ^^^^^^^^^^^^^^^ `s` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*s.pointer` which is behind a `&` reference @@ -11,7 +11,7 @@ error[E0594]: cannot assign to `*s.pointer` which is behind a `&` reference | LL | fn c(s: & &mut S) { | -------- help: consider changing this to be a mutable reference: `&mut &mut S<'_>` -LL | *s.pointer += 1; //~ ERROR cannot assign +LL | *s.pointer += 1; | ^^^^^^^^^^^^^^^ `s` is a `&` reference, so the data it refers to cannot be written error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr index 76e7ee841f82..5ec1ff2c058d 100644 --- a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr +++ b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr @@ -3,7 +3,7 @@ error[E0389]: cannot assign to data in a `&` reference | LL | fn a(s: &S) { | -- use `&mut S` here to make mutable -LL | *s.pointer += 1; //~ ERROR cannot assign +LL | *s.pointer += 1; | ^^^^^^^^^^^^^^^ assignment into an immutable reference error[E0389]: cannot assign to data in a `&` reference @@ -11,7 +11,7 @@ error[E0389]: cannot assign to data in a `&` reference | LL | fn c(s: & &mut S) { | -------- use `&mut &mut S` here to make mutable -LL | *s.pointer += 1; //~ ERROR cannot assign +LL | *s.pointer += 1; | ^^^^^^^^^^^^^^^ assignment into an immutable reference error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.nll.stderr b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.nll.stderr index 8e3e9d41f8c0..0aacaf9cf479 100644 --- a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.nll.stderr +++ b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.nll.stderr @@ -3,7 +3,7 @@ error[E0503]: cannot use `*y.pointer` because it was mutably borrowed | LL | let z = copy_borrowed_ptr(&mut y); | ------ borrow of `y` occurs here -LL | *y.pointer += 1; //~ ERROR cannot assign +LL | *y.pointer += 1; | ^^^^^^^^^^^^^^^ use of borrowed `y` LL | *z.pointer += 1; | --------------- borrow later used here @@ -13,7 +13,7 @@ error[E0506]: cannot assign to `*y.pointer` because it is borrowed | LL | let z = copy_borrowed_ptr(&mut y); | ------ borrow of `*y.pointer` occurs here -LL | *y.pointer += 1; //~ ERROR cannot assign +LL | *y.pointer += 1; | ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here LL | *z.pointer += 1; | --------------- borrow later used here diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr index d4639581223d..10d6ac5464d0 100644 --- a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr +++ b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr @@ -3,7 +3,7 @@ error[E0506]: cannot assign to `*y.pointer` because it is borrowed | LL | let z = copy_borrowed_ptr(&mut y); | - borrow of `*y.pointer` occurs here -LL | *y.pointer += 1; //~ ERROR cannot assign +LL | *y.pointer += 1; | ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.nll.stderr b/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.nll.stderr index 53aaa4a2957e..3ed76c13f6a7 100644 --- a/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.nll.stderr +++ b/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | let x = Foo { x: 3 }; | - help: consider changing this to be mutable: `mut x` -LL | x.printme(); //~ ERROR cannot borrow +LL | x.printme(); | ^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr b/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr index b48473a884c2..759b778e35c8 100644 --- a/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr +++ b/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable | LL | let x = Foo { x: 3 }; | - help: make this binding mutable: `mut x` -LL | x.printme(); //~ ERROR cannot borrow +LL | x.printme(); | ^ cannot borrow mutably error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-autoref-3261.nll.stderr b/src/test/ui/borrowck/borrowck-autoref-3261.nll.stderr index 9e62534c6718..c2dfb687e8ee 100644 --- a/src/test/ui/borrowck/borrowck-autoref-3261.nll.stderr +++ b/src/test/ui/borrowck/borrowck-autoref-3261.nll.stderr @@ -5,7 +5,7 @@ LL | (&mut x).with( | -------- ---- first borrow later used by call | | | first mutable borrow occurs here -LL | |opt| { //~ ERROR cannot borrow `x` as mutable more than once at a time +LL | |opt| { | ^^^^^ second mutable borrow occurs here ... LL | x = X(Either::Left((0, 0))); diff --git a/src/test/ui/borrowck/borrowck-autoref-3261.stderr b/src/test/ui/borrowck/borrowck-autoref-3261.stderr index 7a5430ac15c3..280704a27151 100644 --- a/src/test/ui/borrowck/borrowck-autoref-3261.stderr +++ b/src/test/ui/borrowck/borrowck-autoref-3261.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time | LL | (&mut x).with( | - first mutable borrow occurs here -LL | |opt| { //~ ERROR cannot borrow `x` as mutable more than once at a time +LL | |opt| { | ^^^^^ second mutable borrow occurs here ... LL | x = X(Either::Left((0, 0))); diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-free.nll.stderr b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.nll.stderr index 1732628d40f8..e273a778fdad 100644 --- a/src/test/ui/borrowck/borrowck-bad-nested-calls-free.nll.stderr +++ b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.nll.stderr @@ -5,7 +5,7 @@ LL | add( | --- immutable borrow later used by call LL | &*a, | --- immutable borrow occurs here -LL | rewrite(&mut a)); //~ ERROR cannot borrow +LL | rewrite(&mut a)); | ^^^^^^ mutable borrow occurs here error[E0502]: cannot borrow `a` as mutable because it is also borrowed as immutable @@ -15,7 +15,7 @@ LL | add( | --- immutable borrow later used by call LL | &*a, | --- immutable borrow occurs here -LL | rewrite(&mut a)); //~ ERROR cannot borrow +LL | rewrite(&mut a)); | ^^^^^^ mutable borrow occurs here error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-free.stderr b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.stderr index 165530d270af..06ec2bdac715 100644 --- a/src/test/ui/borrowck/borrowck-bad-nested-calls-free.stderr +++ b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `a` as mutable because `*a` is also borrowed as immu | LL | &*a, | -- immutable borrow occurs here -LL | rewrite(&mut a)); //~ ERROR cannot borrow +LL | rewrite(&mut a)); | ^ - immutable borrow ends here | | | mutable borrow occurs here @@ -13,7 +13,7 @@ error[E0502]: cannot borrow `a` as mutable because `*a` is also borrowed as immu | LL | &*a, | -- immutable borrow occurs here -LL | rewrite(&mut a)); //~ ERROR cannot borrow +LL | rewrite(&mut a)); | ^ - immutable borrow ends here | | | mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-move.nll.stderr b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.nll.stderr index 117567cba192..371bcf2b69cf 100644 --- a/src/test/ui/borrowck/borrowck-bad-nested-calls-move.nll.stderr +++ b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.nll.stderr @@ -5,7 +5,7 @@ LL | add( | --- borrow later used by call LL | &*a, | --- borrow of `*a` occurs here -LL | a); //~ ERROR cannot move +LL | a); | ^ move out of `a` occurs here error[E0505]: cannot move out of `a` because it is borrowed @@ -15,7 +15,7 @@ LL | add( | --- borrow later used by call LL | &*a, | --- borrow of `*a` occurs here -LL | a); //~ ERROR cannot move +LL | a); | ^ move out of `a` occurs here error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-move.stderr b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.stderr index b2c680f39521..3b34a61364ab 100644 --- a/src/test/ui/borrowck/borrowck-bad-nested-calls-move.stderr +++ b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `a` because it is borrowed | LL | &*a, | -- borrow of `*a` occurs here -LL | a); //~ ERROR cannot move +LL | a); | ^ move out of `a` occurs here error[E0505]: cannot move out of `a` because it is borrowed @@ -11,7 +11,7 @@ error[E0505]: cannot move out of `a` because it is borrowed | LL | &*a, | -- borrow of `*a` occurs here -LL | a); //~ ERROR cannot move +LL | a); | ^ move out of `a` occurs here error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-block-unint.nll.stderr b/src/test/ui/borrowck/borrowck-block-unint.nll.stderr index ea17fafc9390..d2a49962bafc 100644 --- a/src/test/ui/borrowck/borrowck-block-unint.nll.stderr +++ b/src/test/ui/borrowck/borrowck-block-unint.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `x` --> $DIR/borrowck-block-unint.rs:4:11 | -LL | force(|| { //~ ERROR capture of possibly uninitialized variable: `x` +LL | force(|| { | ^^ use of possibly uninitialized `x` LL | println!("{}", x); | - borrow occurs due to use in closure diff --git a/src/test/ui/borrowck/borrowck-block-unint.stderr b/src/test/ui/borrowck/borrowck-block-unint.stderr index 6e7af76fc2e8..ab55d7994d0c 100644 --- a/src/test/ui/borrowck/borrowck-block-unint.stderr +++ b/src/test/ui/borrowck/borrowck-block-unint.stderr @@ -1,7 +1,7 @@ error[E0381]: capture of possibly uninitialized variable: `x` --> $DIR/borrowck-block-unint.rs:4:11 | -LL | force(|| { //~ ERROR capture of possibly uninitialized variable: `x` +LL | force(|| { | ^^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.nll.stderr index d1377fd439a4..ad6bd7dc9426 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1; | ------------- first mutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^^^^^^ second mutable borrow occurs here LL | *bar1; | ----- first borrow later used here @@ -13,7 +13,7 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed | LL | let bar1 = &mut foo.bar1; | ------------- mutable borrow occurs here -LL | let _bar2 = &foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &foo.bar1; | ^^^^^^^^^ immutable borrow occurs here LL | *bar1; | ----- mutable borrow later used here @@ -23,7 +23,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as | LL | let bar1 = &foo.bar1; | --------- immutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^^^^^^ mutable borrow occurs here LL | *bar1; | ----- immutable borrow later used here @@ -45,9 +45,9 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed | LL | let bar1 = &mut foo.bar1.int1; | ------------------ mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; | ^^^^^^^^^ immutable borrow occurs here -LL | let _foo2 = &*foo; //~ ERROR cannot borrow +LL | let _foo2 = &*foo; LL | *bar1; | ----- mutable borrow later used here @@ -56,8 +56,8 @@ error[E0502]: cannot borrow `*foo` as immutable because it is also borrowed as m | LL | let bar1 = &mut foo.bar1.int1; | ------------------ mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow -LL | let _foo2 = &*foo; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; +LL | let _foo2 = &*foo; | ^^^^^ immutable borrow occurs here LL | *bar1; | ----- mutable borrow later used here @@ -67,7 +67,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1.int1; | ------------------ first mutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^^^^^^ second mutable borrow occurs here LL | *bar1; | ----- first borrow later used here @@ -77,7 +77,7 @@ error[E0499]: cannot borrow `*foo` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1.int1; | ------------------ first mutable borrow occurs here -LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut *foo; | ^^^^^^^^^ second mutable borrow occurs here LL | *bar1; | ----- first borrow later used here @@ -87,7 +87,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as | LL | let bar1 = &foo.bar1.int1; | -------------- immutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^^^^^^ mutable borrow occurs here LL | *bar1; | ----- immutable borrow later used here @@ -97,7 +97,7 @@ error[E0502]: cannot borrow `*foo` as mutable because it is also borrowed as imm | LL | let bar1 = &foo.bar1.int1; | -------------- immutable borrow occurs here -LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut *foo; | ^^^^^^^^^ mutable borrow occurs here LL | *bar1; | ----- immutable borrow later used here @@ -107,7 +107,7 @@ error[E0596]: cannot borrow `foo.bar1` as mutable, as `foo` is not declared as m | LL | let foo = make_foo(); | --- help: consider changing this to be mutable: `mut foo` -LL | let bar1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let bar1 = &mut foo.bar1; | ^^^^^^^^^^^^^ cannot borrow as mutable error: aborting due to 11 previous errors diff --git a/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr index e116cb70c1c3..a4fb28d0e815 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1; | -------- first mutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^ second mutable borrow occurs here LL | *bar1; LL | } @@ -14,7 +14,7 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed | LL | let bar1 = &mut foo.bar1; | -------- mutable borrow occurs here -LL | let _bar2 = &foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &foo.bar1; | ^^^^^^^^ immutable borrow occurs here LL | *bar1; LL | } @@ -25,7 +25,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as | LL | let bar1 = &foo.bar1; | -------- immutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^ mutable borrow occurs here LL | *bar1; LL | } @@ -36,7 +36,7 @@ error[E0499]: cannot borrow `foo` (via `foo.bar2`) as mutable more than once at | LL | let bar1 = &mut foo.bar1; | -------- first mutable borrow occurs here (via `foo.bar1`) -LL | let _bar2 = &mut foo.bar2; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar2; | ^^^^^^^^ second mutable borrow occurs here (via `foo.bar2`) LL | *bar1; LL | } @@ -49,7 +49,7 @@ LL | Foo { bar1: ref mut _bar1, bar2: ref mut _bar2 } => {} | ------------- ^^^^^^^^^^^^^ second mutable borrow occurs here (via `foo.bar2`) | | | first mutable borrow occurs here (via `foo.bar1`) -LL | //~^ ERROR cannot borrow +LL | LL | } | - first borrow ends here @@ -70,7 +70,7 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because `foo.bar1.int1` is a | LL | let bar1 = &mut foo.bar1.int1; | ------------- mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; | ^^^^^^^^ immutable borrow occurs here ... LL | } @@ -81,8 +81,8 @@ error[E0502]: cannot borrow `*foo` as immutable because `foo.bar1.int1` is also | LL | let bar1 = &mut foo.bar1.int1; | ------------- mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow -LL | let _foo2 = &*foo; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; +LL | let _foo2 = &*foo; | ^^^^ immutable borrow occurs here LL | *bar1; LL | } @@ -93,7 +93,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1.int1; | ------------- first mutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^ second mutable borrow occurs here LL | *bar1; LL | } @@ -104,7 +104,7 @@ error[E0499]: cannot borrow `*foo` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1.int1; | ------------- first mutable borrow occurs here -LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut *foo; | ^^^^ second mutable borrow occurs here LL | *bar1; LL | } @@ -115,7 +115,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because `foo.bar1.int1` is als | LL | let bar1 = &foo.bar1.int1; | ------------- immutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^ mutable borrow occurs here LL | *bar1; LL | } @@ -126,7 +126,7 @@ error[E0502]: cannot borrow `*foo` as mutable because `foo.bar1.int1` is also bo | LL | let bar1 = &foo.bar1.int1; | ------------- immutable borrow occurs here -LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut *foo; | ^^^^ mutable borrow occurs here LL | *bar1; LL | } @@ -137,7 +137,7 @@ error[E0502]: cannot borrow `foo` (via `foo.bar2`) as immutable because `foo` is | LL | let bar1 = &mut foo.bar1; | -------- mutable borrow occurs here (via `foo.bar1`) -LL | let _foo1 = &foo.bar2; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar2; | ^^^^^^^^ immutable borrow of `foo.bar2` -- which overlaps with `foo.bar1` -- occurs here LL | *bar1; LL | } @@ -148,7 +148,7 @@ error[E0596]: cannot borrow field `foo.bar1` of immutable binding as mutable | LL | let foo = make_foo(); | --- help: make this binding mutable: `mut foo` -LL | let bar1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let bar1 = &mut foo.bar1; | ^^^^^^^^ cannot mutably borrow field of immutable binding error[E0499]: cannot borrow `foo` (via `foo.bar2.int2`) as mutable more than once at a time @@ -156,7 +156,7 @@ error[E0499]: cannot borrow `foo` (via `foo.bar2.int2`) as mutable more than onc | LL | let bar1 = &mut foo.bar1.int1; | ------------- first mutable borrow occurs here (via `foo.bar1.int1`) -LL | let foo1 = &mut foo.bar2.int2; //~ ERROR cannot borrow +LL | let foo1 = &mut foo.bar2.int2; | ^^^^^^^^^^^^^ second mutable borrow occurs here (via `foo.bar2.int2`) ... LL | } diff --git a/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.nll.stderr index f53cb32a5679..b5c618479187 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1; | ------------- first mutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^^^^^^ second mutable borrow occurs here LL | *bar1; | ----- first borrow later used here @@ -13,7 +13,7 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed | LL | let bar1 = &mut foo.bar1; | ------------- mutable borrow occurs here -LL | let _bar2 = &foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &foo.bar1; | ^^^^^^^^^ immutable borrow occurs here LL | *bar1; | ----- mutable borrow later used here @@ -23,7 +23,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as | LL | let bar1 = &foo.bar1; | --------- immutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^^^^^^ mutable borrow occurs here LL | *bar1; | ----- immutable borrow later used here @@ -45,9 +45,9 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed | LL | let bar1 = &mut foo.bar1.int1; | ------------------ mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; | ^^^^^^^^^ immutable borrow occurs here -LL | let _foo2 = &foo; //~ ERROR cannot borrow +LL | let _foo2 = &foo; LL | *bar1; | ----- mutable borrow later used here @@ -56,8 +56,8 @@ error[E0502]: cannot borrow `foo` as immutable because it is also borrowed as mu | LL | let bar1 = &mut foo.bar1.int1; | ------------------ mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow -LL | let _foo2 = &foo; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; +LL | let _foo2 = &foo; | ^^^^ immutable borrow occurs here LL | *bar1; | ----- mutable borrow later used here @@ -67,7 +67,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1.int1; | ------------------ first mutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^^^^^^ second mutable borrow occurs here LL | *bar1; | ----- first borrow later used here @@ -77,7 +77,7 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1.int1; | ------------------ first mutable borrow occurs here -LL | let _foo2 = &mut foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut foo; | ^^^^^^^^ second mutable borrow occurs here LL | *bar1; | ----- first borrow later used here @@ -87,7 +87,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as | LL | let bar1 = &foo.bar1.int1; | -------------- immutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^^^^^^ mutable borrow occurs here LL | *bar1; | ----- immutable borrow later used here @@ -97,7 +97,7 @@ error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immu | LL | let bar1 = &foo.bar1.int1; | -------------- immutable borrow occurs here -LL | let _foo2 = &mut foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut foo; | ^^^^^^^^ mutable borrow occurs here LL | *bar1; | ----- immutable borrow later used here @@ -107,7 +107,7 @@ error[E0596]: cannot borrow `foo.bar1` as mutable, as `foo` is not declared as m | LL | let foo = make_foo(); | --- help: consider changing this to be mutable: `mut foo` -LL | let bar1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let bar1 = &mut foo.bar1; | ^^^^^^^^^^^^^ cannot borrow as mutable error: aborting due to 11 previous errors diff --git a/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.stderr b/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.stderr index 2c446dfee44b..fe60d944a44f 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1; | -------- first mutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^ second mutable borrow occurs here LL | *bar1; LL | } @@ -14,7 +14,7 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed | LL | let bar1 = &mut foo.bar1; | -------- mutable borrow occurs here -LL | let _bar2 = &foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &foo.bar1; | ^^^^^^^^ immutable borrow occurs here LL | *bar1; LL | } @@ -25,7 +25,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as | LL | let bar1 = &foo.bar1; | -------- immutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^ mutable borrow occurs here LL | *bar1; LL | } @@ -48,7 +48,7 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because `foo.bar1.int1` is a | LL | let bar1 = &mut foo.bar1.int1; | ------------- mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; | ^^^^^^^^ immutable borrow occurs here ... LL | } @@ -59,8 +59,8 @@ error[E0502]: cannot borrow `foo` as immutable because `foo.bar1.int1` is also b | LL | let bar1 = &mut foo.bar1.int1; | ------------- mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow -LL | let _foo2 = &foo; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; +LL | let _foo2 = &foo; | ^^^ immutable borrow occurs here LL | *bar1; LL | } @@ -71,7 +71,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1.int1; | ------------- first mutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^ second mutable borrow occurs here LL | *bar1; LL | } @@ -82,7 +82,7 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time | LL | let bar1 = &mut foo.bar1.int1; | ------------- first mutable borrow occurs here -LL | let _foo2 = &mut foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut foo; | ^^^ second mutable borrow occurs here LL | *bar1; LL | } @@ -93,7 +93,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because `foo.bar1.int1` is als | LL | let bar1 = &foo.bar1.int1; | ------------- immutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^ mutable borrow occurs here LL | *bar1; LL | } @@ -104,7 +104,7 @@ error[E0502]: cannot borrow `foo` as mutable because `foo.bar1.int1` is also bor | LL | let bar1 = &foo.bar1.int1; | ------------- immutable borrow occurs here -LL | let _foo2 = &mut foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut foo; | ^^^ mutable borrow occurs here LL | *bar1; LL | } @@ -115,7 +115,7 @@ error[E0596]: cannot borrow field `foo.bar1` of immutable binding as mutable | LL | let foo = make_foo(); | --- help: make this binding mutable: `mut foo` -LL | let bar1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let bar1 = &mut foo.bar1; | ^^^^^^^^ cannot mutably borrow field of immutable binding error: aborting due to 11 previous errors diff --git a/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr index 52bc3e982967..71bf052c93d6 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-from-temporary.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing temporary value --> $DIR/borrowck-borrow-from-temporary.rs:10:5 | -LL | let &Foo(ref x) = &id(Foo(3)); //~ ERROR borrowed value does not live long enough +LL | let &Foo(ref x) = &id(Foo(3)); | ---------- temporary value created here LL | x | ^ returns a value referencing data owned by the current function diff --git a/src/test/ui/borrowck/borrowck-borrow-from-temporary.stderr b/src/test/ui/borrowck/borrowck-borrow-from-temporary.stderr index 0726e3d5d5e6..6f101f690cd2 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-temporary.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-from-temporary.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/borrowck-borrow-from-temporary.rs:9:24 | -LL | let &Foo(ref x) = &id(Foo(3)); //~ ERROR borrowed value does not live long enough +LL | let &Foo(ref x) = &id(Foo(3)); | ^^^^^^^^^^ temporary value does not live long enough LL | x LL | } diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.nll.stderr index 82b9449de507..7c1c063d260b 100644 --- a/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.nll.stderr @@ -4,7 +4,7 @@ error[E0594]: cannot assign to `**t1` which is behind a `&` reference LL | let t1 = t0; | -- help: consider changing this to be a mutable reference: `&mut &mut isize` LL | let p: &isize = &**t0; -LL | **t1 = 22; //~ ERROR cannot assign +LL | **t1 = 22; | ^^^^^^^^^ `t1` is a `&` reference, so the data it refers to cannot be written error[E0502]: cannot borrow `**t0` as immutable because it is also borrowed as mutable @@ -12,7 +12,7 @@ error[E0502]: cannot borrow `**t0` as immutable because it is also borrowed as m | LL | let t1 = &mut *t0; | -------- mutable borrow occurs here -LL | let p: &isize = &**t0; //~ ERROR cannot borrow +LL | let p: &isize = &**t0; | ^^^^^ immutable borrow occurs here LL | **t1 = 22; | --------- mutable borrow later used here @@ -22,7 +22,7 @@ error[E0596]: cannot borrow `**t0` as mutable, as it is behind a `&` reference | LL | fn foo4(t0: & &mut isize) { | ------------ help: consider changing this to be a mutable reference: `&mut &mut isize` -LL | let x: &mut isize = &mut **t0; //~ ERROR cannot borrow +LL | let x: &mut isize = &mut **t0; | ^^^^^^^^^ `t0` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr index ff2969f53480..709a797edcb4 100644 --- a/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr @@ -1,7 +1,7 @@ error[E0389]: cannot assign to data in a `&` reference --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:9:5 | -LL | **t1 = 22; //~ ERROR cannot assign +LL | **t1 = 22; | ^^^^^^^^^ assignment into an immutable reference error[E0502]: cannot borrow `**t0` as immutable because `*t0` is also borrowed as mutable @@ -9,7 +9,7 @@ error[E0502]: cannot borrow `**t0` as immutable because `*t0` is also borrowed a | LL | let t1 = &mut *t0; | --- mutable borrow occurs here -LL | let p: &isize = &**t0; //~ ERROR cannot borrow +LL | let p: &isize = &**t0; | ^^^^ immutable borrow occurs here LL | **t1 = 22; LL | } @@ -20,7 +20,7 @@ error[E0389]: cannot borrow data mutably in a `&` reference | LL | fn foo4(t0: & &mut isize) { | ------------ use `&mut &mut isize` here to make mutable -LL | let x: &mut isize = &mut **t0; //~ ERROR cannot borrow +LL | let x: &mut isize = &mut **t0; | ^^^^ assignment into an immutable reference error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.nll.stderr index c329fc9e9108..fa0ae318e72c 100644 --- a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time | LL | let y = x.f1(); | - first mutable borrow occurs here -LL | x.f2(); //~ ERROR cannot borrow `*x` as mutable +LL | x.f2(); | ^ second mutable borrow occurs here LL | y.use_ref(); | - first borrow later used here diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.stderr b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.stderr index abfce9857f7c..1b64ad575645 100644 --- a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time | LL | let y = x.f1(); | - first mutable borrow occurs here -LL | x.f2(); //~ ERROR cannot borrow `*x` as mutable +LL | x.f2(); | ^ second mutable borrow occurs here LL | y.use_ref(); LL | } diff --git a/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.nll.stderr index ecb013b7a160..4fc320c50594 100644 --- a/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.nll.stderr @@ -1,85 +1,85 @@ error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:47:19 | -LL | let __isize = &mut x.y; //~ ERROR cannot borrow +LL | let __isize = &mut x.y; | ^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:51:19 | -LL | let __isize = &mut x.y; //~ ERROR cannot borrow +LL | let __isize = &mut x.y; | ^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:59:5 | -LL | &mut x.y //~ ERROR cannot borrow +LL | &mut x.y | ^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:63:5 | -LL | &mut x.y //~ ERROR cannot borrow +LL | &mut x.y | ^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to data in a `&` reference --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:67:5 | -LL | x.y = 3; //~ ERROR cannot assign +LL | x.y = 3; | ^^^^^^^ cannot assign error[E0594]: cannot assign to data in a `&` reference --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:71:5 | -LL | x.y = 3; //~ ERROR cannot assign +LL | x.y = 3; | ^^^^^^^ cannot assign error[E0594]: cannot assign to data in a `&` reference --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:75:5 | -LL | x.y = 3; //~ ERROR cannot assign +LL | x.y = 3; | ^^^^^^^ cannot assign error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:83:5 | -LL | x.set(0, 0); //~ ERROR cannot borrow +LL | x.set(0, 0); | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:87:5 | -LL | x.set(0, 0); //~ ERROR cannot borrow +LL | x.set(0, 0); | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:95:5 | -LL | x.y_mut() //~ ERROR cannot borrow +LL | x.y_mut() | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:99:5 | -LL | x.y_mut() //~ ERROR cannot borrow +LL | x.y_mut() | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:103:6 | -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:107:6 | -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:111:6 | -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ cannot borrow as mutable error: aborting due to 14 previous errors diff --git a/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr b/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr index c6f9c655a11d..2fe1461a303d 100644 --- a/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr @@ -1,85 +1,85 @@ error[E0596]: cannot borrow field of immutable binding as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:47:24 | -LL | let __isize = &mut x.y; //~ ERROR cannot borrow +LL | let __isize = &mut x.y; | ^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field of immutable binding as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:51:24 | -LL | let __isize = &mut x.y; //~ ERROR cannot borrow +LL | let __isize = &mut x.y; | ^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field of immutable binding as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:59:10 | -LL | &mut x.y //~ ERROR cannot borrow +LL | &mut x.y | ^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field of immutable binding as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:63:10 | -LL | &mut x.y //~ ERROR cannot borrow +LL | &mut x.y | ^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field of immutable binding --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:67:5 | -LL | x.y = 3; //~ ERROR cannot assign +LL | x.y = 3; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field of immutable binding --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:71:5 | -LL | x.y = 3; //~ ERROR cannot assign +LL | x.y = 3; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field of immutable binding --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:75:5 | -LL | x.y = 3; //~ ERROR cannot assign +LL | x.y = 3; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:83:5 | -LL | x.set(0, 0); //~ ERROR cannot borrow +LL | x.set(0, 0); | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:87:5 | -LL | x.set(0, 0); //~ ERROR cannot borrow +LL | x.set(0, 0); | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:95:5 | -LL | x.y_mut() //~ ERROR cannot borrow +LL | x.y_mut() | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:99:5 | -LL | x.y_mut() //~ ERROR cannot borrow +LL | x.y_mut() | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:103:6 | -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:107:6 | -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:111:6 | -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ cannot borrow as mutable error: aborting due to 14 previous errors diff --git a/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.nll.stderr index 1c3131806be2..cc4d91a58e93 100644 --- a/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.nll.stderr @@ -1,43 +1,43 @@ error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-deref.rs:23:19 | -LL | let __isize = &mut *x; //~ ERROR cannot borrow +LL | let __isize = &mut *x; | ^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-deref.rs:27:19 | -LL | let __isize = &mut *x; //~ ERROR cannot borrow +LL | let __isize = &mut *x; | ^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-deref.rs:35:5 | -LL | &mut **x //~ ERROR cannot borrow +LL | &mut **x | ^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/borrowck-borrow-overloaded-deref.rs:39:5 | -LL | &mut **x //~ ERROR cannot borrow +LL | &mut **x | ^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to data in a `&` reference --> $DIR/borrowck-borrow-overloaded-deref.rs:43:5 | -LL | *x = 3; //~ ERROR cannot assign +LL | *x = 3; | ^^^^^^ cannot assign error[E0594]: cannot assign to data in a `&` reference --> $DIR/borrowck-borrow-overloaded-deref.rs:47:5 | -LL | **x = 3; //~ ERROR cannot assign +LL | **x = 3; | ^^^^^^^ cannot assign error[E0594]: cannot assign to data in a `&` reference --> $DIR/borrowck-borrow-overloaded-deref.rs:51:5 | -LL | **x = 3; //~ ERROR cannot assign +LL | **x = 3; | ^^^^^^^ cannot assign error: aborting due to 7 previous errors diff --git a/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.stderr b/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.stderr index 41e7cc210c8f..fb79ccb701fb 100644 --- a/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.stderr @@ -1,43 +1,43 @@ error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/borrowck-borrow-overloaded-deref.rs:23:24 | -LL | let __isize = &mut *x; //~ ERROR cannot borrow +LL | let __isize = &mut *x; | ^^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/borrowck-borrow-overloaded-deref.rs:27:24 | -LL | let __isize = &mut *x; //~ ERROR cannot borrow +LL | let __isize = &mut *x; | ^^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/borrowck-borrow-overloaded-deref.rs:35:10 | -LL | &mut **x //~ ERROR cannot borrow +LL | &mut **x | ^^^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/borrowck-borrow-overloaded-deref.rs:39:10 | -LL | &mut **x //~ ERROR cannot borrow +LL | &mut **x | ^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content --> $DIR/borrowck-borrow-overloaded-deref.rs:43:5 | -LL | *x = 3; //~ ERROR cannot assign +LL | *x = 3; | ^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content --> $DIR/borrowck-borrow-overloaded-deref.rs:47:5 | -LL | **x = 3; //~ ERROR cannot assign +LL | **x = 3; | ^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content --> $DIR/borrowck-borrow-overloaded-deref.rs:51:5 | -LL | **x = 3; //~ ERROR cannot assign +LL | **x = 3; | ^^^^^^^ cannot borrow as mutable error: aborting due to 7 previous errors diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr index 97dc59c95438..1dd18c12fc8d 100644 --- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/borrowck-borrowed-uniq-rvalue-2.rs:20:20 | -LL | let x = defer(&vec!["Goodbye", "world!"]); //~ ERROR borrowed value does not live long enough +LL | let x = defer(&vec!["Goodbye", "world!"]); | ^^^^^^^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary which is freed while still in use diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr index b94926951192..d17cf8a6fac3 100644 --- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr +++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/borrowck-borrowed-uniq-rvalue-2.rs:20:20 | -LL | let x = defer(&vec!["Goodbye", "world!"]); //~ ERROR borrowed value does not live long enough +LL | let x = defer(&vec!["Goodbye", "world!"]); | ^^^^^^^^^^^^^^^^^^^^^^^^^ - temporary value dropped here while still borrowed | | | temporary value does not live long enough diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr index d6e599d1abf9..c91a4377b4c6 100644 --- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr +++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/borrowck-borrowed-uniq-rvalue.rs:10:28 | -LL | buggy_map.insert(42, &*Box::new(1)); //~ ERROR borrowed value does not live long enough +LL | buggy_map.insert(42, &*Box::new(1)); | ^^^^^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary which is freed while still in use diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr index bf4674035ead..32a86562da74 100644 --- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr +++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/borrowck-borrowed-uniq-rvalue.rs:10:27 | -LL | buggy_map.insert(42, &*Box::new(1)); //~ ERROR borrowed value does not live long enough +LL | buggy_map.insert(42, &*Box::new(1)); | ^^^^^^^^^^^^ - borrowed value dropped here while still borrowed | | | borrowed value does not live long enough diff --git a/src/test/ui/borrowck/borrowck-break-uninit-2.nll.stderr b/src/test/ui/borrowck/borrowck-break-uninit-2.nll.stderr index 177a27387728..e40d8d9dfccb 100644 --- a/src/test/ui/borrowck/borrowck-break-uninit-2.nll.stderr +++ b/src/test/ui/borrowck/borrowck-break-uninit-2.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `x` --> $DIR/borrowck-break-uninit-2.rs:9:20 | -LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` +LL | println!("{}", x); | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-break-uninit-2.stderr b/src/test/ui/borrowck/borrowck-break-uninit-2.stderr index e574c0ff8a85..a6c3dfef9e87 100644 --- a/src/test/ui/borrowck/borrowck-break-uninit-2.stderr +++ b/src/test/ui/borrowck/borrowck-break-uninit-2.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-break-uninit-2.rs:9:20 | -LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` +LL | println!("{}", x); | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-break-uninit.nll.stderr b/src/test/ui/borrowck/borrowck-break-uninit.nll.stderr index 64d1e629fecd..bbf9b9f1241a 100644 --- a/src/test/ui/borrowck/borrowck-break-uninit.nll.stderr +++ b/src/test/ui/borrowck/borrowck-break-uninit.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `x` --> $DIR/borrowck-break-uninit.rs:9:20 | -LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` +LL | println!("{}", x); | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-break-uninit.stderr b/src/test/ui/borrowck/borrowck-break-uninit.stderr index 1a853c35d00e..dcb024a3e1a0 100644 --- a/src/test/ui/borrowck/borrowck-break-uninit.stderr +++ b/src/test/ui/borrowck/borrowck-break-uninit.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-break-uninit.rs:9:20 | -LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` +LL | println!("{}", x); | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr index 8123e17ce9da..0064417c57bf 100644 --- a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr @@ -17,7 +17,7 @@ LL | let mut c1 = || set(&mut *x); | -- - first borrow occurs due to use of `x` in closure | | | first closure is constructed here -LL | //~^ ERROR cannot borrow +LL | LL | let mut c2 = || set(&mut *x); | ^^ - second borrow occurs due to use of `x` in closure | | diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr index f529247b1b6f..2f7c6a1a56a5 100644 --- a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr +++ b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr @@ -5,7 +5,7 @@ LL | let mut c1 = || set(&mut *x); | -- - previous borrow occurs due to use of `x` in closure | | | first closure is constructed here -LL | //~^ ERROR cannot borrow +LL | LL | let mut c2 = || set(&mut *x); | ^^ - borrow occurs due to use of `x` in closure | | diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-mut.nll.stderr b/src/test/ui/borrowck/borrowck-closures-mut-of-mut.nll.stderr index 18f95f232cdd..471173e595f4 100644 --- a/src/test/ui/borrowck/borrowck-closures-mut-of-mut.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-mut-of-mut.nll.stderr @@ -9,7 +9,7 @@ LL | let mut c2 = || set(&mut *x); | ^^ - second borrow occurs due to use of `x` in closure | | | second closure is constructed here -LL | //~^ ERROR two closures require unique access to `x` at the same time +LL | LL | c2(); c1(); | -- first borrow later used here diff --git a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.nll.stderr b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.nll.stderr index d3d11e8451cf..07f477d17868 100644 --- a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.nll.stderr @@ -5,7 +5,7 @@ LL | let c1 = to_fn_mut(|| x = 4); | -- - first borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| x = 5); | ^^ - second borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here @@ -19,7 +19,7 @@ LL | let c1 = to_fn_mut(|| set(&mut x)); | -- - first borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| set(&mut x)); | ^^ - second borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here @@ -33,7 +33,7 @@ LL | let c1 = to_fn_mut(|| x = 5); | -- - first borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| set(&mut x)); | ^^ - second borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here @@ -51,7 +51,7 @@ LL | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nes | ^^ - second borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here -LL | //~^ ERROR cannot borrow `x` as mutable more than once +LL | LL | c1; | -- first borrow later used here @@ -66,7 +66,7 @@ LL | let c2 = to_fn_mut(|| set(&mut *x.f)); | ^^ - second borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here -LL | //~^ ERROR cannot borrow `x` as mutable more than once +LL | LL | c1; | -- first borrow later used here diff --git a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.stderr b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.stderr index cb8f5b4366bf..7399f8360dc3 100644 --- a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.stderr +++ b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.stderr @@ -5,7 +5,7 @@ LL | let c1 = to_fn_mut(|| x = 4); | -- - previous borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| x = 5); | ^^ - borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here @@ -20,7 +20,7 @@ LL | let c1 = to_fn_mut(|| set(&mut x)); | -- - previous borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| set(&mut x)); | ^^ - borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here @@ -35,7 +35,7 @@ LL | let c1 = to_fn_mut(|| x = 5); | -- - previous borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| set(&mut x)); | ^^ - borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-closures-two-mut.stderr b/src/test/ui/borrowck/borrowck-closures-two-mut.stderr index bfb706946158..e881201ddfcc 100644 --- a/src/test/ui/borrowck/borrowck-closures-two-mut.stderr +++ b/src/test/ui/borrowck/borrowck-closures-two-mut.stderr @@ -5,7 +5,7 @@ LL | let c1 = to_fn_mut(|| x = 4); | -- - previous borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| x = 5); | ^^ - borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here @@ -20,7 +20,7 @@ LL | let c1 = to_fn_mut(|| set(&mut x)); | -- - previous borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| set(&mut x)); | ^^ - borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here @@ -35,7 +35,7 @@ LL | let c1 = to_fn_mut(|| x = 5); | -- - previous borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| set(&mut x)); | ^^ - borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here @@ -80,11 +80,11 @@ LL | let c1 = to_fn_mut(|| x = 4); | -- - first borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| x = 5); | ^^ - second borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here -LL | //~| ERROR cannot borrow `x` as mutable more than once +LL | LL | drop((c1, c2)); | -- first borrow later used here @@ -95,11 +95,11 @@ LL | let c1 = to_fn_mut(|| set(&mut x)); | -- - first borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| set(&mut x)); | ^^ - second borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here -LL | //~| ERROR cannot borrow `x` as mutable more than once +LL | LL | drop((c1, c2)); | -- first borrow later used here @@ -110,11 +110,11 @@ LL | let c1 = to_fn_mut(|| x = 5); | -- - first borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once +LL | let c2 = to_fn_mut(|| set(&mut x)); | ^^ - second borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here -LL | //~| ERROR cannot borrow `x` as mutable more than once +LL | LL | drop((c1, c2)); | -- first borrow later used here diff --git a/src/test/ui/borrowck/borrowck-closures-unique-imm.nll.stderr b/src/test/ui/borrowck/borrowck-closures-unique-imm.nll.stderr index 80e042fc8fc4..b8bbb31a3550 100644 --- a/src/test/ui/borrowck/borrowck-closures-unique-imm.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-unique-imm.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `this.x` as mutable because it is also borrowed as i | LL | let p = &this.x; | ------- immutable borrow occurs here -LL | &mut this.x; //~ ERROR cannot borrow +LL | &mut this.x; | ^^^^^^^^^^^ mutable borrow occurs here LL | p.use_ref(); | - immutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-closures-unique-imm.stderr b/src/test/ui/borrowck/borrowck-closures-unique-imm.stderr index 1b661b70d7f5..3cdc9b9d4fd4 100644 --- a/src/test/ui/borrowck/borrowck-closures-unique-imm.stderr +++ b/src/test/ui/borrowck/borrowck-closures-unique-imm.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `this.x` as mutable because it is also borrowed as i | LL | let p = &this.x; | ------ immutable borrow occurs here -LL | &mut this.x; //~ ERROR cannot borrow +LL | &mut this.x; | ^^^^^^ mutable borrow occurs here LL | p.use_ref(); LL | }; diff --git a/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr b/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr index d6082734451f..3106f36ac8ba 100644 --- a/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr @@ -5,7 +5,7 @@ LL | let c1 = || get(x); | -- - first borrow occurs due to use of `x` in closure | | | borrow occurs here -LL | let c2 = || set(x); //~ ERROR closure requires unique access to `x` +LL | let c2 = || set(x); | ^^ - second borrow occurs due to use of `x` in closure | | | closure construction occurs here @@ -19,7 +19,7 @@ LL | let c1 = || get(x); | -- - first borrow occurs due to use of `x` in closure | | | borrow occurs here -LL | let c2 = || { get(x); set(x); }; //~ ERROR closure requires unique access to `x` +LL | let c2 = || { get(x); set(x); }; | ^^ - second borrow occurs due to use of `x` in closure | | | closure construction occurs here @@ -33,7 +33,7 @@ LL | let c1 = || set(x); | -- - first borrow occurs due to use of `x` in closure | | | first closure is constructed here -LL | let c2 = || set(x); //~ ERROR two closures require unique access to `x` at the same time +LL | let c2 = || set(x); | ^^ - second borrow occurs due to use of `x` in closure | | | second closure is constructed here @@ -45,7 +45,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable | LL | fn e(x: &'static mut isize) { | - help: consider changing this to be mutable: `mut x` -LL | let c1 = |y: &'static mut isize| x = y; //~ ERROR closure cannot assign to immutable argument +LL | let c1 = |y: &'static mut isize| x = y; | ^^^^^ cannot assign error: aborting due to 4 previous errors diff --git a/src/test/ui/borrowck/borrowck-closures-unique.stderr b/src/test/ui/borrowck/borrowck-closures-unique.stderr index 94181ad2400d..238b16f654e3 100644 --- a/src/test/ui/borrowck/borrowck-closures-unique.stderr +++ b/src/test/ui/borrowck/borrowck-closures-unique.stderr @@ -5,7 +5,7 @@ LL | let c1 = || get(x); | -- - previous borrow occurs due to use of `x` in closure | | | borrow occurs here -LL | let c2 = || set(x); //~ ERROR closure requires unique access to `x` +LL | let c2 = || set(x); | ^^ - borrow occurs due to use of `x` in closure | | | closure construction occurs here @@ -20,7 +20,7 @@ LL | let c1 = || get(x); | -- - previous borrow occurs due to use of `x` in closure | | | borrow occurs here -LL | let c2 = || { get(x); set(x); }; //~ ERROR closure requires unique access to `x` +LL | let c2 = || { get(x); set(x); }; | ^^ - borrow occurs due to use of `x` in closure | | | closure construction occurs here @@ -35,7 +35,7 @@ LL | let c1 = || set(x); | -- - previous borrow occurs due to use of `x` in closure | | | first closure is constructed here -LL | let c2 = || set(x); //~ ERROR two closures require unique access to `x` at the same time +LL | let c2 = || set(x); | ^^ - borrow occurs due to use of `x` in closure | | | second closure is constructed here @@ -46,21 +46,21 @@ LL | } error[E0595]: closure cannot assign to immutable argument `x` --> $DIR/borrowck-closures-unique.rs:47:14 | -LL | let c1 = |y: &'static mut isize| x = y; //~ ERROR closure cannot assign to immutable argument +LL | let c1 = |y: &'static mut isize| x = y; | ^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow mutably help: consider removing the `&mut`, as it is an immutable binding to a mutable reference | -LL | x //~ ERROR closure cannot assign to immutable argument +LL | x | ^ error[E0595]: closure cannot assign to immutable argument `x` --> $DIR/borrowck-closures-unique.rs:52:14 | -LL | let c1 = || x = panic!(); //~ ERROR closure cannot assign to immutable argument +LL | let c1 = || x = panic!(); | ^^ cannot borrow mutably help: consider removing the `&mut`, as it is an immutable binding to a mutable reference | -LL | x //~ ERROR closure cannot assign to immutable argument +LL | x | ^ error: aborting due to 5 previous errors diff --git a/src/test/ui/borrowck/borrowck-closures-use-after-free.nll.stderr b/src/test/ui/borrowck/borrowck-closures-use-after-free.nll.stderr index 4501e28a1881..a6dbcf36077a 100644 --- a/src/test/ui/borrowck/borrowck-closures-use-after-free.nll.stderr +++ b/src/test/ui/borrowck/borrowck-closures-use-after-free.nll.stderr @@ -6,7 +6,7 @@ LL | let mut test = |foo: &Foo| { LL | ptr = box Foo { x: ptr.x + 1 }; | --- first borrow occurs due to use of `ptr` in closure LL | }; -LL | test(&*ptr); //~ ERROR cannot borrow `*ptr` +LL | test(&*ptr); | ---- ^^^^^ immutable borrow occurs here | | | mutable borrow later used by call diff --git a/src/test/ui/borrowck/borrowck-closures-use-after-free.stderr b/src/test/ui/borrowck/borrowck-closures-use-after-free.stderr index b41a4a0c6768..9e77d8ce1881 100644 --- a/src/test/ui/borrowck/borrowck-closures-use-after-free.stderr +++ b/src/test/ui/borrowck/borrowck-closures-use-after-free.stderr @@ -6,7 +6,7 @@ LL | let mut test = |foo: &Foo| { LL | ptr = box Foo { x: ptr.x + 1 }; | --- previous borrow occurs due to use of `ptr` in closure LL | }; -LL | test(&*ptr); //~ ERROR cannot borrow `*ptr` +LL | test(&*ptr); | ^^^^ immutable borrow occurs here LL | } | - mutable borrow ends here diff --git a/src/test/ui/borrowck/borrowck-consume-unsize-vec.nll.stderr b/src/test/ui/borrowck/borrowck-consume-unsize-vec.nll.stderr index ea7683a91adf..c69237fa95f6 100644 --- a/src/test/ui/borrowck/borrowck-consume-unsize-vec.nll.stderr +++ b/src/test/ui/borrowck/borrowck-consume-unsize-vec.nll.stderr @@ -5,7 +5,7 @@ LL | fn foo(b: Box<[i32;5]>) { | - move occurs because `b` has type `std::boxed::Box<[i32; 5]>`, which does not implement the `Copy` trait LL | consume(b); | - value moved here -LL | consume(b); //~ ERROR use of moved value +LL | consume(b); | ^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-consume-unsize-vec.stderr b/src/test/ui/borrowck/borrowck-consume-unsize-vec.stderr index 2fc2248000f3..02644b82f57e 100644 --- a/src/test/ui/borrowck/borrowck-consume-unsize-vec.stderr +++ b/src/test/ui/borrowck/borrowck-consume-unsize-vec.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `b` | LL | consume(b); | - value moved here -LL | consume(b); //~ ERROR use of moved value +LL | consume(b); | ^ value used here after move | = note: move occurs because `b` has type `std::boxed::Box<[i32; 5]>`, which does not implement the `Copy` trait diff --git a/src/test/ui/borrowck/borrowck-consume-upcast-box.nll.stderr b/src/test/ui/borrowck/borrowck-consume-upcast-box.nll.stderr index 15cf359326be..e8194ad69440 100644 --- a/src/test/ui/borrowck/borrowck-consume-upcast-box.nll.stderr +++ b/src/test/ui/borrowck/borrowck-consume-upcast-box.nll.stderr @@ -5,7 +5,7 @@ LL | fn foo(b: Box) { | - move occurs because `b` has type `std::boxed::Box`, which does not implement the `Copy` trait LL | consume(b); | - value moved here -LL | consume(b); //~ ERROR use of moved value +LL | consume(b); | ^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr b/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr index aef1671342ef..7267a99b869b 100644 --- a/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr +++ b/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `b` | LL | consume(b); | - value moved here -LL | consume(b); //~ ERROR use of moved value +LL | consume(b); | ^ value used here after move | = note: move occurs because `b` has type `std::boxed::Box<(dyn Foo + std::marker::Send + 'static)>`, which does not implement the `Copy` trait diff --git a/src/test/ui/borrowck/borrowck-drop-from-guard.stderr b/src/test/ui/borrowck/borrowck-drop-from-guard.stderr index 07b597f480fe..a2b42fa495e0 100644 --- a/src/test/ui/borrowck/borrowck-drop-from-guard.stderr +++ b/src/test/ui/borrowck/borrowck-drop-from-guard.stderr @@ -7,7 +7,7 @@ LL | match Some(42) { LL | Some(_) if { drop(my_str); false } => {} | ------ value moved here LL | Some(_) => {} -LL | None => { foo(my_str); } //~ ERROR [E0382] +LL | None => { foo(my_str); } | ^^^^^^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-field-sensitivity.nll.stderr b/src/test/ui/borrowck/borrowck-field-sensitivity.nll.stderr index 25a9a1120443..b3451659bec5 100644 --- a/src/test/ui/borrowck/borrowck-field-sensitivity.nll.stderr +++ b/src/test/ui/borrowck/borrowck-field-sensitivity.nll.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x.b` | LL | drop(x.b); | --- value moved here -LL | drop(*x.b); //~ ERROR use of moved value: `*x.b` +LL | drop(*x.b); | ^^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -13,7 +13,7 @@ error[E0382]: use of moved value: `x.b` | LL | let y = A { a: 3, .. x }; | ---------------- value moved here -LL | drop(*x.b); //~ ERROR use of moved value: `*x.b` +LL | drop(*x.b); | ^^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -23,7 +23,7 @@ error[E0382]: borrow of moved value: `x.b` | LL | drop(x.b); | --- value moved here -LL | let p = &x.b; //~ ERROR use of moved value: `x.b` +LL | let p = &x.b; | ^^^^ value borrowed here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -33,7 +33,7 @@ error[E0382]: borrow of moved value: `x.b` | LL | let _y = A { a: 3, .. x }; | ---------------- value moved here -LL | let p = &x.b; //~ ERROR use of moved value: `x.b` +LL | let p = &x.b; | ^^^^ value borrowed here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -43,7 +43,7 @@ error[E0505]: cannot move out of `x.b` because it is borrowed | LL | let p = &x.b; | ---- borrow of `x.b` occurs here -LL | drop(x.b); //~ ERROR cannot move out of `x.b` because it is borrowed +LL | drop(x.b); | ^^^ move out of `x.b` occurs here LL | drop(**p); | --- borrow later used here @@ -53,7 +53,7 @@ error[E0505]: cannot move out of `x.b` because it is borrowed | LL | let p = &x.b; | ---- borrow of `x.b` occurs here -LL | let _y = A { a: 3, .. x }; //~ ERROR cannot move out of `x.b` because it is borrowed +LL | let _y = A { a: 3, .. x }; | ^^^^^^^^^^^^^^^^ move out of `x.b` occurs here LL | drop(**p); | --- borrow later used here @@ -63,7 +63,7 @@ error[E0499]: cannot borrow `x.a` as mutable more than once at a time | LL | let p = &mut x.a; | -------- first mutable borrow occurs here -LL | let q = &mut x.a; //~ ERROR cannot borrow `x.a` as mutable more than once at a time +LL | let q = &mut x.a; | ^^^^^^^^ second mutable borrow occurs here LL | drop(*p); | -- first borrow later used here @@ -73,7 +73,7 @@ error[E0382]: use of moved value: `x.b` | LL | drop(x.b); | --- value moved here -LL | drop(x.b); //~ ERROR use of moved value: `x.b` +LL | drop(x.b); | ^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -83,7 +83,7 @@ error[E0382]: use of moved value: `x.b` | LL | let _y = A { a: 3, .. x }; | ---------------- value moved here -LL | drop(x.b); //~ ERROR use of moved value: `x.b` +LL | drop(x.b); | ^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -93,7 +93,7 @@ error[E0382]: use of moved value: `x.b` | LL | drop(x.b); | --- value moved here -LL | let _z = A { a: 3, .. x }; //~ ERROR use of moved value: `x.b` +LL | let _z = A { a: 3, .. x }; | ^^^^^^^^^^^^^^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -103,7 +103,7 @@ error[E0382]: use of moved value: `x.b` | LL | let _y = A { a: 3, .. x }; | ---------------- value moved here -LL | let _z = A { a: 4, .. x }; //~ ERROR use of moved value: `x.b` +LL | let _z = A { a: 4, .. x }; | ^^^^^^^^^^^^^^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/borrowck/borrowck-field-sensitivity.stderr b/src/test/ui/borrowck/borrowck-field-sensitivity.stderr index bfab5cbe536d..0cf6f3f2182e 100644 --- a/src/test/ui/borrowck/borrowck-field-sensitivity.stderr +++ b/src/test/ui/borrowck/borrowck-field-sensitivity.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `*x.b` | LL | drop(x.b); | --- value moved here -LL | drop(*x.b); //~ ERROR use of moved value: `*x.b` +LL | drop(*x.b); | ^^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -13,7 +13,7 @@ error[E0382]: use of moved value: `*x.b` | LL | let y = A { a: 3, .. x }; | - value moved here -LL | drop(*x.b); //~ ERROR use of moved value: `*x.b` +LL | drop(*x.b); | ^^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -23,7 +23,7 @@ error[E0382]: use of moved value: `x.b` | LL | drop(x.b); | --- value moved here -LL | let p = &x.b; //~ ERROR use of moved value: `x.b` +LL | let p = &x.b; | ^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -33,7 +33,7 @@ error[E0382]: use of moved value: `x.b` | LL | let _y = A { a: 3, .. x }; | - value moved here -LL | let p = &x.b; //~ ERROR use of moved value: `x.b` +LL | let p = &x.b; | ^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -43,7 +43,7 @@ error[E0505]: cannot move out of `x.b` because it is borrowed | LL | let p = &x.b; | --- borrow of `x.b` occurs here -LL | drop(x.b); //~ ERROR cannot move out of `x.b` because it is borrowed +LL | drop(x.b); | ^^^ move out of `x.b` occurs here error[E0505]: cannot move out of `x.b` because it is borrowed @@ -51,7 +51,7 @@ error[E0505]: cannot move out of `x.b` because it is borrowed | LL | let p = &x.b; | --- borrow of `x.b` occurs here -LL | let _y = A { a: 3, .. x }; //~ ERROR cannot move out of `x.b` because it is borrowed +LL | let _y = A { a: 3, .. x }; | ^ move out of `x.b` occurs here error[E0499]: cannot borrow `x.a` as mutable more than once at a time @@ -59,7 +59,7 @@ error[E0499]: cannot borrow `x.a` as mutable more than once at a time | LL | let p = &mut x.a; | --- first mutable borrow occurs here -LL | let q = &mut x.a; //~ ERROR cannot borrow `x.a` as mutable more than once at a time +LL | let q = &mut x.a; | ^^^ second mutable borrow occurs here ... LL | } @@ -70,7 +70,7 @@ error[E0382]: use of moved value: `x.b` | LL | drop(x.b); | --- value moved here -LL | drop(x.b); //~ ERROR use of moved value: `x.b` +LL | drop(x.b); | ^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -80,7 +80,7 @@ error[E0382]: use of moved value: `x.b` | LL | let _y = A { a: 3, .. x }; | - value moved here -LL | drop(x.b); //~ ERROR use of moved value: `x.b` +LL | drop(x.b); | ^^^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -90,7 +90,7 @@ error[E0382]: use of moved value: `x.b` | LL | drop(x.b); | --- value moved here -LL | let _z = A { a: 3, .. x }; //~ ERROR use of moved value: `x.b` +LL | let _z = A { a: 3, .. x }; | ^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -100,7 +100,7 @@ error[E0382]: use of moved value: `x.b` | LL | let _y = A { a: 3, .. x }; | - value moved here -LL | let _z = A { a: 4, .. x }; //~ ERROR use of moved value: `x.b` +LL | let _z = A { a: 4, .. x }; | ^ value used here after move | = note: move occurs because `x.b` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -108,19 +108,19 @@ LL | let _z = A { a: 4, .. x }; //~ ERROR use of moved value: `x.b` error[E0381]: use of possibly uninitialized variable: `x.a` --> $DIR/borrowck-field-sensitivity.rs:82:10 | -LL | drop(x.a); //~ ERROR use of possibly uninitialized variable: `x.a` +LL | drop(x.a); | ^^^ use of possibly uninitialized `x.a` error[E0381]: use of possibly uninitialized variable: `x.a` --> $DIR/borrowck-field-sensitivity.rs:88:14 | -LL | let p = &x.a; //~ ERROR use of possibly uninitialized variable: `x.a` +LL | let p = &x.a; | ^^^ use of possibly uninitialized `x.a` error[E0381]: use of possibly uninitialized variable: `x.b` --> $DIR/borrowck-field-sensitivity.rs:95:10 | -LL | drop(x.b); //~ ERROR use of possibly uninitialized variable: `x.b` +LL | drop(x.b); | ^^^ use of possibly uninitialized `x.b` error: aborting due to 14 previous errors diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr b/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr index 7d8618e16d97..d48866dce042 100644 --- a/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr +++ b/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr @@ -1,7 +1,7 @@ error[E0713]: borrow may still be in use when destructor runs --> $DIR/borrowck-fn-in-const-c.rs:17:16 | -LL | return &local.inner; //~ ERROR does not live long enough +LL | return &local.inner; | ^^^^^^^^^^^^ returning this value requires that `local.inner` is borrowed for `'static` LL | } | - here, drop of `local` needs exclusive access to `local.inner`, because the type `DropString` implements the `Drop` trait diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-c.stderr b/src/test/ui/borrowck/borrowck-fn-in-const-c.stderr index f6e7e99393c8..d2ddf808d119 100644 --- a/src/test/ui/borrowck/borrowck-fn-in-const-c.stderr +++ b/src/test/ui/borrowck/borrowck-fn-in-const-c.stderr @@ -1,7 +1,7 @@ error[E0597]: `local.inner` does not live long enough --> $DIR/borrowck-fn-in-const-c.rs:17:17 | -LL | return &local.inner; //~ ERROR does not live long enough +LL | return &local.inner; | ^^^^^^^^^^^ borrowed value does not live long enough LL | } | - borrowed value only lives until here diff --git a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr index 8ba6a07b3d2d..08cafa7da7aa 100644 --- a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr +++ b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:12:15 | -LL | for &a in x.iter() { //~ ERROR cannot move out +LL | for &a in x.iter() { | -- ^^^^^^^^ cannot move out of borrowed content | || | |data moved here @@ -10,13 +10,13 @@ LL | for &a in x.iter() { //~ ERROR cannot move out note: move occurs because `a` has type `&mut i32`, which does not implement the `Copy` trait --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:12:10 | -LL | for &a in x.iter() { //~ ERROR cannot move out +LL | for &a in x.iter() { | ^ error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:18:15 | -LL | for &a in &f.a { //~ ERROR cannot move out +LL | for &a in &f.a { | -- ^^^^ cannot move out of borrowed content | || | |data moved here @@ -25,13 +25,13 @@ LL | for &a in &f.a { //~ ERROR cannot move out note: move occurs because `a` has type `std::boxed::Box`, which does not implement the `Copy` trait --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:18:10 | -LL | for &a in &f.a { //~ ERROR cannot move out +LL | for &a in &f.a { | ^ error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:15 | -LL | for &a in x.iter() { //~ ERROR cannot move out +LL | for &a in x.iter() { | -- ^^^^^^^^ cannot move out of borrowed content | || | |data moved here @@ -40,7 +40,7 @@ LL | for &a in x.iter() { //~ ERROR cannot move out note: move occurs because `a` has type `std::boxed::Box`, which does not implement the `Copy` trait --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:10 | -LL | for &a in x.iter() { //~ ERROR cannot move out +LL | for &a in x.iter() { | ^ error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.stderr b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.stderr index 1a7e2cb69632..fb53b13a58de 100644 --- a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.stderr +++ b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:12:9 | -LL | for &a in x.iter() { //~ ERROR cannot move out +LL | for &a in x.iter() { | ^- | || | |hint: to prevent move, use `ref a` or `ref mut a` @@ -10,7 +10,7 @@ LL | for &a in x.iter() { //~ ERROR cannot move out error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:18:9 | -LL | for &a in &f.a { //~ ERROR cannot move out +LL | for &a in &f.a { | ^- | || | |hint: to prevent move, use `ref a` or `ref mut a` @@ -19,7 +19,7 @@ LL | for &a in &f.a { //~ ERROR cannot move out error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:9 | -LL | for &a in x.iter() { //~ ERROR cannot move out +LL | for &a in x.iter() { | ^- | || | |hint: to prevent move, use `ref a` or `ref mut a` diff --git a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr index 32ca24ba6ec4..f47dce453696 100644 --- a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr +++ b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr @@ -7,7 +7,7 @@ LL | for &x in &vector { | immutable borrow occurs here | immutable borrow later used here LL | let cap = vector.capacity(); -LL | vector.extend(repeat(0)); //~ ERROR cannot borrow +LL | vector.extend(repeat(0)); | ^^^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable @@ -19,7 +19,7 @@ LL | for &x in &vector { | immutable borrow occurs here | immutable borrow later used here ... -LL | vector[1] = 5; //~ ERROR cannot borrow +LL | vector[1] = 5; | ^^^^^^ mutable borrow occurs here error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.stderr b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.stderr index 85008948a1c0..a2d8908c4dd2 100644 --- a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.stderr +++ b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.stderr @@ -7,7 +7,7 @@ LL | for &x in &vector { | | immutable borrow ends here | immutable borrow occurs here LL | let cap = vector.capacity(); -LL | vector.extend(repeat(0)); //~ ERROR cannot borrow +LL | vector.extend(repeat(0)); | ^^^^^^ mutable borrow occurs here error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable @@ -19,7 +19,7 @@ LL | for &x in &vector { | | immutable borrow ends here | immutable borrow occurs here ... -LL | vector[1] = 5; //~ ERROR cannot borrow +LL | vector[1] = 5; | ^^^^^^ mutable borrow occurs here error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-if-no-else.stderr b/src/test/ui/borrowck/borrowck-if-no-else.stderr index f6d199d788bf..1223e409d4df 100644 --- a/src/test/ui/borrowck/borrowck-if-no-else.stderr +++ b/src/test/ui/borrowck/borrowck-if-no-else.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-if-no-else.rs:5:9 | -LL | foo(x); //~ ERROR use of possibly uninitialized variable: `x` +LL | foo(x); | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-if-with-else.stderr b/src/test/ui/borrowck/borrowck-if-with-else.stderr index e569fbdeca1e..d11f29b05f56 100644 --- a/src/test/ui/borrowck/borrowck-if-with-else.stderr +++ b/src/test/ui/borrowck/borrowck-if-with-else.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-if-with-else.rs:10:9 | -LL | foo(x); //~ ERROR use of possibly uninitialized variable: `x` +LL | foo(x); | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-in-static.nll.stderr b/src/test/ui/borrowck/borrowck-in-static.nll.stderr index ff094ecf7074..da639a837aa5 100644 --- a/src/test/ui/borrowck/borrowck-in-static.nll.stderr +++ b/src/test/ui/borrowck/borrowck-in-static.nll.stderr @@ -3,7 +3,7 @@ error[E0507]: cannot move out of captured variable in an `Fn` closure | LL | let x = Box::new(0); | - captured outer variable -LL | Box::new(|| x) //~ ERROR cannot move out of captured outer variable +LL | Box::new(|| x) | ^ cannot move out of captured variable in an `Fn` closure error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-in-static.stderr b/src/test/ui/borrowck/borrowck-in-static.stderr index 400f3cd1c3e7..6eeaf428c5f0 100644 --- a/src/test/ui/borrowck/borrowck-in-static.stderr +++ b/src/test/ui/borrowck/borrowck-in-static.stderr @@ -3,7 +3,7 @@ error[E0507]: cannot move out of captured outer variable in an `Fn` closure | LL | let x = Box::new(0); | - captured outer variable -LL | Box::new(|| x) //~ ERROR cannot move out of captured outer variable +LL | Box::new(|| x) | ^ cannot move out of captured outer variable in an `Fn` closure error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.stderr b/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.stderr index 0195dc60eb3e..82a602c6359c 100644 --- a/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.stderr +++ b/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `i` --> $DIR/borrowck-init-in-called-fn-expr.rs:4:9 | -LL | i //~ ERROR use of possibly uninitialized variable: `i` +LL | i | ^ use of possibly uninitialized `i` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-init-in-fn-expr.stderr b/src/test/ui/borrowck/borrowck-init-in-fn-expr.stderr index dfa63f71c695..899739378524 100644 --- a/src/test/ui/borrowck/borrowck-init-in-fn-expr.stderr +++ b/src/test/ui/borrowck/borrowck-init-in-fn-expr.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `i` --> $DIR/borrowck-init-in-fn-expr.rs:4:9 | -LL | i //~ ERROR use of possibly uninitialized variable: `i` +LL | i | ^ use of possibly uninitialized `i` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-init-op-equal.stderr b/src/test/ui/borrowck/borrowck-init-op-equal.stderr index 414124040aa2..9863ceb14240 100644 --- a/src/test/ui/borrowck/borrowck-init-op-equal.stderr +++ b/src/test/ui/borrowck/borrowck-init-op-equal.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `v` --> $DIR/borrowck-init-op-equal.rs:3:5 | -LL | v += 1; //~ ERROR use of possibly uninitialized variable: `v` +LL | v += 1; | ^^^^^^ use of possibly uninitialized `v` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-init-plus-equal.stderr b/src/test/ui/borrowck/borrowck-init-plus-equal.stderr index 124a60b8a502..80c4e0c80483 100644 --- a/src/test/ui/borrowck/borrowck-init-plus-equal.stderr +++ b/src/test/ui/borrowck/borrowck-init-plus-equal.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `v` --> $DIR/borrowck-init-plus-equal.rs:3:9 | -LL | v = v + 1; //~ ERROR use of possibly uninitialized variable: `v` +LL | v = v + 1; | ^ use of possibly uninitialized `v` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr b/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr index b99d5e813c7c..b004447bf45f 100644 --- a/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr +++ b/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr @@ -5,7 +5,7 @@ LL | f.foo( | ^ --- first borrow later used by call | ___| | | -LL | | |a| { //~ ERROR closure requires unique access to `f` +LL | | |a| { | | --- closure construction occurs here LL | | f.n.insert(*a); | | - first borrow occurs due to use of `f` in closure @@ -19,7 +19,7 @@ LL | f.foo( | - --- first borrow later used by call | | | borrow occurs here -LL | |a| { //~ ERROR closure requires unique access to `f` +LL | |a| { | ^^^ closure construction occurs here LL | f.n.insert(*a); | - second borrow occurs due to use of `f` in closure diff --git a/src/test/ui/borrowck/borrowck-insert-during-each.stderr b/src/test/ui/borrowck/borrowck-insert-during-each.stderr index 021b5b27ae70..3b6339757c97 100644 --- a/src/test/ui/borrowck/borrowck-insert-during-each.stderr +++ b/src/test/ui/borrowck/borrowck-insert-during-each.stderr @@ -3,7 +3,7 @@ error[E0500]: closure requires unique access to `f` but `*f` is already borrowed | LL | f.foo( | - borrow occurs here -LL | |a| { //~ ERROR closure requires unique access to `f` +LL | |a| { | ^^^ closure construction occurs here LL | f.n.insert(*a); | - borrow occurs due to use of `f` in closure diff --git a/src/test/ui/borrowck/borrowck-issue-2657-1.nll.stderr b/src/test/ui/borrowck/borrowck-issue-2657-1.nll.stderr index 3da8d8f8c475..4ea4eb8f0075 100644 --- a/src/test/ui/borrowck/borrowck-issue-2657-1.nll.stderr +++ b/src/test/ui/borrowck/borrowck-issue-2657-1.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | Some(ref _y) => { | ------ borrow of `x.0` occurs here -LL | let _a = x; //~ ERROR cannot move +LL | let _a = x; | ^ move out of `x` occurs here LL | _y.use_ref(); | -- borrow later used here diff --git a/src/test/ui/borrowck/borrowck-issue-2657-1.stderr b/src/test/ui/borrowck/borrowck-issue-2657-1.stderr index 7663822094d8..d9ad86b4f884 100644 --- a/src/test/ui/borrowck/borrowck-issue-2657-1.stderr +++ b/src/test/ui/borrowck/borrowck-issue-2657-1.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | Some(ref _y) => { | ------ borrow of `x.0` occurs here -LL | let _a = x; //~ ERROR cannot move +LL | let _a = x; | ^^ move out of `x` occurs here error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr b/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr index 061c458f73e5..4ef36df52df5 100644 --- a/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr +++ b/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-issue-2657-2.rs:7:18 | -LL | let _b = *y; //~ ERROR cannot move out +LL | let _b = *y; | ^^ | | | cannot move out of borrowed content diff --git a/src/test/ui/borrowck/borrowck-issue-2657-2.stderr b/src/test/ui/borrowck/borrowck-issue-2657-2.stderr index 7e718786caa3..1314b1a14f44 100644 --- a/src/test/ui/borrowck/borrowck-issue-2657-2.stderr +++ b/src/test/ui/borrowck/borrowck-issue-2657-2.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-issue-2657-2.rs:7:18 | -LL | let _b = *y; //~ ERROR cannot move out +LL | let _b = *y; | ^^ | | | cannot move out of borrowed content diff --git a/src/test/ui/borrowck/borrowck-issue-48962.stderr b/src/test/ui/borrowck/borrowck-issue-48962.stderr index de4894d5b526..a5462b413968 100644 --- a/src/test/ui/borrowck/borrowck-issue-48962.stderr +++ b/src/test/ui/borrowck/borrowck-issue-48962.stderr @@ -5,7 +5,7 @@ LL | let mut src = &mut node; | ------- move occurs because `src` has type `&mut Node`, which does not implement the `Copy` trait LL | {src}; | --- value moved here -LL | src.next = None; //~ ERROR use of moved value: `src` [E0382] +LL | src.next = None; | ^^^^^^^^ value used here after move error[E0382]: use of moved value: `src` @@ -15,7 +15,7 @@ LL | let mut src = &mut (22, 44); | ------- move occurs because `src` has type `&mut (i32, i32)`, which does not implement the `Copy` trait LL | {src}; | --- value moved here -LL | src.0 = 66; //~ ERROR use of moved value: `src` [E0382] +LL | src.0 = 66; | ^^^^^^^^^^ value used here after move error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-lend-flow-if.nll.stderr b/src/test/ui/borrowck/borrowck-lend-flow-if.nll.stderr index 0c99edeb1a45..68a82bdb57c5 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow-if.nll.stderr +++ b/src/test/ui/borrowck/borrowck-lend-flow-if.nll.stderr @@ -4,7 +4,7 @@ error[E0502]: cannot borrow `*v` as mutable because it is also borrowed as immut LL | _w = &v; | -- immutable borrow occurs here LL | } -LL | borrow_mut(&mut *v); //~ ERROR cannot borrow +LL | borrow_mut(&mut *v); | ^^^^^^^ mutable borrow occurs here LL | _w.use_ref(); | -- immutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-lend-flow-if.stderr b/src/test/ui/borrowck/borrowck-lend-flow-if.stderr index d1b6bb0c7c96..1acd47ce58bc 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow-if.stderr +++ b/src/test/ui/borrowck/borrowck-lend-flow-if.stderr @@ -4,7 +4,7 @@ error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immu LL | _w = &v; | - immutable borrow occurs here LL | } -LL | borrow_mut(&mut *v); //~ ERROR cannot borrow +LL | borrow_mut(&mut *v); | ^^ mutable borrow occurs here LL | _w.use_ref(); LL | } diff --git a/src/test/ui/borrowck/borrowck-lend-flow.nll.stderr b/src/test/ui/borrowck/borrowck-lend-flow.nll.stderr index ae3313597a3e..07b11b3e7282 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow.nll.stderr +++ b/src/test/ui/borrowck/borrowck-lend-flow.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*v` as mutable because it is also borrowed as immut | LL | let _w = &v; | -- immutable borrow occurs here -LL | borrow_mut(&mut *v); //~ ERROR cannot borrow +LL | borrow_mut(&mut *v); | ^^^^^^^ mutable borrow occurs here LL | _w.use_ref(); | -- immutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-lend-flow.stderr b/src/test/ui/borrowck/borrowck-lend-flow.stderr index d9080d005539..e39fb6c86008 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow.stderr +++ b/src/test/ui/borrowck/borrowck-lend-flow.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immu | LL | let _w = &v; | - immutable borrow occurs here -LL | borrow_mut(&mut *v); //~ ERROR cannot borrow +LL | borrow_mut(&mut *v); | ^^ mutable borrow occurs here LL | _w.use_ref(); LL | } diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-move.nll.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-move.nll.stderr index 450102f0c662..615660febbce 100644 --- a/src/test/ui/borrowck/borrowck-loan-blocks-move.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-blocks-move.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `v` because it is borrowed | LL | let w = &v; | -- borrow of `v` occurs here -LL | take(v); //~ ERROR cannot move out of `v` because it is borrowed +LL | take(v); | ^ move out of `v` occurs here LL | w.use_ref(); | - borrow later used here diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-move.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-move.stderr index ba6e34c2ec82..e6f0a691eca1 100644 --- a/src/test/ui/borrowck/borrowck-loan-blocks-move.stderr +++ b/src/test/ui/borrowck/borrowck-loan-blocks-move.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `v` because it is borrowed | LL | let w = &v; | - borrow of `v` occurs here -LL | take(v); //~ ERROR cannot move out of `v` because it is borrowed +LL | take(v); | ^ move out of `v` occurs here error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.nll.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.nll.stderr index 281a8103f977..1d1522a15b1e 100644 --- a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.nll.stderr @@ -5,7 +5,7 @@ LL | borrow(&*v, | ------ --- immutable borrow occurs here | | | immutable borrow later used by call -LL | |w| { //~ ERROR cannot borrow `v` as mutable +LL | |w| { | ^^^ mutable borrow occurs here LL | v = box 4; | - second borrow occurs due to use of `v` in closure diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr index 6aa2d5d189d2..c916b7efc08e 100644 --- a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr +++ b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `v` as mutable because `*v` is also borrowed as immu | LL | borrow(&*v, | -- immutable borrow occurs here -LL | |w| { //~ ERROR cannot borrow `v` as mutable +LL | |w| { | ^^^ mutable borrow occurs here LL | v = box 4; | - borrow occurs due to use of `v` in closure diff --git a/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.nll.stderr b/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.nll.stderr index 698457589030..6994c837dfcb 100644 --- a/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.nll.stderr @@ -6,7 +6,7 @@ LL | let alias: &'static mut String = s; | | | type annotation requires that `*s` is borrowed for `'static` ... -LL | *s = String::new(); //~ ERROR cannot assign +LL | *s = String::new(); | ^^ assignment to borrowed `*s` occurs here error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr b/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr index eceb923e776b..c9d36a7f9380 100644 --- a/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr +++ b/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `*s` because it is borrowed LL | let alias: &'static mut String = s; | - borrow of `*s` occurs here ... -LL | *s = String::new(); //~ ERROR cannot assign +LL | *s = String::new(); | ^^^^^^^^^^^^^^^^^^ assignment to borrowed `*s` occurs here error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.nll.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.nll.stderr index 421af61ff78c..ad74a89f6689 100644 --- a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.nll.stderr @@ -4,7 +4,7 @@ error[E0503]: cannot use `p` because it was mutably borrowed LL | let q = &mut p; | ------ borrow of `p` occurs here LL | -LL | p + 3; //~ ERROR cannot use `p` +LL | p + 3; | ^ use of borrowed `p` ... LL | *q + 3; // OK to use the new alias `q` @@ -16,7 +16,7 @@ error[E0502]: cannot borrow `p` as immutable because it is also borrowed as muta LL | let q = &mut p; | ------ mutable borrow occurs here ... -LL | p.times(3); //~ ERROR cannot borrow `p` +LL | p.times(3); | ^ immutable borrow occurs here LL | LL | *q + 3; // OK to use the new alias `q` diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr index b4f7a9af666f..d180e3e701c6 100644 --- a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr +++ b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr @@ -4,7 +4,7 @@ error[E0503]: cannot use `p` because it was mutably borrowed LL | let q = &mut p; | - borrow of `p` occurs here LL | -LL | p + 3; //~ ERROR cannot use `p` +LL | p + 3; | ^ use of borrowed `p` error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable @@ -13,7 +13,7 @@ error[E0502]: cannot borrow `p` as immutable because it is also borrowed as muta LL | let q = &mut p; | - mutable borrow occurs here ... -LL | p.times(3); //~ ERROR cannot borrow `p` +LL | p.times(3); | ^ immutable borrow occurs here ... LL | } diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr.nll.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr.nll.stderr index bded4d1e0a3b..ec3edc80323f 100644 --- a/src/test/ui/borrowck/borrowck-loan-rcvr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-rcvr.nll.stderr @@ -1,7 +1,7 @@ error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable --> $DIR/borrowck-loan-rcvr.rs:23:14 | -LL | p.blockm(|| { //~ ERROR cannot borrow `p` as mutable +LL | p.blockm(|| { | - ------ ^^ mutable borrow occurs here | | | | | immutable borrow later used by call @@ -14,7 +14,7 @@ error[E0502]: cannot borrow `p` as immutable because it is also borrowed as muta | LL | let l = &mut p; | ------ mutable borrow occurs here -LL | p.impurem(); //~ ERROR cannot borrow +LL | p.impurem(); | ^ immutable borrow occurs here LL | LL | l.x += 1; diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr.stderr index eb0bbec0bc77..56d33eff73f1 100644 --- a/src/test/ui/borrowck/borrowck-loan-rcvr.stderr +++ b/src/test/ui/borrowck/borrowck-loan-rcvr.stderr @@ -1,7 +1,7 @@ error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable --> $DIR/borrowck-loan-rcvr.rs:23:14 | -LL | p.blockm(|| { //~ ERROR cannot borrow `p` as mutable +LL | p.blockm(|| { | - ^^ mutable borrow occurs here | | | immutable borrow occurs here @@ -15,7 +15,7 @@ error[E0502]: cannot borrow `p` as immutable because it is also borrowed as muta | LL | let l = &mut p; | - mutable borrow occurs here -LL | p.impurem(); //~ ERROR cannot borrow +LL | p.impurem(); | ^ immutable borrow occurs here ... LL | } diff --git a/src/test/ui/borrowck/borrowck-loan-vec-content.nll.stderr b/src/test/ui/borrowck/borrowck-loan-vec-content.nll.stderr index be48f217ef19..6691a2396a1d 100644 --- a/src/test/ui/borrowck/borrowck-loan-vec-content.nll.stderr +++ b/src/test/ui/borrowck/borrowck-loan-vec-content.nll.stderr @@ -5,7 +5,7 @@ LL | takes_imm_elt( | ------------- immutable borrow later used by call LL | &v[0], | - immutable borrow occurs here -LL | || { //~ ERROR cannot borrow `v` as mutable +LL | || { | ^^ mutable borrow occurs here LL | v[1] = 4; | - second borrow occurs due to use of `v` in closure diff --git a/src/test/ui/borrowck/borrowck-loan-vec-content.stderr b/src/test/ui/borrowck/borrowck-loan-vec-content.stderr index 6a565ff2f10d..eea6a09f0fc5 100644 --- a/src/test/ui/borrowck/borrowck-loan-vec-content.stderr +++ b/src/test/ui/borrowck/borrowck-loan-vec-content.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immuta | LL | &v[0], | - immutable borrow occurs here -LL | || { //~ ERROR cannot borrow `v` as mutable +LL | || { | ^^ mutable borrow occurs here LL | v[1] = 4; | - borrow occurs due to use of `v` in closure diff --git a/src/test/ui/borrowck/borrowck-move-by-capture.nll.stderr b/src/test/ui/borrowck/borrowck-move-by-capture.nll.stderr index b8a011744177..38f6ca7be752 100644 --- a/src/test/ui/borrowck/borrowck-move-by-capture.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-by-capture.nll.stderr @@ -4,7 +4,7 @@ error[E0507]: cannot move out of captured variable in an `FnMut` closure LL | let bar: Box<_> = box 3; | --- captured outer variable LL | let _g = to_fn_mut(|| { -LL | let _h = to_fn_once(move || -> isize { *bar }); //~ ERROR cannot move out of +LL | let _h = to_fn_once(move || -> isize { *bar }); | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of captured variable in an `FnMut` closure error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-move-by-capture.stderr b/src/test/ui/borrowck/borrowck-move-by-capture.stderr index 9c485fb48ca7..d845a576b3dc 100644 --- a/src/test/ui/borrowck/borrowck-move-by-capture.stderr +++ b/src/test/ui/borrowck/borrowck-move-by-capture.stderr @@ -4,7 +4,7 @@ error[E0507]: cannot move out of captured outer variable in an `FnMut` closure LL | let bar: Box<_> = box 3; | --- captured outer variable LL | let _g = to_fn_mut(|| { -LL | let _h = to_fn_once(move || -> isize { *bar }); //~ ERROR cannot move out of +LL | let _h = to_fn_once(move || -> isize { *bar }); | ^^^^^^^^^^^^^^^^ cannot move out of captured outer variable in an `FnMut` closure error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr b/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr index 9386278886f6..25eb8d0134c3 100644 --- a/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr @@ -1,12 +1,12 @@ error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-move-error-with-note.rs:11:11 | -LL | match *f { //~ ERROR cannot move out of +LL | match *f { | ^^ | | | cannot move out of borrowed content | help: consider removing the `*`: `f` -LL | //~| cannot move out +LL | LL | Foo::Foo1(num1, | ---- data moved here LL | num2) => (), @@ -46,12 +46,12 @@ LL | g: _t error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-move-error-with-note.rs:47:11 | -LL | match a.a { //~ ERROR cannot move out of +LL | match a.a { | ^^^ | | | cannot move out of borrowed content | help: consider borrowing here: `&a.a` -LL | //~| cannot move out +LL | LL | n => { | - data moved here | diff --git a/src/test/ui/borrowck/borrowck-move-error-with-note.stderr b/src/test/ui/borrowck/borrowck-move-error-with-note.stderr index 07009b42e4da..8b0722916dbf 100644 --- a/src/test/ui/borrowck/borrowck-move-error-with-note.stderr +++ b/src/test/ui/borrowck/borrowck-move-error-with-note.stderr @@ -1,9 +1,9 @@ error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-move-error-with-note.rs:11:11 | -LL | match *f { //~ ERROR cannot move out of +LL | match *f { | ^^ cannot move out of borrowed content -LL | //~| cannot move out +LL | LL | Foo::Foo1(num1, | ---- hint: to prevent move, use `ref num1` or `ref mut num1` LL | num2) => (), @@ -14,8 +14,8 @@ LL | Foo::Foo2(num) => (), error[E0509]: cannot move out of type `S`, which implements the `Drop` trait --> $DIR/borrowck-move-error-with-note.rs:30:9 | -LL | / S { //~ ERROR cannot move out of type `S`, which implements the `Drop` trait -LL | | //~| cannot move out of here +LL | / S { +LL | | LL | | f: _s, | | -- hint: to prevent move, use `ref _s` or `ref mut _s` LL | | g: _t @@ -26,9 +26,9 @@ LL | | } => {} error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-move-error-with-note.rs:47:11 | -LL | match a.a { //~ ERROR cannot move out of +LL | match a.a { | ^ cannot move out of borrowed content -LL | //~| cannot move out +LL | LL | n => { | - hint: to prevent move, use `ref n` or `ref mut n` diff --git a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.nll.stderr b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.nll.stderr index b7fa2247e32f..e4840fba6729 100644 --- a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.nll.stderr @@ -4,7 +4,7 @@ error[E0505]: cannot move out of `*a` because it is borrowed LL | let b = &a; | -- borrow of `a` occurs here LL | -LL | let z = *a; //~ ERROR: cannot move out of `*a` because it is borrowed +LL | let z = *a; | ^^ move out of `*a` occurs here LL | b.use_ref(); | - borrow later used here diff --git a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr index 2ed888051f61..5e2428ef4a3e 100644 --- a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr +++ b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr @@ -4,7 +4,7 @@ error[E0505]: cannot move out of `*a` because it is borrowed LL | let b = &a; | - borrow of `a` occurs here LL | -LL | let z = *a; //~ ERROR: cannot move out of `*a` because it is borrowed +LL | let z = *a; | ^ move out of `*a` occurs here error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr index 5b7846579536..615e3fd18001 100644 --- a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of dereference of raw pointer --> $DIR/borrowck-move-from-unsafe-ptr.rs:2:13 | -LL | let y = *x; //~ ERROR cannot move out of dereference of raw pointer +LL | let y = *x; | ^^ | | | cannot move out of dereference of raw pointer diff --git a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr index 62a522600388..c23c5bb9c4c1 100644 --- a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr +++ b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of dereference of raw pointer --> $DIR/borrowck-move-from-unsafe-ptr.rs:2:13 | -LL | let y = *x; //~ ERROR cannot move out of dereference of raw pointer +LL | let y = *x; | ^^ | | | cannot move out of dereference of raw pointer diff --git a/src/test/ui/borrowck/borrowck-move-mut-base-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.nll.stderr index ce6433d5a527..77f5b72e51c5 100644 --- a/src/test/ui/borrowck/borrowck-move-mut-base-ptr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `t0` because it is borrowed | LL | let p: &isize = &*t0; // Freezes `*t0` | ---- borrow of `*t0` occurs here -LL | let t1 = t0; //~ ERROR cannot move out of `t0` +LL | let t1 = t0; | ^^ move out of `t0` occurs here LL | *t1 = 22; LL | p.use_ref(); diff --git a/src/test/ui/borrowck/borrowck-move-mut-base-ptr.stderr b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.stderr index 224bf0fded87..d3853832c92b 100644 --- a/src/test/ui/borrowck/borrowck-move-mut-base-ptr.stderr +++ b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `t0` because it is borrowed | LL | let p: &isize = &*t0; // Freezes `*t0` | --- borrow of `*t0` occurs here -LL | let t1 = t0; //~ ERROR cannot move out of `t0` +LL | let t1 = t0; | ^^ move out of `t0` occurs here error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr index 9aaeefd4cfc3..51caf60da6e0 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr @@ -20,9 +20,9 @@ LL | Foo { string: b }] => { help: consider removing the `&` | LL | [Foo { string: a }, -LL | //~^ ERROR cannot move out of type `[Foo]` -LL | //~| cannot move out -LL | //~| to prevent move +LL | +LL | +LL | LL | Foo { string: b }] => { | diff --git a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr index 156ba0d4d7bb..5ec0dabfde58 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.stderr @@ -5,9 +5,9 @@ LL | &[Foo { string: a }, | ^ - hint: to prevent move, use `ref a` or `ref mut a` | __________________| | | -LL | | //~^ ERROR cannot move out of type `[Foo]` -LL | | //~| cannot move out -LL | | //~| to prevent move +LL | | +LL | | +LL | | LL | | Foo { string: b }] => { | |_________________________________-__^ cannot move out of here | | diff --git a/src/test/ui/borrowck/borrowck-move-subcomponent.nll.stderr b/src/test/ui/borrowck/borrowck-move-subcomponent.nll.stderr index 3bb5351f97ba..8c9083fcf135 100644 --- a/src/test/ui/borrowck/borrowck-move-subcomponent.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-subcomponent.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `a.x` because it is borrowed | LL | let pb = &a; | -- borrow of `a` occurs here -LL | let S { x: ax } = a; //~ ERROR cannot move out +LL | let S { x: ax } = a; | ^^ move out of `a.x` occurs here LL | f(pb); | -- borrow later used here diff --git a/src/test/ui/borrowck/borrowck-move-subcomponent.stderr b/src/test/ui/borrowck/borrowck-move-subcomponent.stderr index 187cdbbf8156..fd3deef6df5e 100644 --- a/src/test/ui/borrowck/borrowck-move-subcomponent.stderr +++ b/src/test/ui/borrowck/borrowck-move-subcomponent.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `a.x` because it is borrowed | LL | let pb = &a; | - borrow of `a` occurs here -LL | let S { x: ax } = a; //~ ERROR cannot move out +LL | let S { x: ax } = a; | ^^ move out of `a.x` occurs here error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-multiple-captures.nll.stderr b/src/test/ui/borrowck/borrowck-multiple-captures.nll.stderr index d0065a2e7dc3..32c7067acc89 100644 --- a/src/test/ui/borrowck/borrowck-multiple-captures.nll.stderr +++ b/src/test/ui/borrowck/borrowck-multiple-captures.nll.stderr @@ -6,7 +6,7 @@ LL | let p1 = &x1; ... LL | thread::spawn(move|| { | ^^^^^^ move out of `x1` occurs here -LL | drop(x1); //~ ERROR cannot move `x1` into closure because it is borrowed +LL | drop(x1); | -- move occurs due to use in closure ... LL | borrow(&*p1); @@ -19,8 +19,8 @@ LL | let p2 = &x2; | --- borrow of `x2` occurs here LL | thread::spawn(move|| { | ^^^^^^ move out of `x2` occurs here -LL | drop(x1); //~ ERROR cannot move `x1` into closure because it is borrowed -LL | drop(x2); //~ ERROR cannot move `x2` into closure because it is borrowed +LL | drop(x1); +LL | drop(x2); | -- move occurs due to use in closure ... LL | borrow(&*p2); @@ -36,7 +36,7 @@ LL | drop(x1); ... LL | thread::spawn(move|| { | ^^^^^^ value used here after move -LL | drop(x1); //~ ERROR capture of moved value: `x1` +LL | drop(x1); | -- use occurs due to use in closure error[E0382]: use of moved value: `x2` @@ -48,16 +48,16 @@ LL | drop(x2); | -- value moved here LL | thread::spawn(move|| { | ^^^^^^ value used here after move -LL | drop(x1); //~ ERROR capture of moved value: `x1` -LL | drop(x2); //~ ERROR capture of moved value: `x2` +LL | drop(x1); +LL | drop(x2); | -- use occurs due to use in closure error[E0382]: use of moved value: `x` --> $DIR/borrowck-multiple-captures.rs:36:14 | -LL | drop(x); //~ ERROR cannot move `x` into closure because it is borrowed +LL | drop(x); | - value moved here -LL | drop(x); //~ ERROR use of moved value: `x` +LL | drop(x); | ^ value used here after move | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -69,7 +69,7 @@ LL | let p = &x; | -- borrow of `x` occurs here LL | thread::spawn(move|| { | ^^^^^^ move out of `x` occurs here -LL | drop(x); //~ ERROR cannot move `x` into closure because it is borrowed +LL | drop(x); | - move occurs due to use in closure ... LL | borrow(&*p); @@ -78,9 +78,9 @@ LL | borrow(&*p); error[E0382]: use of moved value: `x` --> $DIR/borrowck-multiple-captures.rs:46:14 | -LL | drop(x); //~ ERROR capture of moved value: `x` +LL | drop(x); | - value moved here -LL | drop(x); //~ ERROR use of moved value: `x` +LL | drop(x); | ^ value used here after move | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -94,7 +94,7 @@ LL | drop(x); | - value moved here LL | thread::spawn(move|| { | ^^^^^^ value used here after move -LL | drop(x); //~ ERROR capture of moved value: `x` +LL | drop(x); | - use occurs due to use in closure error: aborting due to 8 previous errors diff --git a/src/test/ui/borrowck/borrowck-multiple-captures.stderr b/src/test/ui/borrowck/borrowck-multiple-captures.stderr index 3cdd09426083..f25b19e3d2ee 100644 --- a/src/test/ui/borrowck/borrowck-multiple-captures.stderr +++ b/src/test/ui/borrowck/borrowck-multiple-captures.stderr @@ -4,7 +4,7 @@ error[E0504]: cannot move `x1` into closure because it is borrowed LL | let p1 = &x1; | -- borrow of `x1` occurs here ... -LL | drop(x1); //~ ERROR cannot move `x1` into closure because it is borrowed +LL | drop(x1); | ^^ move into closure occurs here error[E0504]: cannot move `x2` into closure because it is borrowed @@ -13,7 +13,7 @@ error[E0504]: cannot move `x2` into closure because it is borrowed LL | let p2 = &x2; | -- borrow of `x2` occurs here ... -LL | drop(x2); //~ ERROR cannot move `x2` into closure because it is borrowed +LL | drop(x2); | ^^ move into closure occurs here error[E0382]: capture of moved value: `x1` @@ -22,7 +22,7 @@ error[E0382]: capture of moved value: `x1` LL | drop(x1); | -- value moved here ... -LL | drop(x1); //~ ERROR capture of moved value: `x1` +LL | drop(x1); | ^^ value captured here after move | = note: move occurs because `x1` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -33,7 +33,7 @@ error[E0382]: capture of moved value: `x2` LL | drop(x2); | -- value moved here ... -LL | drop(x2); //~ ERROR capture of moved value: `x2` +LL | drop(x2); | ^^ value captured here after move | = note: move occurs because `x2` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -44,15 +44,15 @@ error[E0504]: cannot move `x` into closure because it is borrowed LL | let p = &x; | - borrow of `x` occurs here LL | thread::spawn(move|| { -LL | drop(x); //~ ERROR cannot move `x` into closure because it is borrowed +LL | drop(x); | ^ move into closure occurs here error[E0382]: use of moved value: `x` --> $DIR/borrowck-multiple-captures.rs:36:14 | -LL | drop(x); //~ ERROR cannot move `x` into closure because it is borrowed +LL | drop(x); | - value moved here -LL | drop(x); //~ ERROR use of moved value: `x` +LL | drop(x); | ^ value used here after move | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -63,7 +63,7 @@ error[E0382]: capture of moved value: `x` LL | drop(x); | - value moved here LL | thread::spawn(move|| { -LL | drop(x); //~ ERROR capture of moved value: `x` +LL | drop(x); | ^ value captured here after move | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -71,9 +71,9 @@ LL | drop(x); //~ ERROR capture of moved value: `x` error[E0382]: use of moved value: `x` --> $DIR/borrowck-multiple-captures.rs:46:14 | -LL | drop(x); //~ ERROR capture of moved value: `x` +LL | drop(x); | - value moved here -LL | drop(x); //~ ERROR use of moved value: `x` +LL | drop(x); | ^ value used here after move | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.nll.stderr b/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.nll.stderr index be69be634117..d58548f22049 100644 --- a/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.nll.stderr +++ b/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | let x: isize = 3; | - help: consider changing this to be mutable: `mut x` -LL | let y: &mut isize = &mut x; //~ ERROR cannot borrow +LL | let y: &mut isize = &mut x; | ^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.stderr b/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.stderr index 95635f7f6703..aa3b39c395de 100644 --- a/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.stderr +++ b/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable | LL | let x: isize = 3; | - help: make this binding mutable: `mut x` -LL | let y: &mut isize = &mut x; //~ ERROR cannot borrow +LL | let y: &mut isize = &mut x; | ^ cannot borrow mutably error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.nll.stderr index 666ccf35a7c9..925930acf865 100644 --- a/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `t0` as mutable because it is also borrowed as immut | LL | let p: &isize = &*t0; // Freezes `*t0` | ---- immutable borrow occurs here -LL | let mut t2 = &mut t0; //~ ERROR cannot borrow `t0` +LL | let mut t2 = &mut t0; | ^^^^^^^ mutable borrow occurs here LL | **t2 += 1; // Mutates `*t0` LL | p.use_ref(); @@ -14,7 +14,7 @@ error[E0499]: cannot borrow `t0` as mutable more than once at a time | LL | let p: &mut isize = &mut *t0; // Claims `*t0` | -------- first mutable borrow occurs here -LL | let mut t2 = &mut t0; //~ ERROR cannot borrow `t0` +LL | let mut t2 = &mut t0; | ^^^^^^^ second mutable borrow occurs here LL | **t2 += 1; // Mutates `*t0` but not through `*p` LL | p.use_mut(); diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr index 154a283b43b5..fb73dbd45104 100644 --- a/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr +++ b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `t0` as mutable because `*t0` is also borrowed as im | LL | let p: &isize = &*t0; // Freezes `*t0` | --- immutable borrow occurs here -LL | let mut t2 = &mut t0; //~ ERROR cannot borrow `t0` +LL | let mut t2 = &mut t0; | ^^ mutable borrow occurs here ... LL | } @@ -14,7 +14,7 @@ error[E0499]: cannot borrow `t0` as mutable more than once at a time | LL | let p: &mut isize = &mut *t0; // Claims `*t0` | --- first mutable borrow occurs here -LL | let mut t2 = &mut t0; //~ ERROR cannot borrow `t0` +LL | let mut t2 = &mut t0; | ^^ second mutable borrow occurs here ... LL | } diff --git a/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.nll.stderr b/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.nll.stderr index 5a9ec98a2db0..8e7ffdc6819a 100644 --- a/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.nll.stderr +++ b/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable | LL | let v = vec![1, 2, 3]; | - help: consider changing this to be mutable: `mut v` -LL | write(&mut v); //~ ERROR cannot borrow +LL | write(&mut v); | ^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.stderr b/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.stderr index 41ee2adf8aa0..416091920ad1 100644 --- a/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.stderr +++ b/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable local variable `v` as mutable | LL | let v = vec![1, 2, 3]; | - help: make this binding mutable: `mut v` -LL | write(&mut v); //~ ERROR cannot borrow +LL | write(&mut v); | ^ cannot borrow mutably error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.nll.stderr b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.nll.stderr index b106708352ef..3462b7610d38 100644 --- a/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.nll.stderr +++ b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | Cycle::Node(ref mut y) => { | --------- borrow of `x.0` occurs here -LL | y.a = x; //~ ERROR cannot move out of +LL | y.a = x; | --- ^ move out of `x` occurs here | | | borrow later used here diff --git a/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.stderr b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.stderr index 5aaf825a3c36..5fc169490c7e 100644 --- a/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.stderr +++ b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | Cycle::Node(ref mut y) => { | --------- borrow of `x.0` occurs here -LL | y.a = x; //~ ERROR cannot move out of +LL | y.a = x; | ^ move out of `x` occurs here error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr b/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr index ff0cc9332325..cf94c74dec22 100644 --- a/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr +++ b/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immut | LL | let y = x.borrowed(); | - immutable borrow occurs here -LL | let z = x.mut_borrowed(); //~ ERROR cannot borrow +LL | let z = x.mut_borrowed(); | ^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | y.use_ref(); | - immutable borrow later used here @@ -13,7 +13,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta | LL | let y = x.borrowed(); | - immutable borrow occurs here -LL | let z = &mut x; //~ ERROR cannot borrow +LL | let z = &mut x; | ^^^^^^ mutable borrow occurs here LL | y.use_ref(); | - immutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-object-lifetime.stderr b/src/test/ui/borrowck/borrowck-object-lifetime.stderr index b22d05b8a2a8..8f6c8e072e54 100644 --- a/src/test/ui/borrowck/borrowck-object-lifetime.stderr +++ b/src/test/ui/borrowck/borrowck-object-lifetime.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immut | LL | let y = x.borrowed(); | - immutable borrow occurs here -LL | let z = x.mut_borrowed(); //~ ERROR cannot borrow +LL | let z = x.mut_borrowed(); | ^ mutable borrow occurs here LL | y.use_ref(); LL | } @@ -14,7 +14,7 @@ error[E0502]: cannot borrow `x` as mutable because `*x` is also borrowed as immu | LL | let y = x.borrowed(); | - immutable borrow occurs here -LL | let z = &mut x; //~ ERROR cannot borrow +LL | let z = &mut x; | ^ mutable borrow occurs here LL | y.use_ref(); LL | } diff --git a/src/test/ui/borrowck/borrowck-or-init.nll.stderr b/src/test/ui/borrowck/borrowck-or-init.nll.stderr index dcd2c18dcaa2..122f5192720c 100644 --- a/src/test/ui/borrowck/borrowck-or-init.nll.stderr +++ b/src/test/ui/borrowck/borrowck-or-init.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `i` --> $DIR/borrowck-or-init.rs:5:20 | -LL | println!("{}", i); //~ ERROR use of possibly uninitialized variable: `i` +LL | println!("{}", i); | ^ use of possibly uninitialized `i` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-or-init.stderr b/src/test/ui/borrowck/borrowck-or-init.stderr index 60024c08303a..a2b69b187b93 100644 --- a/src/test/ui/borrowck/borrowck-or-init.stderr +++ b/src/test/ui/borrowck/borrowck-or-init.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `i` --> $DIR/borrowck-or-init.rs:5:20 | -LL | println!("{}", i); //~ ERROR use of possibly uninitialized variable: `i` +LL | println!("{}", i); | ^ use of possibly uninitialized `i` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr index c5a4c4e005aa..b7fcaa645af2 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `s` as immutable because it is also borrowed as muta | LL | let sp = &mut s; | ------ mutable borrow occurs here -LL | s(3); //~ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable +LL | s(3); | ^ immutable borrow occurs here LL | use_mut(sp); | -- mutable borrow later used here @@ -14,7 +14,7 @@ error[E0596]: cannot borrow `s` as mutable, as it is not declared as mutable LL | let s = SFnMut { | - help: consider changing this to be mutable: `mut s` ... -LL | s(3); //~ ERROR cannot borrow immutable local variable `s` as mutable +LL | s(3); | ^ cannot borrow as mutable error[E0382]: use of moved value: `s` @@ -25,7 +25,7 @@ LL | let s = SFnOnce { ... LL | s(" world".to_string()); | - value moved here -LL | s(" world".to_string()); //~ ERROR use of moved value: `s` +LL | s(" world".to_string()); | ^ value used here after move error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrowck-overloaded-call.stderr b/src/test/ui/borrowck/borrowck-overloaded-call.stderr index 042922613065..97223a2307c6 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-call.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-call.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `s` as immutable because it is also borrowed as muta | LL | let sp = &mut s; | - mutable borrow occurs here -LL | s(3); //~ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable +LL | s(3); | ^ immutable borrow occurs here LL | use_mut(sp); LL | } @@ -15,7 +15,7 @@ error[E0596]: cannot borrow immutable local variable `s` as mutable LL | let s = SFnMut { | - help: make this binding mutable: `mut s` ... -LL | s(3); //~ ERROR cannot borrow immutable local variable `s` as mutable +LL | s(3); | ^ cannot borrow mutably error[E0382]: use of moved value: `s` @@ -23,7 +23,7 @@ error[E0382]: use of moved value: `s` | LL | s(" world".to_string()); | - value moved here -LL | s(" world".to_string()); //~ ERROR use of moved value: `s` +LL | s(" world".to_string()); | ^ value used here after move | = note: move occurs because `s` has type `SFnOnce`, which does not implement the `Copy` trait diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.nll.stderr index 13ace0178f89..5f34749ca89e 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.nll.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*f` as immutable because it is also borrowed as mut | LL | let p = &mut f[&s]; | - mutable borrow occurs here -LL | let q = &f[&s]; //~ ERROR cannot borrow +LL | let q = &f[&s]; | ^ immutable borrow occurs here LL | p.use_mut(); | - mutable borrow later used here @@ -13,7 +13,7 @@ error[E0499]: cannot borrow `*f` as mutable more than once at a time | LL | let p = &mut f[&s]; | - first mutable borrow occurs here -LL | let q = &mut f[&s]; //~ ERROR cannot borrow +LL | let q = &mut f[&s]; | ^ second mutable borrow occurs here LL | p.use_mut(); | - first borrow later used here @@ -23,7 +23,7 @@ error[E0499]: cannot borrow `f.foo` as mutable more than once at a time | LL | let p = &mut f.foo[&s]; | ----- first mutable borrow occurs here -LL | let q = &mut f.foo[&s]; //~ ERROR cannot borrow +LL | let q = &mut f.foo[&s]; | ^^^^^ second mutable borrow occurs here LL | p.use_mut(); | - first borrow later used here @@ -33,7 +33,7 @@ error[E0502]: cannot borrow `f.foo` as mutable because it is also borrowed as im | LL | let p = &f.foo[&s]; | ----- immutable borrow occurs here -LL | let q = &mut f.foo[&s]; //~ ERROR cannot borrow +LL | let q = &mut f.foo[&s]; | ^^^^^ mutable borrow occurs here LL | p.use_ref(); | - immutable borrow later used here @@ -43,7 +43,7 @@ error[E0506]: cannot assign to `f.foo` because it is borrowed | LL | let p = &f.foo[&s]; | ----- borrow of `f.foo` occurs here -LL | f.foo = g; //~ ERROR cannot assign +LL | f.foo = g; | ^^^^^^^^^ assignment to borrowed `f.foo` occurs here LL | p.use_ref(); | - borrow later used here @@ -53,7 +53,7 @@ error[E0506]: cannot assign to `*f` because it is borrowed | LL | let p = &f.foo[&s]; | ----- borrow of `*f` occurs here -LL | *f = g; //~ ERROR cannot assign +LL | *f = g; | ^^^^^^ assignment to borrowed `*f` occurs here LL | p.use_ref(); | - borrow later used here @@ -63,7 +63,7 @@ error[E0506]: cannot assign to `f.foo` because it is borrowed | LL | let p = &mut f.foo[&s]; | ----- borrow of `f.foo` occurs here -LL | f.foo = g; //~ ERROR cannot assign +LL | f.foo = g; | ^^^^^^^^^ assignment to borrowed `f.foo` occurs here LL | p.use_mut(); | - borrow later used here @@ -73,7 +73,7 @@ error[E0506]: cannot assign to `*f` because it is borrowed | LL | let p = &mut f.foo[&s]; | ----- borrow of `*f` occurs here -LL | *f = g; //~ ERROR cannot assign +LL | *f = g; | ^^^^^^ assignment to borrowed `*f` occurs here LL | p.use_mut(); | - borrow later used here diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.stderr index 9bc83f84339c..73cab8868eab 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*f` as immutable because it is also borrowed as mut | LL | let p = &mut f[&s]; | - mutable borrow occurs here -LL | let q = &f[&s]; //~ ERROR cannot borrow +LL | let q = &f[&s]; | ^ immutable borrow occurs here LL | p.use_mut(); LL | } @@ -14,7 +14,7 @@ error[E0499]: cannot borrow `*f` as mutable more than once at a time | LL | let p = &mut f[&s]; | - first mutable borrow occurs here -LL | let q = &mut f[&s]; //~ ERROR cannot borrow +LL | let q = &mut f[&s]; | ^ second mutable borrow occurs here LL | p.use_mut(); LL | } @@ -25,7 +25,7 @@ error[E0499]: cannot borrow `f.foo` as mutable more than once at a time | LL | let p = &mut f.foo[&s]; | ----- first mutable borrow occurs here -LL | let q = &mut f.foo[&s]; //~ ERROR cannot borrow +LL | let q = &mut f.foo[&s]; | ^^^^^ second mutable borrow occurs here LL | p.use_mut(); LL | } @@ -36,7 +36,7 @@ error[E0502]: cannot borrow `f.foo` as mutable because it is also borrowed as im | LL | let p = &f.foo[&s]; | ----- immutable borrow occurs here -LL | let q = &mut f.foo[&s]; //~ ERROR cannot borrow +LL | let q = &mut f.foo[&s]; | ^^^^^ mutable borrow occurs here LL | p.use_ref(); LL | } @@ -47,7 +47,7 @@ error[E0506]: cannot assign to `f.foo` because it is borrowed | LL | let p = &f.foo[&s]; | ----- borrow of `f.foo` occurs here -LL | f.foo = g; //~ ERROR cannot assign +LL | f.foo = g; | ^^^^^^^^^ assignment to borrowed `f.foo` occurs here error[E0506]: cannot assign to `*f` because it is borrowed @@ -55,7 +55,7 @@ error[E0506]: cannot assign to `*f` because it is borrowed | LL | let p = &f.foo[&s]; | ----- borrow of `*f` occurs here -LL | *f = g; //~ ERROR cannot assign +LL | *f = g; | ^^^^^^ assignment to borrowed `*f` occurs here error[E0506]: cannot assign to `f.foo` because it is borrowed @@ -63,7 +63,7 @@ error[E0506]: cannot assign to `f.foo` because it is borrowed | LL | let p = &mut f.foo[&s]; | ----- borrow of `f.foo` occurs here -LL | f.foo = g; //~ ERROR cannot assign +LL | f.foo = g; | ^^^^^^^^^ assignment to borrowed `f.foo` occurs here error[E0506]: cannot assign to `*f` because it is borrowed @@ -71,7 +71,7 @@ error[E0506]: cannot assign to `*f` because it is borrowed | LL | let p = &mut f.foo[&s]; | ----- borrow of `*f` occurs here -LL | *f = g; //~ ERROR cannot assign +LL | *f = g; | ^^^^^^ assignment to borrowed `*f` occurs here error: aborting due to 8 previous errors diff --git a/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr b/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr index 6b41b6f9c4fd..21bc8bb06cc0 100644 --- a/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr +++ b/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let _bar1 = &mut foo.bar1; | ------------- first mutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^^^^^^ second mutable borrow occurs here LL | use_mut(_bar1); | ----- first borrow later used here @@ -13,7 +13,7 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed | LL | let _bar1 = &mut foo.bar1; | ------------- mutable borrow occurs here -LL | let _bar2 = &foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &foo.bar1; | ^^^^^^^^^ immutable borrow occurs here LL | use_mut(_bar1); | ----- mutable borrow later used here @@ -23,7 +23,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as | LL | let _bar1 = &foo.bar1; | --------- immutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^^^^^^ mutable borrow occurs here LL | use_imm(_bar1); | ----- immutable borrow later used here @@ -45,9 +45,9 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed | LL | let _bar1 = &mut foo.bar1.int1; | ------------------ mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; | ^^^^^^^^^ immutable borrow occurs here -LL | let _foo2 = &*foo; //~ ERROR cannot borrow +LL | let _foo2 = &*foo; LL | use_mut(_bar1); | ----- mutable borrow later used here @@ -56,8 +56,8 @@ error[E0502]: cannot borrow `*foo` as immutable because it is also borrowed as m | LL | let _bar1 = &mut foo.bar1.int1; | ------------------ mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow -LL | let _foo2 = &*foo; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; +LL | let _foo2 = &*foo; | ^^^^^ immutable borrow occurs here LL | use_mut(_bar1); | ----- mutable borrow later used here @@ -67,7 +67,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let _bar1 = &mut foo.bar1.int1; | ------------------ first mutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^^^^^^ second mutable borrow occurs here LL | use_mut(_bar1); | ----- first borrow later used here @@ -77,7 +77,7 @@ error[E0499]: cannot borrow `*foo` as mutable more than once at a time | LL | let _bar1 = &mut foo.bar1.int1; | ------------------ first mutable borrow occurs here -LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut *foo; | ^^^^^^^^^ second mutable borrow occurs here LL | use_mut(_bar1); | ----- first borrow later used here @@ -87,7 +87,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as | LL | let _bar1 = &foo.bar1.int1; | -------------- immutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^^^^^^ mutable borrow occurs here LL | use_imm(_bar1); | ----- immutable borrow later used here @@ -97,7 +97,7 @@ error[E0502]: cannot borrow `*foo` as mutable because it is also borrowed as imm | LL | let _bar1 = &foo.bar1.int1; | -------------- immutable borrow occurs here -LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut *foo; | ^^^^^^^^^ mutable borrow occurs here LL | use_imm(_bar1); | ----- immutable borrow later used here @@ -107,7 +107,7 @@ error[E0596]: cannot borrow `foo.bar1` as mutable, as it is behind a `&` referen | LL | fn borrow_mut_from_imm(foo: &Foo) { | ---- help: consider changing this to be a mutable reference: `&mut Foo` -LL | let _bar1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar1 = &mut foo.bar1; | ^^^^^^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to 11 previous errors diff --git a/src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr b/src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr index c20df9f5ff3f..ea624018ad4c 100644 --- a/src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr +++ b/src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let _bar1 = &mut foo.bar1; | -------- first mutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^ second mutable borrow occurs here LL | use_mut(_bar1); LL | } @@ -14,7 +14,7 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed | LL | let _bar1 = &mut foo.bar1; | -------- mutable borrow occurs here -LL | let _bar2 = &foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &foo.bar1; | ^^^^^^^^ immutable borrow occurs here LL | use_mut(_bar1); LL | } @@ -25,7 +25,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as | LL | let _bar1 = &foo.bar1; | -------- immutable borrow occurs here -LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar2 = &mut foo.bar1; | ^^^^^^^^ mutable borrow occurs here LL | use_imm(_bar1); LL | } @@ -48,7 +48,7 @@ error[E0502]: cannot borrow `foo.bar1` as immutable because `foo.bar1.int1` is a | LL | let _bar1 = &mut foo.bar1.int1; | ------------- mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; | ^^^^^^^^ immutable borrow occurs here ... LL | } @@ -59,8 +59,8 @@ error[E0502]: cannot borrow `*foo` as immutable because `foo.bar1.int1` is also | LL | let _bar1 = &mut foo.bar1.int1; | ------------- mutable borrow occurs here -LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow -LL | let _foo2 = &*foo; //~ ERROR cannot borrow +LL | let _foo1 = &foo.bar1; +LL | let _foo2 = &*foo; | ^^^^ immutable borrow occurs here LL | use_mut(_bar1); LL | } @@ -71,7 +71,7 @@ error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time | LL | let _bar1 = &mut foo.bar1.int1; | ------------- first mutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^ second mutable borrow occurs here LL | use_mut(_bar1); LL | } @@ -82,7 +82,7 @@ error[E0499]: cannot borrow `*foo` as mutable more than once at a time | LL | let _bar1 = &mut foo.bar1.int1; | ------------- first mutable borrow occurs here -LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut *foo; | ^^^^ second mutable borrow occurs here LL | use_mut(_bar1); LL | } @@ -93,7 +93,7 @@ error[E0502]: cannot borrow `foo.bar1` as mutable because `foo.bar1.int1` is als | LL | let _bar1 = &foo.bar1.int1; | ------------- immutable borrow occurs here -LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _foo1 = &mut foo.bar1; | ^^^^^^^^ mutable borrow occurs here LL | use_imm(_bar1); LL | } @@ -104,7 +104,7 @@ error[E0502]: cannot borrow `*foo` as mutable because `foo.bar1.int1` is also bo | LL | let _bar1 = &foo.bar1.int1; | ------------- immutable borrow occurs here -LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow +LL | let _foo2 = &mut *foo; | ^^^^ mutable borrow occurs here LL | use_imm(_bar1); LL | } @@ -115,7 +115,7 @@ error[E0596]: cannot borrow field `foo.bar1` of immutable binding as mutable | LL | fn borrow_mut_from_imm(foo: &Foo) { | ---- use `&mut Foo` here to make mutable -LL | let _bar1 = &mut foo.bar1; //~ ERROR cannot borrow +LL | let _bar1 = &mut foo.bar1; | ^^^^^^^^ cannot mutably borrow field of immutable binding error: aborting due to 11 previous errors diff --git a/src/test/ui/borrowck/borrowck-ref-mut-of-imm.nll.stderr b/src/test/ui/borrowck/borrowck-ref-mut-of-imm.nll.stderr index 67948ad38792..e744fc6b54b1 100644 --- a/src/test/ui/borrowck/borrowck-ref-mut-of-imm.nll.stderr +++ b/src/test/ui/borrowck/borrowck-ref-mut-of-imm.nll.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable LL | fn destructure(x: Option) -> isize { | - help: consider changing this to be mutable: `mut x` ... -LL | Some(ref mut v) => *v //~ ERROR cannot borrow +LL | Some(ref mut v) => *v | ^^^^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-ref-mut-of-imm.stderr b/src/test/ui/borrowck/borrowck-ref-mut-of-imm.stderr index 4eb41758fc19..6e0d2f699455 100644 --- a/src/test/ui/borrowck/borrowck-ref-mut-of-imm.stderr +++ b/src/test/ui/borrowck/borrowck-ref-mut-of-imm.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow field `(x as std::prelude::v1::Some).0` of immutable LL | fn destructure(x: Option) -> isize { | - help: make this binding mutable: `mut x` ... -LL | Some(ref mut v) => *v //~ ERROR cannot borrow +LL | Some(ref mut v) => *v | ^^^^^^^^^ cannot mutably borrow field of immutable binding error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-reinit.stderr b/src/test/ui/borrowck/borrowck-reinit.stderr index 96f3981ac2fe..3618a7cb2cd3 100644 --- a/src/test/ui/borrowck/borrowck-reinit.stderr +++ b/src/test/ui/borrowck/borrowck-reinit.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x` (Ast) | LL | drop(x); | - value moved here -LL | let _ = (1,x); //~ ERROR use of moved value: `x` (Ast) +LL | let _ = (1,x); | ^ value used here after move | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -16,7 +16,7 @@ LL | let mut x = Box::new(0); ... LL | drop(x); | - value moved here -LL | let _ = (1,x); //~ ERROR use of moved value: `x` (Ast) +LL | let _ = (1,x); | ^ value used here after move error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.nll.stderr b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.nll.stderr index 7b026ee99511..ee8f90edcd3f 100644 --- a/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.nll.stderr +++ b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.nll.stderr @@ -3,8 +3,8 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta | LL | let y = &mut x; | ------ mutable borrow occurs here -LL | //~^ mutable borrow occurs here -LL | let z = &x; //~ ERROR cannot borrow +LL | +LL | let z = &x; | ^^ immutable borrow occurs here ... LL | y.use_mut(); @@ -15,8 +15,8 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta | LL | let y = &x; | -- immutable borrow occurs here -LL | //~^ immutable borrow occurs here -LL | let z = &mut x; //~ ERROR cannot borrow +LL | +LL | let z = &mut x; | ^^^^^^ mutable borrow occurs here ... LL | y.use_ref(); @@ -27,8 +27,8 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time | LL | let y = &mut x; | ------ first mutable borrow occurs here -LL | //~^ first mutable borrow occurs here -LL | let z = &mut x; //~ ERROR cannot borrow +LL | +LL | let z = &mut x; | ^^^^^^ second mutable borrow occurs here ... LL | y.use_mut(); diff --git a/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr index cb65ea11205d..79aec6c2edaa 100644 --- a/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr +++ b/src/test/ui/borrowck/borrowck-report-with-custom-diagnostic.stderr @@ -3,8 +3,8 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta | LL | let y = &mut x; | - mutable borrow occurs here -LL | //~^ mutable borrow occurs here -LL | let z = &x; //~ ERROR cannot borrow +LL | +LL | let z = &x; | ^ immutable borrow occurs here ... LL | } @@ -15,8 +15,8 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta | LL | let y = &x; | - immutable borrow occurs here -LL | //~^ immutable borrow occurs here -LL | let z = &mut x; //~ ERROR cannot borrow +LL | +LL | let z = &mut x; | ^ mutable borrow occurs here ... LL | } @@ -27,8 +27,8 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time | LL | let y = &mut x; | - first mutable borrow occurs here -LL | //~^ first mutable borrow occurs here -LL | let z = &mut x; //~ ERROR cannot borrow +LL | +LL | let z = &mut x; | ^ second mutable borrow occurs here ... LL | }; diff --git a/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.nll.stderr b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.nll.stderr index 65f910de4c3b..d54449ac4ad4 100644 --- a/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.nll.stderr +++ b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing function parameter `x` --> $DIR/borrowck-return-variable-on-stack-via-clone.rs:7:5 | -LL | (&x).clone() //~ ERROR `x` does not live long enough +LL | (&x).clone() | ----^^^^^^^^ | | | returns a value referencing data owned by the current function diff --git a/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.stderr b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.stderr index b54941eed1be..4d4244ba5efa 100644 --- a/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.stderr +++ b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.stderr @@ -1,7 +1,7 @@ error[E0597]: `x` does not live long enough --> $DIR/borrowck-return-variable-on-stack-via-clone.rs:7:7 | -LL | (&x).clone() //~ ERROR `x` does not live long enough +LL | (&x).clone() | ^ borrowed value does not live long enough LL | } | - borrowed value only lives until here diff --git a/src/test/ui/borrowck/borrowck-return.stderr b/src/test/ui/borrowck/borrowck-return.stderr index b8a5ce8dc99b..a2b65af5dbfc 100644 --- a/src/test/ui/borrowck/borrowck-return.stderr +++ b/src/test/ui/borrowck/borrowck-return.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-return.rs:3:12 | -LL | return x; //~ ERROR use of possibly uninitialized variable: `x` +LL | return x; | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan.stderr b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan.stderr index b1629c0e056c..f716ee68b000 100644 --- a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan.stderr +++ b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im | LL | if let [ref first, ref second, ..] = *s { | ---------- immutable borrow occurs here -LL | if let [_, ref mut second2, ref mut third, ..] = *s { //~ERROR +LL | if let [_, ref mut second2, ref mut third, ..] = *s { | ^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[first, second, second2, third]); | ------ immutable borrow later used here @@ -13,7 +13,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im | LL | if let [.., ref fourth, ref third, _, ref first] = *s { | --------- immutable borrow occurs here -LL | if let [.., ref mut third2, _, _] = *s { //~ERROR +LL | if let [.., ref mut third2, _, _] = *s { | ^^^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[first, third, third2, fourth]); | ----- immutable borrow later used here @@ -24,7 +24,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im LL | if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s { | ------------- immutable borrow occurs here ... -LL | if let [_, ref mut from_begin1, ..] = *s { //~ERROR +LL | if let [_, ref mut from_begin1, ..] = *s { | ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[from_begin1, from_end1, from_end3, from_end4]); | --------- immutable borrow later used here @@ -35,7 +35,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im LL | if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s { | ------------- immutable borrow occurs here ... -LL | if let [_, _, ref mut from_begin2, ..] = *s { //~ERROR +LL | if let [_, _, ref mut from_begin2, ..] = *s { | ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[from_begin2, from_end1, from_end3, from_end4]); | --------- immutable borrow later used here @@ -46,7 +46,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im LL | if let [.., _, ref from_end4, ref from_end3, _, ref from_end1] = *s { | ------------- immutable borrow occurs here ... -LL | if let [_, _, _, ref mut from_begin3, ..] = *s { //~ERROR +LL | if let [_, _, _, ref mut from_begin3, ..] = *s { | ^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[from_begin3, from_end1, from_end3, from_end4]); | --------- immutable borrow later used here @@ -57,7 +57,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im LL | if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s { | --------------- immutable borrow occurs here ... -LL | if let [.., ref mut from_end2, _] = *s { //~ERROR +LL | if let [.., ref mut from_end2, _] = *s { | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[from_begin0, from_begin1, from_begin3, from_end2]); | ----------- immutable borrow later used here @@ -68,7 +68,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im LL | if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s { | --------------- immutable borrow occurs here ... -LL | if let [.., ref mut from_end3, _, _] = *s { //~ERROR +LL | if let [.., ref mut from_end3, _, _] = *s { | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[from_begin0, from_begin1, from_begin3, from_end3]); | ----------- immutable borrow later used here @@ -79,7 +79,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im LL | if let [ref from_begin0, ref from_begin1, _, ref from_begin3, _, ..] = *s { | --------------- immutable borrow occurs here ... -LL | if let [.., ref mut from_end4, _, _, _] = *s { //~ERROR +LL | if let [.., ref mut from_end4, _, _, _] = *s { | ^^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[from_begin0, from_begin1, from_begin3, from_end4]); | ----------- immutable borrow later used here @@ -89,7 +89,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im | LL | if let [ref first, ref second, ..] = *s { | ---------- immutable borrow occurs here -LL | if let [_, ref mut tail..] = *s { //~ERROR +LL | if let [_, ref mut tail..] = *s { | ^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[first, second]); | ------ immutable borrow later used here @@ -99,7 +99,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im | LL | if let [.., ref second, ref first] = *s { | ---------- immutable borrow occurs here -LL | if let [ref mut tail.., _] = *s { //~ERROR +LL | if let [ref mut tail.., _] = *s { | ^^^^^^^^^^^^ mutable borrow occurs here LL | nop(&[first, second]); | ------ immutable borrow later used here @@ -109,7 +109,7 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im | LL | if let [_, _, _, ref s1..] = *s { | ------ immutable borrow occurs here -LL | if let [ref mut s2.., _, _, _] = *s { //~ERROR +LL | if let [ref mut s2.., _, _, _] = *s { | ^^^^^^^^^^ mutable borrow occurs here LL | nop_subslice(s1); | -- immutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-storage-dead.stderr b/src/test/ui/borrowck/borrowck-storage-dead.stderr index 057d40d74cfe..c291ed224eb3 100644 --- a/src/test/ui/borrowck/borrowck-storage-dead.stderr +++ b/src/test/ui/borrowck/borrowck-storage-dead.stderr @@ -1,13 +1,13 @@ error[E0381]: use of possibly uninitialized variable: `x` (Ast) --> $DIR/borrowck-storage-dead.rs:18:17 | -LL | let _ = x + 1; //~ERROR (Ast) [E0381] +LL | let _ = x + 1; | ^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` (Mir) --> $DIR/borrowck-storage-dead.rs:18:17 | -LL | let _ = x + 1; //~ERROR (Ast) [E0381] +LL | let _ = x + 1; | ^ use of possibly uninitialized `x` error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.nll.stderr index 8fdd5ef4ca6b..1c55953c91fb 100644 --- a/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `t0` as mutable because it is also borrowed as immut | LL | let p: &isize = &*t0; // Freezes `*t0` | ---- immutable borrow occurs here -LL | swap(&mut t0, &mut t1); //~ ERROR cannot borrow `t0` +LL | swap(&mut t0, &mut t1); | ^^^^^^^ mutable borrow occurs here LL | *t1 = 22; LL | p.use_ref(); diff --git a/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.stderr b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.stderr index 35007216dace..9efd249caf86 100644 --- a/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.stderr +++ b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `t0` as mutable because `*t0` is also borrowed as im | LL | let p: &isize = &*t0; // Freezes `*t0` | --- immutable borrow occurs here -LL | swap(&mut t0, &mut t1); //~ ERROR cannot borrow `t0` +LL | swap(&mut t0, &mut t1); | ^^ mutable borrow occurs here ... LL | } diff --git a/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr b/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr index 363a5a69a07e..ec1cf4a4e2b0 100644 --- a/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr +++ b/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `f` as immutable because it is also borrowed as muta | LL | let g = &mut f; | ------ mutable borrow occurs here -LL | f(1, 2); //~ ERROR cannot borrow `f` as immutable +LL | f(1, 2); | ^ immutable borrow occurs here LL | use_mut(g); | - mutable borrow later used here @@ -13,7 +13,7 @@ error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable | LL | fn b isize>(f: F) { | - help: consider changing this to be mutable: `mut f` -LL | f(1, 2); //~ ERROR cannot borrow immutable argument +LL | f(1, 2); | ^ cannot borrow as mutable error[E0382]: use of moved value: `f` @@ -25,7 +25,7 @@ LL | fn c isize>(f: F) { | consider adding a `Copy` constraint to this type argument LL | f(1, 2); | - value moved here -LL | f(1, 2); //~ ERROR use of moved value +LL | f(1, 2); | ^ value used here after move error: aborting due to 3 previous errors diff --git a/src/test/ui/borrowck/borrowck-unboxed-closures.stderr b/src/test/ui/borrowck/borrowck-unboxed-closures.stderr index 044119f50895..2e0773aebc4c 100644 --- a/src/test/ui/borrowck/borrowck-unboxed-closures.stderr +++ b/src/test/ui/borrowck/borrowck-unboxed-closures.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `f` as immutable because it is also borrowed as muta | LL | let g = &mut f; | - mutable borrow occurs here -LL | f(1, 2); //~ ERROR cannot borrow `f` as immutable +LL | f(1, 2); | ^ immutable borrow occurs here LL | use_mut(g); LL | } @@ -14,7 +14,7 @@ error[E0596]: cannot borrow immutable argument `f` as mutable | LL | fn b isize>(f: F) { | - help: make this binding mutable: `mut f` -LL | f(1, 2); //~ ERROR cannot borrow immutable argument +LL | f(1, 2); | ^ cannot borrow mutably error[E0382]: use of moved value: `f` @@ -22,7 +22,7 @@ error[E0382]: use of moved value: `f` | LL | f(1, 2); | - value moved here -LL | f(1, 2); //~ ERROR use of moved value +LL | f(1, 2); | ^ value used here after move | = note: move occurs because `f` has type `F`, which does not implement the `Copy` trait diff --git a/src/test/ui/borrowck/borrowck-uninit-after-item.stderr b/src/test/ui/borrowck/borrowck-uninit-after-item.stderr index f658b64f11f4..2d0b21dd0d6f 100644 --- a/src/test/ui/borrowck/borrowck-uninit-after-item.stderr +++ b/src/test/ui/borrowck/borrowck-uninit-after-item.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `bar` --> $DIR/borrowck-uninit-after-item.rs:4:9 | -LL | baz(bar); //~ ERROR use of possibly uninitialized variable: `bar` +LL | baz(bar); | ^^^ use of possibly uninitialized `bar` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-uninit-in-assignop.stderr b/src/test/ui/borrowck/borrowck-uninit-in-assignop.stderr index a685f0ecf3c0..163395e42d25 100644 --- a/src/test/ui/borrowck/borrowck-uninit-in-assignop.stderr +++ b/src/test/ui/borrowck/borrowck-uninit-in-assignop.stderr @@ -1,61 +1,61 @@ error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-uninit-in-assignop.rs:6:5 | -LL | x += 1; //~ ERROR use of possibly uninitialized variable: `x` +LL | x += 1; | ^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-uninit-in-assignop.rs:9:5 | -LL | x -= 1; //~ ERROR use of possibly uninitialized variable: `x` +LL | x -= 1; | ^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-uninit-in-assignop.rs:12:5 | -LL | x *= 1; //~ ERROR use of possibly uninitialized variable: `x` +LL | x *= 1; | ^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-uninit-in-assignop.rs:15:5 | -LL | x /= 1; //~ ERROR use of possibly uninitialized variable: `x` +LL | x /= 1; | ^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-uninit-in-assignop.rs:18:5 | -LL | x %= 1; //~ ERROR use of possibly uninitialized variable: `x` +LL | x %= 1; | ^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-uninit-in-assignop.rs:21:5 | -LL | x ^= 1; //~ ERROR use of possibly uninitialized variable: `x` +LL | x ^= 1; | ^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-uninit-in-assignop.rs:24:5 | -LL | x &= 1; //~ ERROR use of possibly uninitialized variable: `x` +LL | x &= 1; | ^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-uninit-in-assignop.rs:27:5 | -LL | x |= 1; //~ ERROR use of possibly uninitialized variable: `x` +LL | x |= 1; | ^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-uninit-in-assignop.rs:30:5 | -LL | x <<= 1; //~ ERROR use of possibly uninitialized variable: `x` +LL | x <<= 1; | ^^^^^^^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-uninit-in-assignop.rs:33:5 | -LL | x >>= 1; //~ ERROR use of possibly uninitialized variable: `x` +LL | x >>= 1; | ^^^^^^^ use of possibly uninitialized `x` error: aborting due to 10 previous errors diff --git a/src/test/ui/borrowck/borrowck-uninit.stderr b/src/test/ui/borrowck/borrowck-uninit.stderr index 5e3428e20b1f..5db9c1b250cc 100644 --- a/src/test/ui/borrowck/borrowck-uninit.stderr +++ b/src/test/ui/borrowck/borrowck-uninit.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-uninit.rs:5:9 | -LL | foo(x); //~ ERROR use of possibly uninitialized variable: `x` +LL | foo(x); | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-union-borrow-nested.nll.stderr b/src/test/ui/borrowck/borrowck-union-borrow-nested.nll.stderr index 6bb6fc4cf29a..61569b9cac10 100644 --- a/src/test/ui/borrowck/borrowck-union-borrow-nested.nll.stderr +++ b/src/test/ui/borrowck/borrowck-union-borrow-nested.nll.stderr @@ -3,7 +3,7 @@ error[E0503]: cannot use `u.c` because it was mutably borrowed | LL | let ra = &mut u.s.a; | ---------- borrow of `u.s.a` occurs here -LL | let b = u.c; //~ ERROR cannot use `u.c` because it was mutably borrowed +LL | let b = u.c; | ^^^ use of borrowed `u.s.a` LL | ra.use_mut(); | -- borrow later used here diff --git a/src/test/ui/borrowck/borrowck-union-borrow-nested.stderr b/src/test/ui/borrowck/borrowck-union-borrow-nested.stderr index 199a13352c4a..71fae6f8d63b 100644 --- a/src/test/ui/borrowck/borrowck-union-borrow-nested.stderr +++ b/src/test/ui/borrowck/borrowck-union-borrow-nested.stderr @@ -3,7 +3,7 @@ error[E0503]: cannot use `u.c` because it was mutably borrowed | LL | let ra = &mut u.s.a; | ----- borrow of `u.s.a` occurs here -LL | let b = u.c; //~ ERROR cannot use `u.c` because it was mutably borrowed +LL | let b = u.c; | ^ use of borrowed `u.s.a` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-union-borrow.nll.stderr b/src/test/ui/borrowck/borrowck-union-borrow.nll.stderr index 5cba30b43b8a..518f062ba1af 100644 --- a/src/test/ui/borrowck/borrowck-union-borrow.nll.stderr +++ b/src/test/ui/borrowck/borrowck-union-borrow.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `u.a` as mutable because it is also borrowed as immu | LL | let ra = &u.a; | ---- immutable borrow occurs here -LL | let rma = &mut u.a; //~ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable +LL | let rma = &mut u.a; | ^^^^^^^^ mutable borrow occurs here LL | drop(ra); | -- immutable borrow later used here @@ -13,7 +13,7 @@ error[E0506]: cannot assign to `u.a` because it is borrowed | LL | let ra = &u.a; | ---- borrow of `u.a` occurs here -LL | u.a = 1; //~ ERROR cannot assign to `u.a` because it is borrowed +LL | u.a = 1; | ^^^^^^^ assignment to borrowed `u.a` occurs here LL | drop(ra); | -- borrow later used here @@ -23,7 +23,7 @@ error[E0502]: cannot borrow `u` (via `u.b`) as mutable because it is also borrow | LL | let ra = &u.a; | ---- immutable borrow occurs here (via `u.a`) -LL | let rmb = &mut u.b; //~ ERROR cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`) +LL | let rmb = &mut u.b; | ^^^^^^^^ mutable borrow of `u.b` -- which overlaps with `u.a` -- occurs here LL | drop(ra); | -- immutable borrow later used here @@ -35,7 +35,7 @@ error[E0506]: cannot assign to `u.b` because it is borrowed | LL | let ra = &u.a; | ---- borrow of `u.b` occurs here -LL | u.b = 1; //~ ERROR cannot assign to `u.b` because it is borrowed +LL | u.b = 1; | ^^^^^^^ assignment to borrowed `u.b` occurs here LL | drop(ra); | -- borrow later used here @@ -45,7 +45,7 @@ error[E0502]: cannot borrow `u.a` as immutable because it is also borrowed as mu | LL | let rma = &mut u.a; | -------- mutable borrow occurs here -LL | let ra = &u.a; //~ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable +LL | let ra = &u.a; | ^^^^ immutable borrow occurs here LL | drop(rma); | --- mutable borrow later used here @@ -55,7 +55,7 @@ error[E0503]: cannot use `u.a` because it was mutably borrowed | LL | let ra = &mut u.a; | -------- borrow of `u.a` occurs here -LL | let a = u.a; //~ ERROR cannot use `u.a` because it was mutably borrowed +LL | let a = u.a; | ^^^ use of borrowed `u.a` LL | drop(ra); | -- borrow later used here @@ -65,7 +65,7 @@ error[E0499]: cannot borrow `u.a` as mutable more than once at a time | LL | let rma = &mut u.a; | -------- first mutable borrow occurs here -LL | let rma2 = &mut u.a; //~ ERROR cannot borrow `u.a` as mutable more than once at a time +LL | let rma2 = &mut u.a; | ^^^^^^^^ second mutable borrow occurs here LL | drop(rma); | --- first borrow later used here @@ -75,7 +75,7 @@ error[E0506]: cannot assign to `u.a` because it is borrowed | LL | let rma = &mut u.a; | -------- borrow of `u.a` occurs here -LL | u.a = 1; //~ ERROR cannot assign to `u.a` because it is borrowed +LL | u.a = 1; | ^^^^^^^ assignment to borrowed `u.a` occurs here LL | drop(rma); | --- borrow later used here @@ -85,7 +85,7 @@ error[E0502]: cannot borrow `u` (via `u.b`) as immutable because it is also borr | LL | let rma = &mut u.a; | -------- mutable borrow occurs here (via `u.a`) -LL | let rb = &u.b; //~ ERROR cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`) +LL | let rb = &u.b; | ^^^^ immutable borrow of `u.b` -- which overlaps with `u.a` -- occurs here LL | drop(rma); | --- mutable borrow later used here @@ -97,7 +97,7 @@ error[E0503]: cannot use `u.b` because it was mutably borrowed | LL | let ra = &mut u.a; | -------- borrow of `u.a` occurs here -LL | let b = u.b; //~ ERROR cannot use `u.b` because it was mutably borrowed +LL | let b = u.b; | ^^^ use of borrowed `u.a` LL | LL | drop(ra); @@ -108,7 +108,7 @@ error[E0499]: cannot borrow `u` (via `u.b`) as mutable more than once at a time | LL | let rma = &mut u.a; | -------- first mutable borrow occurs here (via `u.a`) -LL | let rmb2 = &mut u.b; //~ ERROR cannot borrow `u` (via `u.b`) as mutable more than once at a time +LL | let rmb2 = &mut u.b; | ^^^^^^^^ second mutable borrow occurs here (via `u.b`) LL | drop(rma); | --- first borrow later used here @@ -120,7 +120,7 @@ error[E0506]: cannot assign to `u.b` because it is borrowed | LL | let rma = &mut u.a; | -------- borrow of `u.b` occurs here -LL | u.b = 1; //~ ERROR cannot assign to `u.b` because it is borrowed +LL | u.b = 1; | ^^^^^^^ assignment to borrowed `u.b` occurs here LL | drop(rma); | --- borrow later used here diff --git a/src/test/ui/borrowck/borrowck-union-borrow.stderr b/src/test/ui/borrowck/borrowck-union-borrow.stderr index ef6a331eda04..1cda7e499298 100644 --- a/src/test/ui/borrowck/borrowck-union-borrow.stderr +++ b/src/test/ui/borrowck/borrowck-union-borrow.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `u.a` as mutable because it is also borrowed as immu | LL | let ra = &u.a; | --- immutable borrow occurs here -LL | let rma = &mut u.a; //~ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable +LL | let rma = &mut u.a; | ^^^ mutable borrow occurs here LL | drop(ra); LL | } @@ -14,7 +14,7 @@ error[E0506]: cannot assign to `u.a` because it is borrowed | LL | let ra = &u.a; | --- borrow of `u.a` occurs here -LL | u.a = 1; //~ ERROR cannot assign to `u.a` because it is borrowed +LL | u.a = 1; | ^^^^^^^ assignment to borrowed `u.a` occurs here error[E0502]: cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`) @@ -22,7 +22,7 @@ error[E0502]: cannot borrow `u` (via `u.b`) as mutable because `u` is also borro | LL | let ra = &u.a; | --- immutable borrow occurs here (via `u.a`) -LL | let rmb = &mut u.b; //~ ERROR cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`) +LL | let rmb = &mut u.b; | ^^^ mutable borrow of `u.b` -- which overlaps with `u.a` -- occurs here LL | drop(ra); LL | } @@ -33,7 +33,7 @@ error[E0506]: cannot assign to `u.b` because it is borrowed | LL | let ra = &u.a; | --- borrow of `u.b` occurs here -LL | u.b = 1; //~ ERROR cannot assign to `u.b` because it is borrowed +LL | u.b = 1; | ^^^^^^^ assignment to borrowed `u.b` occurs here error[E0502]: cannot borrow `u.a` as immutable because it is also borrowed as mutable @@ -41,7 +41,7 @@ error[E0502]: cannot borrow `u.a` as immutable because it is also borrowed as mu | LL | let rma = &mut u.a; | --- mutable borrow occurs here -LL | let ra = &u.a; //~ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable +LL | let ra = &u.a; | ^^^ immutable borrow occurs here LL | drop(rma); LL | } @@ -52,7 +52,7 @@ error[E0503]: cannot use `u.a` because it was mutably borrowed | LL | let ra = &mut u.a; | --- borrow of `u.a` occurs here -LL | let a = u.a; //~ ERROR cannot use `u.a` because it was mutably borrowed +LL | let a = u.a; | ^ use of borrowed `u.a` error[E0499]: cannot borrow `u.a` as mutable more than once at a time @@ -60,7 +60,7 @@ error[E0499]: cannot borrow `u.a` as mutable more than once at a time | LL | let rma = &mut u.a; | --- first mutable borrow occurs here -LL | let rma2 = &mut u.a; //~ ERROR cannot borrow `u.a` as mutable more than once at a time +LL | let rma2 = &mut u.a; | ^^^ second mutable borrow occurs here LL | drop(rma); LL | } @@ -71,7 +71,7 @@ error[E0506]: cannot assign to `u.a` because it is borrowed | LL | let rma = &mut u.a; | --- borrow of `u.a` occurs here -LL | u.a = 1; //~ ERROR cannot assign to `u.a` because it is borrowed +LL | u.a = 1; | ^^^^^^^ assignment to borrowed `u.a` occurs here error[E0502]: cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`) @@ -79,7 +79,7 @@ error[E0502]: cannot borrow `u` (via `u.b`) as immutable because `u` is also bor | LL | let rma = &mut u.a; | --- mutable borrow occurs here (via `u.a`) -LL | let rb = &u.b; //~ ERROR cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`) +LL | let rb = &u.b; | ^^^ immutable borrow of `u.b` -- which overlaps with `u.a` -- occurs here LL | drop(rma); LL | } @@ -90,7 +90,7 @@ error[E0503]: cannot use `u.b` because it was mutably borrowed | LL | let ra = &mut u.a; | --- borrow of `u.a` occurs here -LL | let b = u.b; //~ ERROR cannot use `u.b` because it was mutably borrowed +LL | let b = u.b; | ^ use of borrowed `u.a` error[E0499]: cannot borrow `u` (via `u.b`) as mutable more than once at a time @@ -98,7 +98,7 @@ error[E0499]: cannot borrow `u` (via `u.b`) as mutable more than once at a time | LL | let rma = &mut u.a; | --- first mutable borrow occurs here (via `u.a`) -LL | let rmb2 = &mut u.b; //~ ERROR cannot borrow `u` (via `u.b`) as mutable more than once at a time +LL | let rmb2 = &mut u.b; | ^^^ second mutable borrow occurs here (via `u.b`) LL | drop(rma); LL | } @@ -109,7 +109,7 @@ error[E0506]: cannot assign to `u.b` because it is borrowed | LL | let rma = &mut u.a; | --- borrow of `u.b` occurs here -LL | u.b = 1; //~ ERROR cannot assign to `u.b` because it is borrowed +LL | u.b = 1; | ^^^^^^^ assignment to borrowed `u.b` occurs here error: aborting due to 12 previous errors diff --git a/src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr b/src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr index e59fef2dc0d2..0b1714fd75dc 100644 --- a/src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr +++ b/src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr @@ -5,7 +5,7 @@ LL | let mut u = U { a: A }; | ----- move occurs because `u` has type `U`, which does not implement the `Copy` trait LL | let a = u.a; | --- value moved here -LL | let a = u.a; //~ ERROR use of moved value: `u.a` +LL | let a = u.a; | ^^^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-union-move-assign.stderr b/src/test/ui/borrowck/borrowck-union-move-assign.stderr index f304dc3a1242..04e67fcb9297 100644 --- a/src/test/ui/borrowck/borrowck-union-move-assign.stderr +++ b/src/test/ui/borrowck/borrowck-union-move-assign.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `u.a` | LL | let a = u.a; | - value moved here -LL | let a = u.a; //~ ERROR use of moved value: `u.a` +LL | let a = u.a; | ^ value used here after move | = note: move occurs because `u.a` has type `A`, which does not implement the `Copy` trait diff --git a/src/test/ui/borrowck/borrowck-union-move.nll.stderr b/src/test/ui/borrowck/borrowck-union-move.nll.stderr index 1392a7931c30..abbb0142a9c3 100644 --- a/src/test/ui/borrowck/borrowck-union-move.nll.stderr +++ b/src/test/ui/borrowck/borrowck-union-move.nll.stderr @@ -5,7 +5,7 @@ LL | let mut u = Unn { n1: NonCopy }; | ----- move occurs because `u` has type `Unn`, which does not implement the `Copy` trait LL | let a = u.n1; | ---- value moved here -LL | let a = u.n1; //~ ERROR use of moved value: `u.n1` +LL | let a = u.n1; | ^^^^ value used here after move error[E0382]: use of moved value: `u` @@ -15,7 +15,7 @@ LL | let mut u = Unn { n1: NonCopy }; | ----- move occurs because `u` has type `Unn`, which does not implement the `Copy` trait LL | let a = u.n1; | ---- value moved here -LL | let a = u; //~ ERROR use of partially moved value: `u` +LL | let a = u; | ^ value used here after move error[E0382]: use of moved value: `u` @@ -25,7 +25,7 @@ LL | let mut u = Unn { n1: NonCopy }; | ----- move occurs because `u` has type `Unn`, which does not implement the `Copy` trait LL | let a = u.n1; | ---- value moved here -LL | let a = u.n2; //~ ERROR use of moved value: `u.n2` +LL | let a = u.n2; | ^^^^ value used here after move error[E0382]: use of moved value: `u` @@ -35,7 +35,7 @@ LL | let mut u = Ucn { c: Copy }; | ----- move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait LL | let a = u.n; | --- value moved here -LL | let a = u.n; //~ ERROR use of moved value: `u.n` +LL | let a = u.n; | ^^^ value used here after move error[E0382]: use of moved value: `u` @@ -45,7 +45,7 @@ LL | let mut u = Ucn { c: Copy }; | ----- move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait LL | let a = u.n; | --- value moved here -LL | let a = u.c; //~ ERROR use of moved value: `u.c` +LL | let a = u.c; | ^^^ value used here after move error[E0382]: use of moved value: `u` @@ -55,7 +55,7 @@ LL | let mut u = Ucn { c: Copy }; | ----- move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait LL | let a = u.n; | --- value moved here -LL | let a = u; //~ ERROR use of partially moved value: `u` +LL | let a = u; | ^ value used here after move error: aborting due to 6 previous errors diff --git a/src/test/ui/borrowck/borrowck-union-move.stderr b/src/test/ui/borrowck/borrowck-union-move.stderr index ebd8bdc69c02..4ce372aedc36 100644 --- a/src/test/ui/borrowck/borrowck-union-move.stderr +++ b/src/test/ui/borrowck/borrowck-union-move.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `u.n1` | LL | let a = u.n1; | - value moved here -LL | let a = u.n1; //~ ERROR use of moved value: `u.n1` +LL | let a = u.n1; | ^ value used here after move | = note: move occurs because `u.n1` has type `NonCopy`, which does not implement the `Copy` trait @@ -13,7 +13,7 @@ error[E0382]: use of partially moved value: `u` | LL | let a = u.n1; | - value moved here -LL | let a = u; //~ ERROR use of partially moved value: `u` +LL | let a = u; | ^ value used here after move | = note: move occurs because `u.n2` has type `[type error]`, which does not implement the `Copy` trait @@ -23,7 +23,7 @@ error[E0382]: use of moved value: `u.n2` | LL | let a = u.n1; | - value moved here -LL | let a = u.n2; //~ ERROR use of moved value: `u.n2` +LL | let a = u.n2; | ^ value used here after move | = note: move occurs because `u.n2` has type `[type error]`, which does not implement the `Copy` trait @@ -33,7 +33,7 @@ error[E0382]: use of moved value: `u.n` | LL | let a = u.n; | - value moved here -LL | let a = u.n; //~ ERROR use of moved value: `u.n` +LL | let a = u.n; | ^ value used here after move | = note: move occurs because `u.n` has type `NonCopy`, which does not implement the `Copy` trait @@ -43,7 +43,7 @@ error[E0382]: use of moved value: `u.c` | LL | let a = u.n; | - value moved here -LL | let a = u.c; //~ ERROR use of moved value: `u.c` +LL | let a = u.c; | ^ value used here after move | = note: move occurs because `u.c` has type `[type error]`, which does not implement the `Copy` trait @@ -53,7 +53,7 @@ error[E0382]: use of partially moved value: `u` | LL | let a = u.n; | - value moved here -LL | let a = u; //~ ERROR use of partially moved value: `u` +LL | let a = u; | ^ value used here after move | = note: move occurs because `u.c` has type `[type error]`, which does not implement the `Copy` trait diff --git a/src/test/ui/borrowck/borrowck-union-uninitialized.stderr b/src/test/ui/borrowck/borrowck-union-uninitialized.stderr index c8b22dd1c9ef..6a1401ff32bb 100644 --- a/src/test/ui/borrowck/borrowck-union-uninitialized.stderr +++ b/src/test/ui/borrowck/borrowck-union-uninitialized.stderr @@ -1,13 +1,13 @@ error[E0381]: use of possibly uninitialized variable: `s.a` --> $DIR/borrowck-union-uninitialized.rs:15:13 | -LL | let sa = s.a; //~ ERROR use of possibly uninitialized variable: `s.a` +LL | let sa = s.a; | ^^ use of possibly uninitialized `s.a` error[E0381]: use of possibly uninitialized variable: `u.a` --> $DIR/borrowck-union-uninitialized.rs:16:13 | -LL | let ua = u.a; //~ ERROR use of possibly uninitialized variable: `u.a` +LL | let ua = u.a; | ^^ use of possibly uninitialized `u.a` error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/borrowck-uniq-via-lend.nll.stderr b/src/test/ui/borrowck/borrowck-uniq-via-lend.nll.stderr index 7ca277ac0742..923edc8edae7 100644 --- a/src/test/ui/borrowck/borrowck-uniq-via-lend.nll.stderr +++ b/src/test/ui/borrowck/borrowck-uniq-via-lend.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mut | LL | let w = &mut v; | ------ mutable borrow occurs here -LL | borrow(&*v); //~ ERROR cannot borrow `*v` +LL | borrow(&*v); | ^^^ immutable borrow occurs here LL | w.use_mut(); | - mutable borrow later used here @@ -13,7 +13,7 @@ error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mut | LL | x = &mut v; | ------ mutable borrow occurs here -LL | borrow(&*v); //~ ERROR cannot borrow `*v` +LL | borrow(&*v); | ^^^ immutable borrow occurs here LL | x.use_mut(); | - mutable borrow later used here diff --git a/src/test/ui/borrowck/borrowck-uniq-via-lend.stderr b/src/test/ui/borrowck/borrowck-uniq-via-lend.stderr index 14a9551acc6e..00fd77ed718a 100644 --- a/src/test/ui/borrowck/borrowck-uniq-via-lend.stderr +++ b/src/test/ui/borrowck/borrowck-uniq-via-lend.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mu | LL | let w = &mut v; | - mutable borrow occurs here -LL | borrow(&*v); //~ ERROR cannot borrow `*v` +LL | borrow(&*v); | ^^ immutable borrow occurs here LL | w.use_mut(); LL | } @@ -14,7 +14,7 @@ error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mu | LL | x = &mut v; | - mutable borrow occurs here -LL | borrow(&*v); //~ ERROR cannot borrow `*v` +LL | borrow(&*v); | ^^ immutable borrow occurs here LL | x.use_mut(); LL | } diff --git a/src/test/ui/borrowck/borrowck-use-mut-borrow.nll.stderr b/src/test/ui/borrowck/borrowck-use-mut-borrow.nll.stderr index e7b972fb0141..91d69c51e818 100644 --- a/src/test/ui/borrowck/borrowck-use-mut-borrow.nll.stderr +++ b/src/test/ui/borrowck/borrowck-use-mut-borrow.nll.stderr @@ -3,7 +3,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let p = &mut x; | ------ borrow of `x` occurs here -LL | drop(x); //~ ERROR cannot use `x` because it was mutably borrowed +LL | drop(x); | ^ use of borrowed `x` LL | *p = 2; | ------ borrow later used here @@ -13,7 +13,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let p = &mut x.a; | -------- borrow of `x.a` occurs here -LL | drop(x); //~ ERROR cannot use `x` because it was mutably borrowed +LL | drop(x); | ^ use of borrowed `x.a` LL | *p = 3; | ------ borrow later used here @@ -23,7 +23,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed | LL | let p = &mut x; | ------ borrow of `x` occurs here -LL | drop(x.a); //~ ERROR cannot use `x.a` because it was mutably borrowed +LL | drop(x.a); | ^^^ use of borrowed `x` LL | p.a = 3; | ------- borrow later used here @@ -33,7 +33,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed | LL | let p = &mut x.a; | -------- borrow of `x.a` occurs here -LL | drop(x.a); //~ ERROR cannot use `x.a` because it was mutably borrowed +LL | drop(x.a); | ^^^ use of borrowed `x.a` LL | *p = 3; | ------ borrow later used here @@ -43,7 +43,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed | LL | let p = &mut x; | ------ borrow of `x` occurs here -LL | let y = A { b: 3, .. x }; //~ ERROR cannot use `x.a` because it was mutably borrowed +LL | let y = A { b: 3, .. x }; | ^^^^^^^^^^^^^^^^ use of borrowed `x` LL | drop(y); LL | p.a = 4; @@ -54,7 +54,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed | LL | let p = &mut x.a; | -------- borrow of `x.a` occurs here -LL | let y = A { b: 3, .. x }; //~ ERROR cannot use `x.a` because it was mutably borrowed +LL | let y = A { b: 3, .. x }; | ^^^^^^^^^^^^^^^^ use of borrowed `x.a` LL | drop(y); LL | *p = 4; @@ -65,7 +65,7 @@ error[E0503]: cannot use `*x` because it was mutably borrowed | LL | let p = &mut x; | ------ borrow of `x` occurs here -LL | drop(*x); //~ ERROR cannot use `*x` because it was mutably borrowed +LL | drop(*x); | ^^ use of borrowed `x` LL | **p = 2; | ------- borrow later used here @@ -75,7 +75,7 @@ error[E0503]: cannot use `*x.b` because it was mutably borrowed | LL | let p = &mut x; | ------ borrow of `x` occurs here -LL | drop(*x.b); //~ ERROR cannot use `*x.b` because it was mutably borrowed +LL | drop(*x.b); | ^^^^ use of borrowed `x` LL | p.a = 3; | ------- borrow later used here @@ -85,7 +85,7 @@ error[E0503]: cannot use `*x.b` because it was mutably borrowed | LL | let p = &mut x.b; | -------- borrow of `x.b` occurs here -LL | drop(*x.b); //~ ERROR cannot use `*x.b` because it was mutably borrowed +LL | drop(*x.b); | ^^^^ use of borrowed `x.b` LL | **p = 3; | ------- borrow later used here diff --git a/src/test/ui/borrowck/borrowck-use-mut-borrow.stderr b/src/test/ui/borrowck/borrowck-use-mut-borrow.stderr index b6b09f008a4e..5c1d72691764 100644 --- a/src/test/ui/borrowck/borrowck-use-mut-borrow.stderr +++ b/src/test/ui/borrowck/borrowck-use-mut-borrow.stderr @@ -3,7 +3,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let p = &mut x; | - borrow of `x` occurs here -LL | drop(x); //~ ERROR cannot use `x` because it was mutably borrowed +LL | drop(x); | ^ use of borrowed `x` error[E0503]: cannot use `x` because it was mutably borrowed @@ -11,7 +11,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let p = &mut x.a; | --- borrow of `x.a` occurs here -LL | drop(x); //~ ERROR cannot use `x` because it was mutably borrowed +LL | drop(x); | ^ use of borrowed `x.a` error[E0503]: cannot use `x.a` because it was mutably borrowed @@ -19,7 +19,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed | LL | let p = &mut x; | - borrow of `x` occurs here -LL | drop(x.a); //~ ERROR cannot use `x.a` because it was mutably borrowed +LL | drop(x.a); | ^^^ use of borrowed `x` error[E0503]: cannot use `x.a` because it was mutably borrowed @@ -27,7 +27,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed | LL | let p = &mut x.a; | --- borrow of `x.a` occurs here -LL | drop(x.a); //~ ERROR cannot use `x.a` because it was mutably borrowed +LL | drop(x.a); | ^^^ use of borrowed `x.a` error[E0503]: cannot use `x.a` because it was mutably borrowed @@ -35,7 +35,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed | LL | let p = &mut x; | - borrow of `x` occurs here -LL | let y = A { b: 3, .. x }; //~ ERROR cannot use `x.a` because it was mutably borrowed +LL | let y = A { b: 3, .. x }; | ^ use of borrowed `x` error[E0503]: cannot use `x.a` because it was mutably borrowed @@ -43,7 +43,7 @@ error[E0503]: cannot use `x.a` because it was mutably borrowed | LL | let p = &mut x.a; | --- borrow of `x.a` occurs here -LL | let y = A { b: 3, .. x }; //~ ERROR cannot use `x.a` because it was mutably borrowed +LL | let y = A { b: 3, .. x }; | ^ use of borrowed `x.a` error[E0503]: cannot use `*x` because it was mutably borrowed @@ -51,7 +51,7 @@ error[E0503]: cannot use `*x` because it was mutably borrowed | LL | let p = &mut x; | - borrow of `x` occurs here -LL | drop(*x); //~ ERROR cannot use `*x` because it was mutably borrowed +LL | drop(*x); | ^^ use of borrowed `x` error[E0503]: cannot use `*x.b` because it was mutably borrowed @@ -59,7 +59,7 @@ error[E0503]: cannot use `*x.b` because it was mutably borrowed | LL | let p = &mut x; | - borrow of `x` occurs here -LL | drop(*x.b); //~ ERROR cannot use `*x.b` because it was mutably borrowed +LL | drop(*x.b); | ^^^^ use of borrowed `x` error[E0503]: cannot use `*x.b` because it was mutably borrowed @@ -67,7 +67,7 @@ error[E0503]: cannot use `*x.b` because it was mutably borrowed | LL | let p = &mut x.b; | --- borrow of `x.b` occurs here -LL | drop(*x.b); //~ ERROR cannot use `*x.b` because it was mutably borrowed +LL | drop(*x.b); | ^^^^ use of borrowed `x.b` error: aborting due to 9 previous errors diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.nll.stderr index eabd0731388d..da6d9293b408 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.nll.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local variable `vec` --> $DIR/borrowck-vec-pattern-element-loan.rs:10:5 | -LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough +LL | let vec: &[isize] = &vec; | ---- `vec` is borrowed here ... LL | tail @@ -10,7 +10,7 @@ LL | tail error[E0515]: cannot return value referencing local variable `vec` --> $DIR/borrowck-vec-pattern-element-loan.rs:20:5 | -LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough +LL | let vec: &[isize] = &vec; | ---- `vec` is borrowed here ... LL | init @@ -19,7 +19,7 @@ LL | init error[E0515]: cannot return value referencing local variable `vec` --> $DIR/borrowck-vec-pattern-element-loan.rs:30:5 | -LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough +LL | let vec: &[isize] = &vec; | ---- `vec` is borrowed here ... LL | slice diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.stderr index b2fcb2f8cd1b..b0eaee790743 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.stderr @@ -1,7 +1,7 @@ error[E0597]: `vec` does not live long enough --> $DIR/borrowck-vec-pattern-element-loan.rs:5:26 | -LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough +LL | let vec: &[isize] = &vec; | ^^^ borrowed value does not live long enough ... LL | } @@ -16,7 +16,7 @@ LL | fn a<'a>() -> &'a [isize] { error[E0597]: `vec` does not live long enough --> $DIR/borrowck-vec-pattern-element-loan.rs:15:26 | -LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough +LL | let vec: &[isize] = &vec; | ^^^ borrowed value does not live long enough ... LL | } @@ -31,7 +31,7 @@ LL | fn b<'a>() -> &'a [isize] { error[E0597]: `vec` does not live long enough --> $DIR/borrowck-vec-pattern-element-loan.rs:25:26 | -LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough +LL | let vec: &[isize] = &vec; | ^^^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.nll.stderr index 0059dd60f840..251f44592905 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.nll.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.nll.stderr @@ -4,7 +4,7 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time LL | let vb: &mut [isize] = &mut v; | ------ first mutable borrow occurs here ... -LL | v.push(tail[0] + tail[1]); //~ ERROR cannot borrow +LL | v.push(tail[0] + tail[1]); | ^ ------- first borrow later used here | | | second mutable borrow occurs here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr index caadcb361154..1ce6a3bddce0 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr @@ -4,7 +4,7 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time LL | let vb: &mut [isize] = &mut v; | - first mutable borrow occurs here ... -LL | v.push(tail[0] + tail[1]); //~ ERROR cannot borrow +LL | v.push(tail[0] + tail[1]); | ^ second mutable borrow occurs here ... LL | } diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr index 018a3173af1b..aafcb3160d17 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr @@ -3,10 +3,10 @@ error[E0506]: cannot assign to `vec[_]` because it is borrowed | LL | [box ref _a, _, _] => { | ------ borrow of `vec[_]` occurs here -LL | //~^ borrow of `vec[..]` occurs here -LL | vec[0] = box 4; //~ ERROR cannot assign +LL | +LL | vec[0] = box 4; | ^^^^^^ assignment to borrowed `vec[_]` occurs here -LL | //~^ assignment to borrowed `vec[..]` occurs here +LL | LL | _a.use_ref(); | -- borrow later used here @@ -15,10 +15,10 @@ error[E0506]: cannot assign to `vec[_]` because it is borrowed | LL | &mut [ref _b..] => { | ------ borrow of `vec[_]` occurs here -LL | //~^ borrow of `vec[..]` occurs here -LL | vec[0] = box 4; //~ ERROR cannot assign +LL | +LL | vec[0] = box 4; | ^^^^^^ assignment to borrowed `vec[_]` occurs here -LL | //~^ assignment to borrowed `vec[..]` occurs here +LL | LL | _b.use_ref(); | -- borrow later used here @@ -27,19 +27,19 @@ error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy sli | LL | match vec { | ^^^ cannot move out of here -LL | &mut [_a, //~ ERROR cannot move out +LL | &mut [_a, | -- data moved here | note: move occurs because `_a` has type `std::boxed::Box`, which does not implement the `Copy` trait --> $DIR/borrowck-vec-pattern-nesting.rs:34:15 | -LL | &mut [_a, //~ ERROR cannot move out +LL | &mut [_a, | ^^ help: consider removing the `&mut` | -LL | [_a, //~ ERROR cannot move out -LL | //~| cannot move out -LL | //~| to prevent move +LL | [_a, +LL | +LL | LL | .. LL | ] => { | @@ -47,7 +47,7 @@ LL | ] => { error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:47:13 | -LL | let a = vec[0]; //~ ERROR cannot move out +LL | let a = vec[0]; | ^^^^^^ | | | cannot move out of here @@ -69,15 +69,15 @@ LL | _b] => {} | ^^ help: consider removing the `&mut` | -LL | [ //~ ERROR cannot move out -LL | //~^ cannot move out +LL | [ +LL | LL | _b] => {} | error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:60:13 | -LL | let a = vec[0]; //~ ERROR cannot move out +LL | let a = vec[0]; | ^^^^^^ | | | cannot move out of here @@ -88,7 +88,7 @@ error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy sli | LL | match vec { | ^^^ cannot move out of here -LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out +LL | &mut [_a, _b, _c] => {} | ----------------- | | | | | | | | | ...and here @@ -99,13 +99,13 @@ LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out note: move occurs because these variables have types that don't implement the `Copy` trait --> $DIR/borrowck-vec-pattern-nesting.rs:68:15 | -LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out +LL | &mut [_a, _b, _c] => {} | ^^ ^^ ^^ error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:72:13 | -LL | let a = vec[0]; //~ ERROR cannot move out +LL | let a = vec[0]; | ^^^^^^ | | | cannot move out of here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr index 25825fea1587..0e3f514c662a 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr @@ -3,8 +3,8 @@ error[E0506]: cannot assign to `vec[..]` because it is borrowed | LL | [box ref _a, _, _] => { | ------ borrow of `vec[..]` occurs here -LL | //~^ borrow of `vec[..]` occurs here -LL | vec[0] = box 4; //~ ERROR cannot assign +LL | +LL | vec[0] = box 4; | ^^^^^^^^^^^^^^ assignment to borrowed `vec[..]` occurs here error[E0506]: cannot assign to `vec[..]` because it is borrowed @@ -12,19 +12,19 @@ error[E0506]: cannot assign to `vec[..]` because it is borrowed | LL | &mut [ref _b..] => { | ------ borrow of `vec[..]` occurs here -LL | //~^ borrow of `vec[..]` occurs here -LL | vec[0] = box 4; //~ ERROR cannot assign +LL | +LL | vec[0] = box 4; | ^^^^^^^^^^^^^^ assignment to borrowed `vec[..]` occurs here error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:34:14 | -LL | &mut [_a, //~ ERROR cannot move out +LL | &mut [_a, | ^-- hint: to prevent move, use `ref _a` or `ref mut _a` | ______________| | | -LL | | //~| cannot move out -LL | | //~| to prevent move +LL | | +LL | | LL | | .. LL | | ] => { | |_________^ cannot move out of here @@ -32,7 +32,7 @@ LL | | ] => { error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:47:13 | -LL | let a = vec[0]; //~ ERROR cannot move out +LL | let a = vec[0]; | ^^^^^^ | | | cannot move out of here @@ -41,9 +41,9 @@ LL | let a = vec[0]; //~ ERROR cannot move out error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:55:14 | -LL | &mut [ //~ ERROR cannot move out +LL | &mut [ | ______________^ -LL | | //~^ cannot move out +LL | | LL | | _b] => {} | |__________--^ cannot move out of here | | @@ -52,7 +52,7 @@ LL | | _b] => {} error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:60:13 | -LL | let a = vec[0]; //~ ERROR cannot move out +LL | let a = vec[0]; | ^^^^^^ | | | cannot move out of here @@ -61,7 +61,7 @@ LL | let a = vec[0]; //~ ERROR cannot move out error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:68:14 | -LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out +LL | &mut [_a, _b, _c] => {} | ^--^^--^^--^ | || | | | || | ...and here (use `ref _c` or `ref mut _c`) @@ -72,7 +72,7 @@ LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out error[E0508]: cannot move out of type `[std::boxed::Box]`, a non-copy slice --> $DIR/borrowck-vec-pattern-nesting.rs:72:13 | -LL | let a = vec[0]; //~ ERROR cannot move out +LL | let a = vec[0]; | ^^^^^^ | | | cannot move out of here diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.nll.stderr index d9d3930dc49a..c1290a6f63f3 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.nll.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local variable `vec` --> $DIR/borrowck-vec-pattern-tail-element-loan.rs:10:5 | -LL | let vec: &[isize] = &vec; //~ ERROR `vec` does not live long enough +LL | let vec: &[isize] = &vec; | ---- `vec` is borrowed here ... LL | tail diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr index a4584aac0e8d..0a5f773159f4 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr @@ -1,7 +1,7 @@ error[E0597]: `vec` does not live long enough --> $DIR/borrowck-vec-pattern-tail-element-loan.rs:5:26 | -LL | let vec: &[isize] = &vec; //~ ERROR `vec` does not live long enough +LL | let vec: &[isize] = &vec; | ^^^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/borrowck/borrowck-while-break.nll.stderr b/src/test/ui/borrowck/borrowck-while-break.nll.stderr index 1defa3da60ce..0fe3cdc96a87 100644 --- a/src/test/ui/borrowck/borrowck-while-break.nll.stderr +++ b/src/test/ui/borrowck/borrowck-while-break.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `v` --> $DIR/borrowck-while-break.rs:7:20 | -LL | println!("{}", v); //~ ERROR use of possibly uninitialized variable: `v` +LL | println!("{}", v); | ^ use of possibly uninitialized `v` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-while-break.stderr b/src/test/ui/borrowck/borrowck-while-break.stderr index f35d43162b24..55969b8fb1ff 100644 --- a/src/test/ui/borrowck/borrowck-while-break.stderr +++ b/src/test/ui/borrowck/borrowck-while-break.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `v` --> $DIR/borrowck-while-break.rs:7:20 | -LL | println!("{}", v); //~ ERROR use of possibly uninitialized variable: `v` +LL | println!("{}", v); | ^ use of possibly uninitialized `v` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-while-cond.stderr b/src/test/ui/borrowck/borrowck-while-cond.stderr index 2b5414b42cd0..06deae345ab6 100644 --- a/src/test/ui/borrowck/borrowck-while-cond.stderr +++ b/src/test/ui/borrowck/borrowck-while-cond.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-while-cond.rs:3:11 | -LL | while x { } //~ ERROR use of possibly uninitialized variable: `x` +LL | while x { } | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-while.stderr b/src/test/ui/borrowck/borrowck-while.stderr index e8aff0d22c2c..60622d648dd2 100644 --- a/src/test/ui/borrowck/borrowck-while.stderr +++ b/src/test/ui/borrowck/borrowck-while.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/borrowck-while.rs:4:12 | -LL | return x; //~ ERROR use of possibly uninitialized variable: `x` +LL | return x; | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/borrowck/index-mut-help-with-impl.nll.stderr b/src/test/ui/borrowck/index-mut-help-with-impl.nll.stderr index cd88e25cc42c..4b29beb02b35 100644 --- a/src/test/ui/borrowck/index-mut-help-with-impl.nll.stderr +++ b/src/test/ui/borrowck/index-mut-help-with-impl.nll.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/index-mut-help-with-impl.rs:9:5 | -LL | Index::index(&v, 1..2).make_ascii_uppercase(); //~ ERROR +LL | Index::index(&v, 1..2).make_ascii_uppercase(); | ^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content diff --git a/src/test/ui/borrowck/index-mut-help-with-impl.stderr b/src/test/ui/borrowck/index-mut-help-with-impl.stderr index 260ef7c92d0f..6e6efc670610 100644 --- a/src/test/ui/borrowck/index-mut-help-with-impl.stderr +++ b/src/test/ui/borrowck/index-mut-help-with-impl.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/index-mut-help-with-impl.rs:9:5 | -LL | Index::index(&v, 1..2).make_ascii_uppercase(); //~ ERROR +LL | Index::index(&v, 1..2).make_ascii_uppercase(); | ^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/borrowck/index-mut-help.nll.stderr b/src/test/ui/borrowck/index-mut-help.nll.stderr index e7047f0048db..92b94209c4e4 100644 --- a/src/test/ui/borrowck/index-mut-help.nll.stderr +++ b/src/test/ui/borrowck/index-mut-help.nll.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/index-mut-help.rs:11:5 | -LL | map["peter"].clear(); //~ ERROR +LL | map["peter"].clear(); | ^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>` @@ -9,13 +9,13 @@ LL | map["peter"].clear(); //~ ERROR error[E0594]: cannot assign to data in a `&` reference --> $DIR/index-mut-help.rs:12:5 | -LL | map["peter"] = "0".to_string(); //~ ERROR +LL | map["peter"] = "0".to_string(); | ^^^^^^^^^^^^ cannot assign error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/index-mut-help.rs:13:13 | -LL | let _ = &mut map["peter"]; //~ ERROR +LL | let _ = &mut map["peter"]; | ^^^^^^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>` diff --git a/src/test/ui/borrowck/index-mut-help.stderr b/src/test/ui/borrowck/index-mut-help.stderr index 985fa9f0361e..434dd11eea2e 100644 --- a/src/test/ui/borrowck/index-mut-help.stderr +++ b/src/test/ui/borrowck/index-mut-help.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow immutable indexed content as mutable --> $DIR/index-mut-help.rs:11:5 | -LL | map["peter"].clear(); //~ ERROR +LL | map["peter"].clear(); | ^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>` @@ -9,7 +9,7 @@ LL | map["peter"].clear(); //~ ERROR error[E0594]: cannot assign to immutable indexed content --> $DIR/index-mut-help.rs:12:5 | -LL | map["peter"] = "0".to_string(); //~ ERROR +LL | map["peter"] = "0".to_string(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>` @@ -17,7 +17,7 @@ LL | map["peter"] = "0".to_string(); //~ ERROR error[E0596]: cannot borrow immutable indexed content as mutable --> $DIR/index-mut-help.rs:13:18 | -LL | let _ = &mut map["peter"]; //~ ERROR +LL | let _ = &mut map["peter"]; | ^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>` diff --git a/src/test/ui/borrowck/issue-10876.rs b/src/test/ui/borrowck/issue-10876.rs new file mode 100644 index 000000000000..d8fff5f17760 --- /dev/null +++ b/src/test/ui/borrowck/issue-10876.rs @@ -0,0 +1,19 @@ +// run-pass + +#![feature(nll)] + +enum Nat { + S(Box), + Z +} +fn test(x: &mut Nat) { + let mut p = &mut *x; + loop { + match p { + &mut Nat::Z => break, + &mut Nat::S(ref mut n) => p = &mut *n + } + } +} + +fn main() {} diff --git a/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.nll.stderr b/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.nll.stderr index 255eb757a498..eb71ab0b7ec0 100644 --- a/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.nll.stderr +++ b/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of static item --> $DIR/issue-47215-ice-from-drop-elab.rs:17:21 | -LL | let mut x = X; //~ ERROR cannot move out of thread-local static item [E0507] +LL | let mut x = X; | ^ | | | cannot move out of static item diff --git a/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.stderr b/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.stderr index 219a1fd2e772..b09028e6c7c4 100644 --- a/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.stderr +++ b/src/test/ui/borrowck/issue-47215-ice-from-drop-elab.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of thread-local static item --> $DIR/issue-47215-ice-from-drop-elab.rs:17:21 | -LL | let mut x = X; //~ ERROR cannot move out of thread-local static item [E0507] +LL | let mut x = X; | ^ | | | cannot move out of thread-local static item diff --git a/src/test/ui/borrowck/issue-51117.nll.stderr b/src/test/ui/borrowck/issue-51117.nll.stderr index 140be098a99d..f8a9608ad373 100644 --- a/src/test/ui/borrowck/issue-51117.nll.stderr +++ b/src/test/ui/borrowck/issue-51117.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `*bar` as mutable more than once at a time | LL | Some(baz) => { | --- first mutable borrow occurs here -LL | bar.take(); //~ ERROR cannot borrow +LL | bar.take(); | ^^^ second mutable borrow occurs here LL | drop(baz); | --- first borrow later used here diff --git a/src/test/ui/borrowck/issue-51117.stderr b/src/test/ui/borrowck/issue-51117.stderr index 783ba8df1a6e..8f2a78672c6e 100644 --- a/src/test/ui/borrowck/issue-51117.stderr +++ b/src/test/ui/borrowck/issue-51117.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `*bar` as mutable more than once at a time | LL | Some(baz) => { | --- first mutable borrow occurs here -LL | bar.take(); //~ ERROR cannot borrow +LL | bar.take(); | ^^^ second mutable borrow occurs here ... LL | } diff --git a/src/test/ui/borrowck/issue-52713-bug.stderr b/src/test/ui/borrowck/issue-52713-bug.stderr index 4e6d0d45bf08..e3216f5d33f9 100644 --- a/src/test/ui/borrowck/issue-52713-bug.stderr +++ b/src/test/ui/borrowck/issue-52713-bug.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `x` because it is borrowed LL | let y = &x; | -- borrow of `x` occurs here ... -LL | x += 1; //~ ERROR +LL | x += 1; | ^^^^^^ assignment to borrowed `x` occurs here LL | println!("{}", y); | - borrow later used here diff --git a/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr index d1d7d13088bc..6a12016b2a5e 100644 --- a/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr +++ b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/issue-54597-reject-move-out-of-borrow-via-pat.rs:16:13 | -LL | *array //~ ERROR cannot move out of borrowed content +LL | *array | ^^^^^^ | | | cannot move out of borrowed content diff --git a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.ast.stderr b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.ast.stderr new file mode 100644 index 000000000000..9e0b0aac1e3c --- /dev/null +++ b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.ast.stderr @@ -0,0 +1,15 @@ +error[E0597]: `**greeting` does not live long enough + --> $DIR/issue-58776-borrowck-scans-children.rs:10:24 + | +LL | let res = (|| (|| &greeting)())(); + | -- ^^^^^^^^ - borrowed value only lives until here + | | | + | | borrowed value does not live long enough + | capture occurs here +... +LL | } + | - borrowed value needs to live until here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.migrate.stderr b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.migrate.stderr new file mode 100644 index 000000000000..bd8f2286f170 --- /dev/null +++ b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.migrate.stderr @@ -0,0 +1,32 @@ +error[E0506]: cannot assign to `greeting` because it is borrowed + --> $DIR/issue-58776-borrowck-scans-children.rs:13:5 + | +LL | let res = (|| (|| &greeting)())(); + | -- -------- borrow occurs due to use in closure + | | + | borrow of `greeting` occurs here +... +LL | greeting = "DEALLOCATED".to_string(); + | ^^^^^^^^ assignment to borrowed `greeting` occurs here +... +LL | println!("thread result: {:?}", res); + | --- borrow later used here + +error[E0505]: cannot move out of `greeting` because it is borrowed + --> $DIR/issue-58776-borrowck-scans-children.rs:16:10 + | +LL | let res = (|| (|| &greeting)())(); + | -- -------- borrow occurs due to use in closure + | | + | borrow of `greeting` occurs here +... +LL | drop(greeting); + | ^^^^^^^^ move out of `greeting` occurs here +... +LL | println!("thread result: {:?}", res); + | --- borrow later used here + +error: aborting due to 2 previous errors + +Some errors occurred: E0505, E0506. +For more information about an error, try `rustc --explain E0505`. diff --git a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.nll.stderr b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.nll.stderr new file mode 100644 index 000000000000..bd8f2286f170 --- /dev/null +++ b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.nll.stderr @@ -0,0 +1,32 @@ +error[E0506]: cannot assign to `greeting` because it is borrowed + --> $DIR/issue-58776-borrowck-scans-children.rs:13:5 + | +LL | let res = (|| (|| &greeting)())(); + | -- -------- borrow occurs due to use in closure + | | + | borrow of `greeting` occurs here +... +LL | greeting = "DEALLOCATED".to_string(); + | ^^^^^^^^ assignment to borrowed `greeting` occurs here +... +LL | println!("thread result: {:?}", res); + | --- borrow later used here + +error[E0505]: cannot move out of `greeting` because it is borrowed + --> $DIR/issue-58776-borrowck-scans-children.rs:16:10 + | +LL | let res = (|| (|| &greeting)())(); + | -- -------- borrow occurs due to use in closure + | | + | borrow of `greeting` occurs here +... +LL | drop(greeting); + | ^^^^^^^^ move out of `greeting` occurs here +... +LL | println!("thread result: {:?}", res); + | --- borrow later used here + +error: aborting due to 2 previous errors + +Some errors occurred: E0505, E0506. +For more information about an error, try `rustc --explain E0505`. diff --git a/src/test/ui/borrowck/issue-58776-borrowck-scans-children.rs b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.rs new file mode 100644 index 000000000000..378969f9a186 --- /dev/null +++ b/src/test/ui/borrowck/issue-58776-borrowck-scans-children.rs @@ -0,0 +1,21 @@ +// ignore-compare-mode-nll + +// revisions: ast migrate nll + +//[migrate]compile-flags: -Z borrowck=migrate +#![cfg_attr(nll, feature(nll))] + +fn main() { + let mut greeting = "Hello world!".to_string(); + let res = (|| (|| &greeting)())(); + //[ast]~^ ERROR does not live long enough + + greeting = "DEALLOCATED".to_string(); + //[migrate]~^ ERROR cannot assign + //[nll]~^^ ERROR cannot assign + drop(greeting); + //[migrate]~^ ERROR cannot move + //[nll]~^^ ERROR cannot move + + println!("thread result: {:?}", res); +} diff --git a/src/test/ui/borrowck/issue-7573.stderr b/src/test/ui/borrowck/issue-7573.stderr index fed79ef4f559..32b3ef72d8bd 100644 --- a/src/test/ui/borrowck/issue-7573.stderr +++ b/src/test/ui/borrowck/issue-7573.stderr @@ -3,7 +3,7 @@ error: borrowed data cannot be stored outside of its closure | LL | let mut lines_to_use: Vec<&CrateId> = Vec::new(); | - cannot infer an appropriate lifetime... -LL | //~^ NOTE cannot infer an appropriate lifetime +LL | LL | let push_id = |installed_id: &CrateId| { | ------- ------------------------ borrowed data cannot outlive this closure | | diff --git a/src/test/ui/borrowck/mut-borrow-in-loop.nll.stderr b/src/test/ui/borrowck/mut-borrow-in-loop.nll.stderr index ab05358d03f8..eda2f518f924 100644 --- a/src/test/ui/borrowck/mut-borrow-in-loop.nll.stderr +++ b/src/test/ui/borrowck/mut-borrow-in-loop.nll.stderr @@ -4,7 +4,7 @@ error[E0499]: cannot borrow `*arg` as mutable more than once at a time LL | impl<'a, T : 'a> FuncWrapper<'a, T> { | -- lifetime `'a` defined here ... -LL | (self.func)(arg) //~ ERROR cannot borrow +LL | (self.func)(arg) | ------------^^^- | | | | | mutable borrow starts here in previous iteration of loop @@ -16,7 +16,7 @@ error[E0499]: cannot borrow `*arg` as mutable more than once at a time LL | impl<'a, T : 'a> FuncWrapper<'a, T> { | -- lifetime `'a` defined here ... -LL | (self.func)(arg) //~ ERROR cannot borrow +LL | (self.func)(arg) | ------------^^^- | | | | | mutable borrow starts here in previous iteration of loop @@ -28,7 +28,7 @@ error[E0499]: cannot borrow `*arg` as mutable more than once at a time LL | impl<'a, T : 'a> FuncWrapper<'a, T> { | -- lifetime `'a` defined here ... -LL | (self.func)(arg) //~ ERROR cannot borrow +LL | (self.func)(arg) | ------------^^^- | | | | | mutable borrow starts here in previous iteration of loop diff --git a/src/test/ui/borrowck/mut-borrow-in-loop.stderr b/src/test/ui/borrowck/mut-borrow-in-loop.stderr index 749e0e172f77..478d586d03e5 100644 --- a/src/test/ui/borrowck/mut-borrow-in-loop.stderr +++ b/src/test/ui/borrowck/mut-borrow-in-loop.stderr @@ -1,7 +1,7 @@ error[E0499]: cannot borrow `*arg` as mutable more than once at a time --> $DIR/mut-borrow-in-loop.rs:10:25 | -LL | (self.func)(arg) //~ ERROR cannot borrow +LL | (self.func)(arg) | ^^^ mutable borrow starts here in previous iteration of loop LL | } LL | } @@ -10,7 +10,7 @@ LL | } error[E0499]: cannot borrow `*arg` as mutable more than once at a time --> $DIR/mut-borrow-in-loop.rs:16:25 | -LL | (self.func)(arg) //~ ERROR cannot borrow +LL | (self.func)(arg) | ^^^ mutable borrow starts here in previous iteration of loop LL | } LL | } @@ -19,7 +19,7 @@ LL | } error[E0499]: cannot borrow `*arg` as mutable more than once at a time --> $DIR/mut-borrow-in-loop.rs:23:25 | -LL | (self.func)(arg) //~ ERROR cannot borrow +LL | (self.func)(arg) | ^^^ mutable borrow starts here in previous iteration of loop LL | } LL | } diff --git a/src/test/ui/borrowck/mut-borrow-of-mut-ref.nll.stderr b/src/test/ui/borrowck/mut-borrow-of-mut-ref.nll.stderr index 5ee31b5efd09..09dabbc89b42 100644 --- a/src/test/ui/borrowck/mut-borrow-of-mut-ref.nll.stderr +++ b/src/test/ui/borrowck/mut-borrow-of-mut-ref.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `b` as mutable, as it is not declared as mutable | LL | fn f(b: &mut i32) { | - help: consider changing this to be mutable: `mut b` -LL | g(&mut b) //~ ERROR cannot borrow +LL | g(&mut b) | ^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr b/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr index 5278056ac0f5..4653c353cad6 100644 --- a/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr +++ b/src/test/ui/borrowck/mut-borrow-of-mut-ref.stderr @@ -1,11 +1,11 @@ error[E0596]: cannot borrow immutable argument `b` as mutable --> $DIR/mut-borrow-of-mut-ref.rs:8:12 | -LL | g(&mut b) //~ ERROR cannot borrow +LL | g(&mut b) | ^ cannot borrow mutably help: consider removing the `&mut`, as it is an immutable binding to a mutable reference | -LL | g(b) //~ ERROR cannot borrow +LL | g(b) | ^ error: aborting due to previous error diff --git a/src/test/ui/borrowck/mut-borrow-outside-loop.nll.stderr b/src/test/ui/borrowck/mut-borrow-outside-loop.nll.stderr index 9b20fc023193..4fcb693f1bf1 100644 --- a/src/test/ui/borrowck/mut-borrow-outside-loop.nll.stderr +++ b/src/test/ui/borrowck/mut-borrow-outside-loop.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `void` as mutable more than once at a time | LL | let first = &mut void; | --------- first mutable borrow occurs here -LL | let second = &mut void; //~ ERROR cannot borrow +LL | let second = &mut void; | ^^^^^^^^^ second mutable borrow occurs here LL | first.use_mut(); | ----- first borrow later used here @@ -13,7 +13,7 @@ error[E0499]: cannot borrow `inner_void` as mutable more than once at a time | LL | let inner_first = &mut inner_void; | --------------- first mutable borrow occurs here -LL | let inner_second = &mut inner_void; //~ ERROR cannot borrow +LL | let inner_second = &mut inner_void; | ^^^^^^^^^^^^^^^ second mutable borrow occurs here LL | inner_second.use_mut(); LL | inner_first.use_mut(); diff --git a/src/test/ui/borrowck/mut-borrow-outside-loop.stderr b/src/test/ui/borrowck/mut-borrow-outside-loop.stderr index 1b32d8589b52..45db962fbd01 100644 --- a/src/test/ui/borrowck/mut-borrow-outside-loop.stderr +++ b/src/test/ui/borrowck/mut-borrow-outside-loop.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `void` as mutable more than once at a time | LL | let first = &mut void; | ---- first mutable borrow occurs here -LL | let second = &mut void; //~ ERROR cannot borrow +LL | let second = &mut void; | ^^^^ second mutable borrow occurs here ... LL | } @@ -14,7 +14,7 @@ error[E0499]: cannot borrow `inner_void` as mutable more than once at a time | LL | let inner_first = &mut inner_void; | ---------- first mutable borrow occurs here -LL | let inner_second = &mut inner_void; //~ ERROR cannot borrow +LL | let inner_second = &mut inner_void; | ^^^^^^^^^^ second mutable borrow occurs here ... LL | } diff --git a/src/test/ui/borrowck/mutability-errors.nll.stderr b/src/test/ui/borrowck/mutability-errors.nll.stderr index 6dd3582f95f5..11bc78894432 100644 --- a/src/test/ui/borrowck/mutability-errors.nll.stderr +++ b/src/test/ui/borrowck/mutability-errors.nll.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `*x` which is behind a `&` reference | LL | fn named_ref(x: &(i32,)) { | ------- help: consider changing this to be a mutable reference: `&mut (i32,)` -LL | *x = (1,); //~ ERROR +LL | *x = (1,); | ^^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `x.0` which is behind a `&` reference @@ -11,8 +11,8 @@ error[E0594]: cannot assign to `x.0` which is behind a `&` reference | LL | fn named_ref(x: &(i32,)) { | ------- help: consider changing this to be a mutable reference: `&mut (i32,)` -LL | *x = (1,); //~ ERROR -LL | x.0 = 1; //~ ERROR +LL | *x = (1,); +LL | x.0 = 1; | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference @@ -21,7 +21,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference LL | fn named_ref(x: &(i32,)) { | ------- help: consider changing this to be a mutable reference: `&mut (i32,)` ... -LL | &mut *x; //~ ERROR +LL | &mut *x; | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `&` reference @@ -30,31 +30,31 @@ error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `&` reference LL | fn named_ref(x: &(i32,)) { | ------- help: consider changing this to be a mutable reference: `&mut (i32,)` ... -LL | &mut x.0; //~ ERROR +LL | &mut x.0; | ^^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0594]: cannot assign to data in a `&` reference --> $DIR/mutability-errors.rs:16:5 | -LL | *f() = (1,); //~ ERROR +LL | *f() = (1,); | ^^^^^^^^^^^ cannot assign error[E0594]: cannot assign to data in a `&` reference --> $DIR/mutability-errors.rs:17:5 | -LL | f().0 = 1; //~ ERROR +LL | f().0 = 1; | ^^^^^^^^^ cannot assign error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/mutability-errors.rs:18:5 | -LL | &mut *f(); //~ ERROR +LL | &mut *f(); | ^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/mutability-errors.rs:19:5 | -LL | &mut f().0; //~ ERROR +LL | &mut f().0; | ^^^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `*x` which is behind a `*const` pointer @@ -62,7 +62,7 @@ error[E0594]: cannot assign to `*x` which is behind a `*const` pointer | LL | unsafe fn named_ptr(x: *const (i32,)) { | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)` -LL | *x = (1,); //~ ERROR +LL | *x = (1,); | ^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be written error[E0594]: cannot assign to `x.0` which is behind a `*const` pointer @@ -70,8 +70,8 @@ error[E0594]: cannot assign to `x.0` which is behind a `*const` pointer | LL | unsafe fn named_ptr(x: *const (i32,)) { | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)` -LL | *x = (1,); //~ ERROR -LL | (*x).0 = 1; //~ ERROR +LL | *x = (1,); +LL | (*x).0 = 1; | ^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be written error[E0596]: cannot borrow `*x` as mutable, as it is behind a `*const` pointer @@ -80,7 +80,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `*const` pointer LL | unsafe fn named_ptr(x: *const (i32,)) { | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)` ... -LL | &mut *x; //~ ERROR +LL | &mut *x; | ^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `*const` pointer @@ -89,37 +89,37 @@ error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `*const` pointer LL | unsafe fn named_ptr(x: *const (i32,)) { | ------------- help: consider changing this to be a mutable pointer: `*mut (i32,)` ... -LL | &mut (*x).0; //~ ERROR +LL | &mut (*x).0; | ^^^^^^^^^^^ `x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable error[E0594]: cannot assign to data in a `*const` pointer --> $DIR/mutability-errors.rs:30:5 | -LL | *f() = (1,); //~ ERROR +LL | *f() = (1,); | ^^^^^^^^^^^ cannot assign error[E0594]: cannot assign to data in a `*const` pointer --> $DIR/mutability-errors.rs:31:5 | -LL | (*f()).0 = 1; //~ ERROR +LL | (*f()).0 = 1; | ^^^^^^^^^^^^ cannot assign error[E0596]: cannot borrow data in a `*const` pointer as mutable --> $DIR/mutability-errors.rs:32:5 | -LL | &mut *f(); //~ ERROR +LL | &mut *f(); | ^^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow data in a `*const` pointer as mutable --> $DIR/mutability-errors.rs:33:5 | -LL | &mut (*f()).0; //~ ERROR +LL | &mut (*f()).0; | ^^^^^^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure --> $DIR/mutability-errors.rs:40:9 | -LL | x = (1,); //~ ERROR +LL | x = (1,); | ^^^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` @@ -127,17 +127,17 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(|| { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0594]: cannot assign to `x.0`, as `Fn` closures cannot mutate their captured variables --> $DIR/mutability-errors.rs:41:9 | -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` @@ -145,17 +145,17 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(|| { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/mutability-errors.rs:42:9 | -LL | &mut x; //~ ERROR +LL | &mut x; | ^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` @@ -163,17 +163,17 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(|| { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0596]: cannot borrow `x.0` as mutable, as `Fn` closures cannot mutate their captured variables --> $DIR/mutability-errors.rs:43:9 | -LL | &mut x.0; //~ ERROR +LL | &mut x.0; | ^^^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` @@ -181,17 +181,17 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(|| { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure --> $DIR/mutability-errors.rs:46:9 | -LL | x = (1,); //~ ERROR +LL | x = (1,); | ^^^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` @@ -199,17 +199,17 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(move || { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0594]: cannot assign to `x.0`, as `Fn` closures cannot mutate their captured variables --> $DIR/mutability-errors.rs:47:9 | -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` @@ -217,17 +217,17 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(move || { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/mutability-errors.rs:48:9 | -LL | &mut x; //~ ERROR +LL | &mut x; | ^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` @@ -235,17 +235,17 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(move || { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0596]: cannot borrow `x.0` as mutable, as `Fn` closures cannot mutate their captured variables --> $DIR/mutability-errors.rs:49:9 | -LL | &mut x.0; //~ ERROR +LL | &mut x.0; | ^^^^^^^^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` @@ -253,10 +253,10 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(move || { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ @@ -265,7 +265,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | fn imm_local(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` -LL | &mut x; //~ ERROR +LL | &mut x; | ^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable @@ -273,8 +273,8 @@ error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable | LL | fn imm_local(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` -LL | &mut x; //~ ERROR -LL | &mut x.0; //~ ERROR +LL | &mut x; +LL | &mut x.0; | ^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `x`, as it is not declared as mutable @@ -282,7 +282,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable | LL | fn imm_capture(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` -LL | || { //~ ERROR +LL | || { LL | x = (1,); | ^^^^^^^^ cannot assign @@ -319,7 +319,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable LL | fn imm_capture(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` ... -LL | x = (1,); //~ ERROR +LL | x = (1,); | ^^^^^^^^ cannot assign error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable @@ -328,7 +328,7 @@ error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable LL | fn imm_capture(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` ... -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable @@ -337,7 +337,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable LL | fn imm_capture(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` ... -LL | &mut x; //~ ERROR +LL | &mut x; | ^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable @@ -346,31 +346,31 @@ error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable LL | fn imm_capture(x: (i32,)) { | - help: consider changing this to be mutable: `mut x` ... -LL | &mut x.0; //~ ERROR +LL | &mut x.0; | ^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable static item `X` --> $DIR/mutability-errors.rs:76:5 | -LL | X = (1,); //~ ERROR +LL | X = (1,); | ^^^^^^^^ cannot assign error[E0594]: cannot assign to `X.0`, as `X` is an immutable static item --> $DIR/mutability-errors.rs:77:5 | -LL | X.0 = 1; //~ ERROR +LL | X.0 = 1; | ^^^^^^^ cannot assign error[E0596]: cannot borrow immutable static item `X` as mutable --> $DIR/mutability-errors.rs:78:5 | -LL | &mut X; //~ ERROR +LL | &mut X; | ^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `X.0` as mutable, as `X` is an immutable static item --> $DIR/mutability-errors.rs:79:5 | -LL | &mut X.0; //~ ERROR +LL | &mut X.0; | ^^^^^^^^ cannot borrow as mutable error: aborting due to 38 previous errors diff --git a/src/test/ui/borrowck/mutability-errors.stderr b/src/test/ui/borrowck/mutability-errors.stderr index b7fd6ee7214f..cf4f37edde0b 100644 --- a/src/test/ui/borrowck/mutability-errors.stderr +++ b/src/test/ui/borrowck/mutability-errors.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to immutable borrowed content `*x` | LL | fn named_ref(x: &(i32,)) { | ------- use `&mut (i32,)` here to make mutable -LL | *x = (1,); //~ ERROR +LL | *x = (1,); | ^^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to field `x.0` of immutable binding @@ -11,8 +11,8 @@ error[E0594]: cannot assign to field `x.0` of immutable binding | LL | fn named_ref(x: &(i32,)) { | ------- use `&mut (i32,)` here to make mutable -LL | *x = (1,); //~ ERROR -LL | x.0 = 1; //~ ERROR +LL | *x = (1,); +LL | x.0 = 1; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow immutable borrowed content `*x` as mutable @@ -21,7 +21,7 @@ error[E0596]: cannot borrow immutable borrowed content `*x` as mutable LL | fn named_ref(x: &(i32,)) { | ------- use `&mut (i32,)` here to make mutable ... -LL | &mut *x; //~ ERROR +LL | &mut *x; | ^^ cannot borrow as mutable error[E0596]: cannot borrow field `x.0` of immutable binding as mutable @@ -30,85 +30,85 @@ error[E0596]: cannot borrow field `x.0` of immutable binding as mutable LL | fn named_ref(x: &(i32,)) { | ------- use `&mut (i32,)` here to make mutable ... -LL | &mut x.0; //~ ERROR +LL | &mut x.0; | ^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to immutable borrowed content --> $DIR/mutability-errors.rs:16:5 | -LL | *f() = (1,); //~ ERROR +LL | *f() = (1,); | ^^^^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to field of immutable binding --> $DIR/mutability-errors.rs:17:5 | -LL | f().0 = 1; //~ ERROR +LL | f().0 = 1; | ^^^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow immutable borrowed content as mutable --> $DIR/mutability-errors.rs:18:10 | -LL | &mut *f(); //~ ERROR +LL | &mut *f(); | ^^^^ cannot borrow as mutable error[E0596]: cannot borrow field of immutable binding as mutable --> $DIR/mutability-errors.rs:19:10 | -LL | &mut f().0; //~ ERROR +LL | &mut f().0; | ^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to immutable dereference of raw pointer `*x` --> $DIR/mutability-errors.rs:23:5 | -LL | *x = (1,); //~ ERROR +LL | *x = (1,); | ^^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to field `x.0` of immutable binding --> $DIR/mutability-errors.rs:24:5 | -LL | (*x).0 = 1; //~ ERROR +LL | (*x).0 = 1; | ^^^^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow immutable dereference of raw pointer `*x` as mutable --> $DIR/mutability-errors.rs:25:10 | -LL | &mut *x; //~ ERROR +LL | &mut *x; | ^^ cannot borrow as mutable error[E0596]: cannot borrow field `x.0` of immutable binding as mutable --> $DIR/mutability-errors.rs:26:10 | -LL | &mut (*x).0; //~ ERROR +LL | &mut (*x).0; | ^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to immutable dereference of raw pointer --> $DIR/mutability-errors.rs:30:5 | -LL | *f() = (1,); //~ ERROR +LL | *f() = (1,); | ^^^^^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to field of immutable binding --> $DIR/mutability-errors.rs:31:5 | -LL | (*f()).0 = 1; //~ ERROR +LL | (*f()).0 = 1; | ^^^^^^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow immutable dereference of raw pointer as mutable --> $DIR/mutability-errors.rs:32:10 | -LL | &mut *f(); //~ ERROR +LL | &mut *f(); | ^^^^ cannot borrow as mutable error[E0596]: cannot borrow field of immutable binding as mutable --> $DIR/mutability-errors.rs:33:10 | -LL | &mut (*f()).0; //~ ERROR +LL | &mut (*f()).0; | ^^^^^^^^ cannot mutably borrow field of immutable binding error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure --> $DIR/mutability-errors.rs:40:9 | -LL | x = (1,); //~ ERROR +LL | x = (1,); | ^^^^^^^^ | help: consider changing this closure to take self by mutable reference @@ -116,17 +116,17 @@ help: consider changing this closure to take self by mutable reference | LL | fn_ref(|| { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure --> $DIR/mutability-errors.rs:41:9 | -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ | help: consider changing this closure to take self by mutable reference @@ -134,17 +134,17 @@ help: consider changing this closure to take self by mutable reference | LL | fn_ref(|| { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure --> $DIR/mutability-errors.rs:42:14 | -LL | &mut x; //~ ERROR +LL | &mut x; | ^ | help: consider changing this closure to take self by mutable reference @@ -152,17 +152,17 @@ help: consider changing this closure to take self by mutable reference | LL | fn_ref(|| { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure --> $DIR/mutability-errors.rs:43:14 | -LL | &mut x.0; //~ ERROR +LL | &mut x.0; | ^^^ | help: consider changing this closure to take self by mutable reference @@ -170,17 +170,17 @@ help: consider changing this closure to take self by mutable reference | LL | fn_ref(|| { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0594]: cannot assign to captured outer variable in an `Fn` closure --> $DIR/mutability-errors.rs:46:9 | -LL | x = (1,); //~ ERROR +LL | x = (1,); | ^^^^^^^^ | = note: `Fn` closures cannot capture their enclosing environment for modifications @@ -189,23 +189,23 @@ help: consider changing this closure to take self by mutable reference | LL | fn_ref(move || { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0594]: cannot assign to field `x.0` of immutable binding --> $DIR/mutability-errors.rs:47:9 | -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow captured outer variable in an `Fn` closure as mutable --> $DIR/mutability-errors.rs:48:14 | -LL | &mut x; //~ ERROR +LL | &mut x; | ^ | help: consider changing this closure to take self by mutable reference @@ -213,17 +213,17 @@ help: consider changing this closure to take self by mutable reference | LL | fn_ref(move || { | ____________^ -LL | | x = (1,); //~ ERROR -LL | | x.0 = 1; //~ ERROR -LL | | &mut x; //~ ERROR -LL | | &mut x.0; //~ ERROR +LL | | x = (1,); +LL | | x.0 = 1; +LL | | &mut x; +LL | | &mut x.0; LL | | }); | |_____^ error[E0596]: cannot borrow field `x.0` of immutable binding as mutable --> $DIR/mutability-errors.rs:49:14 | -LL | &mut x.0; //~ ERROR +LL | &mut x.0; | ^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow immutable argument `x` as mutable @@ -231,7 +231,7 @@ error[E0596]: cannot borrow immutable argument `x` as mutable | LL | fn imm_local(x: (i32,)) { | - help: make this binding mutable: `mut x` -LL | &mut x; //~ ERROR +LL | &mut x; | ^ cannot borrow mutably error[E0596]: cannot borrow field `x.0` of immutable binding as mutable @@ -239,8 +239,8 @@ error[E0596]: cannot borrow field `x.0` of immutable binding as mutable | LL | fn imm_local(x: (i32,)) { | - help: make this binding mutable: `mut x` -LL | &mut x; //~ ERROR -LL | &mut x.0; //~ ERROR +LL | &mut x; +LL | &mut x.0; | ^^^ cannot mutably borrow field of immutable binding error[E0595]: closure cannot assign to immutable argument `x` @@ -248,7 +248,7 @@ error[E0595]: closure cannot assign to immutable argument `x` | LL | fn imm_capture(x: (i32,)) { | - help: make this binding mutable: `mut x` -LL | || { //~ ERROR +LL | || { | ^^ cannot borrow mutably error[E0594]: cannot assign to captured outer variable in an `FnMut` closure @@ -257,49 +257,49 @@ error[E0594]: cannot assign to captured outer variable in an `FnMut` closure LL | fn imm_capture(x: (i32,)) { | - help: consider making `x` mutable: `mut x` ... -LL | x = (1,); //~ ERROR +LL | x = (1,); | ^^^^^^^^ error[E0594]: cannot assign to field `x.0` of immutable binding --> $DIR/mutability-errors.rs:67:9 | -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow captured outer variable in an `FnMut` closure as mutable --> $DIR/mutability-errors.rs:68:14 | -LL | &mut x; //~ ERROR +LL | &mut x; | ^ error[E0596]: cannot borrow field `x.0` of immutable binding as mutable --> $DIR/mutability-errors.rs:69:14 | -LL | &mut x.0; //~ ERROR +LL | &mut x.0; | ^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to immutable static item --> $DIR/mutability-errors.rs:76:5 | -LL | X = (1,); //~ ERROR +LL | X = (1,); | ^^^^^^^^ error[E0594]: cannot assign to field of immutable binding --> $DIR/mutability-errors.rs:77:5 | -LL | X.0 = 1; //~ ERROR +LL | X.0 = 1; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow immutable static item as mutable --> $DIR/mutability-errors.rs:78:10 | -LL | &mut X; //~ ERROR +LL | &mut X; | ^ error[E0596]: cannot borrow field of immutable binding as mutable --> $DIR/mutability-errors.rs:79:10 | -LL | &mut X.0; //~ ERROR +LL | &mut X.0; | ^^^ cannot mutably borrow field of immutable binding error: aborting due to 35 previous errors diff --git a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr index 66e3c4056a22..60af41237354 100644 --- a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr +++ b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing temporary value --> $DIR/promote-ref-mut-in-let-issue-46557.rs:6:5 | -LL | let ref mut x = 1234543; //~ ERROR +LL | let ref mut x = 1234543; | ------- temporary value created here LL | x | ^ returns a value referencing data owned by the current function @@ -9,7 +9,7 @@ LL | x error[E0515]: cannot return value referencing temporary value --> $DIR/promote-ref-mut-in-let-issue-46557.rs:11:5 | -LL | let (ref mut x, ) = (1234543, ); //~ ERROR +LL | let (ref mut x, ) = (1234543, ); | ----------- temporary value created here LL | x | ^ returns a value referencing data owned by the current function @@ -21,7 +21,7 @@ LL | match 1234543 { | ^ ------- temporary value created here | _____| | | -LL | | ref mut x => x //~ ERROR +LL | | ref mut x => x LL | | } | |_____^ returns a value referencing data owned by the current function @@ -32,14 +32,14 @@ LL | match (123443,) { | ^ --------- temporary value created here | _____| | | -LL | | (ref mut x,) => x, //~ ERROR +LL | | (ref mut x,) => x, LL | | } | |_____^ returns a value referencing data owned by the current function error[E0515]: cannot return reference to temporary value --> $DIR/promote-ref-mut-in-let-issue-46557.rs:27:5 | -LL | &mut 1234543 //~ ERROR +LL | &mut 1234543 | ^^^^^------- | | | | | temporary value created here diff --git a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.stderr b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.stderr index 51e47fd44d90..ae68df72aa7a 100644 --- a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.stderr +++ b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/promote-ref-mut-in-let-issue-46557.rs:5:9 | -LL | let ref mut x = 1234543; //~ ERROR +LL | let ref mut x = 1234543; | ^^^^^^^^^ temporary value does not live long enough LL | x LL | } @@ -12,7 +12,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/promote-ref-mut-in-let-issue-46557.rs:10:10 | -LL | let (ref mut x, ) = (1234543, ); //~ ERROR +LL | let (ref mut x, ) = (1234543, ); | ^^^^^^^^^ borrowed value does not live long enough LL | x LL | } @@ -23,7 +23,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/promote-ref-mut-in-let-issue-46557.rs:16:9 | -LL | ref mut x => x //~ ERROR +LL | ref mut x => x | ^^^^^^^^^ temporary value does not live long enough LL | } LL | } @@ -34,7 +34,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/promote-ref-mut-in-let-issue-46557.rs:22:10 | -LL | (ref mut x,) => x, //~ ERROR +LL | (ref mut x,) => x, | ^^^^^^^^^ borrowed value does not live long enough LL | } LL | } @@ -45,7 +45,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/promote-ref-mut-in-let-issue-46557.rs:27:10 | -LL | &mut 1234543 //~ ERROR +LL | &mut 1234543 | ^^^^^^^ temporary value does not live long enough LL | } | - temporary value only lives until here diff --git a/src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr b/src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr index bf9084259c83..d455a8f07874 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr @@ -1,13 +1,13 @@ error[E0381]: assign to part of possibly uninitialized variable: `x` --> $DIR/reassignment_immutable_fields.rs:7:5 | -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ use of possibly uninitialized `x` error[E0381]: assign to part of possibly uninitialized variable: `x` --> $DIR/reassignment_immutable_fields.rs:15:5 | -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ use of possibly uninitialized `x` error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/reassignment_immutable_fields.stderr b/src/test/ui/borrowck/reassignment_immutable_fields.stderr index c63f56702ab6..74f0217ef8a9 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to field `x.0` of immutable binding | LL | let x: (u32, u32); | - help: make this binding mutable: `mut x` -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field `x.1` of immutable binding @@ -11,20 +11,20 @@ error[E0594]: cannot assign to field `x.1` of immutable binding | LL | let x: (u32, u32); | - help: make this binding mutable: `mut x` -LL | x.0 = 1; //~ ERROR -LL | x.1 = 22; //~ ERROR +LL | x.0 = 1; +LL | x.1 = 22; | ^^^^^^^^ cannot mutably borrow field of immutable binding error[E0381]: use of possibly uninitialized variable: `x.0` --> $DIR/reassignment_immutable_fields.rs:9:10 | -LL | drop(x.0); //~ ERROR +LL | drop(x.0); | ^^^ use of possibly uninitialized `x.0` error[E0381]: use of possibly uninitialized variable: `x.1` --> $DIR/reassignment_immutable_fields.rs:10:10 | -LL | drop(x.1); //~ ERROR +LL | drop(x.1); | ^^^ use of possibly uninitialized `x.1` error[E0594]: cannot assign to field `x.0` of immutable binding @@ -32,7 +32,7 @@ error[E0594]: cannot assign to field `x.0` of immutable binding | LL | let x: (u32, u32); | - help: make this binding mutable: `mut x` -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field `x.1` of immutable binding @@ -40,14 +40,14 @@ error[E0594]: cannot assign to field `x.1` of immutable binding | LL | let x: (u32, u32); | - help: make this binding mutable: `mut x` -LL | x.0 = 1; //~ ERROR -LL | x.1 = 22; //~ ERROR +LL | x.0 = 1; +LL | x.1 = 22; | ^^^^^^^^ cannot mutably borrow field of immutable binding error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/reassignment_immutable_fields.rs:17:10 | -LL | drop(x); //~ ERROR +LL | drop(x); | ^ use of possibly uninitialized `x` error: aborting due to 7 previous errors diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr index 53b51eb894ae..5f1313f286ee 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: assign to part of possibly uninitialized variable: `x` --> $DIR/reassignment_immutable_fields_overlapping.rs:12:5 | -LL | x.a = 1; //~ ERROR +LL | x.a = 1; | ^^^^^^^ use of possibly uninitialized `x` error[E0594]: cannot assign to `x.b`, as `x` is not declared as mutable @@ -9,8 +9,8 @@ error[E0594]: cannot assign to `x.b`, as `x` is not declared as mutable | LL | let x: Foo; | - help: consider changing this to be mutable: `mut x` -LL | x.a = 1; //~ ERROR -LL | x.b = 22; //~ ERROR +LL | x.a = 1; +LL | x.b = 22; | ^^^^^^^^ cannot assign error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr index e34024736c6a..673c1572ca5f 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to field `x.a` of immutable binding | LL | let x: Foo; | - help: make this binding mutable: `mut x` -LL | x.a = 1; //~ ERROR +LL | x.a = 1; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field `x.b` of immutable binding @@ -11,8 +11,8 @@ error[E0594]: cannot assign to field `x.b` of immutable binding | LL | let x: Foo; | - help: make this binding mutable: `mut x` -LL | x.a = 1; //~ ERROR -LL | x.b = 22; //~ ERROR +LL | x.a = 1; +LL | x.b = 22; | ^^^^^^^^ cannot mutably borrow field of immutable binding error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr index 910b8292ec8f..553ee24cca23 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr @@ -4,13 +4,13 @@ error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable LL | let x: (u32, u32); | - help: consider changing this to be mutable: `mut x` LL | x = (22, 44); -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ cannot assign error[E0381]: assign to part of possibly uninitialized variable: `x` --> $DIR/reassignment_immutable_fields_twice.rs:12:5 | -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ use of possibly uninitialized `x` error: aborting due to 2 previous errors diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr index 75d7f99ed0c8..db1c74d94afb 100644 --- a/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr +++ b/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr @@ -4,7 +4,7 @@ error[E0594]: cannot assign to field `x.0` of immutable binding LL | let x: (u32, u32); | - help: make this binding mutable: `mut x` LL | x = (22, 44); -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field `x.0` of immutable binding @@ -12,7 +12,7 @@ error[E0594]: cannot assign to field `x.0` of immutable binding | LL | let x: (u32, u32); | - help: make this binding mutable: `mut x` -LL | x.0 = 1; //~ ERROR +LL | x.0 = 1; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field `x.0` of immutable binding @@ -20,8 +20,8 @@ error[E0594]: cannot assign to field `x.0` of immutable binding | LL | let x: (u32, u32); | - help: make this binding mutable: `mut x` -LL | x.0 = 1; //~ ERROR -LL | x.0 = 22; //~ ERROR +LL | x.0 = 1; +LL | x.0 = 22; | ^^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field `x.1` of immutable binding @@ -30,7 +30,7 @@ error[E0594]: cannot assign to field `x.1` of immutable binding LL | let x: (u32, u32); | - help: make this binding mutable: `mut x` ... -LL | x.1 = 44; //~ ERROR +LL | x.1 = 44; | ^^^^^^^^ cannot mutably borrow field of immutable binding error: aborting due to 4 previous errors diff --git a/src/test/ui/borrowck/two-phase-across-loop.stderr b/src/test/ui/borrowck/two-phase-across-loop.stderr index 10ff0ca604c5..933d3eb71117 100644 --- a/src/test/ui/borrowck/two-phase-across-loop.stderr +++ b/src/test/ui/borrowck/two-phase-across-loop.stderr @@ -1,7 +1,7 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time --> $DIR/two-phase-across-loop.rs:19:22 | -LL | strings.push(foo.get_string()); //~ ERROR cannot borrow `foo` as mutable +LL | strings.push(foo.get_string()); | ^^^ mutable borrow starts here in previous iteration of loop error: aborting due to previous error diff --git a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.stderr b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.stderr index ad4636a4a91c..bcd743f47c53 100644 --- a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.stderr +++ b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.stderr @@ -1,7 +1,7 @@ error: compilation successful --> $DIR/two-phase-reservation-sharing-interference-2.rs:17:1 | -LL | / fn main() { //~ ERROR compilation successful +LL | / fn main() { LL | | let mut v = vec![0, 1, 2]; LL | | let shared = &v; LL | | diff --git a/src/test/ui/bounds-lifetime.stderr b/src/test/ui/bounds-lifetime.stderr index d57cb40b2a84..21a781462674 100644 --- a/src/test/ui/bounds-lifetime.stderr +++ b/src/test/ui/bounds-lifetime.stderr @@ -1,31 +1,31 @@ error: lifetime bounds cannot be used in this context --> $DIR/bounds-lifetime.rs:1:22 | -LL | type A = for<'b, 'a: 'b> fn(); //~ ERROR lifetime bounds cannot be used in this context +LL | type A = for<'b, 'a: 'b> fn(); | ^^ error: lifetime bounds cannot be used in this context --> $DIR/bounds-lifetime.rs:2:22 | -LL | type B = for<'b, 'a: 'b,> fn(); //~ ERROR lifetime bounds cannot be used in this context +LL | type B = for<'b, 'a: 'b,> fn(); | ^^ error: lifetime bounds cannot be used in this context --> $DIR/bounds-lifetime.rs:3:22 | -LL | type C = for<'b, 'a: 'b +> fn(); //~ ERROR lifetime bounds cannot be used in this context +LL | type C = for<'b, 'a: 'b +> fn(); | ^^ error: only lifetime parameters can be used in this context --> $DIR/bounds-lifetime.rs:4:18 | -LL | type D = for<'a, T> fn(); //~ ERROR only lifetime parameters can be used in this context +LL | type D = for<'a, T> fn(); | ^ error: only lifetime parameters can be used in this context --> $DIR/bounds-lifetime.rs:5:14 | -LL | type E = for Fn(); //~ ERROR only lifetime parameters can be used in this context +LL | type E = for Fn(); | ^ error: aborting due to 5 previous errors diff --git a/src/test/ui/break-outside-loop.stderr b/src/test/ui/break-outside-loop.stderr index 5e008a064772..c1aa580f89ed 100644 --- a/src/test/ui/break-outside-loop.stderr +++ b/src/test/ui/break-outside-loop.stderr @@ -1,31 +1,31 @@ error[E0268]: `break` outside of loop --> $DIR/break-outside-loop.rs:10:15 | -LL | let pth = break; //~ ERROR: `break` outside of loop +LL | let pth = break; | ^^^^^ cannot break outside of a loop error[E0268]: `continue` outside of loop --> $DIR/break-outside-loop.rs:11:17 | -LL | if cond() { continue } //~ ERROR: `continue` outside of loop +LL | if cond() { continue } | ^^^^^^^^ cannot break outside of a loop error[E0267]: `break` inside of a closure --> $DIR/break-outside-loop.rs:17:25 | -LL | if cond() { break } //~ ERROR: `break` inside of a closure +LL | if cond() { break } | ^^^^^ cannot break inside of a closure error[E0267]: `continue` inside of a closure --> $DIR/break-outside-loop.rs:18:25 | -LL | if cond() { continue } //~ ERROR: `continue` inside of a closure +LL | if cond() { continue } | ^^^^^^^^ cannot break inside of a closure error[E0268]: `break` outside of loop --> $DIR/break-outside-loop.rs:24:25 | -LL | let unconstrained = break; //~ ERROR: `break` outside of loop +LL | let unconstrained = break; | ^^^^^ cannot break outside of a loop error: aborting due to 5 previous errors diff --git a/src/test/ui/break-while-condition.stderr b/src/test/ui/break-while-condition.stderr index 3e81753a4105..a08edee07ea0 100644 --- a/src/test/ui/break-while-condition.stderr +++ b/src/test/ui/break-while-condition.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/break-while-condition.rs:9:20 | -LL | let _: ! = { //~ ERROR mismatched types +LL | let _: ! = { | ____________________^ LL | | 'a: while break 'a {}; LL | | }; @@ -13,7 +13,7 @@ LL | | }; error[E0308]: mismatched types --> $DIR/break-while-condition.rs:16:13 | -LL | / while false { //~ ERROR mismatched types +LL | / while false { LL | | break LL | | } | |_____________^ expected !, found () @@ -24,7 +24,7 @@ LL | | } error[E0308]: mismatched types --> $DIR/break-while-condition.rs:24:13 | -LL | / while false { //~ ERROR mismatched types +LL | / while false { LL | | return LL | | } | |_____________^ expected !, found () diff --git a/src/test/ui/by-move-pattern-binding.nll.stderr b/src/test/ui/by-move-pattern-binding.nll.stderr index 4b4a989368a7..8b531474553d 100644 --- a/src/test/ui/by-move-pattern-binding.nll.stderr +++ b/src/test/ui/by-move-pattern-binding.nll.stderr @@ -4,7 +4,7 @@ error[E0507]: cannot move out of borrowed content LL | match &s.x { | ^^^^ cannot move out of borrowed content LL | &E::Foo => {} -LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move +LL | &E::Bar(identifier) => f(identifier.clone()) | ------------------- | | | | | data moved here @@ -13,7 +13,7 @@ LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move note: move occurs because `identifier` has type `std::string::String`, which does not implement the `Copy` trait --> $DIR/by-move-pattern-binding.rs:16:17 | -LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move +LL | &E::Bar(identifier) => f(identifier.clone()) | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/by-move-pattern-binding.stderr b/src/test/ui/by-move-pattern-binding.stderr index d3c5e2caa429..5135e0dadaf9 100644 --- a/src/test/ui/by-move-pattern-binding.stderr +++ b/src/test/ui/by-move-pattern-binding.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/by-move-pattern-binding.rs:16:9 | -LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move +LL | &E::Bar(identifier) => f(identifier.clone()) | ^^^^^^^^----------^ | | | | | hint: to prevent move, use `ref identifier` or `ref mut identifier` diff --git a/src/test/ui/variadic/variadic-ffi.rs b/src/test/ui/c-variadic/variadic-ffi-1.rs similarity index 100% rename from src/test/ui/variadic/variadic-ffi.rs rename to src/test/ui/c-variadic/variadic-ffi-1.rs diff --git a/src/test/ui/c-variadic/variadic-ffi-1.stderr b/src/test/ui/c-variadic/variadic-ffi-1.stderr new file mode 100644 index 000000000000..1a2bb4419b58 --- /dev/null +++ b/src/test/ui/c-variadic/variadic-ffi-1.stderr @@ -0,0 +1,9 @@ +error[E0045]: C-variadic function must have C or cdecl calling convention + --> $DIR/variadic-ffi-1.rs:5:5 + | +LL | fn printf(_: *const u8, ...); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadics require C or cdecl calling convention + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0045`. diff --git a/src/test/ui/variadic/variadic-ffi-2.rs b/src/test/ui/c-variadic/variadic-ffi-2.rs similarity index 100% rename from src/test/ui/variadic/variadic-ffi-2.rs rename to src/test/ui/c-variadic/variadic-ffi-2.rs diff --git a/src/test/ui/variadic/variadic-ffi-2.stderr b/src/test/ui/c-variadic/variadic-ffi-2.stderr similarity index 53% rename from src/test/ui/variadic/variadic-ffi-2.stderr rename to src/test/ui/c-variadic/variadic-ffi-2.stderr index cb2a9f874b7b..4c8b8d2b2e1a 100644 --- a/src/test/ui/variadic/variadic-ffi-2.stderr +++ b/src/test/ui/c-variadic/variadic-ffi-2.stderr @@ -1,8 +1,8 @@ -error[E0045]: variadic function must have C or cdecl calling convention +error[E0045]: C-variadic function must have C or cdecl calling convention --> $DIR/variadic-ffi-2.rs:3:11 | LL | fn baz(f: extern "stdcall" fn(usize, ...)) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variadics require C or cdecl calling convention + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadics require C or cdecl calling convention error: aborting due to previous error diff --git a/src/test/ui/variadic/variadic-ffi-3.rs b/src/test/ui/c-variadic/variadic-ffi-3.rs similarity index 85% rename from src/test/ui/variadic/variadic-ffi-3.rs rename to src/test/ui/c-variadic/variadic-ffi-3.rs index 12b3426d9da1..c02d1f54e564 100644 --- a/src/test/ui/variadic/variadic-ffi-3.rs +++ b/src/test/ui/c-variadic/variadic-ffi-3.rs @@ -14,12 +14,10 @@ fn main() { let x: unsafe extern "C" fn(f: isize, x: u8) = foo; //~^ ERROR: mismatched types //~| expected type `unsafe extern "C" fn(isize, u8)` - //~| found type `unsafe extern "C" fn(isize, u8, ...) {foo}` let y: extern "C" fn(f: isize, x: u8, ...) = bar; //~^ ERROR: mismatched types - //~| expected type `extern "C" fn(isize, u8, ...)` - //~| found type `extern "C" fn(isize, u8) {bar}` + //~| expected type `for<'r> extern "C" fn(isize, u8, std::ffi::VaList<'r>, ...)` foo(1, 2, 3f32); //~ ERROR can't pass `f32` to variadic function foo(1, 2, true); //~ ERROR can't pass `bool` to variadic function diff --git a/src/test/ui/variadic/variadic-ffi-3.stderr b/src/test/ui/c-variadic/variadic-ffi-3.stderr similarity index 71% rename from src/test/ui/variadic/variadic-ffi-3.stderr rename to src/test/ui/c-variadic/variadic-ffi-3.stderr index 0fecbbf36b80..6e19fc126210 100644 --- a/src/test/ui/variadic/variadic-ffi-3.stderr +++ b/src/test/ui/c-variadic/variadic-ffi-3.stderr @@ -4,7 +4,7 @@ error[E0060]: this function takes at least 2 parameters but 0 parameters were su LL | fn foo(f: isize, x: u8, ...); | ----------------------------- defined here ... -LL | foo(); //~ ERROR: this function takes at least 2 parameters but 0 parameters were supplied +LL | foo(); | ^^^^^ expected at least 2 parameters error[E0060]: this function takes at least 2 parameters but 1 parameter was supplied @@ -13,7 +13,7 @@ error[E0060]: this function takes at least 2 parameters but 1 parameter was supp LL | fn foo(f: isize, x: u8, ...); | ----------------------------- defined here ... -LL | foo(1); //~ ERROR: this function takes at least 2 parameters but 1 parameter was supplied +LL | foo(1); | ^^^^^^ expected at least 2 parameters error[E0308]: mismatched types @@ -23,51 +23,51 @@ LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo; | ^^^ expected non-variadic fn, found variadic function | = note: expected type `unsafe extern "C" fn(isize, u8)` - found type `unsafe extern "C" fn(isize, u8, ...) {foo}` + found type `for<'r> unsafe extern "C" fn(isize, u8, std::ffi::VaList<'r>, ...) {foo}` error[E0308]: mismatched types - --> $DIR/variadic-ffi-3.rs:19:54 + --> $DIR/variadic-ffi-3.rs:18:54 | LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar; | ^^^ expected variadic fn, found non-variadic function | - = note: expected type `extern "C" fn(isize, u8, ...)` + = note: expected type `for<'r> extern "C" fn(isize, u8, std::ffi::VaList<'r>, ...)` found type `extern "C" fn(isize, u8) {bar}` error[E0617]: can't pass `f32` to variadic function - --> $DIR/variadic-ffi-3.rs:24:19 + --> $DIR/variadic-ffi-3.rs:22:19 | -LL | foo(1, 2, 3f32); //~ ERROR can't pass `f32` to variadic function +LL | foo(1, 2, 3f32); | ^^^^ help: cast the value to `c_double`: `3f32 as c_double` error[E0617]: can't pass `bool` to variadic function - --> $DIR/variadic-ffi-3.rs:25:19 + --> $DIR/variadic-ffi-3.rs:23:19 | -LL | foo(1, 2, true); //~ ERROR can't pass `bool` to variadic function +LL | foo(1, 2, true); | ^^^^ help: cast the value to `c_int`: `true as c_int` error[E0617]: can't pass `i8` to variadic function - --> $DIR/variadic-ffi-3.rs:26:19 + --> $DIR/variadic-ffi-3.rs:24:19 | -LL | foo(1, 2, 1i8); //~ ERROR can't pass `i8` to variadic function +LL | foo(1, 2, 1i8); | ^^^ help: cast the value to `c_int`: `1i8 as c_int` error[E0617]: can't pass `u8` to variadic function - --> $DIR/variadic-ffi-3.rs:27:19 + --> $DIR/variadic-ffi-3.rs:25:19 | -LL | foo(1, 2, 1u8); //~ ERROR can't pass `u8` to variadic function +LL | foo(1, 2, 1u8); | ^^^ help: cast the value to `c_uint`: `1u8 as c_uint` error[E0617]: can't pass `i16` to variadic function - --> $DIR/variadic-ffi-3.rs:28:19 + --> $DIR/variadic-ffi-3.rs:26:19 | -LL | foo(1, 2, 1i16); //~ ERROR can't pass `i16` to variadic function +LL | foo(1, 2, 1i16); | ^^^^ help: cast the value to `c_int`: `1i16 as c_int` error[E0617]: can't pass `u16` to variadic function - --> $DIR/variadic-ffi-3.rs:29:19 + --> $DIR/variadic-ffi-3.rs:27:19 | -LL | foo(1, 2, 1u16); //~ ERROR can't pass `u16` to variadic function +LL | foo(1, 2, 1u16); | ^^^^ help: cast the value to `c_uint`: `1u16 as c_uint` error: aborting due to 10 previous errors diff --git a/src/test/ui/c-variadic/variadic-ffi-4.rs b/src/test/ui/c-variadic/variadic-ffi-4.rs new file mode 100644 index 000000000000..9101be564564 --- /dev/null +++ b/src/test/ui/c-variadic/variadic-ffi-4.rs @@ -0,0 +1,29 @@ +#![crate_type="lib"] +#![no_std] +#![feature(c_variadic)] + +use core::ffi::VaList; + +pub unsafe extern "C" fn no_escape0<'a>(_: usize, ap: ...) -> VaList<'a> { + ap //~ ERROR: explicit lifetime required +} + +pub unsafe extern "C" fn no_escape1(_: usize, ap: ...) -> VaList<'static> { + ap //~ ERROR: explicit lifetime required +} + +pub unsafe extern "C" fn no_escape2(_: usize, ap: ...) { + let _ = ap.copy(|ap| { ap }); //~ ERROR: cannot infer an appropriate lifetime +} + +pub unsafe extern "C" fn no_escape3(_: usize, mut ap0: &mut VaList, mut ap1: ...) { + *ap0 = ap1; //~ ERROR: mismatched types +} + +pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { + ap0 = &mut ap1; + //~^ ERROR: a value of type `core::ffi::VaList<'_>` is borrowed for too long + //~^^ ERROR: mismatched types + //~^^^ ERROR: mismatched types + //~^^^^ ERROR: cannot infer an appropriate lifetime +} diff --git a/src/test/ui/c-variadic/variadic-ffi-4.stderr b/src/test/ui/c-variadic/variadic-ffi-4.stderr new file mode 100644 index 000000000000..a3e3f81b73d8 --- /dev/null +++ b/src/test/ui/c-variadic/variadic-ffi-4.stderr @@ -0,0 +1,198 @@ +error[E0621]: explicit lifetime required in the type of `ap` + --> $DIR/variadic-ffi-4.rs:8:5 + | +LL | pub unsafe extern "C" fn no_escape0<'a>(_: usize, ap: ...) -> VaList<'a> { + | --- help: add explicit lifetime `'a` to the type of `ap`: `core::ffi::VaList<'a>` +LL | ap + | ^^ lifetime `'a` required + +error[E0621]: explicit lifetime required in the type of `ap` + --> $DIR/variadic-ffi-4.rs:12:5 + | +LL | pub unsafe extern "C" fn no_escape1(_: usize, ap: ...) -> VaList<'static> { + | --- help: add explicit lifetime `'static` to the type of `ap`: `core::ffi::VaList<'static>` +LL | ap + | ^^ lifetime `'static` required + +error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements + --> $DIR/variadic-ffi-4.rs:16:28 + | +LL | let _ = ap.copy(|ap| { ap }); + | ^^ + | +note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 16:21... + --> $DIR/variadic-ffi-4.rs:16:21 + | +LL | let _ = ap.copy(|ap| { ap }); + | ^^^^^^^^^^^ + = note: ...so that the expression is assignable: + expected core::ffi::VaList<'_> + found core::ffi::VaList<'_> +note: but, the lifetime must be valid for the method call at 16:13... + --> $DIR/variadic-ffi-4.rs:16:13 + | +LL | let _ = ap.copy(|ap| { ap }); + | ^^^^^^^^^^^^^^^^^^^^ +note: ...so type `core::ffi::VaList<'_>` of expression is valid during the expression + --> $DIR/variadic-ffi-4.rs:16:13 + | +LL | let _ = ap.copy(|ap| { ap }); + | ^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: mismatched types + --> $DIR/variadic-ffi-4.rs:20:12 + | +LL | *ap0 = ap1; + | ^^^ lifetime mismatch + | + = note: expected type `core::ffi::VaList<'_>` + found type `core::ffi::VaList<'_>` +note: the anonymous lifetime #3 defined on the function body at 19:1... + --> $DIR/variadic-ffi-4.rs:19:1 + | +LL | / pub unsafe extern "C" fn no_escape3(_: usize, mut ap0: &mut VaList, mut ap1: ...) { +LL | | *ap0 = ap1; +LL | | } + | |_^ +note: ...does not necessarily outlive the anonymous lifetime #2 defined on the function body at 19:1 + --> $DIR/variadic-ffi-4.rs:19:1 + | +LL | / pub unsafe extern "C" fn no_escape3(_: usize, mut ap0: &mut VaList, mut ap1: ...) { +LL | | *ap0 = ap1; +LL | | } + | |_^ + +error[E0490]: a value of type `core::ffi::VaList<'_>` is borrowed for too long + --> $DIR/variadic-ffi-4.rs:24:11 + | +LL | ap0 = &mut ap1; + | ^^^^^^^^ + | +note: the type is valid for the anonymous lifetime #1 defined on the function body at 23:1 + --> $DIR/variadic-ffi-4.rs:23:1 + | +LL | / pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { +LL | | ap0 = &mut ap1; +LL | | +LL | | +LL | | +LL | | +LL | | } + | |_^ +note: but the borrow lasts for the anonymous lifetime #3 defined on the function body at 23:1 + --> $DIR/variadic-ffi-4.rs:23:1 + | +LL | / pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { +LL | | ap0 = &mut ap1; +LL | | +LL | | +LL | | +LL | | +LL | | } + | |_^ + +error[E0308]: mismatched types + --> $DIR/variadic-ffi-4.rs:24:11 + | +LL | ap0 = &mut ap1; + | ^^^^^^^^ lifetime mismatch + | + = note: expected type `&mut core::ffi::VaList<'_>` + found type `&mut core::ffi::VaList<'_>` +note: the anonymous lifetime #3 defined on the function body at 23:1... + --> $DIR/variadic-ffi-4.rs:23:1 + | +LL | / pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { +LL | | ap0 = &mut ap1; +LL | | +LL | | +LL | | +LL | | +LL | | } + | |_^ +note: ...does not necessarily outlive the anonymous lifetime #2 defined on the function body at 23:1 + --> $DIR/variadic-ffi-4.rs:23:1 + | +LL | / pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { +LL | | ap0 = &mut ap1; +LL | | +LL | | +LL | | +LL | | +LL | | } + | |_^ + +error[E0308]: mismatched types + --> $DIR/variadic-ffi-4.rs:24:11 + | +LL | ap0 = &mut ap1; + | ^^^^^^^^ lifetime mismatch + | + = note: expected type `&mut core::ffi::VaList<'_>` + found type `&mut core::ffi::VaList<'_>` +note: the anonymous lifetime #2 defined on the function body at 23:1... + --> $DIR/variadic-ffi-4.rs:23:1 + | +LL | / pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { +LL | | ap0 = &mut ap1; +LL | | +LL | | +LL | | +LL | | +LL | | } + | |_^ +note: ...does not necessarily outlive the anonymous lifetime #3 defined on the function body at 23:1 + --> $DIR/variadic-ffi-4.rs:23:1 + | +LL | / pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { +LL | | ap0 = &mut ap1; +LL | | +LL | | +LL | | +LL | | +LL | | } + | |_^ + +error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements + --> $DIR/variadic-ffi-4.rs:24:11 + | +LL | ap0 = &mut ap1; + | ^^^^^^^^ + | +note: first, the lifetime cannot outlive the anonymous lifetime #3 defined on the function body at 23:1... + --> $DIR/variadic-ffi-4.rs:23:1 + | +LL | / pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { +LL | | ap0 = &mut ap1; +LL | | +LL | | +LL | | +LL | | +LL | | } + | |_^ +note: ...so that the type `core::ffi::VaList<'_>` is not borrowed for too long + --> $DIR/variadic-ffi-4.rs:24:11 + | +LL | ap0 = &mut ap1; + | ^^^^^^^^ +note: but, the lifetime must be valid for the anonymous lifetime #1 defined on the function body at 23:1... + --> $DIR/variadic-ffi-4.rs:23:1 + | +LL | / pub unsafe extern "C" fn no_escape4(_: usize, ap0: &mut VaList, mut ap1: ...) { +LL | | ap0 = &mut ap1; +LL | | +LL | | +LL | | +LL | | +LL | | } + | |_^ +note: ...so that reference does not outlive borrowed content + --> $DIR/variadic-ffi-4.rs:24:11 + | +LL | ap0 = &mut ap1; + | ^^^^^^^^ + +error: aborting due to 8 previous errors + +Some errors occurred: E0308, E0490, E0495, E0621. +For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/c-variadic/variadic-ffi-5.rs b/src/test/ui/c-variadic/variadic-ffi-5.rs new file mode 100644 index 000000000000..d96482ff4d17 --- /dev/null +++ b/src/test/ui/c-variadic/variadic-ffi-5.rs @@ -0,0 +1,31 @@ +#![crate_type="lib"] +#![no_std] +#![feature(c_variadic)] +// The tests in this file are similar to that of variadic-ffi-4, but this +// one enables nll. +#![feature(nll)] + +use core::ffi::VaList; + +pub unsafe extern "C" fn no_escape0<'a>(_: usize, ap: ...) -> VaList<'a> { + ap //~ ERROR: explicit lifetime required +} + +pub unsafe extern "C" fn no_escape1(_: usize, ap: ...) -> VaList<'static> { + ap //~ ERROR: explicit lifetime required +} + +pub unsafe extern "C" fn no_escape2(_: usize, ap: ...) { + let _ = ap.copy(|ap| { ap }); //~ ERROR: lifetime may not live long enough +} + +pub unsafe extern "C" fn no_escape3(_: usize, ap0: &mut VaList, mut ap1: ...) { + *ap0 = ap1; //~ ERROR: lifetime may not live long enough +} + +pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaList, mut ap1: ...) { + ap0 = &mut ap1; + //~^ ERROR: lifetime may not live long enough + //~^^ ERROR: lifetime may not live long enough + //~^^^ ERROR: `ap1` does not live long enough +} diff --git a/src/test/ui/c-variadic/variadic-ffi-5.stderr b/src/test/ui/c-variadic/variadic-ffi-5.stderr new file mode 100644 index 000000000000..2ad1964b6fc7 --- /dev/null +++ b/src/test/ui/c-variadic/variadic-ffi-5.stderr @@ -0,0 +1,73 @@ +error[E0621]: explicit lifetime required in the type of `ap` + --> $DIR/variadic-ffi-5.rs:11:5 + | +LL | pub unsafe extern "C" fn no_escape0<'a>(_: usize, ap: ...) -> VaList<'a> { + | --- help: add explicit lifetime `'a` to the type of `ap`: `core::ffi::VaList<'a>` +LL | ap + | ^^ lifetime `'a` required + +error[E0621]: explicit lifetime required in the type of `ap` + --> $DIR/variadic-ffi-5.rs:15:5 + | +LL | pub unsafe extern "C" fn no_escape1(_: usize, ap: ...) -> VaList<'static> { + | --- help: add explicit lifetime `'static` to the type of `ap`: `core::ffi::VaList<'static>` +LL | ap + | ^^ lifetime `'static` required + +error: lifetime may not live long enough + --> $DIR/variadic-ffi-5.rs:19:28 + | +LL | let _ = ap.copy(|ap| { ap }); + | --- ^^ returning this value requires that `'1` must outlive `'2` + | | | + | | return type of closure is core::ffi::VaList<'2> + | has type `core::ffi::VaList<'1>` + +error: lifetime may not live long enough + --> $DIR/variadic-ffi-5.rs:23:5 + | +LL | pub unsafe extern "C" fn no_escape3(_: usize, ap0: &mut VaList, mut ap1: ...) { + | --- ------- has type `core::ffi::VaList<'1>` + | | + | has type `&mut core::ffi::VaList<'2>` +LL | *ap0 = ap1; + | ^^^^^^^^^^ assignment requires that `'1` must outlive `'2` + +error: lifetime may not live long enough + --> $DIR/variadic-ffi-5.rs:27:5 + | +LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaList, mut ap1: ...) { + | ------- ------- has type `core::ffi::VaList<'2>` + | | + | has type `&mut core::ffi::VaList<'1>` +LL | ap0 = &mut ap1; + | ^^^^^^^^^^^^^^ assignment requires that `'1` must outlive `'2` + +error: lifetime may not live long enough + --> $DIR/variadic-ffi-5.rs:27:5 + | +LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaList, mut ap1: ...) { + | ------- ------- has type `core::ffi::VaList<'1>` + | | + | has type `&mut core::ffi::VaList<'2>` +LL | ap0 = &mut ap1; + | ^^^^^^^^^^^^^^ assignment requires that `'1` must outlive `'2` + +error[E0597]: `ap1` does not live long enough + --> $DIR/variadic-ffi-5.rs:27:11 + | +LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaList, mut ap1: ...) { + | - let's call the lifetime of this reference `'1` +LL | ap0 = &mut ap1; + | ------^^^^^^^^ + | | | + | | borrowed value does not live long enough + | assignment requires that `ap1` is borrowed for `'1` +... +LL | } + | - `ap1` dropped here while still borrowed + +error: aborting due to 7 previous errors + +Some errors occurred: E0597, E0621. +For more information about an error, try `rustc --explain E0597`. diff --git a/src/test/ui/c-variadic/variadic-ffi-6.rs b/src/test/ui/c-variadic/variadic-ffi-6.rs new file mode 100644 index 000000000000..4dd8a2d45218 --- /dev/null +++ b/src/test/ui/c-variadic/variadic-ffi-6.rs @@ -0,0 +1,13 @@ +#![crate_type="lib"] +#![feature(c_variadic)] + +pub unsafe extern "C" fn use_vararg_lifetime( + x: usize, + y: ... +) -> &usize { //~ ERROR missing lifetime specifier + &0 +} + +pub unsafe extern "C" fn use_normal_arg_lifetime(x: &usize, y: ...) -> &usize { // OK + x +} diff --git a/src/test/ui/c-variadic/variadic-ffi-6.stderr b/src/test/ui/c-variadic/variadic-ffi-6.stderr new file mode 100644 index 000000000000..882e7f89f2a0 --- /dev/null +++ b/src/test/ui/c-variadic/variadic-ffi-6.stderr @@ -0,0 +1,11 @@ +error[E0106]: missing lifetime specifier + --> $DIR/variadic-ffi-6.rs:7:6 + | +LL | ) -> &usize { + | ^ help: consider giving it an explicit bounded or 'static lifetime: `&'static` + | + = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/call-fn-never-arg-wrong-type.stderr b/src/test/ui/call-fn-never-arg-wrong-type.stderr index 602963ee89cd..7a50fd367d2d 100644 --- a/src/test/ui/call-fn-never-arg-wrong-type.stderr +++ b/src/test/ui/call-fn-never-arg-wrong-type.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/call-fn-never-arg-wrong-type.rs:10:9 | -LL | foo("wow"); //~ ERROR mismatched types +LL | foo("wow"); | ^^^^^ expected !, found reference | = note: expected type `!` diff --git a/src/test/ui/can-begin-expr-check.stderr b/src/test/ui/can-begin-expr-check.stderr index f25b348816b6..676c2cb661e7 100644 --- a/src/test/ui/can-begin-expr-check.stderr +++ b/src/test/ui/can-begin-expr-check.stderr @@ -1,7 +1,7 @@ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `enum` --> $DIR/can-begin-expr-check.rs:19:12 | -LL | return enum; //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `enum` +LL | return enum; | ^^^^ expected one of `.`, `;`, `?`, `}`, or an operator here error: aborting due to previous error diff --git a/src/test/ui/cast/cast-as-bool.stderr b/src/test/ui/cast/cast-as-bool.stderr index 6099a4195b32..30f8459c2e1e 100644 --- a/src/test/ui/cast/cast-as-bool.stderr +++ b/src/test/ui/cast/cast-as-bool.stderr @@ -1,19 +1,19 @@ error[E0054]: cannot cast as `bool` --> $DIR/cast-as-bool.rs:2:13 | -LL | let u = 5 as bool; //~ ERROR cannot cast as `bool` +LL | let u = 5 as bool; | ^^^^^^^^^ help: compare with zero instead: `5 != 0` error[E0054]: cannot cast as `bool` --> $DIR/cast-as-bool.rs:5:13 | -LL | let t = (1 + 2) as bool; //~ ERROR cannot cast as `bool` +LL | let t = (1 + 2) as bool; | ^^^^^^^^^^^^^^^ help: compare with zero instead: `(1 + 2) != 0` error[E0054]: cannot cast as `bool` --> $DIR/cast-as-bool.rs:8:13 | -LL | let v = "hello" as bool; //~ ERROR cannot cast as `bool` +LL | let v = "hello" as bool; | ^^^^^^^^^^^^^^^ unsupported cast error: aborting due to 3 previous errors diff --git a/src/test/ui/cast/cast-errors-issue-43825.stderr b/src/test/ui/cast/cast-errors-issue-43825.stderr index cfd1ca25a96a..1e77f5dbdc64 100644 --- a/src/test/ui/cast/cast-errors-issue-43825.stderr +++ b/src/test/ui/cast/cast-errors-issue-43825.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `error` in this scope --> $DIR/cast-errors-issue-43825.rs:2:17 | -LL | let error = error; //~ ERROR cannot find value `error` +LL | let error = error; | ^^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/cast/cast-ptr-to-int-const.stderr b/src/test/ui/cast/cast-ptr-to-int-const.stderr index d04595ee4e88..0d4397c2e2d7 100644 --- a/src/test/ui/cast/cast-ptr-to-int-const.stderr +++ b/src/test/ui/cast/cast-ptr-to-int-const.stderr @@ -1,7 +1,7 @@ error[E0658]: casting pointers to integers in constants is unstable (see issue #51910) --> $DIR/cast-ptr-to-int-const.rs:5:9 | -LL | main as u32 //~ ERROR casting pointers to integers in constants is unstable +LL | main as u32 | ^^^^^^^^^^^ | = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | main as u32 //~ ERROR casting pointers to integers in constants is error[E0658]: casting pointers to integers in constants is unstable (see issue #51910) --> $DIR/cast-ptr-to-int-const.rs:9:9 | -LL | &Y as *const u32 as u32 //~ ERROR is unstable +LL | &Y as *const u32 as u32 | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable diff --git a/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.stderr b/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.stderr index 37c6ba1b909c..bd7a0e1834aa 100644 --- a/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.stderr +++ b/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.stderr @@ -1,7 +1,7 @@ error[E0620]: cast to unsized type: `&{integer}` as `dyn std::marker::Send` --> $DIR/cast-to-unsized-trait-object-suggestion.rs:2:5 | -LL | &1 as Send; //~ ERROR cast to unsized +LL | &1 as Send; | ^^^^^^---- | | | help: try casting to a reference instead: `&Send` @@ -9,7 +9,7 @@ LL | &1 as Send; //~ ERROR cast to unsized error[E0620]: cast to unsized type: `std::boxed::Box<{integer}>` as `dyn std::marker::Send` --> $DIR/cast-to-unsized-trait-object-suggestion.rs:3:5 | -LL | Box::new(1) as Send; //~ ERROR cast to unsized +LL | Box::new(1) as Send; | ^^^^^^^^^^^^^^^---- | | | help: try casting to a `Box` instead: `Box` diff --git a/src/test/ui/casts-differing-anon.stderr b/src/test/ui/casts-differing-anon.stderr index 8e09a7cd83b5..fbbb8e3bb332 100644 --- a/src/test/ui/casts-differing-anon.stderr +++ b/src/test/ui/casts-differing-anon.stderr @@ -1,7 +1,7 @@ error[E0606]: casting `*mut impl std::fmt::Debug+?Sized` as `*mut impl std::fmt::Debug+?Sized` is invalid --> $DIR/casts-differing-anon.rs:21:13 | -LL | b_raw = f_raw as *mut _; //~ ERROR is invalid +LL | b_raw = f_raw as *mut _; | ^^^^^^^^^^^^^^^ | = note: vtable kinds may not match diff --git a/src/test/ui/casts-issue-46365.stderr b/src/test/ui/casts-issue-46365.stderr index 91edfaf410ea..84175473696d 100644 --- a/src/test/ui/casts-issue-46365.stderr +++ b/src/test/ui/casts-issue-46365.stderr @@ -1,7 +1,7 @@ error[E0412]: cannot find type `Ipsum` in this scope --> $DIR/casts-issue-46365.rs:2:12 | -LL | ipsum: Ipsum //~ ERROR cannot find type `Ipsum` +LL | ipsum: Ipsum | ^^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/chalkify/lower_env1.stderr b/src/test/ui/chalkify/lower_env1.stderr index f4d16a09a367..bc426e0707b7 100644 --- a/src/test/ui/chalkify/lower_env1.stderr +++ b/src/test/ui/chalkify/lower_env1.stderr @@ -1,7 +1,7 @@ error: program clause dump --> $DIR/lower_env1.rs:6:1 | -LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall { FromEnv(Self: Foo) :- FromEnv(Self: Bar). } @@ -11,7 +11,7 @@ LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump error: program clause dump --> $DIR/lower_env1.rs:9:1 | -LL | #[rustc_dump_env_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_env_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall { FromEnv(Self: Foo) :- FromEnv(Self: Bar). } diff --git a/src/test/ui/chalkify/lower_env2.stderr b/src/test/ui/chalkify/lower_env2.stderr index f05b91c674d9..2a71fa9df5e8 100644 --- a/src/test/ui/chalkify/lower_env2.stderr +++ b/src/test/ui/chalkify/lower_env2.stderr @@ -1,7 +1,7 @@ error: program clause dump --> $DIR/lower_env2.rs:6:1 | -LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall<'a, T> { FromEnv(T: Foo) :- FromEnv(S<'a, T>). } @@ -11,7 +11,7 @@ LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump error: program clause dump --> $DIR/lower_env2.rs:11:1 | -LL | #[rustc_dump_env_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_env_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall<'a, T> { FromEnv(T: Foo) :- FromEnv(S<'a, T>). } diff --git a/src/test/ui/chalkify/lower_env3.stderr b/src/test/ui/chalkify/lower_env3.stderr index e602a8fcdaf8..46e083686895 100644 --- a/src/test/ui/chalkify/lower_env3.stderr +++ b/src/test/ui/chalkify/lower_env3.stderr @@ -1,7 +1,7 @@ error: program clause dump --> $DIR/lower_env3.rs:5:5 | -LL | #[rustc_dump_env_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_env_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall<'^0, ^1> { TypeOutlives(^1: '^0) :- FromEnv(&^1). } @@ -10,7 +10,7 @@ LL | #[rustc_dump_env_program_clauses] //~ ERROR program clause dump error: program clause dump --> $DIR/lower_env3.rs:10:5 | -LL | #[rustc_dump_env_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_env_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall<'^0, ^1> { TypeOutlives(^1: '^0) :- FromEnv(&^1). } diff --git a/src/test/ui/chalkify/lower_impl.stderr b/src/test/ui/chalkify/lower_impl.stderr index 48af37edec49..d6827fbff3dd 100644 --- a/src/test/ui/chalkify/lower_impl.stderr +++ b/src/test/ui/chalkify/lower_impl.stderr @@ -1,7 +1,7 @@ error: program clause dump --> $DIR/lower_impl.rs:5:1 | -LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall { Implemented(T: Foo) :- ProjectionEq(::Item == i32), TypeOutlives(T: 'static), Implemented(T: std::iter::Iterator), Implemented(T: std::marker::Sized). } @@ -9,7 +9,7 @@ LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump error: program clause dump --> $DIR/lower_impl.rs:13:5 | -LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall { Normalize(::Assoc -> std::vec::Vec) :- Implemented(T: Bar). } diff --git a/src/test/ui/chalkify/lower_struct.stderr b/src/test/ui/chalkify/lower_struct.stderr index e75e71450fbc..91525c3ba55d 100644 --- a/src/test/ui/chalkify/lower_struct.stderr +++ b/src/test/ui/chalkify/lower_struct.stderr @@ -1,7 +1,7 @@ error: program clause dump --> $DIR/lower_struct.rs:3:1 | -LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall<'a, T> { FromEnv(T: std::marker::Sized) :- FromEnv(Foo<'a, T>). } diff --git a/src/test/ui/chalkify/lower_trait.stderr b/src/test/ui/chalkify/lower_trait.stderr index 4546d2ede823..423c55730830 100644 --- a/src/test/ui/chalkify/lower_trait.stderr +++ b/src/test/ui/chalkify/lower_trait.stderr @@ -1,7 +1,7 @@ error: program clause dump --> $DIR/lower_trait.rs:5:1 | -LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall { FromEnv(>::Assoc: Bar) :- FromEnv(Self: Foo). } @@ -12,7 +12,7 @@ LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump error: program clause dump --> $DIR/lower_trait.rs:7:5 | -LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall { ProjectionEq(>::Assoc == ^3) :- Normalize(>::Assoc -> ^3). } diff --git a/src/test/ui/chalkify/lower_trait_higher_rank.stderr b/src/test/ui/chalkify/lower_trait_higher_rank.stderr index d7e18596a7d2..79bbc9fa6b3a 100644 --- a/src/test/ui/chalkify/lower_trait_higher_rank.stderr +++ b/src/test/ui/chalkify/lower_trait_higher_rank.stderr @@ -1,7 +1,7 @@ error: program clause dump --> $DIR/lower_trait_higher_rank.rs:3:1 | -LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall<'a, Self, F> { FromEnv(F: std::ops::Fn<(&'a (u8, u16),)>) :- FromEnv(Self: Foo). } diff --git a/src/test/ui/chalkify/lower_trait_where_clause.stderr b/src/test/ui/chalkify/lower_trait_where_clause.stderr index 5400224bdf42..408f3712a707 100644 --- a/src/test/ui/chalkify/lower_trait_where_clause.stderr +++ b/src/test/ui/chalkify/lower_trait_where_clause.stderr @@ -1,7 +1,7 @@ error: program clause dump --> $DIR/lower_trait_where_clause.rs:5:1 | -LL | #[rustc_dump_program_clauses] //~ ERROR program clause dump +LL | #[rustc_dump_program_clauses] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: forall<'a, 'b, Self, T, U> { FromEnv(T: std::borrow::Borrow) :- FromEnv(Self: Foo<'a, 'b, T, U>). } diff --git a/src/test/ui/chalkify/type_inference.stderr b/src/test/ui/chalkify/type_inference.stderr index d65b701307b4..d1d56d3d4a23 100644 --- a/src/test/ui/chalkify/type_inference.stderr +++ b/src/test/ui/chalkify/type_inference.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/type_inference.rs:21:14 | -LL | only_foo(x); //~ ERROR mismatched types +LL | only_foo(x); | ^ expected i32, found floating-point number | = note: expected type `i32` @@ -10,7 +10,7 @@ LL | only_foo(x); //~ ERROR mismatched types error[E0277]: the trait bound `{float}: Bar` is not satisfied --> $DIR/type_inference.rs:25:5 | -LL | only_bar(x); //~ ERROR the trait bound `{float}: Bar` is not satisfied +LL | only_bar(x); | ^^^^^^^^ the trait `Bar` is not implemented for `{float}` | = help: the following implementations were found: diff --git a/src/test/ui/changing-crates.stderr b/src/test/ui/changing-crates.stderr index a8b986d67f87..633930904983 100644 --- a/src/test/ui/changing-crates.stderr +++ b/src/test/ui/changing-crates.stderr @@ -1,7 +1,7 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on --> $DIR/changing-crates.rs:10:1 | -LL | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on +LL | extern crate b; | ^^^^^^^^^^^^^^^ | = note: perhaps that crate needs to be recompiled? diff --git a/src/test/ui/check-static-values-constraints.nll.stderr b/src/test/ui/check-static-values-constraints.nll.stderr index f1a231249081..fe014fa10596 100644 --- a/src/test/ui/check-static-values-constraints.nll.stderr +++ b/src/test/ui/check-static-values-constraints.nll.stderr @@ -3,7 +3,7 @@ error[E0493]: destructors cannot be evaluated at compile-time | LL | ..SafeStruct{field1: SafeEnum::Variant3(WithDtor), | ___________________________________________^ -LL | | //~^ ERROR destructors cannot be evaluated at compile-time +LL | | LL | | field2: SafeEnum::Variant1}}; | |________________________________________________________________________________^ statics cannot evaluate destructors @@ -28,49 +28,49 @@ LL | field2: SafeEnum::Variant4("str".to_string()) error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:95:5 | -LL | box MyOwned, //~ ERROR allocations are not allowed in statics +LL | box MyOwned, | ^^^^^^^^^^^ allocation not allowed in statics error[E0019]: static contains unimplemented expression type --> $DIR/check-static-values-constraints.rs:95:9 | -LL | box MyOwned, //~ ERROR allocations are not allowed in statics +LL | box MyOwned, | ^^^^^^^ error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:97:5 | -LL | box MyOwned, //~ ERROR allocations are not allowed in statics +LL | box MyOwned, | ^^^^^^^^^^^ allocation not allowed in statics error[E0019]: static contains unimplemented expression type --> $DIR/check-static-values-constraints.rs:97:9 | -LL | box MyOwned, //~ ERROR allocations are not allowed in statics +LL | box MyOwned, | ^^^^^^^ error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:102:6 | -LL | &box MyOwned, //~ ERROR allocations are not allowed in statics +LL | &box MyOwned, | ^^^^^^^^^^^ allocation not allowed in statics error[E0019]: static contains unimplemented expression type --> $DIR/check-static-values-constraints.rs:102:10 | -LL | &box MyOwned, //~ ERROR allocations are not allowed in statics +LL | &box MyOwned, | ^^^^^^^ error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:104:6 | -LL | &box MyOwned, //~ ERROR allocations are not allowed in statics +LL | &box MyOwned, | ^^^^^^^^^^^ allocation not allowed in statics error[E0019]: static contains unimplemented expression type --> $DIR/check-static-values-constraints.rs:104:10 | -LL | &box MyOwned, //~ ERROR allocations are not allowed in statics +LL | &box MyOwned, | ^^^^^^^ error[E0010]: allocations are not allowed in statics diff --git a/src/test/ui/check-static-values-constraints.stderr b/src/test/ui/check-static-values-constraints.stderr index 5b1f265c34ae..91fe0feb1bcd 100644 --- a/src/test/ui/check-static-values-constraints.stderr +++ b/src/test/ui/check-static-values-constraints.stderr @@ -3,7 +3,7 @@ error[E0493]: destructors cannot be evaluated at compile-time | LL | ..SafeStruct{field1: SafeEnum::Variant3(WithDtor), | ___________________________________________^ -LL | | //~^ ERROR destructors cannot be evaluated at compile-time +LL | | LL | | field2: SafeEnum::Variant1}}; | |________________________________________________________________________________^ statics cannot evaluate destructors @@ -28,49 +28,49 @@ LL | field2: SafeEnum::Variant4("str".to_string()) error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:95:5 | -LL | box MyOwned, //~ ERROR allocations are not allowed in statics +LL | box MyOwned, | ^^^^^^^^^^^ allocation not allowed in statics error[E0019]: static contains unimplemented expression type --> $DIR/check-static-values-constraints.rs:95:9 | -LL | box MyOwned, //~ ERROR allocations are not allowed in statics +LL | box MyOwned, | ^^^^^^^ error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:97:5 | -LL | box MyOwned, //~ ERROR allocations are not allowed in statics +LL | box MyOwned, | ^^^^^^^^^^^ allocation not allowed in statics error[E0019]: static contains unimplemented expression type --> $DIR/check-static-values-constraints.rs:97:9 | -LL | box MyOwned, //~ ERROR allocations are not allowed in statics +LL | box MyOwned, | ^^^^^^^ error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:102:6 | -LL | &box MyOwned, //~ ERROR allocations are not allowed in statics +LL | &box MyOwned, | ^^^^^^^^^^^ allocation not allowed in statics error[E0019]: static contains unimplemented expression type --> $DIR/check-static-values-constraints.rs:102:10 | -LL | &box MyOwned, //~ ERROR allocations are not allowed in statics +LL | &box MyOwned, | ^^^^^^^ error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:104:6 | -LL | &box MyOwned, //~ ERROR allocations are not allowed in statics +LL | &box MyOwned, | ^^^^^^^^^^^ allocation not allowed in statics error[E0019]: static contains unimplemented expression type --> $DIR/check-static-values-constraints.rs:104:10 | -LL | &box MyOwned, //~ ERROR allocations are not allowed in statics +LL | &box MyOwned, | ^^^^^^^ error[E0010]: allocations are not allowed in statics diff --git a/src/test/ui/check_match/issue-35609.stderr b/src/test/ui/check_match/issue-35609.stderr index 7a517e856cbe..af22535c55e5 100644 --- a/src/test/ui/check_match/issue-35609.stderr +++ b/src/test/ui/check_match/issue-35609.stderr @@ -1,50 +1,72 @@ error[E0004]: non-exhaustive patterns: `(B, _)`, `(C, _)`, `(D, _)` and 2 more not covered --> $DIR/issue-35609.rs:10:11 | -LL | match (A, ()) { //~ ERROR non-exhaustive +LL | match (A, ()) { | ^^^^^^^ patterns `(B, _)`, `(C, _)`, `(D, _)` and 2 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `(_, B)`, `(_, C)`, `(_, D)` and 2 more not covered --> $DIR/issue-35609.rs:14:11 | -LL | match (A, A) { //~ ERROR non-exhaustive +LL | match (A, A) { | ^^^^^^ patterns `(_, B)`, `(_, C)`, `(_, D)` and 2 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered --> $DIR/issue-35609.rs:18:11 | -LL | match ((A, ()), ()) { //~ ERROR non-exhaustive +LL | match ((A, ()), ()) { | ^^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered --> $DIR/issue-35609.rs:22:11 | -LL | match ((A, ()), A) { //~ ERROR non-exhaustive +LL | match ((A, ()), A) { | ^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered --> $DIR/issue-35609.rs:26:11 | -LL | match ((A, ()), ()) { //~ ERROR non-exhaustive +LL | match ((A, ()), ()) { | ^^^^^^^^^^^^^ patterns `((B, _), _)`, `((C, _), _)`, `((D, _), _)` and 2 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 more not covered --> $DIR/issue-35609.rs:31:11 | -LL | match S(A, ()) { //~ ERROR non-exhaustive +LL | struct S(Enum, ()); + | ------------------- `S` defined here +... +LL | match S(A, ()) { | ^^^^^^^^ patterns `S(B, _)`, `S(C, _)`, `S(D, _)` and 2 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `Sd { x: B, .. }`, `Sd { x: C, .. }`, `Sd { x: D, .. }` and 2 more not covered --> $DIR/issue-35609.rs:35:11 | -LL | match (Sd { x: A, y: () }) { //~ ERROR non-exhaustive +LL | struct Sd { x: Enum, y: () } + | ---------------------------- `Sd` defined here +... +LL | match (Sd { x: A, y: () }) { | ^^^^^^^^^^^^^^^^^^^^ patterns `Sd { x: B, .. }`, `Sd { x: C, .. }`, `Sd { x: D, .. }` and 2 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `Some(B)`, `Some(C)`, `Some(D)` and 2 more not covered --> $DIR/issue-35609.rs:39:11 | -LL | match Some(A) { //~ ERROR non-exhaustive +LL | match Some(A) { | ^^^^^^^ patterns `Some(B)`, `Some(C)`, `Some(D)` and 2 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to 8 previous errors diff --git a/src/test/ui/class-cast-to-trait.stderr b/src/test/ui/class-cast-to-trait.stderr index f5bd7a13aa48..39f308cdfd49 100644 --- a/src/test/ui/class-cast-to-trait.stderr +++ b/src/test/ui/class-cast-to-trait.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `eat` found for type `std::boxed::Box` in the current scope --> $DIR/class-cast-to-trait.rs:53:8 | -LL | nyan.eat(); //~ ERROR no method named `eat` found +LL | nyan.eat(); | ^^^ error: aborting due to previous error diff --git a/src/test/ui/class-missing-self.stderr b/src/test/ui/class-missing-self.stderr index 484778f83ec5..ec11f1253990 100644 --- a/src/test/ui/class-missing-self.stderr +++ b/src/test/ui/class-missing-self.stderr @@ -1,13 +1,13 @@ error[E0425]: cannot find value `meows` in this scope --> $DIR/class-missing-self.rs:9:7 | -LL | meows += 1; //~ ERROR cannot find value `meows` in this scope +LL | meows += 1; | ^^^^^ help: try: `self.meows` error[E0425]: cannot find function `sleep` in this scope --> $DIR/class-missing-self.rs:10:7 | -LL | sleep(); //~ ERROR cannot find function `sleep` in this scope +LL | sleep(); | ^^^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | diff --git a/src/test/ui/cleanup-rvalue-scopes-cf.stderr b/src/test/ui/cleanup-rvalue-scopes-cf.stderr index 561403d1b42d..e35e71ce6e23 100644 --- a/src/test/ui/cleanup-rvalue-scopes-cf.stderr +++ b/src/test/ui/cleanup-rvalue-scopes-cf.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/cleanup-rvalue-scopes-cf.rs:28:19 | -LL | let _x = arg(&AddFlags(1)); //~ ERROR value does not live long enough +LL | let _x = arg(&AddFlags(1)); | ^^^^^^^^^^^ - temporary value dropped here while still borrowed | | | temporary value does not live long enough @@ -14,7 +14,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/cleanup-rvalue-scopes-cf.rs:29:14 | -LL | let _x = AddFlags(1).get(); //~ ERROR value does not live long enough +LL | let _x = AddFlags(1).get(); | ^^^^^^^^^^^ - temporary value dropped here while still borrowed | | | temporary value does not live long enough @@ -27,7 +27,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/cleanup-rvalue-scopes-cf.rs:30:21 | -LL | let _x = &*arg(&AddFlags(1)); //~ ERROR value does not live long enough +LL | let _x = &*arg(&AddFlags(1)); | ^^^^^^^^^^^ - temporary value dropped here while still borrowed | | | temporary value does not live long enough @@ -40,7 +40,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/cleanup-rvalue-scopes-cf.rs:31:24 | -LL | let ref _x = *arg(&AddFlags(1)); //~ ERROR value does not live long enough +LL | let ref _x = *arg(&AddFlags(1)); | ^^^^^^^^^^^ - temporary value dropped here while still borrowed | | | temporary value does not live long enough @@ -53,7 +53,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/cleanup-rvalue-scopes-cf.rs:32:24 | -LL | let &ref _x = arg(&AddFlags(1)); //~ ERROR value does not live long enough +LL | let &ref _x = arg(&AddFlags(1)); | ^^^^^^^^^^^ - temporary value dropped here while still borrowed | | | temporary value does not live long enough @@ -66,11 +66,11 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/cleanup-rvalue-scopes-cf.rs:33:14 | -LL | let _x = AddFlags(1).get(); //~ ERROR value does not live long enough +LL | let _x = AddFlags(1).get(); | ^^^^^^^^^^^ - temporary value dropped here while still borrowed | | | temporary value does not live long enough -LL | let Box { f: _x } = Box { f: AddFlags(1).get() }; //~ ERROR value does not live long enough +LL | let Box { f: _x } = Box { f: AddFlags(1).get() }; LL | } | - temporary value needs to live until here | @@ -79,7 +79,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/cleanup-rvalue-scopes-cf.rs:34:34 | -LL | let Box { f: _x } = Box { f: AddFlags(1).get() }; //~ ERROR value does not live long enough +LL | let Box { f: _x } = Box { f: AddFlags(1).get() }; | ^^^^^^^^^^^ - temporary value dropped here while still borrowed | | | temporary value does not live long enough diff --git a/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr b/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr index 7dd996cce5d4..2005bd4dd5ca 100644 --- a/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr +++ b/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/expect-two-infer-vars-supply-ty-with-bound-region.rs:8:27 | -LL | with_closure(|x: u32, y| {}); //~ ERROR E0282 +LL | with_closure(|x: u32, y| {}); | ^ consider giving this closure parameter a type error: aborting due to previous error diff --git a/src/test/ui/closure_context/issue-26046-fn-mut.stderr b/src/test/ui/closure_context/issue-26046-fn-mut.stderr index bdfd26f6871a..74d3c4977ee6 100644 --- a/src/test/ui/closure_context/issue-26046-fn-mut.stderr +++ b/src/test/ui/closure_context/issue-26046-fn-mut.stderr @@ -1,7 +1,7 @@ error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnMut` --> $DIR/issue-26046-fn-mut.rs:4:19 | -LL | let closure = || { //~ ERROR expected a closure that +LL | let closure = || { | ^^ this closure implements `FnMut`, not `Fn` LL | num += 1; | --- closure is `FnMut` because it mutates the variable `num` here diff --git a/src/test/ui/closure_context/issue-26046-fn-once.stderr b/src/test/ui/closure_context/issue-26046-fn-once.stderr index e7bcbb9e6308..473e8e8417e6 100644 --- a/src/test/ui/closure_context/issue-26046-fn-once.stderr +++ b/src/test/ui/closure_context/issue-26046-fn-once.stderr @@ -1,7 +1,7 @@ error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce` --> $DIR/issue-26046-fn-once.rs:4:19 | -LL | let closure = move || { //~ ERROR expected a closure +LL | let closure = move || { | ^^^^^^^ this closure implements `FnOnce`, not `Fn` LL | vec | --- closure is `FnOnce` because it moves the variable `vec` out of its environment diff --git a/src/test/ui/closure_promotion.stderr b/src/test/ui/closure_promotion.stderr index 7b901e301178..475e28309cfb 100644 --- a/src/test/ui/closure_promotion.stderr +++ b/src/test/ui/closure_promotion.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/closure_promotion.rs:7:26 | -LL | let x: &'static _ = &|| { let z = 3; z }; //~ ERROR does not live long enough +LL | let x: &'static _ = &|| { let z = 3; z }; | ^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough LL | } | - temporary value only lives until here diff --git a/src/test/ui/closures/closure-array-break-length.stderr b/src/test/ui/closures/closure-array-break-length.stderr index fa7a63b642e6..9b78aa16a580 100644 --- a/src/test/ui/closures/closure-array-break-length.stderr +++ b/src/test/ui/closures/closure-array-break-length.stderr @@ -1,19 +1,19 @@ error[E0268]: `continue` outside of loop --> $DIR/closure-array-break-length.rs:2:13 | -LL | |_: [_; continue]| {}; //~ ERROR: `continue` outside of loop +LL | |_: [_; continue]| {}; | ^^^^^^^^ cannot break outside of a loop error[E0268]: `continue` outside of loop --> $DIR/closure-array-break-length.rs:4:19 | -LL | while |_: [_; continue]| {} {} //~ ERROR: `continue` outside of loop +LL | while |_: [_; continue]| {} {} | ^^^^^^^^ cannot break outside of a loop error[E0268]: `break` outside of loop --> $DIR/closure-array-break-length.rs:6:19 | -LL | while |_: [_; break]| {} {} //~ ERROR: `break` outside of loop +LL | while |_: [_; break]| {} {} | ^^^^^ cannot break outside of a loop error: aborting due to 3 previous errors diff --git a/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr b/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr index 7d637fed8ab6..81c4f4e00aba 100644 --- a/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr +++ b/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr @@ -2,7 +2,7 @@ error[E0277]: `F` cannot be sent between threads safely --> $DIR/closure-bounds-cant-promote-superkind-in-struct.rs:5:1 | LL | / fn foo(blk: F) -> X where F: FnOnce() + 'static { -LL | | //~^ ERROR `F` cannot be sent between threads safely +LL | | LL | | return X { field: blk }; LL | | } | |_^ `F` cannot be sent between threads safely diff --git a/src/test/ui/closures/closure-bounds-subtype.stderr b/src/test/ui/closures/closure-bounds-subtype.stderr index d018956d026c..3b9fd10af386 100644 --- a/src/test/ui/closures/closure-bounds-subtype.stderr +++ b/src/test/ui/closures/closure-bounds-subtype.stderr @@ -1,7 +1,7 @@ error[E0277]: `F` cannot be shared between threads safely --> $DIR/closure-bounds-subtype.rs:13:5 | -LL | take_const_owned(f); //~ ERROR `F` cannot be shared between threads safely [E0277] +LL | take_const_owned(f); | ^^^^^^^^^^^^^^^^ `F` cannot be shared between threads safely | = help: the trait `std::marker::Sync` is not implemented for `F` diff --git a/src/test/ui/closures/closure-expected-type/expect-region-supply-region.stderr b/src/test/ui/closures/closure-expected-type/expect-region-supply-region.stderr index 633dd4f5c62a..e3b623d55248 100644 --- a/src/test/ui/closures/closure-expected-type/expect-region-supply-region.stderr +++ b/src/test/ui/closures/closure-expected-type/expect-region-supply-region.stderr @@ -5,7 +5,7 @@ LL | let mut f: Option<&u32> = None; | ----- borrowed data cannot be stored into here... LL | closure_expecting_bound(|x| { | --- ...because it cannot outlive this closure -LL | f = Some(x); //~ ERROR borrowed data cannot be stored outside of its closure +LL | f = Some(x); | ^ cannot be stored outside of its closure error: borrowed data cannot be stored outside of its closure @@ -15,7 +15,7 @@ LL | let mut f: Option<&u32> = None; | ----- borrowed data cannot be stored into here... LL | closure_expecting_bound(|x: &u32| { | --------- ...because it cannot outlive this closure -LL | f = Some(x); //~ ERROR borrowed data cannot be stored outside of its closure +LL | f = Some(x); | ^ cannot be stored outside of its closure error[E0308]: mismatched types @@ -31,11 +31,11 @@ note: the anonymous lifetime #2 defined on the body at 37:29... | LL | closure_expecting_bound(|x: &'x u32| { | _____________________________^ -LL | | //~^ ERROR mismatched types -LL | | //~| ERROR mismatched types +LL | | +LL | | LL | | ... | -LL | | //~^ ERROR borrowed data cannot be stored outside of its closure +LL | | LL | | }); | |_____^ note: ...does not necessarily outlive the lifetime 'x as defined on the function body at 32:30 @@ -62,11 +62,11 @@ note: ...does not necessarily outlive the anonymous lifetime #2 defined on the b | LL | closure_expecting_bound(|x: &'x u32| { | _____________________________^ -LL | | //~^ ERROR mismatched types -LL | | //~| ERROR mismatched types +LL | | +LL | | LL | | ... | -LL | | //~^ ERROR borrowed data cannot be stored outside of its closure +LL | | LL | | }); | |_____^ diff --git a/src/test/ui/closures/closure-immutable-outer-variable.nll.stderr b/src/test/ui/closures/closure-immutable-outer-variable.nll.stderr index 0c4d90f4c531..7e60f3cd8ffa 100644 --- a/src/test/ui/closures/closure-immutable-outer-variable.nll.stderr +++ b/src/test/ui/closures/closure-immutable-outer-variable.nll.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `y`, as it is not declared as mutable | LL | let y = true; | - help: consider changing this to be mutable: `mut y` -LL | foo(Box::new(move || y = false) as Box<_>); //~ ERROR cannot assign to captured outer variable +LL | foo(Box::new(move || y = false) as Box<_>); | ^^^^^^^^^ cannot assign error: aborting due to previous error diff --git a/src/test/ui/closures/closure-immutable-outer-variable.stderr b/src/test/ui/closures/closure-immutable-outer-variable.stderr index c6a6ebd931c6..332320791d44 100644 --- a/src/test/ui/closures/closure-immutable-outer-variable.stderr +++ b/src/test/ui/closures/closure-immutable-outer-variable.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to captured outer variable in an `FnMut` closure | LL | let y = true; | - help: consider making `y` mutable: `mut y` -LL | foo(Box::new(move || y = false) as Box<_>); //~ ERROR cannot assign to captured outer variable +LL | foo(Box::new(move || y = false) as Box<_>); | ^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/closures/closure-referencing-itself-issue-25954.stderr b/src/test/ui/closures/closure-referencing-itself-issue-25954.stderr index f60be43bba81..8ca43cd1cffb 100644 --- a/src/test/ui/closures/closure-referencing-itself-issue-25954.stderr +++ b/src/test/ui/closures/closure-referencing-itself-issue-25954.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/closure-referencing-itself-issue-25954.rs:15:13 | -LL | let q = || p.b.set(5i32); //~ ERROR mismatched types +LL | let q = || p.b.set(5i32); | ^^^^^^^^^^^^^^^^ cyclic type of infinite size error: aborting due to previous error diff --git a/src/test/ui/closures/closure-reform-bad.stderr b/src/test/ui/closures/closure-reform-bad.stderr index 76f88d049074..5c5480912be4 100644 --- a/src/test/ui/closures/closure-reform-bad.stderr +++ b/src/test/ui/closures/closure-reform-bad.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/closure-reform-bad.rs:11:15 | -LL | call_bare(f) //~ ERROR mismatched types +LL | call_bare(f) | ^ expected fn pointer, found closure | = note: expected type `for<'r> fn(&'r str)` diff --git a/src/test/ui/closures/closure-wrong-kind.stderr b/src/test/ui/closures/closure-wrong-kind.stderr index b289ea296442..65026128ae62 100644 --- a/src/test/ui/closures/closure-wrong-kind.stderr +++ b/src/test/ui/closures/closure-wrong-kind.stderr @@ -1,7 +1,7 @@ error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce` --> $DIR/closure-wrong-kind.rs:10:19 | -LL | let closure = |_| foo(x); //~ ERROR E0525 +LL | let closure = |_| foo(x); | ^^^^^^^^-^ | | | | | closure is `FnOnce` because it moves the variable `x` out of its environment diff --git a/src/test/ui/codemap_tests/bad-format-args.stderr b/src/test/ui/codemap_tests/bad-format-args.stderr index 38320416b450..c424eb08a7a9 100644 --- a/src/test/ui/codemap_tests/bad-format-args.stderr +++ b/src/test/ui/codemap_tests/bad-format-args.stderr @@ -1,7 +1,7 @@ error: requires at least a format string argument --> $DIR/bad-format-args.rs:2:5 | -LL | format!(); //~ ERROR requires at least a format string argument +LL | format!(); | ^^^^^^^^^^ | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) @@ -9,13 +9,13 @@ LL | format!(); //~ ERROR requires at least a format string argument error: expected token: `,` --> $DIR/bad-format-args.rs:3:16 | -LL | format!("" 1); //~ ERROR expected token: `,` +LL | format!("" 1); | ^ error: expected token: `,` --> $DIR/bad-format-args.rs:4:19 | -LL | format!("", 1 1); //~ ERROR expected token: `,` +LL | format!("", 1 1); | ^ error: aborting due to 3 previous errors diff --git a/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr b/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr index 5f8bc387a3d2..087084ae5dad 100644 --- a/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr +++ b/src/test/ui/codemap_tests/coherence-overlapping-inherent-impl-trait.stderr @@ -1,7 +1,7 @@ error[E0592]: duplicate definitions with name `f` --> $DIR/coherence-overlapping-inherent-impl-trait.rs:4:10 | -LL | impl C { fn f() {} } //~ ERROR duplicate +LL | impl C { fn f() {} } | ^^^^^^^^^ duplicate definitions for `f` LL | impl C { fn f() {} } | --------- other definition for `f` diff --git a/src/test/ui/codemap_tests/empty_span.stderr b/src/test/ui/codemap_tests/empty_span.stderr index f52856770978..1dd99cfd64fa 100644 --- a/src/test/ui/codemap_tests/empty_span.stderr +++ b/src/test/ui/codemap_tests/empty_span.stderr @@ -1,7 +1,7 @@ error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `&'static main::Foo` --> $DIR/empty_span.rs:7:5 | -LL | unsafe impl Send for &'static Foo { } //~ ERROR cross-crate traits with a default impl +LL | unsafe impl Send for &'static Foo { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type error: aborting due to previous error diff --git a/src/test/ui/codemap_tests/huge_multispan_highlight.nll.stderr b/src/test/ui/codemap_tests/huge_multispan_highlight.nll.stderr index 7fdeb03acbd6..a60f1c77a586 100644 --- a/src/test/ui/codemap_tests/huge_multispan_highlight.nll.stderr +++ b/src/test/ui/codemap_tests/huge_multispan_highlight.nll.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable LL | let x = "foo"; | - help: consider changing this to be mutable: `mut x` ... -LL | let y = &mut x; //~ ERROR cannot borrow +LL | let y = &mut x; | ^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/codemap_tests/huge_multispan_highlight.stderr b/src/test/ui/codemap_tests/huge_multispan_highlight.stderr index 41df802b503d..13bd666a5077 100644 --- a/src/test/ui/codemap_tests/huge_multispan_highlight.stderr +++ b/src/test/ui/codemap_tests/huge_multispan_highlight.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable LL | let x = "foo"; | - help: make this binding mutable: `mut x` ... -LL | let y = &mut x; //~ ERROR cannot borrow +LL | let y = &mut x; | ^ cannot borrow mutably error: aborting due to previous error diff --git a/src/test/ui/codemap_tests/issue-11715.nll.stderr b/src/test/ui/codemap_tests/issue-11715.nll.stderr index 9f30f3854254..d0c29c768eb6 100644 --- a/src/test/ui/codemap_tests/issue-11715.nll.stderr +++ b/src/test/ui/codemap_tests/issue-11715.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time | LL | let y = &mut x; | ------ first mutable borrow occurs here -LL | let z = &mut x; //~ ERROR cannot borrow +LL | let z = &mut x; | ^^^^^^ second mutable borrow occurs here LL | z.use_mut(); LL | y.use_mut(); diff --git a/src/test/ui/codemap_tests/issue-11715.stderr b/src/test/ui/codemap_tests/issue-11715.stderr index 8f320a4e19b2..c37e6b34727b 100644 --- a/src/test/ui/codemap_tests/issue-11715.stderr +++ b/src/test/ui/codemap_tests/issue-11715.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time | LL | let y = &mut x; | - first mutable borrow occurs here -LL | let z = &mut x; //~ ERROR cannot borrow +LL | let z = &mut x; | ^ second mutable borrow occurs here ... LL | } diff --git a/src/test/ui/codemap_tests/one_line.nll.stderr b/src/test/ui/codemap_tests/one_line.nll.stderr index 0eb257c5976a..eddbd29c0ef8 100644 --- a/src/test/ui/codemap_tests/one_line.nll.stderr +++ b/src/test/ui/codemap_tests/one_line.nll.stderr @@ -1,7 +1,7 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time --> $DIR/one_line.rs:3:12 | -LL | v.push(v.pop().unwrap()); //~ ERROR cannot borrow +LL | v.push(v.pop().unwrap()); | - ---- ^ second mutable borrow occurs here | | | | | first borrow later used by call diff --git a/src/test/ui/codemap_tests/one_line.stderr b/src/test/ui/codemap_tests/one_line.stderr index 2ea793c09694..9dcaba8748e0 100644 --- a/src/test/ui/codemap_tests/one_line.stderr +++ b/src/test/ui/codemap_tests/one_line.stderr @@ -1,7 +1,7 @@ error[E0499]: cannot borrow `v` as mutable more than once at a time --> $DIR/one_line.rs:3:12 | -LL | v.push(v.pop().unwrap()); //~ ERROR cannot borrow +LL | v.push(v.pop().unwrap()); | - ^ - first borrow ends here | | | | | second mutable borrow occurs here diff --git a/src/test/ui/codemap_tests/overlapping_inherent_impls.stderr b/src/test/ui/codemap_tests/overlapping_inherent_impls.stderr index 1b20b699d9f8..70c1093e9ed4 100644 --- a/src/test/ui/codemap_tests/overlapping_inherent_impls.stderr +++ b/src/test/ui/codemap_tests/overlapping_inherent_impls.stderr @@ -1,7 +1,7 @@ error[E0592]: duplicate definitions with name `id` --> $DIR/overlapping_inherent_impls.rs:9:5 | -LL | fn id() {} //~ ERROR duplicate definitions +LL | fn id() {} | ^^^^^^^^^^ duplicate definitions for `id` ... LL | fn id() {} @@ -10,7 +10,7 @@ LL | fn id() {} error[E0592]: duplicate definitions with name `bar` --> $DIR/overlapping_inherent_impls.rs:19:5 | -LL | fn bar(&self) {} //~ ERROR duplicate definitions +LL | fn bar(&self) {} | ^^^^^^^^^^^^^^^^ duplicate definitions for `bar` ... LL | fn bar(&self) {} @@ -19,7 +19,7 @@ LL | fn bar(&self) {} error[E0592]: duplicate definitions with name `baz` --> $DIR/overlapping_inherent_impls.rs:29:5 | -LL | fn baz(&self) {} //~ ERROR duplicate definitions +LL | fn baz(&self) {} | ^^^^^^^^^^^^^^^^ duplicate definitions for `baz` ... LL | fn baz(&self) {} diff --git a/src/test/ui/codemap_tests/tab.stderr b/src/test/ui/codemap_tests/tab.stderr index 80b5773fda33..bcc21e9c7ade 100644 --- a/src/test/ui/codemap_tests/tab.stderr +++ b/src/test/ui/codemap_tests/tab.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `bar` in this scope --> $DIR/tab.rs:4:2 | -LL | bar; //~ ERROR cannot find value `bar` +LL | bar; | ^^^ not found in this scope error[E0308]: mismatched types @@ -9,7 +9,7 @@ error[E0308]: mismatched types | LL | fn foo() { | - help: try adding a return type: `-> &'static str` -LL | "bar boo" //~ ERROR mismatched types +LL | "bar boo" | ^^^^^^^^^^^^^^^^^^^^ expected (), found reference | = note: expected type `()` diff --git a/src/test/ui/codemap_tests/tab_2.stderr b/src/test/ui/codemap_tests/tab_2.stderr index f7eec3eb8da8..70414bbd953d 100644 --- a/src/test/ui/codemap_tests/tab_2.stderr +++ b/src/test/ui/codemap_tests/tab_2.stderr @@ -1,7 +1,7 @@ error: unterminated double quote string --> $DIR/tab_2.rs:4:7 | -LL | """; //~ ERROR unterminated double quote +LL | """; | ___________________^ LL | | } | |__^ diff --git a/src/test/ui/codemap_tests/tab_3.nll.stderr b/src/test/ui/codemap_tests/tab_3.nll.stderr index 3b8507a067de..97816a76004d 100644 --- a/src/test/ui/codemap_tests/tab_3.nll.stderr +++ b/src/test/ui/codemap_tests/tab_3.nll.stderr @@ -6,7 +6,7 @@ LL | let some_vec = vec!["hi"]; LL | some_vec.into_iter(); | -------- value moved here LL | { -LL | println!("{:?}", some_vec); //~ ERROR use of moved +LL | println!("{:?}", some_vec); | ^^^^^^^^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/codemap_tests/tab_3.stderr b/src/test/ui/codemap_tests/tab_3.stderr index 6e93ae130696..4b550dbf9ee1 100644 --- a/src/test/ui/codemap_tests/tab_3.stderr +++ b/src/test/ui/codemap_tests/tab_3.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `some_vec` LL | some_vec.into_iter(); | -------- value moved here LL | { -LL | println!("{:?}", some_vec); //~ ERROR use of moved +LL | println!("{:?}", some_vec); | ^^^^^^^^ value used here after move | = note: move occurs because `some_vec` has type `std::vec::Vec<&str>`, which does not implement the `Copy` trait diff --git a/src/test/ui/codemap_tests/two_files.stderr b/src/test/ui/codemap_tests/two_files.stderr index 65df3f382c04..5027b78b38e3 100644 --- a/src/test/ui/codemap_tests/two_files.stderr +++ b/src/test/ui/codemap_tests/two_files.stderr @@ -1,7 +1,7 @@ error[E0404]: expected trait, found type alias `Bar` --> $DIR/two_files.rs:5:6 | -LL | impl Bar for Baz { } //~ ERROR expected trait, found type alias +LL | impl Bar for Baz { } | ^^^ type aliases cannot be used as traits | = note: did you mean to use a trait alias? diff --git a/src/test/ui/codemap_tests/unicode.stderr b/src/test/ui/codemap_tests/unicode.stderr index 1ba6ac447889..7aadeb7dfc98 100644 --- a/src/test/ui/codemap_tests/unicode.stderr +++ b/src/test/ui/codemap_tests/unicode.stderr @@ -1,7 +1,7 @@ error[E0703]: invalid ABI: found `路濫狼Ñ́́` --> $DIR/unicode.rs:1:8 | -LL | extern "路濫狼Ñ́́" fn foo() {} //~ ERROR invalid ABI +LL | extern "路濫狼Ñ́́" fn foo() {} | ^^^^^^^^^ invalid ABI | = help: valid ABIs: cdecl, stdcall, fastcall, vectorcall, thiscall, aapcs, win64, sysv64, ptx-kernel, msp430-interrupt, x86-interrupt, amdgpu-kernel, Rust, C, system, rust-intrinsic, rust-call, platform-intrinsic, unadjusted diff --git a/src/test/ui/codemap_tests/unicode_2.stderr b/src/test/ui/codemap_tests/unicode_2.stderr index 1bc7452b9f2d..92634d8e5f94 100644 --- a/src/test/ui/codemap_tests/unicode_2.stderr +++ b/src/test/ui/codemap_tests/unicode_2.stderr @@ -1,7 +1,7 @@ error: invalid width `7` for integer literal --> $DIR/unicode_2.rs:4:25 | -LL | let _ = ("a̐éö̲", 0u7); //~ ERROR invalid width +LL | let _ = ("a̐éö̲", 0u7); | ^^^ | = help: valid widths are 8, 16, 32, 64 and 128 @@ -9,7 +9,7 @@ LL | let _ = ("a̐éö̲", 0u7); //~ ERROR invalid width error: invalid width `42` for integer literal --> $DIR/unicode_2.rs:5:20 | -LL | let _ = ("아あ", 1i42); //~ ERROR invalid width +LL | let _ = ("아あ", 1i42); | ^^^^ | = help: valid widths are 8, 16, 32, 64 and 128 @@ -17,7 +17,7 @@ LL | let _ = ("아あ", 1i42); //~ ERROR invalid width error[E0425]: cannot find value `a̐é` in this scope --> $DIR/unicode_2.rs:6:13 | -LL | let _ = a̐é; //~ ERROR cannot find +LL | let _ = a̐é; | ^^ not found in this scope error: aborting due to 3 previous errors diff --git a/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr b/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr index 5ad3889666b7..be362c9a78b9 100644 --- a/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr +++ b/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:9:13 | -LL | let _ = box { [1, 2, 3] }: Box<[i32]>; //~ ERROR mismatched types +LL | let _ = box { [1, 2, 3] }: Box<[i32]>; | ^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements | = note: expected type `std::boxed::Box<[i32]>` @@ -10,7 +10,7 @@ LL | let _ = box { [1, 2, 3] }: Box<[i32]>; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:10:13 | -LL | let _ = box if true { [1, 2, 3] } else { [1, 3, 4] }: Box<[i32]>; //~ ERROR mismatched types +LL | let _ = box if true { [1, 2, 3] } else { [1, 3, 4] }: Box<[i32]>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements | = note: expected type `std::boxed::Box<[i32]>` @@ -28,7 +28,7 @@ LL | let _ = box match true { true => [1, 2, 3], false => [1, 3, 4] }: Box<[ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:13:13 | -LL | let _ = box { |x| (x as u8) }: Box _>; //~ ERROR mismatched types +LL | let _ = box { |x| (x as u8) }: Box _>; | ^^^^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure | = note: expected type `std::boxed::Box u8>` @@ -37,7 +37,7 @@ LL | let _ = box { |x| (x as u8) }: Box _>; //~ ERROR mismatched error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:14:13 | -LL | let _ = box if true { false } else { true }: Box; //~ ERROR mismatched types +LL | let _ = box if true { false } else { true }: Box; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found bool | = note: expected type `std::boxed::Box` @@ -46,7 +46,7 @@ LL | let _ = box if true { false } else { true }: Box; //~ ERROR mism error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:15:13 | -LL | let _ = box match true { true => 'a', false => 'b' }: Box; //~ ERROR mismatched types +LL | let _ = box match true { true => 'a', false => 'b' }: Box; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found char | = note: expected type `std::boxed::Box` @@ -55,7 +55,7 @@ LL | let _ = box match true { true => 'a', false => 'b' }: Box; //~ E error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:17:13 | -LL | let _ = &{ [1, 2, 3] }: &[i32]; //~ ERROR mismatched types +LL | let _ = &{ [1, 2, 3] }: &[i32]; | ^^^^^^^^^^^^^^ expected slice, found array of 3 elements | = note: expected type `&[i32]` @@ -64,7 +64,7 @@ LL | let _ = &{ [1, 2, 3] }: &[i32]; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:18:13 | -LL | let _ = &if true { [1, 2, 3] } else { [1, 3, 4] }: &[i32]; //~ ERROR mismatched types +LL | let _ = &if true { [1, 2, 3] } else { [1, 3, 4] }: &[i32]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements | = note: expected type `&[i32]` @@ -82,7 +82,7 @@ LL | let _ = &match true { true => [1, 2, 3], false => [1, 3, 4] }: &[i32]; error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:21:13 | -LL | let _ = &{ |x| (x as u8) }: &Fn(i32) -> _; //~ ERROR mismatched types +LL | let _ = &{ |x| (x as u8) }: &Fn(i32) -> _; | ^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure | = note: expected type `&dyn std::ops::Fn(i32) -> u8` @@ -91,7 +91,7 @@ LL | let _ = &{ |x| (x as u8) }: &Fn(i32) -> _; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:22:13 | -LL | let _ = &if true { false } else { true }: &Debug; //~ ERROR mismatched types +LL | let _ = &if true { false } else { true }: &Debug; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found bool | = note: expected type `&dyn std::fmt::Debug` @@ -100,7 +100,7 @@ LL | let _ = &if true { false } else { true }: &Debug; //~ ERROR mismatched error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:23:13 | -LL | let _ = &match true { true => 'a', false => 'b' }: &Debug; //~ ERROR mismatched types +LL | let _ = &match true { true => 'a', false => 'b' }: &Debug; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found char | = note: expected type `&dyn std::fmt::Debug` @@ -109,7 +109,7 @@ LL | let _ = &match true { true => 'a', false => 'b' }: &Debug; //~ ERROR mi error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:25:13 | -LL | let _ = Box::new([1, 2, 3]): Box<[i32]>; //~ ERROR mismatched types +LL | let _ = Box::new([1, 2, 3]): Box<[i32]>; | ^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements | = note: expected type `std::boxed::Box<[i32]>` @@ -118,7 +118,7 @@ LL | let _ = Box::new([1, 2, 3]): Box<[i32]>; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:26:13 | -LL | let _ = Box::new(|x| (x as u8)): Box _>; //~ ERROR mismatched types +LL | let _ = Box::new(|x| (x as u8)): Box _>; | ^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure | = note: expected type `std::boxed::Box _>` diff --git a/src/test/ui/coercion/coerce-to-bang-cast.stderr b/src/test/ui/coercion/coerce-to-bang-cast.stderr index 2982801f4613..ff30ebc09c63 100644 --- a/src/test/ui/coercion/coerce-to-bang-cast.stderr +++ b/src/test/ui/coercion/coerce-to-bang-cast.stderr @@ -9,7 +9,7 @@ LL | let y = {return; 22} as !; error[E0605]: non-primitive cast: `i32` as `!` --> $DIR/coerce-to-bang-cast.rs:11:13 | -LL | let y = 22 as !; //~ ERROR non-primitive cast +LL | let y = 22 as !; | ^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait diff --git a/src/test/ui/coercion/coerce-to-bang.stderr b/src/test/ui/coercion/coerce-to-bang.stderr index 72e7211de7a7..a46e97da8159 100644 --- a/src/test/ui/coercion/coerce-to-bang.stderr +++ b/src/test/ui/coercion/coerce-to-bang.stderr @@ -10,7 +10,7 @@ LL | foo(return, 22, 44); error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:18:13 | -LL | foo(22, 44, return); //~ ERROR mismatched types +LL | foo(22, 44, return); | ^^ expected !, found integer | = note: expected type `!` @@ -28,7 +28,7 @@ LL | foo(a, b, c); // ... and hence a reference to `a` is expected to diverg error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:36:12 | -LL | foo(a, b, c); //~ ERROR mismatched types +LL | foo(a, b, c); | ^ expected !, found integer | = note: expected type `!` @@ -37,7 +37,7 @@ LL | foo(a, b, c); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:45:12 | -LL | foo(a, b, c); //~ ERROR mismatched types +LL | foo(a, b, c); | ^ expected !, found integer | = note: expected type `!` @@ -46,7 +46,7 @@ LL | foo(a, b, c); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:50:21 | -LL | let x: [!; 2] = [return, 22]; //~ ERROR mismatched types +LL | let x: [!; 2] = [return, 22]; | ^^^^^^^^^^^^ expected !, found integer | = note: expected type `[!; 2]` @@ -55,7 +55,7 @@ LL | let x: [!; 2] = [return, 22]; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:55:22 | -LL | let x: [!; 2] = [22, return]; //~ ERROR mismatched types +LL | let x: [!; 2] = [22, return]; | ^^ expected !, found integer | = note: expected type `!` @@ -64,7 +64,7 @@ LL | let x: [!; 2] = [22, return]; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:60:37 | -LL | let x: (usize, !, usize) = (22, 44, 66); //~ ERROR mismatched types +LL | let x: (usize, !, usize) = (22, 44, 66); | ^^ expected !, found integer | = note: expected type `!` @@ -82,7 +82,7 @@ LL | let x: (usize, !, usize) = (return, 44, 66); error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:76:37 | -LL | let x: (usize, !, usize) = (22, 44, return); //~ ERROR mismatched types +LL | let x: (usize, !, usize) = (22, 44, return); | ^^ expected !, found integer | = note: expected type `!` diff --git a/src/test/ui/coercion/coercion-missing-tail-expected-type.stderr b/src/test/ui/coercion/coercion-missing-tail-expected-type.stderr index c8ec2f0545e6..057de5b625e8 100644 --- a/src/test/ui/coercion/coercion-missing-tail-expected-type.stderr +++ b/src/test/ui/coercion/coercion-missing-tail-expected-type.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/coercion-missing-tail-expected-type.rs:3:24 | -LL | fn plus_one(x: i32) -> i32 { //~ ERROR mismatched types +LL | fn plus_one(x: i32) -> i32 { | -------- ^^^ expected i32, found () | | | this function's body doesn't return @@ -14,7 +14,7 @@ LL | x + 1; error[E0308]: mismatched types --> $DIR/coercion-missing-tail-expected-type.rs:7:13 | -LL | fn foo() -> Result { //~ ERROR mismatched types +LL | fn foo() -> Result { | --- ^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found () | | | this function's body doesn't return diff --git a/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr b/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr index c8a146cdd445..86a63eb56991 100644 --- a/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr +++ b/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-negative.stderr @@ -1,19 +1,19 @@ error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker1` --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:14:1 | -LL | impl !Marker1 for dyn Object + Marker2 { } //~ ERROR E0371 +LL | impl !Marker1 for dyn Object + Marker2 { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker1` error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker2` --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:16:1 | -LL | impl !Marker2 for dyn Object + Marker2 { } //~ ERROR E0371 +LL | impl !Marker2 for dyn Object + Marker2 { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker2` error[E0117]: only traits defined in the current crate can be implemented for arbitrary types --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:22:1 | -LL | impl !Send for dyn Marker2 {} //~ ERROR E0117 +LL | impl !Send for dyn Marker2 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | = note: the impl does not reference only types defined in this crate @@ -22,13 +22,13 @@ LL | impl !Send for dyn Marker2 {} //~ ERROR E0117 error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `(dyn Object + 'static)` --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:26:1 | -LL | impl !Send for dyn Object {} //~ ERROR E0321 +LL | impl !Send for dyn Object {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `(dyn Object + Marker2 + 'static)` --> $DIR/coherence-impl-trait-for-marker-trait-negative.rs:27:1 | -LL | impl !Send for dyn Object + Marker2 {} //~ ERROR E0321 +LL | impl !Send for dyn Object + Marker2 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type error: aborting due to 5 previous errors diff --git a/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr b/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr index 78ca2f5279d6..536b4625aee2 100644 --- a/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr +++ b/src/test/ui/coherence/coherence-impl-trait-for-marker-trait-positive.stderr @@ -1,19 +1,19 @@ error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker1` --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:14:1 | -LL | impl Marker1 for dyn Object + Marker2 { } //~ ERROR E0371 +LL | impl Marker1 for dyn Object + Marker2 { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker1` error[E0371]: the object type `(dyn Object + Marker2 + 'static)` automatically implements the trait `Marker2` --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:16:1 | -LL | impl Marker2 for dyn Object + Marker2 { } //~ ERROR E0371 +LL | impl Marker2 for dyn Object + Marker2 { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Object + Marker2 + 'static)` automatically implements trait `Marker2` error[E0117]: only traits defined in the current crate can be implemented for arbitrary types --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:22:1 | -LL | unsafe impl Send for dyn Marker2 {} //~ ERROR E0117 +LL | unsafe impl Send for dyn Marker2 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | = note: the impl does not reference only types defined in this crate @@ -22,13 +22,13 @@ LL | unsafe impl Send for dyn Marker2 {} //~ ERROR E0117 error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `(dyn Object + 'static)` --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:26:1 | -LL | unsafe impl Send for dyn Object {} //~ ERROR E0321 +LL | unsafe impl Send for dyn Object {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `(dyn Object + Marker2 + 'static)` --> $DIR/coherence-impl-trait-for-marker-trait-positive.rs:27:1 | -LL | unsafe impl Send for dyn Object + Marker2 {} //~ ERROR E0321 +LL | unsafe impl Send for dyn Object + Marker2 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type error: aborting due to 5 previous errors diff --git a/src/test/ui/compare-method/proj-outlives-region.stderr b/src/test/ui/compare-method/proj-outlives-region.stderr index ba0b04dca9d2..e5f5c5ed20d5 100644 --- a/src/test/ui/compare-method/proj-outlives-region.stderr +++ b/src/test/ui/compare-method/proj-outlives-region.stderr @@ -4,7 +4,7 @@ error[E0276]: impl has stricter requirements than trait LL | fn foo() where T: 'a; | --------------------- definition of `foo` from trait ... -LL | fn foo() where U: 'a { } //~ ERROR E0276 +LL | fn foo() where U: 'a { } | ^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `U: 'a` error: aborting due to previous error diff --git a/src/test/ui/compare-method/region-extra.stderr b/src/test/ui/compare-method/region-extra.stderr index 48ca690f425e..5a584c7d6ed9 100644 --- a/src/test/ui/compare-method/region-extra.stderr +++ b/src/test/ui/compare-method/region-extra.stderr @@ -4,7 +4,7 @@ error[E0276]: impl has stricter requirements than trait LL | fn foo(); | --------- definition of `foo` from trait ... -LL | fn foo() where 'a: 'b { } //~ ERROR impl has stricter +LL | fn foo() where 'a: 'b { } | ^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `'a: 'b` error: aborting due to previous error diff --git a/src/test/ui/compare-method/reordered-type-param.stderr b/src/test/ui/compare-method/reordered-type-param.stderr index c162c720a48b..a33908c01c84 100644 --- a/src/test/ui/compare-method/reordered-type-param.stderr +++ b/src/test/ui/compare-method/reordered-type-param.stderr @@ -4,7 +4,7 @@ error[E0053]: method `b` has an incompatible type for trait LL | fn b(&self, x: C) -> C; | - type in trait ... -LL | fn b(&self, _x: G) -> G { panic!() } //~ ERROR method `b` has an incompatible type +LL | fn b(&self, _x: G) -> G { panic!() } | ^ expected type parameter, found a different type parameter | = note: expected type `fn(&E, F) -> F` diff --git a/src/test/ui/compare-method/trait-bound-on-type-parameter.stderr b/src/test/ui/compare-method/trait-bound-on-type-parameter.stderr index 07f5a0a6cec4..5d09038076f9 100644 --- a/src/test/ui/compare-method/trait-bound-on-type-parameter.stderr +++ b/src/test/ui/compare-method/trait-bound-on-type-parameter.stderr @@ -4,7 +4,7 @@ error[E0276]: impl has stricter requirements than trait LL | fn b(&self, x: C) -> C; | ---------------------------- definition of `b` from trait ... -LL | fn b(&self, _x: F) -> F { panic!() } //~ ERROR E0276 +LL | fn b(&self, _x: F) -> F { panic!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `F: std::marker::Sync` error: aborting due to previous error diff --git a/src/test/ui/compile_error_macro.stderr b/src/test/ui/compile_error_macro.stderr index 9e11db68315e..8aa1878c5d7c 100644 --- a/src/test/ui/compile_error_macro.stderr +++ b/src/test/ui/compile_error_macro.stderr @@ -1,7 +1,7 @@ error: a very descriptive error message --> $DIR/compile_error_macro.rs:2:5 | -LL | compile_error!("a very descriptive error message"); //~ ERROR: a very descriptive error message +LL | compile_error!("a very descriptive error message"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/concat.stderr b/src/test/ui/concat.stderr index b6024972c744..61fb9de1ef96 100644 --- a/src/test/ui/concat.stderr +++ b/src/test/ui/concat.stderr @@ -1,19 +1,19 @@ error: cannot concatenate a byte string literal --> $DIR/concat.rs:2:13 | -LL | concat!(b'f'); //~ ERROR: cannot concatenate a byte string literal +LL | concat!(b'f'); | ^^^^ error: cannot concatenate a byte string literal --> $DIR/concat.rs:3:13 | -LL | concat!(b"foo"); //~ ERROR: cannot concatenate a byte string literal +LL | concat!(b"foo"); | ^^^^^^ error: expected a literal --> $DIR/concat.rs:4:13 | -LL | concat!(foo); //~ ERROR: expected a literal +LL | concat!(foo); | ^^^ | = note: only literals (like `"foo"`, `42` and `3.14`) can be passed to `concat!()` @@ -21,7 +21,7 @@ LL | concat!(foo); //~ ERROR: expected a literal error: expected a literal --> $DIR/concat.rs:5:13 | -LL | concat!(foo()); //~ ERROR: expected a literal +LL | concat!(foo()); | ^^^^^ | = note: only literals (like `"foo"`, `42` and `3.14`) can be passed to `concat!()` diff --git a/src/test/ui/conditional-compilation/cfg-attr-crate-2.stderr b/src/test/ui/conditional-compilation/cfg-attr-crate-2.stderr index 37c7a571d0f5..8d308f0c96fb 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-crate-2.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-crate-2.stderr @@ -1,7 +1,7 @@ error[E0658]: no_core is experimental (see issue #29639) --> $DIR/cfg-attr-crate-2.rs:6:21 | -LL | #![cfg_attr(broken, no_core)] //~ ERROR no_core is experimental +LL | #![cfg_attr(broken, no_core)] | ^^^^^^^ | = help: add #![feature(no_core)] to the crate attributes to enable diff --git a/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.stderr b/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.stderr index d75a0389851a..96c571ebebdb 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.stderr @@ -1,7 +1,7 @@ error[E0537]: invalid predicate `foo` --> $DIR/cfg-attr-invalid-predicate.rs:1:7 | -LL | #[cfg(foo(bar))] //~ ERROR invalid predicate `foo` +LL | #[cfg(foo(bar))] | ^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-1.stderr b/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-1.stderr index 8cdf4ec31e7f..8485459ca6bd 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-1.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-1.stderr @@ -1,7 +1,7 @@ error[E0658]: no_core is experimental (see issue #29639) --> $DIR/cfg-attr-multi-invalid-1.rs:4:21 | -LL | #![cfg_attr(broken, no_core, no_std)] //~ ERROR no_core is experimental +LL | #![cfg_attr(broken, no_core, no_std)] | ^^^^^^^ | = help: add #![feature(no_core)] to the crate attributes to enable diff --git a/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-2.stderr b/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-2.stderr index b3a3b0c0f97b..2a673ea81317 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-2.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-multi-invalid-2.stderr @@ -1,7 +1,7 @@ error[E0658]: no_core is experimental (see issue #29639) --> $DIR/cfg-attr-multi-invalid-2.rs:4:29 | -LL | #![cfg_attr(broken, no_std, no_core)] //~ ERROR no_core is experimental +LL | #![cfg_attr(broken, no_std, no_core)] | ^^^^^^^ | = help: add #![feature(no_core)] to the crate attributes to enable diff --git a/src/test/ui/conditional-compilation/cfg-attr-multi-true.stderr b/src/test/ui/conditional-compilation/cfg-attr-multi-true.stderr index 3d14c1973979..64e9570773a6 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-multi-true.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-multi-true.stderr @@ -1,7 +1,7 @@ warning: use of deprecated item 'MustUseDeprecated' --> $DIR/cfg-attr-multi-true.rs:12:6 | -LL | impl MustUseDeprecated { //~ warning: use of deprecated item +LL | impl MustUseDeprecated { | ^^^^^^^^^^^^^^^^^ | = note: #[warn(deprecated)] on by default @@ -9,25 +9,25 @@ LL | impl MustUseDeprecated { //~ warning: use of deprecated item warning: use of deprecated item 'MustUseDeprecated' --> $DIR/cfg-attr-multi-true.rs:19:5 | -LL | MustUseDeprecated::new(); //~ warning: use of deprecated item +LL | MustUseDeprecated::new(); | ^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'MustUseDeprecated' --> $DIR/cfg-attr-multi-true.rs:13:17 | -LL | fn new() -> MustUseDeprecated { //~ warning: use of deprecated item +LL | fn new() -> MustUseDeprecated { | ^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'MustUseDeprecated' --> $DIR/cfg-attr-multi-true.rs:14:9 | -LL | MustUseDeprecated {} //~ warning: use of deprecated item +LL | MustUseDeprecated {} | ^^^^^^^^^^^^^^^^^ warning: unused `MustUseDeprecated` that must be used --> $DIR/cfg-attr-multi-true.rs:19:5 | -LL | MustUseDeprecated::new(); //~ warning: use of deprecated item +LL | MustUseDeprecated::new(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/conditional-compilation/cfg-attr-parse.stderr b/src/test/ui/conditional-compilation/cfg-attr-parse.stderr index 36c7c817cb33..3dfbd6df256e 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-parse.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-parse.stderr @@ -1,31 +1,31 @@ error: expected identifier, found `)` --> $DIR/cfg-attr-parse.rs:4:12 | -LL | #[cfg_attr()] //~ error: expected identifier, found `)` +LL | #[cfg_attr()] | ^ expected identifier error: expected `,`, found `)` --> $DIR/cfg-attr-parse.rs:8:17 | -LL | #[cfg_attr(all())] //~ error: expected `,`, found `)` +LL | #[cfg_attr(all())] | ^ expected `,` error: expected identifier, found `,` --> $DIR/cfg-attr-parse.rs:16:18 | -LL | #[cfg_attr(all(),,)] //~ ERROR expected identifier +LL | #[cfg_attr(all(),,)] | ^ expected identifier error: expected identifier, found `,` --> $DIR/cfg-attr-parse.rs:28:28 | -LL | #[cfg_attr(all(), must_use,,)] //~ ERROR expected identifier +LL | #[cfg_attr(all(), must_use,,)] | ^ expected identifier error: expected identifier, found `,` --> $DIR/cfg-attr-parse.rs:40:40 | -LL | #[cfg_attr(all(), must_use, deprecated,,)] //~ ERROR expected identifier +LL | #[cfg_attr(all(), must_use, deprecated,,)] | ^ expected identifier error: aborting due to 5 previous errors diff --git a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs index c5aa903f9491..7f0648b381db 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs +++ b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs @@ -28,7 +28,7 @@ struct S9; macro_rules! generate_s10 { ($expr: expr) => { #[cfg(feature = $expr)] - //~^ ERROR expected unsuffixed literal or identifier, found concat!("nonexistent") + //~^ ERROR expected unsuffixed literal or identifier, found `concat!("nonexistent")` struct S10; } } diff --git a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr index bcf13ead2f4f..ae37461cab81 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr @@ -1,62 +1,62 @@ error: `cfg` is not followed by parentheses --> $DIR/cfg-attr-syntax-validation.rs:1:1 | -LL | #[cfg] //~ ERROR `cfg` is not followed by parentheses +LL | #[cfg] | ^^^^^^ help: expected syntax is: `cfg(/* predicate */)` error: `cfg` is not followed by parentheses --> $DIR/cfg-attr-syntax-validation.rs:4:1 | -LL | #[cfg = 10] //~ ERROR `cfg` is not followed by parentheses +LL | #[cfg = 10] | ^^^^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)` error: `cfg` predicate is not specified --> $DIR/cfg-attr-syntax-validation.rs:7:1 | -LL | #[cfg()] //~ ERROR `cfg` predicate is not specified +LL | #[cfg()] | ^^^^^^^^ error: multiple `cfg` predicates are specified --> $DIR/cfg-attr-syntax-validation.rs:10:10 | -LL | #[cfg(a, b)] //~ ERROR multiple `cfg` predicates are specified +LL | #[cfg(a, b)] | ^ error: `cfg` predicate key cannot be a literal --> $DIR/cfg-attr-syntax-validation.rs:13:7 | -LL | #[cfg("str")] //~ ERROR `cfg` predicate key cannot be a literal +LL | #[cfg("str")] | ^^^^^ error: `cfg` predicate key must be an identifier --> $DIR/cfg-attr-syntax-validation.rs:16:7 | -LL | #[cfg(a::b)] //~ ERROR `cfg` predicate key must be an identifier +LL | #[cfg(a::b)] | ^^^^ error[E0537]: invalid predicate `a` --> $DIR/cfg-attr-syntax-validation.rs:19:7 | -LL | #[cfg(a())] //~ ERROR invalid predicate `a` +LL | #[cfg(a())] | ^^^ error[E0565]: literal in `cfg` predicate value must be a string --> $DIR/cfg-attr-syntax-validation.rs:22:11 | -LL | #[cfg(a = 10)] //~ ERROR literal in `cfg` predicate value must be a string +LL | #[cfg(a = 10)] | ^^ error[E0565]: literal in `cfg` predicate value must be a string --> $DIR/cfg-attr-syntax-validation.rs:25:11 | -LL | #[cfg(a = b"hi")] //~ ERROR literal in `cfg` predicate value must be a string +LL | #[cfg(a = b"hi")] | ^^^^^ help: consider removing the prefix: `"hi"` -error: expected unsuffixed literal or identifier, found concat!("nonexistent") - --> $DIR/cfg-attr-syntax-validation.rs:30:15 +error: expected unsuffixed literal or identifier, found `concat!("nonexistent")` + --> $DIR/cfg-attr-syntax-validation.rs:30:25 | LL | #[cfg(feature = $expr)] - | ^^^^^^^ + | ^^^^^ ... LL | generate_s10!(concat!("nonexistent")); | -------------------------------------- in this macro invocation diff --git a/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr b/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr index c5097c15c3c8..d0b59c3994cc 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr @@ -1,7 +1,7 @@ error[E0658]: The attribute `unknown` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/cfg-attr-unknown-attribute-macro-expansion.rs:3:27 | -LL | #[cfg_attr(all(), unknown)] //~ ERROR `unknown` is currently unknown +LL | #[cfg_attr(all(), unknown)] | ^^^^^^^ ... LL | foo!(); diff --git a/src/test/ui/conflicting-repr-hints.stderr b/src/test/ui/conflicting-repr-hints.stderr index 148f1211b083..c39055f01721 100644 --- a/src/test/ui/conflicting-repr-hints.stderr +++ b/src/test/ui/conflicting-repr-hints.stderr @@ -1,49 +1,49 @@ warning[E0566]: conflicting representation hints --> $DIR/conflicting-repr-hints.rs:9:8 | -LL | #[repr(C, u64)] //~ WARNING conflicting representation hints +LL | #[repr(C, u64)] | ^ ^^^ warning[E0566]: conflicting representation hints --> $DIR/conflicting-repr-hints.rs:12:8 | -LL | #[repr(u32, u64)] //~ WARNING conflicting representation hints +LL | #[repr(u32, u64)] | ^^^ ^^^ error[E0587]: type has conflicting packed and align representation hints --> $DIR/conflicting-repr-hints.rs:19:1 | -LL | struct F(i32); //~ ERROR type has conflicting packed and align representation hints +LL | struct F(i32); | ^^^^^^^^^^^^^^ error[E0587]: type has conflicting packed and align representation hints --> $DIR/conflicting-repr-hints.rs:23:1 | -LL | struct G(i32); //~ ERROR type has conflicting packed and align representation hints +LL | struct G(i32); | ^^^^^^^^^^^^^^ error[E0587]: type has conflicting packed and align representation hints --> $DIR/conflicting-repr-hints.rs:27:1 | -LL | struct H(i32); //~ ERROR type has conflicting packed and align representation hints +LL | struct H(i32); | ^^^^^^^^^^^^^^ error[E0634]: type has conflicting packed representation hints --> $DIR/conflicting-repr-hints.rs:30:1 | -LL | struct I(i32); //~ ERROR type has conflicting packed representation hints +LL | struct I(i32); | ^^^^^^^^^^^^^^ error[E0634]: type has conflicting packed representation hints --> $DIR/conflicting-repr-hints.rs:34:1 | -LL | struct J(i32); //~ ERROR type has conflicting packed representation hints +LL | struct J(i32); | ^^^^^^^^^^^^^^ error[E0587]: type has conflicting packed and align representation hints --> $DIR/conflicting-repr-hints.rs:40:1 | -LL | / union X { //~ ERROR type has conflicting packed and align representation hints +LL | / union X { LL | | i: i32 LL | | } | |_^ @@ -51,7 +51,7 @@ LL | | } error[E0587]: type has conflicting packed and align representation hints --> $DIR/conflicting-repr-hints.rs:46:1 | -LL | / union Y { //~ ERROR type has conflicting packed and align representation hints +LL | / union Y { LL | | i: i32 LL | | } | |_^ @@ -59,7 +59,7 @@ LL | | } error[E0587]: type has conflicting packed and align representation hints --> $DIR/conflicting-repr-hints.rs:52:1 | -LL | / union Z { //~ ERROR type has conflicting packed and align representation hints +LL | / union Z { LL | | i: i32 LL | | } | |_^ diff --git a/src/test/ui/confuse-field-and-method/issue-2392.stderr b/src/test/ui/confuse-field-and-method/issue-2392.stderr index 0c09bd2284be..7cd1941d80e8 100644 --- a/src/test/ui/confuse-field-and-method/issue-2392.stderr +++ b/src/test/ui/confuse-field-and-method/issue-2392.stderr @@ -4,7 +4,7 @@ error[E0599]: no method named `closure` found for type `Obj<[closure@$DIR/issue- LL | struct Obj where F: FnOnce() -> u32 { | -------------------------------------- method `closure` not found for this ... -LL | o_closure.closure(); //~ ERROR no method named `closure` found +LL | o_closure.closure(); | ^^^^^^^ field, not a method | = help: use `(o_closure.closure)(...)` if you meant to call the function stored in the `closure` field @@ -26,7 +26,7 @@ error[E0599]: no method named `closure` found for type `Obj u32 {func}>` LL | struct Obj where F: FnOnce() -> u32 { | -------------------------------------- method `closure` not found for this ... -LL | o_func.closure(); //~ ERROR no method named `closure` found +LL | o_func.closure(); | ^^^^^^^ field, not a method | = help: use `(o_func.closure)(...)` if you meant to call the function stored in the `closure` field @@ -37,7 +37,7 @@ error[E0599]: no method named `boxed_closure` found for type `BoxedObj` in the c LL | struct BoxedObj { | --------------- method `boxed_closure` not found for this ... -LL | boxed_fn.boxed_closure();//~ ERROR no method named `boxed_closure` found +LL | boxed_fn.boxed_closure(); | ^^^^^^^^^^^^^ field, not a method | = help: use `(boxed_fn.boxed_closure)(...)` if you meant to call the function stored in the `boxed_closure` field @@ -48,7 +48,7 @@ error[E0599]: no method named `boxed_closure` found for type `BoxedObj` in the c LL | struct BoxedObj { | --------------- method `boxed_closure` not found for this ... -LL | boxed_closure.boxed_closure();//~ ERROR no method named `boxed_closure` found +LL | boxed_closure.boxed_closure(); | ^^^^^^^^^^^^^ field, not a method | = help: use `(boxed_closure.boxed_closure)(...)` if you meant to call the function stored in the `boxed_closure` field @@ -59,7 +59,7 @@ error[E0599]: no method named `closure` found for type `Obj u32 {func}>` LL | struct Obj where F: FnOnce() -> u32 { | -------------------------------------- method `closure` not found for this ... -LL | w.wrap.closure();//~ ERROR no method named `closure` found +LL | w.wrap.closure(); | ^^^^^^^ field, not a method | = help: use `(w.wrap.closure)(...)` if you meant to call the function stored in the `closure` field @@ -81,7 +81,7 @@ error[E0599]: no method named `closure` found for type `Obj where F: FnOnce() -> u32 { | -------------------------------------- method `closure` not found for this ... -LL | check_expression().closure();//~ ERROR no method named `closure` found +LL | check_expression().closure(); | ^^^^^^^ field, not a method | = help: use `(check_expression().closure)(...)` if you meant to call the function stored in the `closure` field @@ -92,7 +92,7 @@ error[E0599]: no method named `f1` found for type `FuncContainer` in the current LL | struct FuncContainer { | -------------------- method `f1` not found for this ... -LL | (*self.container).f1(1); //~ ERROR no method named `f1` found +LL | (*self.container).f1(1); | ^^ field, not a method | = help: use `((*self.container).f1)(...)` if you meant to call the function stored in the `f1` field @@ -103,7 +103,7 @@ error[E0599]: no method named `f2` found for type `FuncContainer` in the current LL | struct FuncContainer { | -------------------- method `f2` not found for this ... -LL | (*self.container).f2(1); //~ ERROR no method named `f2` found +LL | (*self.container).f2(1); | ^^ field, not a method | = help: use `((*self.container).f2)(...)` if you meant to call the function stored in the `f2` field @@ -114,7 +114,7 @@ error[E0599]: no method named `f3` found for type `FuncContainer` in the current LL | struct FuncContainer { | -------------------- method `f3` not found for this ... -LL | (*self.container).f3(1); //~ ERROR no method named `f3` found +LL | (*self.container).f3(1); | ^^ field, not a method | = help: use `((*self.container).f3)(...)` if you meant to call the function stored in the `f3` field diff --git a/src/test/ui/confuse-field-and-method/issue-33784.stderr b/src/test/ui/confuse-field-and-method/issue-33784.stderr index 73bcf0fd9c07..cce961f1e4ed 100644 --- a/src/test/ui/confuse-field-and-method/issue-33784.stderr +++ b/src/test/ui/confuse-field-and-method/issue-33784.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `closure` found for type `&Obj<[closure@$DIR/issue-33784.rs:25:43: 25:48]>` in the current scope --> $DIR/issue-33784.rs:27:7 | -LL | p.closure(); //~ ERROR no method named `closure` found +LL | p.closure(); | ^^^^^^^ field, not a method | = help: use `(p.closure)(...)` if you meant to call the function stored in the `closure` field @@ -9,7 +9,7 @@ LL | p.closure(); //~ ERROR no method named `closure` found error[E0599]: no method named `fn_ptr` found for type `&&Obj<[closure@$DIR/issue-33784.rs:25:43: 25:48]>` in the current scope --> $DIR/issue-33784.rs:29:7 | -LL | q.fn_ptr(); //~ ERROR no method named `fn_ptr` found +LL | q.fn_ptr(); | ^^^^^^ field, not a method | = help: use `(q.fn_ptr)(...)` if you meant to call the function stored in the `fn_ptr` field @@ -17,7 +17,7 @@ LL | q.fn_ptr(); //~ ERROR no method named `fn_ptr` found error[E0599]: no method named `c_fn_ptr` found for type `&D` in the current scope --> $DIR/issue-33784.rs:32:7 | -LL | s.c_fn_ptr(); //~ ERROR no method named `c_fn_ptr` found +LL | s.c_fn_ptr(); | ^^^^^^^^ field, not a method | = help: use `(s.c_fn_ptr)(...)` if you meant to call the function stored in the `c_fn_ptr` field diff --git a/src/test/ui/confuse-field-and-method/private-field.stderr b/src/test/ui/confuse-field-and-method/private-field.stderr index e3058ad0a9ea..97c949e32e34 100644 --- a/src/test/ui/confuse-field-and-method/private-field.stderr +++ b/src/test/ui/confuse-field-and-method/private-field.stderr @@ -4,7 +4,7 @@ error[E0599]: no method named `dog_age` found for type `animal::Dog` in the curr LL | pub struct Dog { | -------------- method `dog_age` not found for this ... -LL | let dog_age = dog.dog_age(); //~ ERROR no method +LL | let dog_age = dog.dog_age(); | ^^^^^^^ private field, not a method error: aborting due to previous error diff --git a/src/test/ui/const-generics/const-expression-parameter.rs b/src/test/ui/const-generics/const-expression-parameter.rs index f4e9008dbd0f..662c7b767bae 100644 --- a/src/test/ui/const-generics/const-expression-parameter.rs +++ b/src/test/ui/const-generics/const-expression-parameter.rs @@ -1,23 +1,22 @@ #![feature(const_generics)] //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash -fn u32_identity() -> u32 { - //~^ ERROR const generics in any position are currently unsupported +fn i32_identity() -> i32 { 5 } fn foo_a() { - u32_identity::<-1>(); //~ ERROR expected identifier, found `<-` + i32_identity::<-1>(); //~ ERROR expected identifier, found `<-` } fn foo_b() { - u32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+` + i32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+` } fn foo_c() { - u32_identity::< -1 >(); // ok + i32_identity::< -1 >(); // ok } fn main() { - u32_identity::<5>(); // ok + i32_identity::<5>(); // ok } diff --git a/src/test/ui/const-generics/const-expression-parameter.stderr b/src/test/ui/const-generics/const-expression-parameter.stderr index 1dd3a960316d..2f7a80f0c8fd 100644 --- a/src/test/ui/const-generics/const-expression-parameter.stderr +++ b/src/test/ui/const-generics/const-expression-parameter.stderr @@ -1,13 +1,13 @@ error: expected identifier, found `<-` - --> $DIR/const-expression-parameter.rs:10:19 + --> $DIR/const-expression-parameter.rs:9:19 | -LL | u32_identity::<-1>(); //~ ERROR expected identifier, found `<-` +LL | i32_identity::<-1>(); | ^^ expected identifier error: expected one of `,` or `>`, found `+` - --> $DIR/const-expression-parameter.rs:14:22 + --> $DIR/const-expression-parameter.rs:13:22 | -LL | u32_identity::<1 + 2>(); //~ ERROR expected one of `,` or `>`, found `+` +LL | i32_identity::<1 + 2>(); | ^ expected one of `,` or `>` here warning: the feature `const_generics` is incomplete and may cause the compiler to crash @@ -16,11 +16,5 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t LL | #![feature(const_generics)] | ^^^^^^^^^^^^^^ -error: const generics in any position are currently unsupported - --> $DIR/const-expression-parameter.rs:4:23 - | -LL | fn u32_identity() -> u32 { - | ^ - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/const-fn-with-const-param.rs b/src/test/ui/const-generics/const-fn-with-const-param.rs index 052d723d96ed..f36bf3875c34 100644 --- a/src/test/ui/const-generics/const-fn-with-const-param.rs +++ b/src/test/ui/const-generics/const-fn-with-const-param.rs @@ -3,7 +3,6 @@ const fn const_u32_identity() -> u32 { //~^ ERROR const parameters are not permitted in `const fn` - //~^^ ERROR const generics in any position are currently unsupported X } diff --git a/src/test/ui/const-generics/const-fn-with-const-param.stderr b/src/test/ui/const-generics/const-fn-with-const-param.stderr index a08ebfb0d976..c0cd7bace471 100644 --- a/src/test/ui/const-generics/const-fn-with-const-param.stderr +++ b/src/test/ui/const-generics/const-fn-with-const-param.stderr @@ -8,17 +8,10 @@ error: const parameters are not permitted in `const fn` --> $DIR/const-fn-with-const-param.rs:4:1 | LL | / const fn const_u32_identity() -> u32 { -LL | | //~^ ERROR const parameters are not permitted in `const fn` -LL | | //~^^ ERROR const generics in any position are currently unsupported +LL | | LL | | X LL | | } | |_^ -error: const generics in any position are currently unsupported - --> $DIR/const-fn-with-const-param.rs:4:35 - | -LL | const fn const_u32_identity() -> u32 { - | ^ - -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/src/test/ui/const-generics/const-param-before-other-params.rs b/src/test/ui/const-generics/const-param-before-other-params.rs index 47f826789e03..188b5dce31ea 100644 --- a/src/test/ui/const-generics/const-param-before-other-params.rs +++ b/src/test/ui/const-generics/const-param-before-other-params.rs @@ -1,14 +1,12 @@ #![feature(const_generics)] //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash -fn foo(_: T) { +fn foo(_: &T) { //~^ ERROR type parameters must be declared prior to const parameters - //~^^ ERROR const generics in any position are currently unsupported } fn bar(_: &'a ()) { //~^ ERROR lifetime parameters must be declared prior to const parameters - //~^^ ERROR const generics in any position are currently unsupported } fn main() {} diff --git a/src/test/ui/const-generics/const-param-before-other-params.stderr b/src/test/ui/const-generics/const-param-before-other-params.stderr index a43415d0e5a4..78f129e79ea2 100644 --- a/src/test/ui/const-generics/const-param-before-other-params.stderr +++ b/src/test/ui/const-generics/const-param-before-other-params.stderr @@ -7,26 +7,14 @@ LL | #![feature(const_generics)] error: type parameters must be declared prior to const parameters --> $DIR/const-param-before-other-params.rs:4:21 | -LL | fn foo(_: T) { +LL | fn foo(_: &T) { | --------------^- help: reorder the parameters: lifetimes, then types, then consts: `` error: lifetime parameters must be declared prior to const parameters - --> $DIR/const-param-before-other-params.rs:9:21 + --> $DIR/const-param-before-other-params.rs:8:21 | LL | fn bar(_: &'a ()) { | --------------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, const X: ()>` -error: const generics in any position are currently unsupported - --> $DIR/const-param-before-other-params.rs:4:14 - | -LL | fn foo(_: T) { - | ^ - -error: const generics in any position are currently unsupported - --> $DIR/const-param-before-other-params.rs:9:14 - | -LL | fn bar(_: &'a ()) { - | ^ - -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/const-param-from-outer-fn.rs b/src/test/ui/const-generics/const-param-from-outer-fn.rs index 5a8dd92086f8..6534bcf5ce64 100644 --- a/src/test/ui/const-generics/const-param-from-outer-fn.rs +++ b/src/test/ui/const-generics/const-param-from-outer-fn.rs @@ -2,7 +2,6 @@ //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash fn foo() { - //~^ ERROR const generics in any position are currently unsupported fn bar() -> u32 { X //~ ERROR can't use generic parameters from outer function } diff --git a/src/test/ui/const-generics/const-param-from-outer-fn.stderr b/src/test/ui/const-generics/const-param-from-outer-fn.stderr index b238b3a2aa45..e37b34fac335 100644 --- a/src/test/ui/const-generics/const-param-from-outer-fn.stderr +++ b/src/test/ui/const-generics/const-param-from-outer-fn.stderr @@ -5,22 +5,15 @@ LL | #![feature(const_generics)] | ^^^^^^^^^^^^^^ error[E0401]: can't use generic parameters from outer function - --> $DIR/const-param-from-outer-fn.rs:7:9 + --> $DIR/const-param-from-outer-fn.rs:6:9 | LL | fn foo() { | - const variable from outer function -LL | //~^ ERROR const generics in any position are currently unsupported LL | fn bar() -> u32 { | --- try adding a local generic parameter in this method instead -LL | X //~ ERROR can't use generic parameters from outer function +LL | X | ^ use of generic parameter from outer function -error: const generics in any position are currently unsupported - --> $DIR/const-param-from-outer-fn.rs:4:14 - | -LL | fn foo() { - | ^ - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0401`. diff --git a/src/test/ui/const-generics/const-parameter-uppercase-lint.rs b/src/test/ui/const-generics/const-parameter-uppercase-lint.rs index 37fe9af98b3d..164205dd75cb 100644 --- a/src/test/ui/const-generics/const-parameter-uppercase-lint.rs +++ b/src/test/ui/const-generics/const-parameter-uppercase-lint.rs @@ -4,5 +4,7 @@ #![deny(non_upper_case_globals)] fn noop() { - //~^ ERROR const generics in any position are currently unsupported + //~^ ERROR const parameter `x` should have an upper case name } + +fn main() {} diff --git a/src/test/ui/const-generics/const-parameter-uppercase-lint.stderr b/src/test/ui/const-generics/const-parameter-uppercase-lint.stderr index 9683e91cef30..190798d202be 100644 --- a/src/test/ui/const-generics/const-parameter-uppercase-lint.stderr +++ b/src/test/ui/const-generics/const-parameter-uppercase-lint.stderr @@ -4,16 +4,17 @@ warning: the feature `const_generics` is incomplete and may cause the compiler t LL | #![feature(const_generics)] | ^^^^^^^^^^^^^^ -error[E0601]: `main` function not found in crate `const_parameter_uppercase_lint` - | - = note: consider adding a `main` function to `$DIR/const-parameter-uppercase-lint.rs` - -error: const generics in any position are currently unsupported +error: const parameter `x` should have an upper case name --> $DIR/const-parameter-uppercase-lint.rs:6:15 | LL | fn noop() { - | ^ + | ^ help: convert the identifier to upper case: `X` + | +note: lint level defined here + --> $DIR/const-parameter-uppercase-lint.rs:4:9 + | +LL | #![deny(non_upper_case_globals)] + | ^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0601`. diff --git a/src/test/ui/const-generics/invalid-constant-in-args.rs b/src/test/ui/const-generics/invalid-constant-in-args.rs new file mode 100644 index 000000000000..40df237ee72e --- /dev/null +++ b/src/test/ui/const-generics/invalid-constant-in-args.rs @@ -0,0 +1,3 @@ +fn main() { + let _: Vec<&str, "a"> = Vec::new(); //~ ERROR wrong number of const arguments +} diff --git a/src/test/ui/const-generics/invalid-constant-in-args.stderr b/src/test/ui/const-generics/invalid-constant-in-args.stderr new file mode 100644 index 000000000000..b9f874ff18bb --- /dev/null +++ b/src/test/ui/const-generics/invalid-constant-in-args.stderr @@ -0,0 +1,9 @@ +error[E0107]: wrong number of const arguments: expected 0, found 1 + --> $DIR/invalid-constant-in-args.rs:2:22 + | +LL | let _: Vec<&str, "a"> = Vec::new(); + | ^^^ unexpected const argument + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0107`. diff --git a/src/test/ui/consts/const-array-oob-arith.stderr b/src/test/ui/consts/const-array-oob-arith.stderr index edd3095b0fc7..00286b0b0e0f 100644 --- a/src/test/ui/consts/const-array-oob-arith.stderr +++ b/src/test/ui/consts/const-array-oob-arith.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/const-array-oob-arith.rs:7:45 | -LL | const BLUB: [i32; (ARR[0] - 40) as usize] = [5]; //~ ERROR: mismatched types +LL | const BLUB: [i32; (ARR[0] - 40) as usize] = [5]; | ^^^ expected an array with a fixed size of 2 elements, found one with 1 elements | = note: expected type `[i32; 2]` @@ -10,7 +10,7 @@ LL | const BLUB: [i32; (ARR[0] - 40) as usize] = [5]; //~ ERROR: mismatched type error[E0308]: mismatched types --> $DIR/const-array-oob-arith.rs:8:44 | -LL | const BOO: [i32; (ARR[0] - 41) as usize] = [5, 99]; //~ ERROR: mismatched types +LL | const BOO: [i32; (ARR[0] - 41) as usize] = [5, 99]; | ^^^^^^^ expected an array with a fixed size of 1 elements, found one with 2 elements | = note: expected type `[i32; 1]` diff --git a/src/test/ui/consts/const-cast-different-types.stderr b/src/test/ui/consts/const-cast-different-types.stderr index ced9b9fb3c7c..9960ccb4166b 100644 --- a/src/test/ui/consts/const-cast-different-types.stderr +++ b/src/test/ui/consts/const-cast-different-types.stderr @@ -1,13 +1,13 @@ error[E0606]: casting `&'static str` as `*const u8` is invalid --> $DIR/const-cast-different-types.rs:2:23 | -LL | static b: *const u8 = a as *const u8; //~ ERROR casting +LL | static b: *const u8 = a as *const u8; | ^^^^^^^^^^^^^^ error[E0606]: casting `&&'static str` as `*const u8` is invalid --> $DIR/const-cast-different-types.rs:3:23 | -LL | static c: *const u8 = &a as *const u8; //~ ERROR casting +LL | static c: *const u8 = &a as *const u8; | ^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/consts/const-cast-wrong-type.stderr b/src/test/ui/consts/const-cast-wrong-type.stderr index 7684822d9393..ad816d9297bd 100644 --- a/src/test/ui/consts/const-cast-wrong-type.stderr +++ b/src/test/ui/consts/const-cast-wrong-type.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/const-cast-wrong-type.rs:2:23 | -LL | static b: *const i8 = &a as *const i8; //~ ERROR mismatched types +LL | static b: *const i8 = &a as *const i8; | ^^^^^^^^^^^^^^^ expected u8, found i8 error: aborting due to previous error diff --git a/src/test/ui/consts/const-err-early.stderr b/src/test/ui/consts/const-err-early.stderr index a64f0e259495..a61f9b303aa1 100644 --- a/src/test/ui/consts/const-err-early.stderr +++ b/src/test/ui/consts/const-err-early.stderr @@ -1,7 +1,7 @@ error: any use of this value will cause an error --> $DIR/const-err-early.rs:3:1 | -LL | pub const A: i8 = -std::i8::MIN; //~ ERROR const_err +LL | pub const A: i8 = -std::i8::MIN; | ^^^^^^^^^^^^^^^^^^-------------^ | | | attempt to negate with overflow @@ -15,7 +15,7 @@ LL | #![deny(const_err)] error: any use of this value will cause an error --> $DIR/const-err-early.rs:4:1 | -LL | pub const B: u8 = 200u8 + 200u8; //~ ERROR const_err +LL | pub const B: u8 = 200u8 + 200u8; | ^^^^^^^^^^^^^^^^^^-------------^ | | | attempt to add with overflow @@ -23,7 +23,7 @@ LL | pub const B: u8 = 200u8 + 200u8; //~ ERROR const_err error: any use of this value will cause an error --> $DIR/const-err-early.rs:5:1 | -LL | pub const C: u8 = 200u8 * 4; //~ ERROR const_err +LL | pub const C: u8 = 200u8 * 4; | ^^^^^^^^^^^^^^^^^^---------^ | | | attempt to multiply with overflow @@ -31,7 +31,7 @@ LL | pub const C: u8 = 200u8 * 4; //~ ERROR const_err error: any use of this value will cause an error --> $DIR/const-err-early.rs:6:1 | -LL | pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR const_err +LL | pub const D: u8 = 42u8 - (42u8 + 1); | ^^^^^^^^^^^^^^^^^^-----------------^ | | | attempt to subtract with overflow @@ -39,7 +39,7 @@ LL | pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR const_err error: any use of this value will cause an error --> $DIR/const-err-early.rs:7:1 | -LL | pub const E: u8 = [5u8][1]; //~ ERROR const_err +LL | pub const E: u8 = [5u8][1]; | ^^^^^^^^^^^^^^^^^^--------^ | | | index out of bounds: the len is 1 but the index is 1 diff --git a/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.stderr b/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.stderr index be1be6c06007..148b1210d39e 100644 --- a/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.stderr +++ b/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.stderr @@ -1,7 +1,7 @@ error[E0019]: static contains unimplemented expression type --> $DIR/assign-to-static-within-other-static-2.rs:16:5 | -LL | *FOO.0.get() = 5; //~ ERROR contains unimplemented expression type +LL | *FOO.0.get() = 5; | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/consts/const-eval/assign-to-static-within-other-static.stderr b/src/test/ui/consts/const-eval/assign-to-static-within-other-static.stderr index 31e49dc10ca6..02b72765b377 100644 --- a/src/test/ui/consts/const-eval/assign-to-static-within-other-static.stderr +++ b/src/test/ui/consts/const-eval/assign-to-static-within-other-static.stderr @@ -1,7 +1,7 @@ error: cannot mutate statics in the initializer of another static --> $DIR/assign-to-static-within-other-static.rs:10:5 | -LL | FOO = 5; //~ ERROR cannot mutate statics in the initializer of another static +LL | FOO = 5; | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2.stderr b/src/test/ui/consts/const-eval/const-eval-overflow2.stderr index 5ec2a2feb097..44ee8b336c89 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow2.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow2.stderr @@ -1,7 +1,7 @@ error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:14:1 | -LL | / const VALS_I8: (i8,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_I8: (i8,) = LL | | ( LL | | i8::MIN - 1, | | ----------- attempt to subtract with overflow @@ -17,7 +17,7 @@ LL | #![deny(const_err)] error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:19:1 | -LL | / const VALS_I16: (i16,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_I16: (i16,) = LL | | ( LL | | i16::MIN - 1, | | ------------ attempt to subtract with overflow @@ -27,7 +27,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:24:1 | -LL | / const VALS_I32: (i32,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_I32: (i32,) = LL | | ( LL | | i32::MIN - 1, | | ------------ attempt to subtract with overflow @@ -37,7 +37,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:29:1 | -LL | / const VALS_I64: (i64,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_I64: (i64,) = LL | | ( LL | | i64::MIN - 1, | | ------------ attempt to subtract with overflow @@ -47,7 +47,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:34:1 | -LL | / const VALS_U8: (u8,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_U8: (u8,) = LL | | ( LL | | u8::MIN - 1, | | ----------- attempt to subtract with overflow @@ -57,7 +57,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:39:1 | -LL | / const VALS_U16: (u16,) = ( //~ ERROR any use of this value will cause an error +LL | / const VALS_U16: (u16,) = ( LL | | u16::MIN - 1, | | ------------ attempt to subtract with overflow LL | | ); @@ -66,7 +66,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:43:1 | -LL | / const VALS_U32: (u32,) = ( //~ ERROR any use of this value will cause an error +LL | / const VALS_U32: (u32,) = ( LL | | u32::MIN - 1, | | ------------ attempt to subtract with overflow LL | | ); @@ -75,7 +75,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2.rs:47:1 | -LL | / const VALS_U64: (u64,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_U64: (u64,) = LL | | ( LL | | u64::MIN - 1, | | ------------ attempt to subtract with overflow diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr b/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr index 7866b6c30c3d..69e165bef4a7 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr @@ -1,7 +1,7 @@ error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:14:1 | -LL | / const VALS_I8: (i8,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_I8: (i8,) = LL | | ( LL | | i8::MAX + 1, | | ----------- attempt to add with overflow @@ -17,7 +17,7 @@ LL | #![deny(const_err)] error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:19:1 | -LL | / const VALS_I16: (i16,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_I16: (i16,) = LL | | ( LL | | i16::MAX + 1, | | ------------ attempt to add with overflow @@ -27,7 +27,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:24:1 | -LL | / const VALS_I32: (i32,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_I32: (i32,) = LL | | ( LL | | i32::MAX + 1, | | ------------ attempt to add with overflow @@ -37,7 +37,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:29:1 | -LL | / const VALS_I64: (i64,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_I64: (i64,) = LL | | ( LL | | i64::MAX + 1, | | ------------ attempt to add with overflow @@ -47,7 +47,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:34:1 | -LL | / const VALS_U8: (u8,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_U8: (u8,) = LL | | ( LL | | u8::MAX + 1, | | ----------- attempt to add with overflow @@ -57,7 +57,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:39:1 | -LL | / const VALS_U16: (u16,) = ( //~ ERROR any use of this value will cause an error +LL | / const VALS_U16: (u16,) = ( LL | | u16::MAX + 1, | | ------------ attempt to add with overflow LL | | ); @@ -66,7 +66,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:43:1 | -LL | / const VALS_U32: (u32,) = ( //~ ERROR any use of this value will cause an error +LL | / const VALS_U32: (u32,) = ( LL | | u32::MAX + 1, | | ------------ attempt to add with overflow LL | | ); @@ -75,7 +75,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2b.rs:47:1 | -LL | / const VALS_U64: (u64,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_U64: (u64,) = LL | | ( LL | | u64::MAX + 1, | | ------------ attempt to add with overflow diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr b/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr index 5370fdd25d82..ba606f6d09de 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr @@ -1,7 +1,7 @@ error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:14:1 | -LL | / const VALS_I8: (i8,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_I8: (i8,) = LL | | ( LL | | i8::MIN * 2, | | ----------- attempt to multiply with overflow @@ -17,7 +17,7 @@ LL | #![deny(const_err)] error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:19:1 | -LL | / const VALS_I16: (i16,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_I16: (i16,) = LL | | ( LL | | i16::MIN * 2, | | ------------ attempt to multiply with overflow @@ -27,7 +27,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:24:1 | -LL | / const VALS_I32: (i32,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_I32: (i32,) = LL | | ( LL | | i32::MIN * 2, | | ------------ attempt to multiply with overflow @@ -37,7 +37,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:29:1 | -LL | / const VALS_I64: (i64,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_I64: (i64,) = LL | | ( LL | | i64::MIN * 2, | | ------------ attempt to multiply with overflow @@ -47,7 +47,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:34:1 | -LL | / const VALS_U8: (u8,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_U8: (u8,) = LL | | ( LL | | u8::MAX * 2, | | ----------- attempt to multiply with overflow @@ -57,7 +57,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:39:1 | -LL | / const VALS_U16: (u16,) = ( //~ ERROR any use of this value will cause an error +LL | / const VALS_U16: (u16,) = ( LL | | u16::MAX * 2, | | ------------ attempt to multiply with overflow LL | | ); @@ -66,7 +66,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:43:1 | -LL | / const VALS_U32: (u32,) = ( //~ ERROR any use of this value will cause an error +LL | / const VALS_U32: (u32,) = ( LL | | u32::MAX * 2, | | ------------ attempt to multiply with overflow LL | | ); @@ -75,7 +75,7 @@ LL | | ); error: any use of this value will cause an error --> $DIR/const-eval-overflow2c.rs:47:1 | -LL | / const VALS_U64: (u64,) = //~ ERROR any use of this value will cause an error +LL | / const VALS_U64: (u64,) = LL | | ( LL | | u64::MAX * 2, | | ------------ attempt to multiply with overflow diff --git a/src/test/ui/consts/const-eval/const_raw_ptr_ops.stderr b/src/test/ui/consts/const-eval/const_raw_ptr_ops.stderr index 6be54c0bad4f..773441182b4b 100644 --- a/src/test/ui/consts/const-eval/const_raw_ptr_ops.stderr +++ b/src/test/ui/consts/const-eval/const_raw_ptr_ops.stderr @@ -1,7 +1,7 @@ error: any use of this value will cause an error --> $DIR/const_raw_ptr_ops.rs:6:1 | -LL | const X: bool = unsafe { &1 as *const i32 == &2 as *const i32 }; //~ ERROR any use of this +LL | const X: bool = unsafe { &1 as *const i32 == &2 as *const i32 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------^^^ | | | "pointer arithmetic or comparison" needs an rfc before being allowed inside constants @@ -11,7 +11,7 @@ LL | const X: bool = unsafe { &1 as *const i32 == &2 as *const i32 }; //~ ERROR error: any use of this value will cause an error --> $DIR/const_raw_ptr_ops.rs:12:1 | -LL | const Y2: usize = unsafe { &1 as *const i32 as usize + 1 }; //~ ERROR any use of this +LL | const Y2: usize = unsafe { &1 as *const i32 as usize + 1 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------------^^^ | | | "pointer arithmetic or comparison" needs an rfc before being allowed inside constants @@ -19,7 +19,7 @@ LL | const Y2: usize = unsafe { &1 as *const i32 as usize + 1 }; //~ ERROR any u error: any use of this value will cause an error --> $DIR/const_raw_ptr_ops.rs:16:1 | -LL | const Z2: i32 = unsafe { *(42 as *const i32) }; //~ ERROR any use of this value will cause +LL | const Z2: i32 = unsafe { *(42 as *const i32) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^-------------------^^^ | | | a memory access tried to interpret some bytes as a pointer @@ -27,7 +27,7 @@ LL | const Z2: i32 = unsafe { *(42 as *const i32) }; //~ ERROR any use of this v error: any use of this value will cause an error --> $DIR/const_raw_ptr_ops.rs:17:1 | -LL | const Z3: i32 = unsafe { *(44 as *const i32) }; //~ ERROR any use of this value will cause +LL | const Z3: i32 = unsafe { *(44 as *const i32) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^-------------------^^^ | | | a memory access tried to interpret some bytes as a pointer diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr index 238db527e388..ca80a9ab3911 100644 --- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr +++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr @@ -1,7 +1,7 @@ error: `foo` is not yet stable as a const fn --> $DIR/dont_promote_unstable_const_fn.rs:15:25 | -LL | const fn bar() -> u32 { foo() } //~ ERROR `foo` is not yet stable as a const fn +LL | const fn bar() -> u32 { foo() } | ^^^^^ | = help: add `#![feature(foo)]` to the crate attributes to enable @@ -9,7 +9,7 @@ LL | const fn bar() -> u32 { foo() } //~ ERROR `foo` is not yet stable as a cons error[E0716]: temporary value dropped while borrowed --> $DIR/dont_promote_unstable_const_fn.rs:18:28 | -LL | let _: &'static u32 = &foo(); //~ ERROR does not live long enough +LL | let _: &'static u32 = &foo(); | ------------ ^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -19,7 +19,7 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/dont_promote_unstable_const_fn.rs:22:28 | -LL | let _: &'static u32 = &meh(); //~ ERROR does not live long enough +LL | let _: &'static u32 = &meh(); | ------------ ^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -34,7 +34,7 @@ LL | let x: &'static _ = &std::time::Duration::from_millis(42).subsec_millis | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | //~^ ERROR does not live long enough +LL | LL | } | - temporary value is freed at the end of this statement diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr index fdbc4cb0c8d2..d79666688fa2 100644 --- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr +++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr @@ -1,7 +1,7 @@ error: `foo` is not yet stable as a const fn --> $DIR/dont_promote_unstable_const_fn.rs:15:25 | -LL | const fn bar() -> u32 { foo() } //~ ERROR `foo` is not yet stable as a const fn +LL | const fn bar() -> u32 { foo() } | ^^^^^ | = help: add `#![feature(foo)]` to the crate attributes to enable @@ -9,7 +9,7 @@ LL | const fn bar() -> u32 { foo() } //~ ERROR `foo` is not yet stable as a cons error[E0597]: borrowed value does not live long enough --> $DIR/dont_promote_unstable_const_fn.rs:18:28 | -LL | let _: &'static u32 = &foo(); //~ ERROR does not live long enough +LL | let _: &'static u32 = &foo(); | ^^^^^ temporary value does not live long enough LL | } | - temporary value only lives until here @@ -19,7 +19,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/dont_promote_unstable_const_fn.rs:22:28 | -LL | let _: &'static u32 = &meh(); //~ ERROR does not live long enough +LL | let _: &'static u32 = &meh(); | ^^^^^ temporary value does not live long enough ... LL | } @@ -32,7 +32,7 @@ error[E0597]: borrowed value does not live long enough | LL | let x: &'static _ = &std::time::Duration::from_millis(42).subsec_millis(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough -LL | //~^ ERROR does not live long enough +LL | LL | } | - temporary value only lives until here | diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr index 4355401987b0..129f06151074 100644 --- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr +++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.nll.stderr @@ -1,18 +1,18 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:8:28 | -LL | let _: &'static u32 = &foo(); //~ ERROR does not live long enough +LL | let _: &'static u32 = &foo(); | ------------ ^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | let _x: &'static u32 = &foo(); //~ ERROR does not live long enough +LL | let _x: &'static u32 = &foo(); LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:9:29 | -LL | let _x: &'static u32 = &foo(); //~ ERROR does not live long enough +LL | let _x: &'static u32 = &foo(); | ------------ ^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr index 8be7add22009..516c008e7206 100644 --- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr +++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr @@ -1,9 +1,9 @@ error[E0597]: borrowed value does not live long enough --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:8:28 | -LL | let _: &'static u32 = &foo(); //~ ERROR does not live long enough +LL | let _: &'static u32 = &foo(); | ^^^^^ temporary value does not live long enough -LL | let _x: &'static u32 = &foo(); //~ ERROR does not live long enough +LL | let _x: &'static u32 = &foo(); LL | } | - temporary value only lives until here | @@ -12,7 +12,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:9:29 | -LL | let _x: &'static u32 = &foo(); //~ ERROR does not live long enough +LL | let _x: &'static u32 = &foo(); | ^^^^^ temporary value does not live long enough LL | } | - temporary value only lives until here diff --git a/src/test/ui/consts/const-eval/double_check2.stderr b/src/test/ui/consts/const-eval/double_check2.stderr index 06b38bf71034..2b61d33852c9 100644 --- a/src/test/ui/consts/const-eval/double_check2.stderr +++ b/src/test/ui/consts/const-eval/double_check2.stderr @@ -1,7 +1,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/double_check2.rs:15:1 | -LL | / static FOO: (&Foo, &Bar) = unsafe {( //~ undefined behavior +LL | / static FOO: (&Foo, &Bar) = unsafe {( LL | | Union { u8: &BAR }.foo, LL | | Union { u8: &BAR }.bar, LL | | )}; diff --git a/src/test/ui/consts/const-eval/feature-gate-const_fn_union.stderr b/src/test/ui/consts/const-eval/feature-gate-const_fn_union.stderr index c562c66389f9..5a72c8205b66 100644 --- a/src/test/ui/consts/const-eval/feature-gate-const_fn_union.stderr +++ b/src/test/ui/consts/const-eval/feature-gate-const_fn_union.stderr @@ -1,7 +1,7 @@ error[E0658]: unions in const fn are unstable (see issue #51909) --> $DIR/feature-gate-const_fn_union.rs:11:5 | -LL | Foo { u }.i //~ ERROR unions in const fn are unstable +LL | Foo { u }.i | ^^^^^^^^^^^ | = help: add #![feature(const_fn_union)] to the crate attributes to enable diff --git a/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr b/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr index 1a9e1b0ae850..ac045f29b110 100644 --- a/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr +++ b/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr @@ -1,7 +1,7 @@ error: index out of bounds: the len is 1 but the index is 1 --> $DIR/index_out_of_bounds_propagated.rs:3:5 | -LL | array[1]; //~ ERROR index out of bounds +LL | array[1]; | ^^^^^^^^ | = note: #[deny(const_err)] on by default diff --git a/src/test/ui/consts/const-eval/infinite_loop.stderr b/src/test/ui/consts/const-eval/infinite_loop.stderr index 422c2bab6ea9..ee696c5439ff 100644 --- a/src/test/ui/consts/const-eval/infinite_loop.stderr +++ b/src/test/ui/consts/const-eval/infinite_loop.stderr @@ -1,9 +1,9 @@ error[E0019]: constant contains unimplemented expression type --> $DIR/infinite_loop.rs:7:9 | -LL | / while n != 0 { //~ ERROR constant contains unimplemented expression type +LL | / while n != 0 { LL | | n = if n % 2 == 0 { n/2 } else { 3*n + 1 }; -LL | | //~^ ERROR evaluation of constant value failed +LL | | LL | | } | |_________^ @@ -12,9 +12,9 @@ warning: Constant evaluating a complex constant, this might take some time | LL | let _ = [(); { | __________________^ -LL | | //~^ WARNING Constant evaluating a complex constant, this might take some time +LL | | LL | | let mut n = 113383; // #20 in https://oeis.org/A006884 -LL | | while n != 0 { //~ ERROR constant contains unimplemented expression type +LL | | while n != 0 { ... | LL | | n LL | | }]; diff --git a/src/test/ui/consts/const-eval/issue-50814-2.stderr b/src/test/ui/consts/const-eval/issue-50814-2.stderr index 7c2cd7c5ca04..29ebc31b634a 100644 --- a/src/test/ui/consts/const-eval/issue-50814-2.stderr +++ b/src/test/ui/consts/const-eval/issue-50814-2.stderr @@ -1,7 +1,7 @@ error: any use of this value will cause an error --> $DIR/issue-50814-2.rs:12:5 | -LL | const BAR: usize = [5, 6, 7][T::BOO]; //~ ERROR any use of this value will cause an error +LL | const BAR: usize = [5, 6, 7][T::BOO]; | ^^^^^^^^^^^^^^^^^^^-----------------^ | | | index out of bounds: the len is 3 but the index is 42 @@ -11,7 +11,7 @@ LL | const BAR: usize = [5, 6, 7][T::BOO]; //~ ERROR any use of this value w error[E0080]: evaluation of constant expression failed --> $DIR/issue-50814-2.rs:16:5 | -LL | & as Foo>::BAR //~ ERROR E0080 +LL | & as Foo>::BAR | ^--------------------- | | | referenced constant has errors diff --git a/src/test/ui/consts/const-eval/issue-50814.stderr b/src/test/ui/consts/const-eval/issue-50814.stderr index 757e55fe31d3..6fbfb4d11fe5 100644 --- a/src/test/ui/consts/const-eval/issue-50814.stderr +++ b/src/test/ui/consts/const-eval/issue-50814.stderr @@ -1,7 +1,7 @@ error: any use of this value will cause an error --> $DIR/issue-50814.rs:13:5 | -LL | const MAX: u8 = A::MAX + B::MAX; //~ ERROR any use of this value will cause an error +LL | const MAX: u8 = A::MAX + B::MAX; | ^^^^^^^^^^^^^^^^---------------^ | | | attempt to add with overflow @@ -11,7 +11,7 @@ LL | const MAX: u8 = A::MAX + B::MAX; //~ ERROR any use of this value will c error[E0080]: evaluation of constant expression failed --> $DIR/issue-50814.rs:17:5 | -LL | &Sum::::MAX //~ ERROR E0080 +LL | &Sum::::MAX | ^----------------- | | | referenced constant has errors diff --git a/src/test/ui/consts/const-eval/issue-52442.stderr b/src/test/ui/consts/const-eval/issue-52442.stderr index 516796c1a42d..2352ecba6895 100644 --- a/src/test/ui/consts/const-eval/issue-52442.stderr +++ b/src/test/ui/consts/const-eval/issue-52442.stderr @@ -1,13 +1,13 @@ error[E0019]: constant contains unimplemented expression type --> $DIR/issue-52442.rs:2:14 | -LL | [(); { &loop { break } as *const _ as usize } ]; //~ ERROR unimplemented expression type +LL | [(); { &loop { break } as *const _ as usize } ]; | ^^^^^^^^^^^^^^ error[E0080]: it is undefined behavior to use this value --> $DIR/issue-52442.rs:2:11 | -LL | [(); { &loop { break } as *const _ as usize } ]; //~ ERROR unimplemented expression type +LL | [(); { &loop { break } as *const _ as usize } ]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior diff --git a/src/test/ui/consts/const-eval/issue-52475.stderr b/src/test/ui/consts/const-eval/issue-52475.stderr index 4f1b2ab4c8f4..605c71d5a6b5 100644 --- a/src/test/ui/consts/const-eval/issue-52475.stderr +++ b/src/test/ui/consts/const-eval/issue-52475.stderr @@ -1,8 +1,8 @@ error[E0019]: constant contains unimplemented expression type --> $DIR/issue-52475.rs:6:9 | -LL | / while n < 5 { //~ ERROR constant contains unimplemented expression type -LL | | n = (n + 1) % 5; //~ ERROR evaluation of constant value failed +LL | / while n < 5 { +LL | | n = (n + 1) % 5; LL | | x = &0; // Materialize a new AllocId LL | | } | |_________^ @@ -12,7 +12,7 @@ warning: Constant evaluating a complex constant, this might take some time | LL | let _ = [(); { | __________________^ -LL | | //~^ WARNING Constant evaluating a complex constant, this might take some time +LL | | LL | | let mut x = &0; LL | | let mut n = 0; ... | @@ -23,7 +23,7 @@ LL | | }]; error[E0080]: evaluation of constant value failed --> $DIR/issue-52475.rs:7:17 | -LL | n = (n + 1) % 5; //~ ERROR evaluation of constant value failed +LL | n = (n + 1) % 5; | ^^^^^^^^^^^ duplicate interpreter state observed here, const evaluation will never terminate error: aborting due to 2 previous errors diff --git a/src/test/ui/consts/const-eval/match-test-ptr-null.stderr b/src/test/ui/consts/const-eval/match-test-ptr-null.stderr index 94615c019fe8..fd5647c9af3d 100644 --- a/src/test/ui/consts/const-eval/match-test-ptr-null.stderr +++ b/src/test/ui/consts/const-eval/match-test-ptr-null.stderr @@ -1,7 +1,7 @@ error[E0658]: casting pointers to integers in constants is unstable (see issue #51910) --> $DIR/match-test-ptr-null.rs:6:15 | -LL | match &1 as *const i32 as usize { //~ ERROR casting pointers to integers in constants +LL | match &1 as *const i32 as usize { | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable @@ -9,13 +9,13 @@ LL | match &1 as *const i32 as usize { //~ ERROR casting pointers to int error[E0019]: constant contains unimplemented expression type --> $DIR/match-test-ptr-null.rs:7:13 | -LL | 0 => 42, //~ ERROR constant contains unimplemented expression type +LL | 0 => 42, | ^ error[E0080]: evaluation of constant value failed --> $DIR/match-test-ptr-null.rs:7:13 | -LL | 0 => 42, //~ ERROR constant contains unimplemented expression type +LL | 0 => 42, | ^ "pointer arithmetic or comparison" needs an rfc before being allowed inside constants error: aborting due to 3 previous errors diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail.nll.stderr b/src/test/ui/consts/const-eval/promoted_const_fn_fail.nll.stderr index a2a71fc2ce36..519ba7d84b08 100644 --- a/src/test/ui/consts/const-eval/promoted_const_fn_fail.nll.stderr +++ b/src/test/ui/consts/const-eval/promoted_const_fn_fail.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/promoted_const_fn_fail.rs:20:27 | -LL | let x: &'static u8 = &(bar() + 1); //~ ERROR does not live long enough +LL | let x: &'static u8 = &(bar() + 1); | ----------- ^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr b/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr index 9316d48ab431..c9a357d0f1bc 100644 --- a/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr +++ b/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/promoted_const_fn_fail.rs:20:27 | -LL | let x: &'static u8 = &(bar() + 1); //~ ERROR does not live long enough +LL | let x: &'static u8 = &(bar() + 1); | ^^^^^^^^^^^ temporary value does not live long enough ... LL | } diff --git a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr index 117090d89fd7..a8bb6976da75 100644 --- a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr +++ b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.nll.stderr @@ -12,7 +12,7 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/promoted_raw_ptr_ops.rs:6:30 | -LL | let y: &'static usize = &(&1 as *const i32 as usize + 1); //~ ERROR does not live long enough +LL | let y: &'static usize = &(&1 as *const i32 as usize + 1); | -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -23,18 +23,18 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/promoted_raw_ptr_ops.rs:7:28 | -LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) }); //~ ERROR does not live long enough +LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) }); | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | let a: &'static bool = &(main as fn() == main as fn()); //~ ERROR does not live long enough +LL | let a: &'static bool = &(main as fn() == main as fn()); LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promoted_raw_ptr_ops.rs:8:29 | -LL | let a: &'static bool = &(main as fn() == main as fn()); //~ ERROR does not live long enough +LL | let a: &'static bool = &(main as fn() == main as fn()); | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr index 9d1dcfafa636..5a0654cc0c13 100644 --- a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr +++ b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr @@ -12,7 +12,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/promoted_raw_ptr_ops.rs:6:30 | -LL | let y: &'static usize = &(&1 as *const i32 as usize + 1); //~ ERROR does not live long enough +LL | let y: &'static usize = &(&1 as *const i32 as usize + 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough ... LL | } @@ -23,9 +23,9 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/promoted_raw_ptr_ops.rs:7:28 | -LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) }); //~ ERROR does not live long enough +LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough -LL | let a: &'static bool = &(main as fn() == main as fn()); //~ ERROR does not live long enough +LL | let a: &'static bool = &(main as fn() == main as fn()); LL | } | - temporary value only lives until here | @@ -34,7 +34,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/promoted_raw_ptr_ops.rs:8:29 | -LL | let a: &'static bool = &(main as fn() == main as fn()); //~ ERROR does not live long enough +LL | let a: &'static bool = &(main as fn() == main as fn()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough LL | } | - temporary value only lives until here diff --git a/src/test/ui/consts/const-eval/ref_to_int_match.stderr b/src/test/ui/consts/const-eval/ref_to_int_match.stderr index 888fe065a625..f8eafed68e43 100644 --- a/src/test/ui/consts/const-eval/ref_to_int_match.stderr +++ b/src/test/ui/consts/const-eval/ref_to_int_match.stderr @@ -1,7 +1,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ref_to_int_match.rs:23:1 | -LL | const BAR: Int = unsafe { Foo { r: &42 }.f }; //~ ERROR it is undefined behavior to use this value +LL | const BAR: Int = unsafe { Foo { r: &42 }.f }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior @@ -9,7 +9,7 @@ LL | const BAR: Int = unsafe { Foo { r: &42 }.f }; //~ ERROR it is undefined beh error: could not evaluate constant pattern --> $DIR/ref_to_int_match.rs:7:14 | -LL | 10..=BAR => {}, //~ ERROR could not evaluate constant pattern +LL | 10..=BAR => {}, | ^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/consts/const-eval/shift_overflow.stderr b/src/test/ui/consts/const-eval/shift_overflow.stderr index e5c34f94d2c5..5db231cd5b0d 100644 --- a/src/test/ui/consts/const-eval/shift_overflow.stderr +++ b/src/test/ui/consts/const-eval/shift_overflow.stderr @@ -1,7 +1,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/shift_overflow.rs:3:9 | -LL | X = 1 << ((u32::max_value() as u64) + 1), //~ ERROR E0080 +LL | X = 1 << ((u32::max_value() as u64) + 1), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to shift left with overflow error: aborting due to previous error diff --git a/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr b/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr index 90fe7eebe4a7..5aae8c12d16e 100644 --- a/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr +++ b/src/test/ui/consts/const-eval/transmute-const-promotion.nll.stderr @@ -5,7 +5,7 @@ LL | let x: &'static u32 = unsafe { &mem::transmute(3.0f32) }; | ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | //~^ ERROR value does not live long enough +LL | LL | } | - temporary value is freed at the end of this statement diff --git a/src/test/ui/consts/const-eval/transmute-const-promotion.stderr b/src/test/ui/consts/const-eval/transmute-const-promotion.stderr index 996e84de06dc..5829a1772d65 100644 --- a/src/test/ui/consts/const-eval/transmute-const-promotion.stderr +++ b/src/test/ui/consts/const-eval/transmute-const-promotion.stderr @@ -3,7 +3,7 @@ error[E0597]: borrowed value does not live long enough | LL | let x: &'static u32 = unsafe { &mem::transmute(3.0f32) }; | ^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough -LL | //~^ ERROR value does not live long enough +LL | LL | } | - temporary value only lives until here | diff --git a/src/test/ui/consts/const-eval/ub-upvars.stderr b/src/test/ui/consts/const-eval/ub-upvars.stderr index d18339f2434a..21d2847db1e8 100644 --- a/src/test/ui/consts/const-eval/ub-upvars.stderr +++ b/src/test/ui/consts/const-eval/ub-upvars.stderr @@ -1,7 +1,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/ub-upvars.rs:6:1 | -LL | / const BAD_UPVAR: &FnOnce() = &{ //~ ERROR it is undefined behavior to use this value +LL | / const BAD_UPVAR: &FnOnce() = &{ LL | | let bad_ref: &'static u16 = unsafe { mem::transmute(0usize) }; LL | | let another_var = 13; LL | | move || { let _ = bad_ref; let _ = another_var; } diff --git a/src/test/ui/consts/const-eval/union-ice.stderr b/src/test/ui/consts/const-eval/union-ice.stderr index 3edc52415717..b25cb8c5aa02 100644 --- a/src/test/ui/consts/const-eval/union-ice.stderr +++ b/src/test/ui/consts/const-eval/union-ice.stderr @@ -1,7 +1,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/union-ice.rs:13:1 | -LL | const FIELD3: Field3 = unsafe { UNION.field3 }; //~ ERROR it is undefined behavior to use this value +LL | const FIELD3: Field3 = unsafe { UNION.field3 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected initialized plain (non-pointer) bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior @@ -9,7 +9,7 @@ LL | const FIELD3: Field3 = unsafe { UNION.field3 }; //~ ERROR it is undefined b error[E0080]: it is undefined behavior to use this value --> $DIR/union-ice.rs:15:1 | -LL | / const FIELD_PATH: Struct = Struct { //~ ERROR it is undefined behavior to use this value +LL | / const FIELD_PATH: Struct = Struct { LL | | a: 42, LL | | b: unsafe { UNION.field3 }, LL | | }; @@ -20,7 +20,7 @@ LL | | }; error[E0080]: it is undefined behavior to use this value --> $DIR/union-ice.rs:25:1 | -LL | / const FIELD_PATH2: Struct2 = Struct2 { //~ ERROR it is undefined behavior to use this value +LL | / const FIELD_PATH2: Struct2 = Struct2 { LL | | b: [ LL | | 21, LL | | unsafe { UNION.field3 }, diff --git a/src/test/ui/consts/const-eval/union_promotion.nll.stderr b/src/test/ui/consts/const-eval/union_promotion.nll.stderr index 11bc7f9da35f..b530c02f2fb9 100644 --- a/src/test/ui/consts/const-eval/union_promotion.nll.stderr +++ b/src/test/ui/consts/const-eval/union_promotion.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/union_promotion.rs:9:29 | -LL | let x: &'static bool = &unsafe { //~ borrowed value does not live long enough +LL | let x: &'static bool = &unsafe { | ____________-------------____^ | | | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/const-eval/union_promotion.stderr b/src/test/ui/consts/const-eval/union_promotion.stderr index 643c784ca08f..c60f67181832 100644 --- a/src/test/ui/consts/const-eval/union_promotion.stderr +++ b/src/test/ui/consts/const-eval/union_promotion.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/union_promotion.rs:9:29 | -LL | let x: &'static bool = &unsafe { //~ borrowed value does not live long enough +LL | let x: &'static bool = &unsafe { | _____________________________^ LL | | Foo { a: &1 }.b == Foo { a: &2 }.b LL | | }; diff --git a/src/test/ui/consts/const-fn-not-safe-for-const.stderr b/src/test/ui/consts/const-fn-not-safe-for-const.stderr index 2003b137c272..a5e48074f704 100644 --- a/src/test/ui/consts/const-fn-not-safe-for-const.stderr +++ b/src/test/ui/consts/const-fn-not-safe-for-const.stderr @@ -1,7 +1,7 @@ error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants --> $DIR/const-fn-not-safe-for-const.rs:14:5 | -LL | random() //~ ERROR E0015 +LL | random() | ^^^^^^^^ error[E0013]: constant functions cannot refer to statics, use a constant instead diff --git a/src/test/ui/consts/const-int-conversion.nll.stderr b/src/test/ui/consts/const-int-conversion.nll.stderr index afc051013ed7..65330e282c96 100644 --- a/src/test/ui/consts/const-int-conversion.nll.stderr +++ b/src/test/ui/consts/const-int-conversion.nll.stderr @@ -71,7 +71,7 @@ LL | let d: &'static [u8] = &(i32::min_value().to_be().to_ne_bytes()); | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | //~^ ERROR does not live long enough +LL | LL | } | - temporary value is freed at the end of this statement diff --git a/src/test/ui/consts/const-int-conversion.stderr b/src/test/ui/consts/const-int-conversion.stderr index b216d41727b5..ddb1a75f1b75 100644 --- a/src/test/ui/consts/const-int-conversion.stderr +++ b/src/test/ui/consts/const-int-conversion.stderr @@ -69,7 +69,7 @@ error[E0597]: borrowed value does not live long enough | LL | let d: &'static [u8] = &(i32::min_value().to_be().to_ne_bytes()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough -LL | //~^ ERROR does not live long enough +LL | LL | } | - temporary value only lives until here | diff --git a/src/test/ui/consts/const-int-overflowing.nll.stderr b/src/test/ui/consts/const-int-overflowing.nll.stderr index ffcac69c1af8..bd061ab33318 100644 --- a/src/test/ui/consts/const-int-overflowing.nll.stderr +++ b/src/test/ui/consts/const-int-overflowing.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-overflowing.rs:2:36 | -LL | let x: &'static (i32, bool) = &(5_i32.overflowing_add(3)); //~ ERROR does not live long enough +LL | let x: &'static (i32, bool) = &(5_i32.overflowing_add(3)); | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -12,18 +12,18 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-overflowing.rs:3:36 | -LL | let y: &'static (i32, bool) = &(5_i32.overflowing_sub(3)); //~ ERROR does not live long enough +LL | let y: &'static (i32, bool) = &(5_i32.overflowing_sub(3)); | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); //~ ERROR does not live long enough +LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-overflowing.rs:4:36 | -LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); //~ ERROR does not live long enough +LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/const-int-overflowing.stderr b/src/test/ui/consts/const-int-overflowing.stderr index 736909e09322..7228b5dbd4bf 100644 --- a/src/test/ui/consts/const-int-overflowing.stderr +++ b/src/test/ui/consts/const-int-overflowing.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/const-int-overflowing.rs:2:36 | -LL | let x: &'static (i32, bool) = &(5_i32.overflowing_add(3)); //~ ERROR does not live long enough +LL | let x: &'static (i32, bool) = &(5_i32.overflowing_add(3)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough ... LL | } @@ -12,9 +12,9 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/const-int-overflowing.rs:3:36 | -LL | let y: &'static (i32, bool) = &(5_i32.overflowing_sub(3)); //~ ERROR does not live long enough +LL | let y: &'static (i32, bool) = &(5_i32.overflowing_sub(3)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough -LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); //~ ERROR does not live long enough +LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); LL | } | - temporary value only lives until here | @@ -23,7 +23,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/const-int-overflowing.rs:4:36 | -LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); //~ ERROR does not live long enough +LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough LL | } | - temporary value only lives until here diff --git a/src/test/ui/consts/const-int-rotate.nll.stderr b/src/test/ui/consts/const-int-rotate.nll.stderr index 9923096f46d6..2b7cdf5746ed 100644 --- a/src/test/ui/consts/const-int-rotate.nll.stderr +++ b/src/test/ui/consts/const-int-rotate.nll.stderr @@ -1,18 +1,18 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-rotate.rs:2:28 | -LL | let x: &'static i32 = &(5_i32.rotate_left(3)); //~ ERROR does not live long enough +LL | let x: &'static i32 = &(5_i32.rotate_left(3)); | ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | let y: &'static i32 = &(5_i32.rotate_right(3)); //~ ERROR does not live long enough +LL | let y: &'static i32 = &(5_i32.rotate_right(3)); LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-rotate.rs:3:28 | -LL | let y: &'static i32 = &(5_i32.rotate_right(3)); //~ ERROR does not live long enough +LL | let y: &'static i32 = &(5_i32.rotate_right(3)); | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/const-int-rotate.stderr b/src/test/ui/consts/const-int-rotate.stderr index c15727961f9f..ec08e0a3f57d 100644 --- a/src/test/ui/consts/const-int-rotate.stderr +++ b/src/test/ui/consts/const-int-rotate.stderr @@ -1,9 +1,9 @@ error[E0597]: borrowed value does not live long enough --> $DIR/const-int-rotate.rs:2:28 | -LL | let x: &'static i32 = &(5_i32.rotate_left(3)); //~ ERROR does not live long enough +LL | let x: &'static i32 = &(5_i32.rotate_left(3)); | ^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough -LL | let y: &'static i32 = &(5_i32.rotate_right(3)); //~ ERROR does not live long enough +LL | let y: &'static i32 = &(5_i32.rotate_right(3)); LL | } | - temporary value only lives until here | @@ -12,7 +12,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/const-int-rotate.rs:3:28 | -LL | let y: &'static i32 = &(5_i32.rotate_right(3)); //~ ERROR does not live long enough +LL | let y: &'static i32 = &(5_i32.rotate_right(3)); | ^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough LL | } | - temporary value only lives until here diff --git a/src/test/ui/consts/const-int-sign.nll.stderr b/src/test/ui/consts/const-int-sign.nll.stderr index 43fd002ff3a6..0ad7a39d5955 100644 --- a/src/test/ui/consts/const-int-sign.nll.stderr +++ b/src/test/ui/consts/const-int-sign.nll.stderr @@ -1,18 +1,18 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-sign.rs:2:29 | -LL | let x: &'static bool = &(5_i32.is_negative()); //~ ERROR does not live long enough +LL | let x: &'static bool = &(5_i32.is_negative()); | ------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | let y: &'static bool = &(5_i32.is_positive()); //~ ERROR does not live long enough +LL | let y: &'static bool = &(5_i32.is_positive()); LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-sign.rs:3:29 | -LL | let y: &'static bool = &(5_i32.is_positive()); //~ ERROR does not live long enough +LL | let y: &'static bool = &(5_i32.is_positive()); | ------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/const-int-sign.stderr b/src/test/ui/consts/const-int-sign.stderr index 5a9a23af9d65..ffe09a0cfec0 100644 --- a/src/test/ui/consts/const-int-sign.stderr +++ b/src/test/ui/consts/const-int-sign.stderr @@ -1,9 +1,9 @@ error[E0597]: borrowed value does not live long enough --> $DIR/const-int-sign.rs:2:29 | -LL | let x: &'static bool = &(5_i32.is_negative()); //~ ERROR does not live long enough +LL | let x: &'static bool = &(5_i32.is_negative()); | ^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough -LL | let y: &'static bool = &(5_i32.is_positive()); //~ ERROR does not live long enough +LL | let y: &'static bool = &(5_i32.is_positive()); LL | } | - temporary value only lives until here | @@ -12,7 +12,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/const-int-sign.rs:3:29 | -LL | let y: &'static bool = &(5_i32.is_positive()); //~ ERROR does not live long enough +LL | let y: &'static bool = &(5_i32.is_positive()); | ^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough LL | } | - temporary value only lives until here diff --git a/src/test/ui/consts/const-int-wrapping.nll.stderr b/src/test/ui/consts/const-int-wrapping.nll.stderr index 036c8b9d95e1..a186854ce0cb 100644 --- a/src/test/ui/consts/const-int-wrapping.nll.stderr +++ b/src/test/ui/consts/const-int-wrapping.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-wrapping.rs:2:28 | -LL | let x: &'static i32 = &(5_i32.wrapping_add(3)); //~ ERROR does not live long enough +LL | let x: &'static i32 = &(5_i32.wrapping_add(3)); | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -12,7 +12,7 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-wrapping.rs:3:28 | -LL | let y: &'static i32 = &(5_i32.wrapping_sub(3)); //~ ERROR does not live long enough +LL | let y: &'static i32 = &(5_i32.wrapping_sub(3)); | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -23,7 +23,7 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-wrapping.rs:4:28 | -LL | let z: &'static i32 = &(5_i32.wrapping_mul(3)); //~ ERROR does not live long enough +LL | let z: &'static i32 = &(5_i32.wrapping_mul(3)); | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -34,18 +34,18 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-wrapping.rs:5:28 | -LL | let a: &'static i32 = &(5_i32.wrapping_shl(3)); //~ ERROR does not live long enough +LL | let a: &'static i32 = &(5_i32.wrapping_shl(3)); | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); //~ ERROR does not live long enough +LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/const-int-wrapping.rs:6:28 | -LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); //~ ERROR does not live long enough +LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/const-int-wrapping.stderr b/src/test/ui/consts/const-int-wrapping.stderr index ec9776b82119..478a6d80838d 100644 --- a/src/test/ui/consts/const-int-wrapping.stderr +++ b/src/test/ui/consts/const-int-wrapping.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/const-int-wrapping.rs:2:28 | -LL | let x: &'static i32 = &(5_i32.wrapping_add(3)); //~ ERROR does not live long enough +LL | let x: &'static i32 = &(5_i32.wrapping_add(3)); | ^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough ... LL | } @@ -12,7 +12,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/const-int-wrapping.rs:3:28 | -LL | let y: &'static i32 = &(5_i32.wrapping_sub(3)); //~ ERROR does not live long enough +LL | let y: &'static i32 = &(5_i32.wrapping_sub(3)); | ^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough ... LL | } @@ -23,7 +23,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/const-int-wrapping.rs:4:28 | -LL | let z: &'static i32 = &(5_i32.wrapping_mul(3)); //~ ERROR does not live long enough +LL | let z: &'static i32 = &(5_i32.wrapping_mul(3)); | ^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough ... LL | } @@ -34,9 +34,9 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/const-int-wrapping.rs:5:28 | -LL | let a: &'static i32 = &(5_i32.wrapping_shl(3)); //~ ERROR does not live long enough +LL | let a: &'static i32 = &(5_i32.wrapping_shl(3)); | ^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough -LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); //~ ERROR does not live long enough +LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); LL | } | - temporary value only lives until here | @@ -45,7 +45,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/const-int-wrapping.rs:6:28 | -LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); //~ ERROR does not live long enough +LL | let b: &'static i32 = &(5_i32.wrapping_shr(3)); | ^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough LL | } | - temporary value only lives until here diff --git a/src/test/ui/consts/const-pattern-irrefutable.stderr b/src/test/ui/consts/const-pattern-irrefutable.stderr index ee0d4d883740..48fe24df4d04 100644 --- a/src/test/ui/consts/const-pattern-irrefutable.stderr +++ b/src/test/ui/consts/const-pattern-irrefutable.stderr @@ -1,19 +1,19 @@ error[E0005]: refutable pattern in local binding: `0u8..=1u8` not covered --> $DIR/const-pattern-irrefutable.rs:12:9 | -LL | let a = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered +LL | let a = 4; | ^ interpreted as a constant pattern, not new variable error[E0005]: refutable pattern in local binding: `0u8..=1u8` not covered --> $DIR/const-pattern-irrefutable.rs:13:9 | -LL | let c = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered +LL | let c = 4; | ^ interpreted as a constant pattern, not new variable error[E0005]: refutable pattern in local binding: `0u8..=1u8` not covered --> $DIR/const-pattern-irrefutable.rs:14:9 | -LL | let d = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered +LL | let d = 4; | ^ interpreted as a constant pattern, not new variable error: aborting due to 3 previous errors diff --git a/src/test/ui/consts/const-prop-ice.stderr b/src/test/ui/consts/const-prop-ice.stderr index 749ef952b5dd..8ec54b4438dd 100644 --- a/src/test/ui/consts/const-prop-ice.stderr +++ b/src/test/ui/consts/const-prop-ice.stderr @@ -1,7 +1,7 @@ error: index out of bounds: the len is 3 but the index is 3 --> $DIR/const-prop-ice.rs:2:5 | -LL | [0; 3][3u64 as usize]; //~ ERROR the len is 3 but the index is 3 +LL | [0; 3][3u64 as usize]; | ^^^^^^^^^^^^^^^^^^^^^ | = note: #[deny(const_err)] on by default diff --git a/src/test/ui/consts/const-prop-ice2.stderr b/src/test/ui/consts/const-prop-ice2.stderr index 4febd0ee1e39..68a7164da3d3 100644 --- a/src/test/ui/consts/const-prop-ice2.stderr +++ b/src/test/ui/consts/const-prop-ice2.stderr @@ -1,7 +1,7 @@ error: index out of bounds: the len is 1 but the index is 1 --> $DIR/const-prop-ice2.rs:4:20 | -LL | println!("{}", xs[Enum::One as usize]); //~ ERROR the len is 1 but the index is 1 +LL | println!("{}", xs[Enum::One as usize]); | ^^^^^^^^^^^^^^^^^^^^^^ | = note: #[deny(const_err)] on by default diff --git a/src/test/ui/consts/const-ptr-nonnull.nll.stderr b/src/test/ui/consts/const-ptr-nonnull.nll.stderr new file mode 100644 index 000000000000..26946fb99024 --- /dev/null +++ b/src/test/ui/consts/const-ptr-nonnull.nll.stderr @@ -0,0 +1,25 @@ +error[E0716]: temporary value dropped while borrowed + --> $DIR/const-ptr-nonnull.rs:4:37 + | +LL | let x: &'static NonNull = &(NonNull::dangling()); + | --------------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use + | | + | type annotation requires that borrow lasts for `'static` +... +LL | } + | - temporary value is freed at the end of this statement + +error[E0716]: temporary value dropped while borrowed + --> $DIR/const-ptr-nonnull.rs:9:37 + | +LL | let x: &'static NonNull = &(non_null.cast()); + | --------------------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use + | | + | type annotation requires that borrow lasts for `'static` +LL | +LL | } + | - temporary value is freed at the end of this statement + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/consts/const-ptr-nonnull.rs b/src/test/ui/consts/const-ptr-nonnull.rs new file mode 100644 index 000000000000..54e743aa32e2 --- /dev/null +++ b/src/test/ui/consts/const-ptr-nonnull.rs @@ -0,0 +1,11 @@ +use std::ptr::NonNull; + +fn main() { + let x: &'static NonNull = &(NonNull::dangling()); + //~^ ERROR borrowed value does not live long enough + + let mut i: i32 = 10; + let non_null = NonNull::new(&mut i).unwrap(); + let x: &'static NonNull = &(non_null.cast()); + //~^ ERROR borrowed value does not live long enough +} diff --git a/src/test/ui/consts/const-ptr-nonnull.stderr b/src/test/ui/consts/const-ptr-nonnull.stderr new file mode 100644 index 000000000000..a606bed1782b --- /dev/null +++ b/src/test/ui/consts/const-ptr-nonnull.stderr @@ -0,0 +1,25 @@ +error[E0597]: borrowed value does not live long enough + --> $DIR/const-ptr-nonnull.rs:4:37 + | +LL | let x: &'static NonNull = &(NonNull::dangling()); + | ^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough +... +LL | } + | - temporary value only lives until here + | + = note: borrowed value must be valid for the static lifetime... + +error[E0597]: borrowed value does not live long enough + --> $DIR/const-ptr-nonnull.rs:9:37 + | +LL | let x: &'static NonNull = &(non_null.cast()); + | ^^^^^^^^^^^^^^^^^ temporary value does not live long enough +LL | +LL | } + | - temporary value only lives until here + | + = note: borrowed value must be valid for the static lifetime... + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/consts/const-ptr-unique.nll.stderr b/src/test/ui/consts/const-ptr-unique.nll.stderr new file mode 100644 index 000000000000..3644cf4cec7d --- /dev/null +++ b/src/test/ui/consts/const-ptr-unique.nll.stderr @@ -0,0 +1,14 @@ +error[E0716]: temporary value dropped while borrowed + --> $DIR/const-ptr-unique.rs:8:33 + | +LL | let x: &'static *mut u32 = &(unique.as_ptr()); + | ----------------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use + | | + | type annotation requires that borrow lasts for `'static` +LL | +LL | } + | - temporary value is freed at the end of this statement + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0716`. diff --git a/src/test/ui/consts/const-ptr-unique.rs b/src/test/ui/consts/const-ptr-unique.rs new file mode 100644 index 000000000000..be44a2418160 --- /dev/null +++ b/src/test/ui/consts/const-ptr-unique.rs @@ -0,0 +1,10 @@ +#![feature(ptr_internals)] + +use std::ptr::Unique; + +fn main() { + let mut i: u32 = 10; + let unique = Unique::new(&mut i).unwrap(); + let x: &'static *mut u32 = &(unique.as_ptr()); + //~^ ERROR borrowed value does not live long enough +} diff --git a/src/test/ui/consts/const-ptr-unique.stderr b/src/test/ui/consts/const-ptr-unique.stderr new file mode 100644 index 000000000000..482b78b2386f --- /dev/null +++ b/src/test/ui/consts/const-ptr-unique.stderr @@ -0,0 +1,14 @@ +error[E0597]: borrowed value does not live long enough + --> $DIR/const-ptr-unique.rs:8:33 + | +LL | let x: &'static *mut u32 = &(unique.as_ptr()); + | ^^^^^^^^^^^^^^^^^ temporary value does not live long enough +LL | +LL | } + | - temporary value only lives until here + | + = note: borrowed value must be valid for the static lifetime... + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/consts/const_let_assign3.stderr b/src/test/ui/consts/const_let_assign3.stderr index 6649fb997cce..c0e978a0ab7a 100644 --- a/src/test/ui/consts/const_let_assign3.stderr +++ b/src/test/ui/consts/const_let_assign3.stderr @@ -7,7 +7,7 @@ LL | self.state = x; error[E0017]: references in constants may only refer to immutable values --> $DIR/const_let_assign3.rs:16:5 | -LL | s.foo(3); //~ ERROR references in constants may only refer to immutable values +LL | s.foo(3); | ^ constants require immutable values error[E0017]: references in constants may only refer to immutable values diff --git a/src/test/ui/consts/const_let_refutable.stderr b/src/test/ui/consts/const_let_refutable.stderr index c5d2ba02a70c..155c858af37e 100644 --- a/src/test/ui/consts/const_let_refutable.stderr +++ b/src/test/ui/consts/const_let_refutable.stderr @@ -1,7 +1,7 @@ error[E0005]: refutable pattern in function argument: `&[]` not covered --> $DIR/const_let_refutable.rs:3:16 | -LL | const fn slice([a, b]: &[i32]) -> i32 { //~ ERROR refutable pattern in function argument +LL | const fn slice([a, b]: &[i32]) -> i32 { | ^^^^^^ pattern `&[]` not covered error: aborting due to previous error diff --git a/src/test/ui/consts/dangling-alloc-id-ice.stderr b/src/test/ui/consts/dangling-alloc-id-ice.stderr index 2cd8711f03d3..87f84480bf66 100644 --- a/src/test/ui/consts/dangling-alloc-id-ice.stderr +++ b/src/test/ui/consts/dangling-alloc-id-ice.stderr @@ -1,7 +1,7 @@ error: any use of this value will cause an error --> $DIR/dangling-alloc-id-ice.rs:8:1 | -LL | / const FOO: &() = { //~ ERROR any use of this value will cause an error +LL | / const FOO: &() = { LL | | let y = (); LL | | unsafe { Foo { y: &y }.long_live_the_unit } LL | | }; diff --git a/src/test/ui/consts/dangling_raw_ptr.stderr b/src/test/ui/consts/dangling_raw_ptr.stderr index 091f1f785cb0..0168c08f011d 100644 --- a/src/test/ui/consts/dangling_raw_ptr.stderr +++ b/src/test/ui/consts/dangling_raw_ptr.stderr @@ -1,7 +1,7 @@ error: any use of this value will cause an error --> $DIR/dangling_raw_ptr.rs:1:1 | -LL | / const FOO: *const u32 = { //~ ERROR any use of this value will cause an error +LL | / const FOO: *const u32 = { LL | | let x = 42; LL | | &x LL | | }; diff --git a/src/test/ui/consts/invalid_promotion.rs b/src/test/ui/consts/invalid_promotion.rs new file mode 100644 index 000000000000..f98406e50e9a --- /dev/null +++ b/src/test/ui/consts/invalid_promotion.rs @@ -0,0 +1,18 @@ +// compile-pass +// note this was only reproducible with lib crates +// compile-flags: --crate-type=lib + +pub struct Hz; + +impl Hz { + pub const fn num(&self) -> u32 { + 42 + } + pub const fn normalized(&self) -> Hz { + Hz + } + + pub const fn as_u32(&self) -> u32 { + self.normalized().num() // this used to promote the `self.normalized()` + } +} diff --git a/src/test/ui/consts/issue-54224.stderr b/src/test/ui/consts/issue-54224.stderr index 451f49c1cb57..9b6638b228e7 100644 --- a/src/test/ui/consts/issue-54224.stderr +++ b/src/test/ui/consts/issue-54224.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/issue-54224.rs:3:39 | -LL | const FOO: Option<&[[u8; 3]]> = Some(&[*b"foo"]); //~ ERROR temporary value dropped while borrowed +LL | const FOO: Option<&[[u8; 3]]> = Some(&[*b"foo"]); | ------^^^^^^^^^- | | | | | | | temporary value is freed at the end of this statement diff --git a/src/test/ui/consts/match_ice.stderr b/src/test/ui/consts/match_ice.stderr index e6e04e2c4627..e238fad43183 100644 --- a/src/test/ui/consts/match_ice.stderr +++ b/src/test/ui/consts/match_ice.stderr @@ -1,8 +1,10 @@ error[E0004]: non-exhaustive patterns: `&S` not covered --> $DIR/match_ice.rs:7:11 | -LL | match C { //~ ERROR non-exhaustive +LL | match C { | ^ pattern `&S` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr b/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr index 62f678790d21..b0cd57ba2eb4 100644 --- a/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr +++ b/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr @@ -1,7 +1,7 @@ error[E0723]: heap allocations are not allowed in const fn (see issue #57563) --> $DIR/bad_const_fn_body_ice.rs:2:5 | -LL | vec![1, 2, 3] //~ ERROR heap allocations are not allowed in const fn +LL | vec![1, 2, 3] | ^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/consts/min_const_fn/cmp_fn_pointers.stderr b/src/test/ui/consts/min_const_fn/cmp_fn_pointers.stderr index d84e2651d4fc..0de41c65bec0 100644 --- a/src/test/ui/consts/min_const_fn/cmp_fn_pointers.stderr +++ b/src/test/ui/consts/min_const_fn/cmp_fn_pointers.stderr @@ -1,7 +1,7 @@ error[E0723]: function pointers in const fn are unstable (see issue #57563) --> $DIR/cmp_fn_pointers.rs:1:14 | -LL | const fn cmp(x: fn(), y: fn()) -> bool { //~ ERROR function pointers in const fn are unstable +LL | const fn cmp(x: fn(), y: fn()) -> bool { | ^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/consts/min_const_fn/loop_ice.stderr b/src/test/ui/consts/min_const_fn/loop_ice.stderr index 716e8380c45d..0d35e3635410 100644 --- a/src/test/ui/consts/min_const_fn/loop_ice.stderr +++ b/src/test/ui/consts/min_const_fn/loop_ice.stderr @@ -1,7 +1,7 @@ error[E0723]: loops are not allowed in const fn (see issue #57563) --> $DIR/loop_ice.rs:2:5 | -LL | loop {} //~ ERROR loops are not allowed in const fn +LL | loop {} | ^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr index feb4960e0c74..95b809712ffe 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn.nll.stderr @@ -1,7 +1,7 @@ error[E0493]: destructors cannot be evaluated at compile-time --> $DIR/min_const_fn.rs:37:25 | -LL | const fn into_inner(self) -> T { self.0 } //~ destructors cannot be evaluated +LL | const fn into_inner(self) -> T { self.0 } | ^^^^ constant functions cannot evaluate destructors error[E0723]: mutable references in const fn are unstable (see issue #57563) @@ -15,7 +15,7 @@ LL | const fn get_mut(&mut self) -> &mut T { &mut self.0 } error[E0493]: destructors cannot be evaluated at compile-time --> $DIR/min_const_fn.rs:44:28 | -LL | const fn into_inner_lt(self) -> T { self.0 } //~ destructors cannot be evaluated +LL | const fn into_inner_lt(self) -> T { self.0 } | ^^^^ constant functions cannot evaluate destructors error[E0723]: mutable references in const fn are unstable (see issue #57563) @@ -29,7 +29,7 @@ LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 } error[E0493]: destructors cannot be evaluated at compile-time --> $DIR/min_const_fn.rs:51:27 | -LL | const fn into_inner_s(self) -> T { self.0 } //~ ERROR destructors +LL | const fn into_inner_s(self) -> T { self.0 } | ^^^^ constant functions cannot evaluate destructors error[E0723]: mutable references in const fn are unstable (see issue #57563) @@ -99,7 +99,7 @@ LL | const fn foo19_4(f: f32, g: f32) -> f32 { f / g } error[E0723]: cannot access `static` items in const fn (see issue #57563) --> $DIR/min_const_fn.rs:90:27 | -LL | const fn foo25() -> u32 { BAR } //~ ERROR cannot access `static` items in const fn +LL | const fn foo25() -> u32 { BAR } | ^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -107,7 +107,7 @@ LL | const fn foo25() -> u32 { BAR } //~ ERROR cannot access `static` items in c error[E0723]: cannot access `static` items in const fn (see issue #57563) --> $DIR/min_const_fn.rs:91:36 | -LL | const fn foo26() -> &'static u32 { &BAR } //~ ERROR cannot access `static` items +LL | const fn foo26() -> &'static u32 { &BAR } | ^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -155,7 +155,7 @@ LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } } error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn (see issue #57563) --> $DIR/min_const_fn.rs:102:29 | -LL | const fn foo30_5(b: bool) { while b { } } //~ ERROR not stable in const fn +LL | const fn foo30_5(b: bool) { while b { } } | ^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -227,7 +227,7 @@ LL | const fn no_apit2(_x: AlanTuring) {} error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563) --> $DIR/min_const_fn.rs:133:22 | -LL | const fn no_apit(_x: impl std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized` +LL | const fn no_apit(_x: impl std::fmt::Debug) {} | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -235,7 +235,7 @@ LL | const fn no_apit(_x: impl std::fmt::Debug) {} //~ ERROR trait bounds other error[E0723]: `impl Trait` in const fn is unstable (see issue #57563) --> $DIR/min_const_fn.rs:134:23 | -LL | const fn no_rpit() -> impl std::fmt::Debug {} //~ ERROR `impl Trait` in const fn is unstable +LL | const fn no_rpit() -> impl std::fmt::Debug {} | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -243,7 +243,7 @@ LL | const fn no_rpit() -> impl std::fmt::Debug {} //~ ERROR `impl Trait` in con error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563) --> $DIR/min_const_fn.rs:135:23 | -LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized` +LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} | ^^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.stderr index e095ccaf20e2..cdf6b1016b4b 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn.stderr @@ -1,7 +1,7 @@ error[E0493]: destructors cannot be evaluated at compile-time --> $DIR/min_const_fn.rs:37:25 | -LL | const fn into_inner(self) -> T { self.0 } //~ destructors cannot be evaluated +LL | const fn into_inner(self) -> T { self.0 } | ^^^^ constant functions cannot evaluate destructors error[E0723]: mutable references in const fn are unstable (see issue #57563) @@ -15,7 +15,7 @@ LL | const fn get_mut(&mut self) -> &mut T { &mut self.0 } error[E0493]: destructors cannot be evaluated at compile-time --> $DIR/min_const_fn.rs:44:28 | -LL | const fn into_inner_lt(self) -> T { self.0 } //~ destructors cannot be evaluated +LL | const fn into_inner_lt(self) -> T { self.0 } | ^^^^ constant functions cannot evaluate destructors error[E0723]: mutable references in const fn are unstable (see issue #57563) @@ -29,7 +29,7 @@ LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 } error[E0493]: destructors cannot be evaluated at compile-time --> $DIR/min_const_fn.rs:51:27 | -LL | const fn into_inner_s(self) -> T { self.0 } //~ ERROR destructors +LL | const fn into_inner_s(self) -> T { self.0 } | ^^^^ constant functions cannot evaluate destructors error[E0723]: mutable references in const fn are unstable (see issue #57563) @@ -99,7 +99,7 @@ LL | const fn foo19_4(f: f32, g: f32) -> f32 { f / g } error[E0723]: cannot access `static` items in const fn (see issue #57563) --> $DIR/min_const_fn.rs:90:27 | -LL | const fn foo25() -> u32 { BAR } //~ ERROR cannot access `static` items in const fn +LL | const fn foo25() -> u32 { BAR } | ^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -107,7 +107,7 @@ LL | const fn foo25() -> u32 { BAR } //~ ERROR cannot access `static` items in c error[E0723]: cannot access `static` items in const fn (see issue #57563) --> $DIR/min_const_fn.rs:91:36 | -LL | const fn foo26() -> &'static u32 { &BAR } //~ ERROR cannot access `static` items +LL | const fn foo26() -> &'static u32 { &BAR } | ^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -155,7 +155,7 @@ LL | const fn foo30_4(b: bool) -> usize { if b { 1 } else { 42 } } error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn (see issue #57563) --> $DIR/min_const_fn.rs:102:29 | -LL | const fn foo30_5(b: bool) { while b { } } //~ ERROR not stable in const fn +LL | const fn foo30_5(b: bool) { while b { } } | ^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -227,7 +227,7 @@ LL | const fn no_apit2(_x: AlanTuring) {} error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563) --> $DIR/min_const_fn.rs:133:22 | -LL | const fn no_apit(_x: impl std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized` +LL | const fn no_apit(_x: impl std::fmt::Debug) {} | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -235,7 +235,7 @@ LL | const fn no_apit(_x: impl std::fmt::Debug) {} //~ ERROR trait bounds other error[E0723]: `impl Trait` in const fn is unstable (see issue #57563) --> $DIR/min_const_fn.rs:134:23 | -LL | const fn no_rpit() -> impl std::fmt::Debug {} //~ ERROR `impl Trait` in const fn is unstable +LL | const fn no_rpit() -> impl std::fmt::Debug {} | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -243,7 +243,7 @@ LL | const fn no_rpit() -> impl std::fmt::Debug {} //~ ERROR `impl Trait` in con error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable (see issue #57563) --> $DIR/min_const_fn.rs:135:23 | -LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized` +LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} | ^^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr index 1e6f698b3c8e..a8d0dc37e403 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr @@ -1,7 +1,7 @@ error[E0723]: can only call other `min_const_fn` within a `min_const_fn` (see issue #57563) --> $DIR/min_const_fn_libstd_stability.rs:15:25 | -LL | const fn bar() -> u32 { foo() } //~ ERROR can only call other `min_const_fn` +LL | const fn bar() -> u32 { foo() } | ^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | const fn bar() -> u32 { foo() } //~ ERROR can only call other `min_const_fn error[E0723]: can only call other `min_const_fn` within a `min_const_fn` (see issue #57563) --> $DIR/min_const_fn_libstd_stability.rs:22:26 | -LL | const fn bar2() -> u32 { foo2() } //~ ERROR can only call other `min_const_fn` +LL | const fn bar2() -> u32 { foo2() } | ^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | const fn bar2() -> u32 { foo2() } //~ ERROR can only call other `min_const_ error[E0723]: only int, `bool` and `char` operations are stable in const fn (see issue #57563) --> $DIR/min_const_fn_libstd_stability.rs:26:26 | -LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 } //~ ERROR only int, `bool` and `char` operations +LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 } | ^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 } //~ ERROR only int, `bool` error[E0723]: can only call other `min_const_fn` within a `min_const_fn` (see issue #57563) --> $DIR/min_const_fn_libstd_stability.rs:34:32 | -LL | const fn bar2_gated() -> u32 { foo2_gated() } //~ ERROR can only call other `min_const_fn` +LL | const fn bar2_gated() -> u32 { foo2_gated() } | ^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr index 95871749365f..48c260644a74 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr @@ -1,7 +1,7 @@ error[E0658]: dereferencing raw pointers in constant functions is unstable (see issue #51911) --> $DIR/min_const_fn_unsafe.rs:50:77 | -LL | const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } } //~ is unsafe +LL | const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } } | ^^^ | = help: add #![feature(const_raw_ptr_deref)] to the crate attributes to enable @@ -33,7 +33,7 @@ LL | Foo { x: () }.y error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block --> $DIR/min_const_fn_unsafe.rs:50:77 | -LL | const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } } //~ is unsafe +LL | const fn bad_const_fn_deref_raw(x: *mut usize) -> &'static usize { unsafe { &*x } } | ^^^ dereference of raw pointer | = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior diff --git a/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr b/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr index 07d10984392d..5b2bee19acf9 100644 --- a/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr @@ -1,7 +1,7 @@ error[E0723]: can only call other `min_const_fn` within a `min_const_fn` (see issue #57563) --> $DIR/min_const_unsafe_fn_libstd_stability.rs:15:41 | -LL | const unsafe fn bar() -> u32 { unsafe { foo() } } //~ ERROR can only call other `min_const_fn` +LL | const unsafe fn bar() -> u32 { unsafe { foo() } } | ^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | const unsafe fn bar() -> u32 { unsafe { foo() } } //~ ERROR can only call o error[E0723]: can only call other `min_const_fn` within a `min_const_fn` (see issue #57563) --> $DIR/min_const_unsafe_fn_libstd_stability.rs:22:42 | -LL | const unsafe fn bar2() -> u32 { unsafe { foo2() } } //~ ERROR can only call other `min_const_fn` +LL | const unsafe fn bar2() -> u32 { unsafe { foo2() } } | ^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | const unsafe fn bar2() -> u32 { unsafe { foo2() } } //~ ERROR can only call error[E0723]: only int, `bool` and `char` operations are stable in const fn (see issue #57563) --> $DIR/min_const_unsafe_fn_libstd_stability.rs:26:33 | -LL | const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 } //~ ERROR only int, `bool` and `char` op +LL | const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 } | ^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 } //~ ERROR only int, error[E0723]: can only call other `min_const_fn` within a `min_const_fn` (see issue #57563) --> $DIR/min_const_unsafe_fn_libstd_stability.rs:34:48 | -LL | const unsafe fn bar2_gated() -> u32 { unsafe { foo2_gated() } } //~ ERROR can only call other +LL | const unsafe fn bar2_gated() -> u32 { unsafe { foo2_gated() } } | ^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr b/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr index 7cb8c6e62ec6..f7f630c9ae3f 100644 --- a/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr @@ -1,7 +1,7 @@ error[E0723]: can only call other `min_const_fn` within a `min_const_fn` (see issue #57563) --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:15:32 | -LL | const unsafe fn bar() -> u32 { foo() } //~ ERROR can only call other `min_const_fn` +LL | const unsafe fn bar() -> u32 { foo() } | ^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | const unsafe fn bar() -> u32 { foo() } //~ ERROR can only call other `min_c error[E0723]: can only call other `min_const_fn` within a `min_const_fn` (see issue #57563) --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:22:33 | -LL | const unsafe fn bar2() -> u32 { foo2() } //~ ERROR can only call other `min_const_fn` +LL | const unsafe fn bar2() -> u32 { foo2() } | ^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | const unsafe fn bar2() -> u32 { foo2() } //~ ERROR can only call other `min error[E0723]: can only call other `min_const_fn` within a `min_const_fn` (see issue #57563) --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:30:39 | -LL | const unsafe fn bar2_gated() -> u32 { foo2_gated() } //~ ERROR can only call other `min_const_fn` +LL | const unsafe fn bar2_gated() -> u32 { foo2_gated() } | ^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/consts/min_const_fn/mutable_borrow.stderr b/src/test/ui/consts/min_const_fn/mutable_borrow.stderr index e5a3502a3dc5..a2d67a041707 100644 --- a/src/test/ui/consts/min_const_fn/mutable_borrow.stderr +++ b/src/test/ui/consts/min_const_fn/mutable_borrow.stderr @@ -1,7 +1,7 @@ error[E0723]: mutable references in const fn are unstable (see issue #57563) --> $DIR/mutable_borrow.rs:3:9 | -LL | let b = &mut a; //~ ERROR mutable references in const fn +LL | let b = &mut a; | ^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | let b = &mut a; //~ ERROR mutable references in const fn error[E0723]: mutable references in const fn are unstable (see issue #57563) --> $DIR/mutable_borrow.rs:12:13 | -LL | let b = &mut a; //~ ERROR mutable references in const fn +LL | let b = &mut a; | ^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/consts/min_const_fn/promotion.nll.stderr b/src/test/ui/consts/min_const_fn/promotion.nll.stderr index eb186ce49513..550423c2d933 100644 --- a/src/test/ui/consts/min_const_fn/promotion.nll.stderr +++ b/src/test/ui/consts/min_const_fn/promotion.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/promotion.rs:11:27 | -LL | let x: &'static () = &foo1(); //~ ERROR does not live long enough +LL | let x: &'static () = &foo1(); | ----------- ^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -12,7 +12,7 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/promotion.rs:12:28 | -LL | let y: &'static i32 = &foo2(42); //~ ERROR does not live long enough +LL | let y: &'static i32 = &foo2(42); | ------------ ^^^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -23,7 +23,7 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/promotion.rs:13:28 | -LL | let z: &'static i32 = &foo3(); //~ ERROR does not live long enough +LL | let z: &'static i32 = &foo3(); | ------------ ^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -34,7 +34,7 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/promotion.rs:14:34 | -LL | let a: &'static Cell = &foo4(); //~ ERROR does not live long enough +LL | let a: &'static Cell = &foo4(); | ------------------ ^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` @@ -45,18 +45,18 @@ LL | } error[E0716]: temporary value dropped while borrowed --> $DIR/promotion.rs:15:42 | -LL | let a: &'static Option> = &foo5(); //~ ERROR does not live long enough +LL | let a: &'static Option> = &foo5(); | -------------------------- ^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` -LL | let a: &'static Option> = &foo6(); //~ ERROR does not live long enough +LL | let a: &'static Option> = &foo6(); LL | } | - temporary value is freed at the end of this statement error[E0716]: temporary value dropped while borrowed --> $DIR/promotion.rs:16:42 | -LL | let a: &'static Option> = &foo6(); //~ ERROR does not live long enough +LL | let a: &'static Option> = &foo6(); | -------------------------- ^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/min_const_fn/promotion.stderr b/src/test/ui/consts/min_const_fn/promotion.stderr index 7052f68c3ec6..92d60f0c5854 100644 --- a/src/test/ui/consts/min_const_fn/promotion.stderr +++ b/src/test/ui/consts/min_const_fn/promotion.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/promotion.rs:11:27 | -LL | let x: &'static () = &foo1(); //~ ERROR does not live long enough +LL | let x: &'static () = &foo1(); | ^^^^^^ temporary value does not live long enough ... LL | } @@ -12,7 +12,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/promotion.rs:12:28 | -LL | let y: &'static i32 = &foo2(42); //~ ERROR does not live long enough +LL | let y: &'static i32 = &foo2(42); | ^^^^^^^^ temporary value does not live long enough ... LL | } @@ -23,7 +23,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/promotion.rs:13:28 | -LL | let z: &'static i32 = &foo3(); //~ ERROR does not live long enough +LL | let z: &'static i32 = &foo3(); | ^^^^^^ temporary value does not live long enough ... LL | } @@ -34,7 +34,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/promotion.rs:14:34 | -LL | let a: &'static Cell = &foo4(); //~ ERROR does not live long enough +LL | let a: &'static Cell = &foo4(); | ^^^^^^ temporary value does not live long enough ... LL | } @@ -45,9 +45,9 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/promotion.rs:15:42 | -LL | let a: &'static Option> = &foo5(); //~ ERROR does not live long enough +LL | let a: &'static Option> = &foo5(); | ^^^^^^ temporary value does not live long enough -LL | let a: &'static Option> = &foo6(); //~ ERROR does not live long enough +LL | let a: &'static Option> = &foo6(); LL | } | - temporary value only lives until here | @@ -56,7 +56,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/promotion.rs:16:42 | -LL | let a: &'static Option> = &foo6(); //~ ERROR does not live long enough +LL | let a: &'static Option> = &foo6(); | ^^^^^^ temporary value does not live long enough LL | } | - temporary value only lives until here diff --git a/src/test/ui/consts/miri_unleashed/assoc_const.stderr b/src/test/ui/consts/miri_unleashed/assoc_const.stderr index a40f8d46d0aa..e814303923e1 100644 --- a/src/test/ui/consts/miri_unleashed/assoc_const.stderr +++ b/src/test/ui/consts/miri_unleashed/assoc_const.stderr @@ -1,13 +1,13 @@ warning: skipping const checks --> $DIR/assoc_const.rs:12:31 | -LL | const F: u32 = (U::X, 42).1; //~ WARN skipping const checks +LL | const F: u32 = (U::X, 42).1; | ^ error[E0080]: erroneous constant used --> $DIR/assoc_const.rs:29:13 | -LL | let y = , String>>::F; //~ ERROR erroneous constant +LL | let y = , String>>::F; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors error: aborting due to previous error diff --git a/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr b/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr index 77aab31d26ec..dbfe1d93aa40 100644 --- a/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr +++ b/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr @@ -1,7 +1,7 @@ error[E0080]: erroneous constant used --> $DIR/assoc_const_2.rs:27:13 | -LL | let y = >::F; //~ ERROR erroneous constant +LL | let y = >::F; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors error: aborting due to previous error diff --git a/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr b/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr index e23ed1c62063..1fe3d33322fd 100644 --- a/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr +++ b/src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr @@ -1,13 +1,13 @@ error[E0493]: destructors cannot be evaluated at compile-time --> $DIR/feature-gate-unleash_the_miri_inside_of_you.rs:11:20 | -LL | const F: u32 = (U::X, 42).1; //~ ERROR destructors cannot be evaluated at compile-time +LL | const F: u32 = (U::X, 42).1; | ^^^^^^^^^^ constants cannot evaluate destructors error: `>::new` is not yet stable as a const fn --> $DIR/feature-gate-unleash_the_miri_inside_of_you.rs:18:25 | -LL | const X: Vec = Vec::new(); //~ ERROR not yet stable as a const fn +LL | const X: Vec = Vec::new(); | ^^^^^^^^^^ | = help: add `#![feature(const_vec_new)]` to the crate attributes to enable diff --git a/src/test/ui/consts/partial_qualif.stderr b/src/test/ui/consts/partial_qualif.stderr index 967fb83b78b0..221e449b6f9a 100644 --- a/src/test/ui/consts/partial_qualif.stderr +++ b/src/test/ui/consts/partial_qualif.stderr @@ -1,7 +1,7 @@ error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead --> $DIR/partial_qualif.rs:6:5 | -LL | &{a} //~ ERROR cannot borrow a constant which may contain interior mutability +LL | &{a} | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/consts/projection_qualif.stderr b/src/test/ui/consts/projection_qualif.stderr index 410c51c4b54e..45679e3b962d 100644 --- a/src/test/ui/consts/projection_qualif.stderr +++ b/src/test/ui/consts/projection_qualif.stderr @@ -1,19 +1,19 @@ error[E0017]: references in constants may only refer to immutable values --> $DIR/projection_qualif.rs:6:27 | -LL | let b: *mut u32 = &mut a; //~ ERROR may only refer to immutable values +LL | let b: *mut u32 = &mut a; | ^^^^^^ constants require immutable values error[E0019]: constant contains unimplemented expression type --> $DIR/projection_qualif.rs:7:18 | -LL | unsafe { *b = 5; } //~ ERROR dereferencing raw pointers in constants +LL | unsafe { *b = 5; } | ^^^^^^ error[E0658]: dereferencing raw pointers in constants is unstable (see issue #51911) --> $DIR/projection_qualif.rs:7:18 | -LL | unsafe { *b = 5; } //~ ERROR dereferencing raw pointers in constants +LL | unsafe { *b = 5; } | ^^^^^^ | = help: add #![feature(const_raw_ptr_deref)] to the crate attributes to enable diff --git a/src/test/ui/consts/promote_const_let.nll.stderr b/src/test/ui/consts/promote_const_let.nll.stderr index e6ee1523a3b2..a0af949bf71e 100644 --- a/src/test/ui/consts/promote_const_let.nll.stderr +++ b/src/test/ui/consts/promote_const_let.nll.stderr @@ -4,7 +4,7 @@ error[E0597]: `y` does not live long enough LL | let x: &'static u32 = { | ------------ type annotation requires that `y` is borrowed for `'static` LL | let y = 42; -LL | &y //~ ERROR does not live long enough +LL | &y | ^^ borrowed value does not live long enough LL | }; | - `y` dropped here while still borrowed @@ -12,7 +12,7 @@ LL | }; error[E0716]: temporary value dropped while borrowed --> $DIR/promote_const_let.rs:6:28 | -LL | let x: &'static u32 = &{ //~ ERROR does not live long enough +LL | let x: &'static u32 = &{ | ____________------------____^ | | | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/consts/promote_const_let.stderr b/src/test/ui/consts/promote_const_let.stderr index d37bd4918603..c4295776d0a7 100644 --- a/src/test/ui/consts/promote_const_let.stderr +++ b/src/test/ui/consts/promote_const_let.stderr @@ -1,7 +1,7 @@ error[E0597]: `y` does not live long enough --> $DIR/promote_const_let.rs:4:10 | -LL | &y //~ ERROR does not live long enough +LL | &y | ^ borrowed value does not live long enough LL | }; | - borrowed value only lives until here @@ -11,7 +11,7 @@ LL | }; error[E0597]: borrowed value does not live long enough --> $DIR/promote_const_let.rs:6:28 | -LL | let x: &'static u32 = &{ //~ ERROR does not live long enough +LL | let x: &'static u32 = &{ | ____________________________^ LL | | let y = 42; LL | | y diff --git a/src/test/ui/consts/qualif_overwrite.stderr b/src/test/ui/consts/qualif_overwrite.stderr index 30479139e314..fbaae711d7c0 100644 --- a/src/test/ui/consts/qualif_overwrite.stderr +++ b/src/test/ui/consts/qualif_overwrite.stderr @@ -1,7 +1,7 @@ error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead --> $DIR/qualif_overwrite.rs:10:5 | -LL | &{a} //~ ERROR cannot borrow a constant which may contain interior mutability +LL | &{a} | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/consts/qualif_overwrite_2.stderr b/src/test/ui/consts/qualif_overwrite_2.stderr index 8276db99a12c..a393c4e336d6 100644 --- a/src/test/ui/consts/qualif_overwrite_2.stderr +++ b/src/test/ui/consts/qualif_overwrite_2.stderr @@ -1,7 +1,7 @@ error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead --> $DIR/qualif_overwrite_2.rs:8:5 | -LL | &{a.0} //~ ERROR cannot borrow a constant which may contain interior mutability +LL | &{a.0} | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/consts/single_variant_match_ice.stderr b/src/test/ui/consts/single_variant_match_ice.stderr index 5272062ccfc1..bc80de4ce04a 100644 --- a/src/test/ui/consts/single_variant_match_ice.stderr +++ b/src/test/ui/consts/single_variant_match_ice.stderr @@ -1,19 +1,19 @@ error[E0019]: constant contains unimplemented expression type --> $DIR/single_variant_match_ice.rs:6:5 | -LL | Foo::Prob => 42, //~ ERROR unimplemented expression type +LL | Foo::Prob => 42, | ^^^^^^^^^ error[E0019]: constant contains unimplemented expression type --> $DIR/single_variant_match_ice.rs:10:5 | -LL | x => 42, //~ ERROR unimplemented expression type +LL | x => 42, | ^ error[E0723]: `if`, `match`, `&&` and `||` are not stable in const fn (see issue #57563) --> $DIR/single_variant_match_ice.rs:18:13 | -LL | Prob => 0x1, //~ ERROR `if`, `match`, `&&` and `||` are not stable in const fn +LL | Prob => 0x1, | ^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/consts/validate_never_arrays.stderr b/src/test/ui/consts/validate_never_arrays.stderr index b9d181a76dd9..7a7d81687335 100644 --- a/src/test/ui/consts/validate_never_arrays.stderr +++ b/src/test/ui/consts/validate_never_arrays.stderr @@ -1,7 +1,7 @@ error[E0080]: it is undefined behavior to use this value --> $DIR/validate_never_arrays.rs:3:1 | -LL | const FOO: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) }; //~ ERROR undefined behavior +LL | const FOO: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of an uninhabited type at . | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior diff --git a/src/test/ui/conversion-methods.stderr b/src/test/ui/conversion-methods.stderr index 33fff4a0f68e..b9662e760749 100644 --- a/src/test/ui/conversion-methods.stderr +++ b/src/test/ui/conversion-methods.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/conversion-methods.rs:5:41 | -LL | let _tis_an_instants_play: String = "'Tis a fond Ambushβ€”"; //~ ERROR mismatched types +LL | let _tis_an_instants_play: String = "'Tis a fond Ambushβ€”"; | ^^^^^^^^^^^^^^^^^^^^^ | | | expected struct `std::string::String`, found reference @@ -37,7 +37,7 @@ LL | let _but_should_the_play: String = 2; // Perhaps surprisingly, we sugge error[E0308]: mismatched types --> $DIR/conversion-methods.rs:12:47 | -LL | let _prove_piercing_earnest: Vec = &[1, 2, 3]; //~ ERROR mismatched types +LL | let _prove_piercing_earnest: Vec = &[1, 2, 3]; | ^^^^^^^^^^ | | | expected struct `std::vec::Vec`, found reference diff --git a/src/test/ui/cross/cross-borrow-trait.stderr b/src/test/ui/cross/cross-borrow-trait.stderr index 949b63ffbde6..b35f59658c04 100644 --- a/src/test/ui/cross/cross-borrow-trait.stderr +++ b/src/test/ui/cross/cross-borrow-trait.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/cross-borrow-trait.rs:10:22 | -LL | let _y: &Trait = x; //~ ERROR E0308 +LL | let _y: &Trait = x; | ^ | | | expected &dyn Trait, found struct `std::boxed::Box` diff --git a/src/test/ui/cross/cross-fn-cache-hole.stderr b/src/test/ui/cross/cross-fn-cache-hole.stderr index 2cd57e363d0d..3bedd0dac23b 100644 --- a/src/test/ui/cross/cross-fn-cache-hole.stderr +++ b/src/test/ui/cross/cross-fn-cache-hole.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `i32: Bar` is not satisfied --> $DIR/cross-fn-cache-hole.rs:15:1 | -LL | / fn vacuous() //~ ERROR the trait bound `i32: Bar` is not satisfied +LL | / fn vacuous() LL | | where i32: Foo LL | | { LL | | // ... the original intention was to check that we don't use that diff --git a/src/test/ui/custom-attribute-multisegment.stderr b/src/test/ui/custom-attribute-multisegment.stderr index 6f6a87dd1594..9ba9c00e55bc 100644 --- a/src/test/ui/custom-attribute-multisegment.stderr +++ b/src/test/ui/custom-attribute-multisegment.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: could not find `nonexistent` in `existent` --> $DIR/custom-attribute-multisegment.rs:7:13 | -LL | #[existent::nonexistent] //~ ERROR failed to resolve: could not find `nonexistent` in `existent` +LL | #[existent::nonexistent] | ^^^^^^^^^^^ could not find `nonexistent` in `existent` error: aborting due to previous error diff --git a/src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.stderr b/src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.stderr index 2c9d226cc9ef..e83c291c9bfe 100644 --- a/src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.stderr +++ b/src/test/ui/custom-derive/helper-attr-blocked-by-import-ambig.stderr @@ -1,7 +1,7 @@ error[E0659]: `helper` is ambiguous (derive helper attribute vs any other name) --> $DIR/helper-attr-blocked-by-import-ambig.rs:9:3 | -LL | #[helper] //~ ERROR `helper` is ambiguous +LL | #[helper] | ^^^^^^ ambiguous name | note: `helper` could refer to the derive helper attribute defined here diff --git a/src/test/ui/custom-derive/issue-36935.stderr b/src/test/ui/custom-derive/issue-36935.stderr index d4c91546329a..2875bc5fce99 100644 --- a/src/test/ui/custom-derive/issue-36935.stderr +++ b/src/test/ui/custom-derive/issue-36935.stderr @@ -1,7 +1,7 @@ error: proc-macro derive panicked --> $DIR/issue-36935.rs:6:15 | -LL | #[derive(Foo, Bar)] //~ ERROR proc-macro derive panicked +LL | #[derive(Foo, Bar)] | ^^^ | = help: message: lolnope diff --git a/src/test/ui/custom_attribute.stderr b/src/test/ui/custom_attribute.stderr index 1100d82f8406..6608fb53c30d 100644 --- a/src/test/ui/custom_attribute.stderr +++ b/src/test/ui/custom_attribute.stderr @@ -1,7 +1,7 @@ error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/custom_attribute.rs:3:3 | -LL | #[foo] //~ ERROR The attribute `foo` +LL | #[foo] | ^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #[foo] //~ ERROR The attribute `foo` error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/custom_attribute.rs:5:7 | -LL | #[foo] //~ ERROR The attribute `foo` +LL | #[foo] | ^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | #[foo] //~ ERROR The attribute `foo` error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/custom_attribute.rs:7:7 | -LL | #[foo] //~ ERROR The attribute `foo` +LL | #[foo] | ^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable diff --git a/src/test/ui/dep-graph/dep-graph-assoc-type-codegen.stderr b/src/test/ui/dep-graph/dep-graph-assoc-type-codegen.stderr index a25a1786e813..db6ee98bb7b1 100644 --- a/src/test/ui/dep-graph/dep-graph-assoc-type-codegen.stderr +++ b/src/test/ui/dep-graph/dep-graph-assoc-type-codegen.stderr @@ -1,7 +1,7 @@ error: OK --> $DIR/dep-graph-assoc-type-codegen.rs:28:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/dep-graph/dep-graph-caller-callee.stderr b/src/test/ui/dep-graph/dep-graph-caller-callee.stderr index d7bf63822579..2b1b7fe9a565 100644 --- a/src/test/ui/dep-graph/dep-graph-caller-callee.stderr +++ b/src/test/ui/dep-graph/dep-graph-caller-callee.stderr @@ -1,13 +1,13 @@ error: OK --> $DIR/dep-graph-caller-callee.rs:20:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `x::x` to `TypeckTables` --> $DIR/dep-graph-caller-callee.rs:31:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/dep-graph/dep-graph-struct-signature.stderr b/src/test/ui/dep-graph/dep-graph-struct-signature.stderr index d7d56f219b42..8736d1562473 100644 --- a/src/test/ui/dep-graph/dep-graph-struct-signature.stderr +++ b/src/test/ui/dep-graph/dep-graph-struct-signature.stderr @@ -1,133 +1,133 @@ error: no path from `WillChange` to `TypeOfItem` --> $DIR/dep-graph-struct-signature.rs:27:5 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `WillChange` to `AssociatedItems` --> $DIR/dep-graph-struct-signature.rs:28:5 | -LL | #[rustc_then_this_would_need(AssociatedItems)] //~ ERROR no path +LL | #[rustc_then_this_would_need(AssociatedItems)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `WillChange` to `TraitDefOfItem` --> $DIR/dep-graph-struct-signature.rs:29:5 | -LL | #[rustc_then_this_would_need(TraitDefOfItem)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TraitDefOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:35:5 | -LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK +LL | #[rustc_then_this_would_need(FnSignature)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:36:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:39:5 | -LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK +LL | #[rustc_then_this_would_need(FnSignature)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:40:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:45:5 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:52:5 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:60:9 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:62:9 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `WillChange` to `TypeOfItem` --> $DIR/dep-graph-struct-signature.rs:67:5 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `WillChange` to `TypeOfItem` --> $DIR/dep-graph-struct-signature.rs:74:5 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `WillChange` to `FnSignature` --> $DIR/dep-graph-struct-signature.rs:80:5 | -LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR no path +LL | #[rustc_then_this_would_need(FnSignature)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `WillChange` to `FnSignature` --> $DIR/dep-graph-struct-signature.rs:83:5 | -LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR no path from `WillChange` +LL | #[rustc_then_this_would_need(FnSignature)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `WillChange` to `TypeckTables` --> $DIR/dep-graph-struct-signature.rs:84:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path from `WillChange` +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:31:9 | -LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK +LL | #[rustc_then_this_would_need(FnSignature)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `WillChange` to `FnSignature` --> $DIR/dep-graph-struct-signature.rs:76:9 | -LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR no path +LL | #[rustc_then_this_would_need(FnSignature)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:47:9 | -LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK +LL | #[rustc_then_this_would_need(FnSignature)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:48:9 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:54:9 | -LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK +LL | #[rustc_then_this_would_need(FnSignature)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-struct-signature.rs:55:9 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 22 previous errors diff --git a/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.stderr b/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.stderr index 2fa1e1edc872..2df4b9ec39d1 100644 --- a/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.stderr +++ b/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.stderr @@ -1,13 +1,13 @@ error: OK --> $DIR/dep-graph-trait-impl-two-traits-same-method.rs:32:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `x::` to `TypeckTables` --> $DIR/dep-graph-trait-impl-two-traits-same-method.rs:41:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits.stderr b/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits.stderr index 8670e7deb4cd..54125367f90c 100644 --- a/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits.stderr +++ b/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits.stderr @@ -1,13 +1,13 @@ error: no path from `x::` to `TypeckTables` --> $DIR/dep-graph-trait-impl-two-traits.rs:31:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `x::` to `TypeckTables` --> $DIR/dep-graph-trait-impl-two-traits.rs:40:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/dep-graph/dep-graph-trait-impl.stderr b/src/test/ui/dep-graph/dep-graph-trait-impl.stderr index fe97846d6cc2..97072e74f429 100644 --- a/src/test/ui/dep-graph/dep-graph-trait-impl.stderr +++ b/src/test/ui/dep-graph/dep-graph-trait-impl.stderr @@ -1,31 +1,31 @@ error: OK --> $DIR/dep-graph-trait-impl.rs:27:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-trait-impl.rs:32:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-trait-impl.rs:37:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-trait-impl.rs:42:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `x::` to `TypeckTables` --> $DIR/dep-graph-trait-impl.rs:55:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/dep-graph/dep-graph-type-alias.stderr b/src/test/ui/dep-graph/dep-graph-type-alias.stderr index 72def33cbcf9..f54e511acc1f 100644 --- a/src/test/ui/dep-graph/dep-graph-type-alias.stderr +++ b/src/test/ui/dep-graph/dep-graph-type-alias.stderr @@ -1,73 +1,73 @@ error: no path from `TypeAlias` to `TypeOfItem` --> $DIR/dep-graph-type-alias.rs:17:1 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-type-alias.rs:19:5 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `TypeAlias` to `TypeOfItem` --> $DIR/dep-graph-type-alias.rs:24:1 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-type-alias.rs:27:9 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `TypeAlias` to `TypeOfItem` --> $DIR/dep-graph-type-alias.rs:33:1 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: no path from `TypeAlias` to `TypeOfItem` --> $DIR/dep-graph-type-alias.rs:41:1 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-type-alias.rs:48:1 | -LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeOfItem)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-type-alias.rs:51:1 | -LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK +LL | #[rustc_then_this_would_need(FnSignature)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-type-alias.rs:52:1 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-type-alias.rs:35:5 | -LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK +LL | #[rustc_then_this_would_need(FnSignature)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-type-alias.rs:43:5 | -LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK +LL | #[rustc_then_this_would_need(FnSignature)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: OK --> $DIR/dep-graph-type-alias.rs:44:5 | -LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK +LL | #[rustc_then_this_would_need(TypeckTables)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 12 previous errors diff --git a/src/test/ui/dep-graph/dep-graph-variance-alias.stderr b/src/test/ui/dep-graph/dep-graph-variance-alias.stderr index f7c7f01020d2..86cb0f9fe325 100644 --- a/src/test/ui/dep-graph/dep-graph-variance-alias.stderr +++ b/src/test/ui/dep-graph/dep-graph-variance-alias.stderr @@ -1,7 +1,7 @@ error: OK --> $DIR/dep-graph-variance-alias.rs:19:1 | -LL | #[rustc_then_this_would_need(ItemVariances)] //~ ERROR OK +LL | #[rustc_then_this_would_need(ItemVariances)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr b/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr index 94229386e5f5..a2cd196b21f8 100644 --- a/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr +++ b/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr @@ -1,7 +1,7 @@ warning: macro_escape is a deprecated synonym for macro_use --> $DIR/deprecated-macro_escape-inner.rs:4:5 | -LL | #![macro_escape] //~ WARNING macro_escape is a deprecated synonym for macro_use +LL | #![macro_escape] | ^^^^^^^^^^^^^^^^ | = help: consider an outer attribute, #[macro_use] mod ... diff --git a/src/test/ui/deprecation/deprecated-macro_escape.stderr b/src/test/ui/deprecation/deprecated-macro_escape.stderr index f0edd838874e..b76d6d73d972 100644 --- a/src/test/ui/deprecation/deprecated-macro_escape.stderr +++ b/src/test/ui/deprecation/deprecated-macro_escape.stderr @@ -1,6 +1,6 @@ warning: macro_escape is a deprecated synonym for macro_use --> $DIR/deprecated-macro_escape.rs:3:1 | -LL | #[macro_escape] //~ WARNING macro_escape is a deprecated synonym for macro_use +LL | #[macro_escape] | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/deprecation/deprecation-in-staged-api.stderr b/src/test/ui/deprecation/deprecation-in-staged-api.stderr index 3e64d756e7e6..6a8056ec2d9d 100644 --- a/src/test/ui/deprecation/deprecation-in-staged-api.stderr +++ b/src/test/ui/deprecation/deprecation-in-staged-api.stderr @@ -1,7 +1,7 @@ error: `#[deprecated]` cannot be used in staged api, use `#[rustc_deprecated]` instead --> $DIR/deprecation-in-staged-api.rs:8:1 | -LL | fn main() { } //~ERROR `#[deprecated]` cannot be used in staged api +LL | fn main() { } | ^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/deprecation/deprecation-lint-nested.stderr b/src/test/ui/deprecation/deprecation-lint-nested.stderr index b30da3493350..206e12cfb3ec 100644 --- a/src/test/ui/deprecation/deprecation-lint-nested.stderr +++ b/src/test/ui/deprecation/deprecation-lint-nested.stderr @@ -1,7 +1,7 @@ error: use of deprecated item 'loud::DeprecatedType' --> $DIR/deprecation-lint-nested.rs:55:16 | -LL | struct Foo(DeprecatedType); //~ ERROR use of deprecated item +LL | struct Foo(DeprecatedType); | ^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,31 +13,31 @@ LL | #![deny(deprecated)] error: use of deprecated item 'loud::DeprecatedTrait' --> $DIR/deprecation-lint-nested.rs:57:10 | -LL | impl DeprecatedTrait for Foo {} //~ ERROR use of deprecated item +LL | impl DeprecatedTrait for Foo {} | ^^^^^^^^^^^^^^^ error: use of deprecated item 'loud::DEPRECATED_STATIC' --> $DIR/deprecation-lint-nested.rs:66:9 | -LL | DEPRECATED_STATIC + //~ ERROR use of deprecated item +LL | DEPRECATED_STATIC + | ^^^^^^^^^^^^^^^^^ error: use of deprecated item 'loud::DEPRECATED_CONST' --> $DIR/deprecation-lint-nested.rs:67:9 | -LL | DEPRECATED_CONST //~ ERROR use of deprecated item +LL | DEPRECATED_CONST | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'loud::DeprecatedTrait' --> $DIR/deprecation-lint-nested.rs:60:19 | -LL | fn bar() { //~ ERROR use of deprecated item +LL | fn bar() { | ^^^^^^^^^^^^^^^ error: use of deprecated item 'loud::deprecated_fn' --> $DIR/deprecation-lint-nested.rs:61:13 | -LL | deprecated_fn(); //~ ERROR use of deprecated item +LL | deprecated_fn(); | ^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/deprecation/deprecation-lint.stderr b/src/test/ui/deprecation/deprecation-lint.stderr index c48d06e86154..50cbe3846bba 100644 --- a/src/test/ui/deprecation/deprecation-lint.stderr +++ b/src/test/ui/deprecation/deprecation-lint.stderr @@ -1,7 +1,7 @@ error: use of deprecated item 'deprecation_lint::deprecated': text --> $DIR/deprecation-lint.rs:17:9 | -LL | deprecated(); //~ ERROR use of deprecated item 'deprecation_lint::deprecated' +LL | deprecated(); | ^^^^^^^^^^ | note: lint level defined here @@ -13,127 +13,127 @@ LL | #![deny(deprecated)] error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:22:9 | -LL | Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' +LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:24:9 | -LL | ::trait_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::deprecated_text': text --> $DIR/deprecation-lint.rs:26:9 | -LL | deprecated_text(); //~ ERROR use of deprecated item 'deprecation_lint::deprecated_text': text +LL | deprecated_text(); | ^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:31:9 | -LL | Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text +LL | Trait::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:33:9 | -LL | ::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::DeprecatedStruct': text --> $DIR/deprecation-lint.rs:35:17 | -LL | let _ = DeprecatedStruct { //~ ERROR use of deprecated item 'deprecation_lint::DeprecatedStruct': text +LL | let _ = DeprecatedStruct { | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::DeprecatedUnitStruct': text --> $DIR/deprecation-lint.rs:39:17 | -LL | let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item 'deprecation_lint::DeprecatedUnitStruct': text +LL | let _ = DeprecatedUnitStruct; | ^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Enum::DeprecatedVariant': text --> $DIR/deprecation-lint.rs:41:17 | -LL | let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item 'deprecation_lint::Enum::DeprecatedVariant': text +LL | let _ = Enum::DeprecatedVariant; | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::DeprecatedTupleStruct': text --> $DIR/deprecation-lint.rs:43:17 | -LL | let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item 'deprecation_lint::DeprecatedTupleStruct': text +LL | let _ = DeprecatedTupleStruct (1); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::nested::DeprecatedStruct': text --> $DIR/deprecation-lint.rs:45:17 | -LL | let _ = nested::DeprecatedStruct { //~ ERROR use of deprecated item 'deprecation_lint::nested::DeprecatedStruct': text +LL | let _ = nested::DeprecatedStruct { | ^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::nested::DeprecatedUnitStruct': text --> $DIR/deprecation-lint.rs:49:17 | -LL | let _ = nested::DeprecatedUnitStruct; //~ ERROR use of deprecated item 'deprecation_lint::nested::DeprecatedUnitStruct': text +LL | let _ = nested::DeprecatedUnitStruct; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::nested::Enum::DeprecatedVariant': text --> $DIR/deprecation-lint.rs:51:17 | -LL | let _ = nested::Enum::DeprecatedVariant; //~ ERROR use of deprecated item 'deprecation_lint::nested::Enum::DeprecatedVariant': text +LL | let _ = nested::Enum::DeprecatedVariant; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::nested::DeprecatedTupleStruct': text --> $DIR/deprecation-lint.rs:53:17 | -LL | let _ = nested::DeprecatedTupleStruct (1); //~ ERROR use of deprecated item 'deprecation_lint::nested::DeprecatedTupleStruct': text +LL | let _ = nested::DeprecatedTupleStruct (1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::deprecated_text': text --> $DIR/deprecation-lint.rs:60:25 | -LL | macro_test_arg!(deprecated_text()); //~ ERROR use of deprecated item 'deprecation_lint::deprecated_text': text +LL | macro_test_arg!(deprecated_text()); | ^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::deprecated_text': text --> $DIR/deprecation-lint.rs:61:41 | -LL | macro_test_arg!(macro_test_arg!(deprecated_text())); //~ ERROR use of deprecated item 'deprecation_lint::deprecated_text': text +LL | macro_test_arg!(macro_test_arg!(deprecated_text())); | ^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:66:9 | -LL | Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' +LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:68:9 | -LL | ::trait_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:70:9 | -LL | Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text +LL | Trait::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:72:9 | -LL | ::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::DeprecatedTrait': text --> $DIR/deprecation-lint.rs:82:10 | -LL | impl DeprecatedTrait for S {} //~ ERROR use of deprecated item 'deprecation_lint::DeprecatedTrait': text +LL | impl DeprecatedTrait for S {} | ^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::DeprecatedTrait': text --> $DIR/deprecation-lint.rs:83:24 | -LL | trait LocalTrait : DeprecatedTrait { } //~ ERROR use of deprecated item 'deprecation_lint::DeprecatedTrait': text +LL | trait LocalTrait : DeprecatedTrait { } | ^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Deprecated': text @@ -175,55 +175,55 @@ LL | let Deprecated2 error: use of deprecated item 'deprecation_lint::deprecated_mod::deprecated': text --> $DIR/deprecation-lint.rs:163:9 | -LL | deprecated_mod::deprecated(); //~ ERROR use of deprecated item 'deprecation_lint::deprecated_mod::deprecated': text +LL | deprecated_mod::deprecated(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::deprecated': text --> $DIR/deprecation-lint.rs:246:9 | -LL | deprecated(); //~ ERROR use of deprecated item 'this_crate::deprecated' +LL | deprecated(); | ^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:251:9 | -LL | Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:253:9 | -LL | ::trait_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::deprecated_text': text --> $DIR/deprecation-lint.rs:255:9 | -LL | deprecated_text(); //~ ERROR use of deprecated item 'this_crate::deprecated_text': text +LL | deprecated_text(); | ^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:260:9 | -LL | Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | Trait::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:262:9 | -LL | ::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::deprecated_future': text --> $DIR/deprecation-lint.rs:265:9 | -LL | deprecated_future(); //~ ERROR use of deprecated item +LL | deprecated_future(); | ^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::deprecated_future_text': text --> $DIR/deprecation-lint.rs:266:9 | -LL | deprecated_future_text(); //~ ERROR use of deprecated item +LL | deprecated_future_text(); | ^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::DeprecatedStruct': text @@ -235,19 +235,19 @@ LL | let _ = DeprecatedStruct { error: use of deprecated item 'this_crate::DeprecatedUnitStruct': text --> $DIR/deprecation-lint.rs:273:17 | -LL | let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item 'this_crate::DeprecatedUnitStruct': text +LL | let _ = DeprecatedUnitStruct; | ^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Enum::DeprecatedVariant': text --> $DIR/deprecation-lint.rs:275:17 | -LL | let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item 'this_crate::Enum::DeprecatedVariant': text +LL | let _ = Enum::DeprecatedVariant; | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::DeprecatedTupleStruct': text --> $DIR/deprecation-lint.rs:277:17 | -LL | let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item 'this_crate::DeprecatedTupleStruct': text +LL | let _ = DeprecatedTupleStruct (1); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::nested::DeprecatedStruct': text @@ -259,61 +259,61 @@ LL | let _ = nested::DeprecatedStruct { error: use of deprecated item 'this_crate::nested::DeprecatedUnitStruct': text --> $DIR/deprecation-lint.rs:284:17 | -LL | let _ = nested::DeprecatedUnitStruct; //~ ERROR use of deprecated item 'this_crate::nested::DeprecatedUnitStruct': text +LL | let _ = nested::DeprecatedUnitStruct; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::nested::Enum::DeprecatedVariant': text --> $DIR/deprecation-lint.rs:286:17 | -LL | let _ = nested::Enum::DeprecatedVariant; //~ ERROR use of deprecated item 'this_crate::nested::Enum::DeprecatedVariant': text +LL | let _ = nested::Enum::DeprecatedVariant; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::nested::DeprecatedTupleStruct': text --> $DIR/deprecation-lint.rs:288:17 | -LL | let _ = nested::DeprecatedTupleStruct (1); //~ ERROR use of deprecated item 'this_crate::nested::DeprecatedTupleStruct': text +LL | let _ = nested::DeprecatedTupleStruct (1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:293:9 | -LL | Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:295:9 | -LL | ::trait_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:297:9 | -LL | Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | Trait::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:299:9 | -LL | ::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::test_fn_closure_body::{{closure}}::bar' --> $DIR/deprecation-lint.rs:317:13 | -LL | bar(); //~ ERROR use of deprecated item 'this_crate::test_fn_closure_body::{{closure}}::bar' +LL | bar(); | ^^^ error: use of deprecated item 'this_crate::DeprecatedTrait': text --> $DIR/deprecation-lint.rs:336:10 | -LL | impl DeprecatedTrait for S { } //~ ERROR use of deprecated item 'this_crate::DeprecatedTrait': text +LL | impl DeprecatedTrait for S { } | ^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::DeprecatedTrait': text --> $DIR/deprecation-lint.rs:338:24 | -LL | trait LocalTrait : DeprecatedTrait { } //~ ERROR use of deprecated item 'this_crate::DeprecatedTrait': text +LL | trait LocalTrait : DeprecatedTrait { } | ^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate2::Deprecated': text @@ -355,109 +355,109 @@ LL | let Deprecated2 error: use of deprecated item 'deprecation_lint::MethodTester::method_deprecated': text --> $DIR/deprecation-lint.rs:18:13 | -LL | foo.method_deprecated(); //~ ERROR use of deprecated item 'deprecation_lint::MethodTester::method_deprecated' +LL | foo.method_deprecated(); | ^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::MethodTester::method_deprecated': text --> $DIR/deprecation-lint.rs:19:9 | -LL | Foo::method_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::MethodTester::method_deprecated' +LL | Foo::method_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::MethodTester::method_deprecated': text --> $DIR/deprecation-lint.rs:20:9 | -LL | ::method_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::MethodTester::method_deprecated' +LL | ::method_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:21:13 | -LL | foo.trait_deprecated(); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' +LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:23:9 | -LL | ::trait_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::MethodTester::method_deprecated_text': text --> $DIR/deprecation-lint.rs:27:13 | -LL | foo.method_deprecated_text(); //~ ERROR use of deprecated item 'deprecation_lint::MethodTester::method_deprecated_text': text +LL | foo.method_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::MethodTester::method_deprecated_text': text --> $DIR/deprecation-lint.rs:28:9 | -LL | Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::MethodTester::method_deprecated_text': text +LL | Foo::method_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::MethodTester::method_deprecated_text': text --> $DIR/deprecation-lint.rs:29:9 | -LL | ::method_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::MethodTester::method_deprecated_text': text +LL | ::method_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:30:13 | -LL | foo.trait_deprecated_text(); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text +LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:32:9 | -LL | ::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::DeprecatedStruct::i': text --> $DIR/deprecation-lint.rs:36:13 | -LL | i: 0 //~ ERROR use of deprecated item 'deprecation_lint::DeprecatedStruct::i': text +LL | i: 0 | ^^^^ error: use of deprecated item 'deprecation_lint::nested::DeprecatedStruct::i': text --> $DIR/deprecation-lint.rs:46:13 | -LL | i: 0 //~ ERROR use of deprecated item 'deprecation_lint::nested::DeprecatedStruct::i': text +LL | i: 0 | ^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:65:13 | -LL | foo.trait_deprecated(); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' +LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:67:9 | -LL | ::trait_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:69:13 | -LL | foo.trait_deprecated_text(); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text +LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:71:9 | -LL | ::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:76:13 | -LL | foo.trait_deprecated(); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated' +LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:77:13 | -LL | foo.trait_deprecated_text(); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text +LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'deprecation_lint::Stable::override2': text @@ -547,109 +547,109 @@ LL | _) error: use of deprecated item 'this_crate::MethodTester::method_deprecated': text --> $DIR/deprecation-lint.rs:247:13 | -LL | foo.method_deprecated(); //~ ERROR use of deprecated item 'this_crate::MethodTester::method_deprecated' +LL | foo.method_deprecated(); | ^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::MethodTester::method_deprecated': text --> $DIR/deprecation-lint.rs:248:9 | -LL | Foo::method_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::MethodTester::method_deprecated' +LL | Foo::method_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::MethodTester::method_deprecated': text --> $DIR/deprecation-lint.rs:249:9 | -LL | ::method_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::MethodTester::method_deprecated' +LL | ::method_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:250:13 | -LL | foo.trait_deprecated(); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:252:9 | -LL | ::trait_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text --> $DIR/deprecation-lint.rs:256:13 | -LL | foo.method_deprecated_text(); //~ ERROR use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text +LL | foo.method_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text --> $DIR/deprecation-lint.rs:257:9 | -LL | Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text +LL | Foo::method_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text --> $DIR/deprecation-lint.rs:258:9 | -LL | ::method_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text +LL | ::method_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:259:13 | -LL | foo.trait_deprecated_text(); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:261:9 | -LL | ::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::DeprecatedStruct::i': text --> $DIR/deprecation-lint.rs:270:13 | -LL | i: 0 //~ ERROR use of deprecated item 'this_crate::DeprecatedStruct::i': text +LL | i: 0 | ^^^^ error: use of deprecated item 'this_crate::nested::DeprecatedStruct::i': text --> $DIR/deprecation-lint.rs:281:13 | -LL | i: 0 //~ ERROR use of deprecated item 'this_crate::nested::DeprecatedStruct::i': text +LL | i: 0 | ^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:292:13 | -LL | foo.trait_deprecated(); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:294:9 | -LL | ::trait_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:296:13 | -LL | foo.trait_deprecated_text(); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:298:9 | -LL | ::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/deprecation-lint.rs:303:13 | -LL | foo.trait_deprecated(); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/deprecation-lint.rs:304:13 | -LL | foo.trait_deprecated_text(); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated item 'this_crate2::Stable::override2': text diff --git a/src/test/ui/deprecation/deprecation-sanity.stderr b/src/test/ui/deprecation/deprecation-sanity.stderr index a071a4fc10d5..6d5e3d513632 100644 --- a/src/test/ui/deprecation/deprecation-sanity.stderr +++ b/src/test/ui/deprecation/deprecation-sanity.stderr @@ -1,55 +1,55 @@ error[E0541]: unknown meta item 'reason' --> $DIR/deprecation-sanity.rs:4:43 | -LL | #[deprecated(since = "a", note = "a", reason)] //~ ERROR unknown meta item 'reason' +LL | #[deprecated(since = "a", note = "a", reason)] | ^^^^^^ expected one of `since`, `note` error[E0551]: incorrect meta item --> $DIR/deprecation-sanity.rs:7:31 | -LL | #[deprecated(since = "a", note)] //~ ERROR incorrect meta item +LL | #[deprecated(since = "a", note)] | ^^^^ error[E0551]: incorrect meta item --> $DIR/deprecation-sanity.rs:10:18 | -LL | #[deprecated(since, note = "a")] //~ ERROR incorrect meta item +LL | #[deprecated(since, note = "a")] | ^^^^^ error[E0551]: incorrect meta item --> $DIR/deprecation-sanity.rs:13:31 | -LL | #[deprecated(since = "a", note(b))] //~ ERROR incorrect meta item +LL | #[deprecated(since = "a", note(b))] | ^^^^^^^ error[E0551]: incorrect meta item --> $DIR/deprecation-sanity.rs:16:18 | -LL | #[deprecated(since(b), note = "a")] //~ ERROR incorrect meta item +LL | #[deprecated(since(b), note = "a")] | ^^^^^^^^ error[E0565]: literal in `deprecated` value must be a string --> $DIR/deprecation-sanity.rs:19:25 | -LL | #[deprecated(note = b"test")] //~ ERROR literal in `deprecated` value must be a string +LL | #[deprecated(note = b"test")] | ^^^^^^^ help: consider removing the prefix: `"test"` error[E0565]: item in `deprecated` must be a key/value pair --> $DIR/deprecation-sanity.rs:22:18 | -LL | #[deprecated("test")] //~ ERROR item in `deprecated` must be a key/value pair +LL | #[deprecated("test")] | ^^^^^^ error[E0550]: multiple deprecated attributes --> $DIR/deprecation-sanity.rs:28:1 | -LL | fn multiple1() { } //~ ERROR multiple deprecated attributes +LL | fn multiple1() { } | ^^^^^^^^^^^^^^^^^^ error[E0538]: multiple 'since' items --> $DIR/deprecation-sanity.rs:30:27 | -LL | #[deprecated(since = "a", since = "b", note = "c")] //~ ERROR multiple 'since' items +LL | #[deprecated(since = "a", since = "b", note = "c")] | ^^^^^^^^^^^ error: aborting due to 9 previous errors diff --git a/src/test/ui/deprecation/invalid-literal.stderr b/src/test/ui/deprecation/invalid-literal.stderr index f13d599c0b13..28bc2e2c2d8f 100644 --- a/src/test/ui/deprecation/invalid-literal.stderr +++ b/src/test/ui/deprecation/invalid-literal.stderr @@ -1,7 +1,7 @@ error: attribute must be of the form `#[deprecated]` or `#[deprecated(/*opt*/ since = "version", /*opt*/ note = "reason)]` or `#[deprecated = "reason"]` --> $DIR/invalid-literal.rs:1:1 | -LL | #[deprecated = b"test"] //~ ERROR attribute must be of the form +LL | #[deprecated = b"test"] | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/deprecation/rustc_deprecation-in-future.stderr b/src/test/ui/deprecation/rustc_deprecation-in-future.stderr index bd8ade16ec0e..4bbe79b55b32 100644 --- a/src/test/ui/deprecation/rustc_deprecation-in-future.stderr +++ b/src/test/ui/deprecation/rustc_deprecation-in-future.stderr @@ -1,7 +1,7 @@ error: use of item 'S' that will be deprecated in future version 99.99.99: effectively never --> $DIR/rustc_deprecation-in-future.rs:14:13 | -LL | let _ = S; //~ ERROR use of item 'S' that will be deprecated in future version 99.99.99: effectively never +LL | let _ = S; | ^ | note: lint level defined here diff --git a/src/test/ui/deref-non-pointer.stderr b/src/test/ui/deref-non-pointer.stderr index 0852311b7b16..1297e496bcb3 100644 --- a/src/test/ui/deref-non-pointer.stderr +++ b/src/test/ui/deref-non-pointer.stderr @@ -1,7 +1,7 @@ error[E0614]: type `{integer}` cannot be dereferenced --> $DIR/deref-non-pointer.rs:2:9 | -LL | match *1 { //~ ERROR: cannot be dereferenced +LL | match *1 { | ^^ error: aborting due to previous error diff --git a/src/test/ui/deref-suggestion.stderr b/src/test/ui/deref-suggestion.stderr index 99e2b38c3f0d..8f061b3416e1 100644 --- a/src/test/ui/deref-suggestion.stderr +++ b/src/test/ui/deref-suggestion.stderr @@ -49,7 +49,7 @@ LL | foo(&mut "aaa".to_owned()); error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:2:20 | -LL | ($x:expr) => { &$x } //~ ERROR mismatched types +LL | ($x:expr) => { &$x } | ^^^ expected u32, found &{integer} ... LL | foo3(borrow!(0)); diff --git a/src/test/ui/derive-uninhabited-enum-38885.stderr b/src/test/ui/derive-uninhabited-enum-38885.stderr index 8930b1f1974f..941c98b5506b 100644 --- a/src/test/ui/derive-uninhabited-enum-38885.stderr +++ b/src/test/ui/derive-uninhabited-enum-38885.stderr @@ -1,7 +1,7 @@ warning: enum is never used: `Void` --> $DIR/derive-uninhabited-enum-38885.rs:8:1 | -LL | enum Void {} //~ WARN never used +LL | enum Void {} | ^^^^^^^^^ | = note: `-W dead-code` implied by `-W unused` @@ -9,6 +9,6 @@ LL | enum Void {} //~ WARN never used warning: enum is never used: `Foo` --> $DIR/derive-uninhabited-enum-38885.rs:11:1 | -LL | enum Foo { //~ WARN never used +LL | enum Foo { | ^^^^^^^^ diff --git a/src/test/ui/derived-errors/issue-30580.stderr b/src/test/ui/derived-errors/issue-30580.stderr index d4829ad2a1af..14c575f2699a 100644 --- a/src/test/ui/derived-errors/issue-30580.stderr +++ b/src/test/ui/derived-errors/issue-30580.stderr @@ -1,7 +1,7 @@ error[E0609]: no field `c` on type `&Foo` --> $DIR/issue-30580.rs:12:11 | -LL | b.c; //~ ERROR no field `c` on type `&Foo` +LL | b.c; | ^ error: aborting due to previous error diff --git a/src/test/ui/derived-errors/issue-31997.stderr b/src/test/ui/derived-errors/issue-31997.stderr index 246e6f6465cd..dbceba046e2a 100644 --- a/src/test/ui/derived-errors/issue-31997.stderr +++ b/src/test/ui/derived-errors/issue-31997.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find function `bar` in this scope --> $DIR/issue-31997.rs:13:21 | -LL | try!(closure(|| bar(0 as *mut _))); //~ ERROR cannot find function `bar` in this scope +LL | try!(closure(|| bar(0 as *mut _))); | ^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/derives/derive-assoc-type-not-impl.stderr b/src/test/ui/derives/derive-assoc-type-not-impl.stderr index 1b25231677c7..b9e175e43d1c 100644 --- a/src/test/ui/derives/derive-assoc-type-not-impl.stderr +++ b/src/test/ui/derives/derive-assoc-type-not-impl.stderr @@ -4,7 +4,7 @@ error[E0599]: no method named `clone` found for type `Bar` in the curr LL | struct Bar { | ------------------ method `clone` not found for this ... -LL | Bar:: { x: 1 }.clone(); //~ ERROR +LL | Bar:: { x: 1 }.clone(); | ^^^^^ | = note: the method `clone` exists but the following trait bounds were not satisfied: diff --git a/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr index deb1cbd89b87..7db5fbe3de40 100644 --- a/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::clone::Clone` is not satisfied --> $DIR/derives-span-Clone-enum-struct-variant.rs:9:6 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ the trait `std::clone::Clone` is not implemented for `Error` | = note: required by `std::clone::Clone::clone` diff --git a/src/test/ui/derives/derives-span-Clone-enum.stderr b/src/test/ui/derives/derives-span-Clone-enum.stderr index de043cd28aa6..4371dc900ac1 100644 --- a/src/test/ui/derives/derives-span-Clone-enum.stderr +++ b/src/test/ui/derives/derives-span-Clone-enum.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::clone::Clone` is not satisfied --> $DIR/derives-span-Clone-enum.rs:9:6 | -LL | Error //~ ERROR +LL | Error | ^^^^^ the trait `std::clone::Clone` is not implemented for `Error` | = note: required by `std::clone::Clone::clone` diff --git a/src/test/ui/derives/derives-span-Clone-struct.stderr b/src/test/ui/derives/derives-span-Clone-struct.stderr index dd6fa9706c2c..cc3b602c9c0b 100644 --- a/src/test/ui/derives/derives-span-Clone-struct.stderr +++ b/src/test/ui/derives/derives-span-Clone-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::clone::Clone` is not satisfied --> $DIR/derives-span-Clone-struct.rs:8:5 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ the trait `std::clone::Clone` is not implemented for `Error` | = note: required by `std::clone::Clone::clone` diff --git a/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr b/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr index 5258240fc1f3..b2bf3527b0cc 100644 --- a/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::clone::Clone` is not satisfied --> $DIR/derives-span-Clone-tuple-struct.rs:8:5 | -LL | Error //~ ERROR +LL | Error | ^^^^^ the trait `std::clone::Clone` is not implemented for `Error` | = note: required by `std::clone::Clone::clone` diff --git a/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr index c981c20b762e..ca5bcfe930d6 100644 --- a/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr @@ -1,7 +1,7 @@ error[E0277]: `Error` doesn't implement `std::fmt::Debug` --> $DIR/derives-span-Debug-enum-struct-variant.rs:9:6 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ `Error` cannot be formatted using `{:?}` | = help: the trait `std::fmt::Debug` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Debug-enum.stderr b/src/test/ui/derives/derives-span-Debug-enum.stderr index 02cfe20616cd..cd367a334fc6 100644 --- a/src/test/ui/derives/derives-span-Debug-enum.stderr +++ b/src/test/ui/derives/derives-span-Debug-enum.stderr @@ -1,7 +1,7 @@ error[E0277]: `Error` doesn't implement `std::fmt::Debug` --> $DIR/derives-span-Debug-enum.rs:9:6 | -LL | Error //~ ERROR +LL | Error | ^^^^^ `Error` cannot be formatted using `{:?}` | = help: the trait `std::fmt::Debug` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Debug-struct.stderr b/src/test/ui/derives/derives-span-Debug-struct.stderr index 5fe7d846b4c2..e00695ec0ba6 100644 --- a/src/test/ui/derives/derives-span-Debug-struct.stderr +++ b/src/test/ui/derives/derives-span-Debug-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: `Error` doesn't implement `std::fmt::Debug` --> $DIR/derives-span-Debug-struct.rs:8:5 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ `Error` cannot be formatted using `{:?}` | = help: the trait `std::fmt::Debug` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr b/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr index 9088b9e83b0c..37440b59ae70 100644 --- a/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: `Error` doesn't implement `std::fmt::Debug` --> $DIR/derives-span-Debug-tuple-struct.rs:8:5 | -LL | Error //~ ERROR +LL | Error | ^^^^^ `Error` cannot be formatted using `{:?}` | = help: the trait `std::fmt::Debug` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Default-struct.stderr b/src/test/ui/derives/derives-span-Default-struct.stderr index 1ad7cd454773..413d4ec8c291 100644 --- a/src/test/ui/derives/derives-span-Default-struct.stderr +++ b/src/test/ui/derives/derives-span-Default-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::default::Default` is not satisfied --> $DIR/derives-span-Default-struct.rs:8:5 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ the trait `std::default::Default` is not implemented for `Error` | = note: required by `std::default::Default::default` diff --git a/src/test/ui/derives/derives-span-Default-tuple-struct.stderr b/src/test/ui/derives/derives-span-Default-tuple-struct.stderr index 447bc73ceb40..8f4d43daa519 100644 --- a/src/test/ui/derives/derives-span-Default-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Default-tuple-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::default::Default` is not satisfied --> $DIR/derives-span-Default-tuple-struct.rs:8:5 | -LL | Error //~ ERROR +LL | Error | ^^^^^ the trait `std::default::Default` is not implemented for `Error` | = note: required by `std::default::Default::default` diff --git a/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr index e8bcec466550..52ecce4632d1 100644 --- a/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied --> $DIR/derives-span-Eq-enum-struct-variant.rs:9:6 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Error` | = note: required by `std::cmp::AssertParamIsEq` diff --git a/src/test/ui/derives/derives-span-Eq-enum.stderr b/src/test/ui/derives/derives-span-Eq-enum.stderr index 95ff08a4332c..bf91a0edc375 100644 --- a/src/test/ui/derives/derives-span-Eq-enum.stderr +++ b/src/test/ui/derives/derives-span-Eq-enum.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied --> $DIR/derives-span-Eq-enum.rs:9:6 | -LL | Error //~ ERROR +LL | Error | ^^^^^ the trait `std::cmp::Eq` is not implemented for `Error` | = note: required by `std::cmp::AssertParamIsEq` diff --git a/src/test/ui/derives/derives-span-Eq-struct.stderr b/src/test/ui/derives/derives-span-Eq-struct.stderr index 44bbcf73dd77..531e8887cd2b 100644 --- a/src/test/ui/derives/derives-span-Eq-struct.stderr +++ b/src/test/ui/derives/derives-span-Eq-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied --> $DIR/derives-span-Eq-struct.rs:8:5 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Error` | = note: required by `std::cmp::AssertParamIsEq` diff --git a/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr b/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr index 26228b389131..9e21c6c67bfc 100644 --- a/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied --> $DIR/derives-span-Eq-tuple-struct.rs:8:5 | -LL | Error //~ ERROR +LL | Error | ^^^^^ the trait `std::cmp::Eq` is not implemented for `Error` | = note: required by `std::cmp::AssertParamIsEq` diff --git a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr index 324f2f1fd6d1..417c720c63e9 100644 --- a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::hash::Hash` is not satisfied --> $DIR/derives-span-Hash-enum-struct-variant.rs:9:6 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ the trait `std::hash::Hash` is not implemented for `Error` | = note: required by `std::hash::Hash::hash` diff --git a/src/test/ui/derives/derives-span-Hash-enum.stderr b/src/test/ui/derives/derives-span-Hash-enum.stderr index da44a8f498ea..25be8794889f 100644 --- a/src/test/ui/derives/derives-span-Hash-enum.stderr +++ b/src/test/ui/derives/derives-span-Hash-enum.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::hash::Hash` is not satisfied --> $DIR/derives-span-Hash-enum.rs:9:6 | -LL | Error //~ ERROR +LL | Error | ^^^^^ the trait `std::hash::Hash` is not implemented for `Error` | = note: required by `std::hash::Hash::hash` diff --git a/src/test/ui/derives/derives-span-Hash-struct.stderr b/src/test/ui/derives/derives-span-Hash-struct.stderr index 17d45e4b0dd2..c0574453a7a6 100644 --- a/src/test/ui/derives/derives-span-Hash-struct.stderr +++ b/src/test/ui/derives/derives-span-Hash-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::hash::Hash` is not satisfied --> $DIR/derives-span-Hash-struct.rs:8:5 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ the trait `std::hash::Hash` is not implemented for `Error` | = note: required by `std::hash::Hash::hash` diff --git a/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr b/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr index e0e5cce107f9..6339c38578eb 100644 --- a/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::hash::Hash` is not satisfied --> $DIR/derives-span-Hash-tuple-struct.rs:8:5 | -LL | Error //~ ERROR +LL | Error | ^^^^^ the trait `std::hash::Hash` is not implemented for `Error` | = note: required by `std::hash::Hash::hash` diff --git a/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr index 149a9475f103..5c0d4e4ebe91 100644 --- a/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::cmp::Ord` is not satisfied --> $DIR/derives-span-Ord-enum-struct-variant.rs:9:6 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `Error` | = note: required by `std::cmp::Ord::cmp` diff --git a/src/test/ui/derives/derives-span-Ord-enum.stderr b/src/test/ui/derives/derives-span-Ord-enum.stderr index 17ab75549e46..56268a237450 100644 --- a/src/test/ui/derives/derives-span-Ord-enum.stderr +++ b/src/test/ui/derives/derives-span-Ord-enum.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::cmp::Ord` is not satisfied --> $DIR/derives-span-Ord-enum.rs:9:6 | -LL | Error //~ ERROR +LL | Error | ^^^^^ the trait `std::cmp::Ord` is not implemented for `Error` | = note: required by `std::cmp::Ord::cmp` diff --git a/src/test/ui/derives/derives-span-Ord-struct.stderr b/src/test/ui/derives/derives-span-Ord-struct.stderr index 7088f8fc8901..40dc3d09dad7 100644 --- a/src/test/ui/derives/derives-span-Ord-struct.stderr +++ b/src/test/ui/derives/derives-span-Ord-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::cmp::Ord` is not satisfied --> $DIR/derives-span-Ord-struct.rs:8:5 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `Error` | = note: required by `std::cmp::Ord::cmp` diff --git a/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr b/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr index 5c046366993f..4a9dea8c12e9 100644 --- a/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Error: std::cmp::Ord` is not satisfied --> $DIR/derives-span-Ord-tuple-struct.rs:8:5 | -LL | Error //~ ERROR +LL | Error | ^^^^^ the trait `std::cmp::Ord` is not implemented for `Error` | = note: required by `std::cmp::Ord::cmp` diff --git a/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr index 7683402d8aaa..ed5468cc4dac 100644 --- a/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr @@ -1,7 +1,7 @@ error[E0369]: binary operation `==` cannot be applied to type `Error` --> $DIR/derives-span-PartialEq-enum-struct-variant.rs:9:6 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` @@ -9,7 +9,7 @@ LL | x: Error //~ ERROR error[E0369]: binary operation `!=` cannot be applied to type `Error` --> $DIR/derives-span-PartialEq-enum-struct-variant.rs:9:6 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` diff --git a/src/test/ui/derives/derives-span-PartialEq-enum.stderr b/src/test/ui/derives/derives-span-PartialEq-enum.stderr index 9fa1a2bf17a6..06a88c03f58a 100644 --- a/src/test/ui/derives/derives-span-PartialEq-enum.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-enum.stderr @@ -1,7 +1,7 @@ error[E0369]: binary operation `==` cannot be applied to type `Error` --> $DIR/derives-span-PartialEq-enum.rs:9:6 | -LL | Error //~ ERROR +LL | Error | ^^^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` @@ -9,7 +9,7 @@ LL | Error //~ ERROR error[E0369]: binary operation `!=` cannot be applied to type `Error` --> $DIR/derives-span-PartialEq-enum.rs:9:6 | -LL | Error //~ ERROR +LL | Error | ^^^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` diff --git a/src/test/ui/derives/derives-span-PartialEq-struct.stderr b/src/test/ui/derives/derives-span-PartialEq-struct.stderr index 4a08c985b4a0..b8481048361e 100644 --- a/src/test/ui/derives/derives-span-PartialEq-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-struct.stderr @@ -1,7 +1,7 @@ error[E0369]: binary operation `==` cannot be applied to type `Error` --> $DIR/derives-span-PartialEq-struct.rs:8:5 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` @@ -9,7 +9,7 @@ LL | x: Error //~ ERROR error[E0369]: binary operation `!=` cannot be applied to type `Error` --> $DIR/derives-span-PartialEq-struct.rs:8:5 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` diff --git a/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr index 850eab4f0880..4398d2521255 100644 --- a/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr @@ -1,7 +1,7 @@ error[E0369]: binary operation `==` cannot be applied to type `Error` --> $DIR/derives-span-PartialEq-tuple-struct.rs:8:5 | -LL | Error //~ ERROR +LL | Error | ^^^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` @@ -9,7 +9,7 @@ LL | Error //~ ERROR error[E0369]: binary operation `!=` cannot be applied to type `Error` --> $DIR/derives-span-PartialEq-tuple-struct.rs:8:5 | -LL | Error //~ ERROR +LL | Error | ^^^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr index 0c359629d789..ac9f45046353 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr @@ -1,7 +1,7 @@ error[E0277]: can't compare `Error` with `Error` --> $DIR/derives-span-PartialOrd-enum-struct-variant.rs:9:6 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ no implementation for `Error < Error` and `Error > Error` | = help: the trait `std::cmp::PartialOrd` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum.stderr b/src/test/ui/derives/derives-span-PartialOrd-enum.stderr index e4036a540db2..3e684aef39f2 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-enum.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-enum.stderr @@ -1,7 +1,7 @@ error[E0277]: can't compare `Error` with `Error` --> $DIR/derives-span-PartialOrd-enum.rs:9:6 | -LL | Error //~ ERROR +LL | Error | ^^^^^ no implementation for `Error < Error` and `Error > Error` | = help: the trait `std::cmp::PartialOrd` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-PartialOrd-struct.stderr b/src/test/ui/derives/derives-span-PartialOrd-struct.stderr index 5c77a05e9d04..10659aac6421 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: can't compare `Error` with `Error` --> $DIR/derives-span-PartialOrd-struct.rs:8:5 | -LL | x: Error //~ ERROR +LL | x: Error | ^^^^^^^^ no implementation for `Error < Error` and `Error > Error` | = help: the trait `std::cmp::PartialOrd` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr index e38a0424b3d7..cbe05e378405 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr @@ -1,7 +1,7 @@ error[E0277]: can't compare `Error` with `Error` --> $DIR/derives-span-PartialOrd-tuple-struct.rs:8:5 | -LL | Error //~ ERROR +LL | Error | ^^^^^ no implementation for `Error < Error` and `Error > Error` | = help: the trait `std::cmp::PartialOrd` is not implemented for `Error` diff --git a/src/test/ui/derives/deriving-copyclone.stderr b/src/test/ui/derives/deriving-copyclone.stderr index 0a9fdd34fe2e..e6060c269e10 100644 --- a/src/test/ui/derives/deriving-copyclone.stderr +++ b/src/test/ui/derives/deriving-copyclone.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `C: std::marker::Copy` is not satisfied --> $DIR/deriving-copyclone.rs:31:5 | -LL | is_copy(B { a: 1, b: C }); //~ERROR Copy +LL | is_copy(B { a: 1, b: C }); | ^^^^^^^ the trait `std::marker::Copy` is not implemented for `C` | = note: required because of the requirements on the impl of `std::marker::Copy` for `B` @@ -14,7 +14,7 @@ LL | fn is_copy(_: T) {} error[E0277]: the trait bound `C: std::clone::Clone` is not satisfied --> $DIR/deriving-copyclone.rs:32:5 | -LL | is_clone(B { a: 1, b: C }); //~ERROR Clone +LL | is_clone(B { a: 1, b: C }); | ^^^^^^^^ the trait `std::clone::Clone` is not implemented for `C` | = note: required because of the requirements on the impl of `std::clone::Clone` for `B` @@ -27,7 +27,7 @@ LL | fn is_clone(_: T) {} error[E0277]: the trait bound `D: std::marker::Copy` is not satisfied --> $DIR/deriving-copyclone.rs:35:5 | -LL | is_copy(B { a: 1, b: D }); //~ERROR Copy +LL | is_copy(B { a: 1, b: D }); | ^^^^^^^ the trait `std::marker::Copy` is not implemented for `D` | = note: required because of the requirements on the impl of `std::marker::Copy` for `B` diff --git a/src/test/ui/derives/deriving-meta-empty-trait-list.stderr b/src/test/ui/derives/deriving-meta-empty-trait-list.stderr index 191bb780f7e1..f8414b6e65e6 100644 --- a/src/test/ui/derives/deriving-meta-empty-trait-list.stderr +++ b/src/test/ui/derives/deriving-meta-empty-trait-list.stderr @@ -1,6 +1,6 @@ warning: empty trait list in `derive` --> $DIR/deriving-meta-empty-trait-list.rs:3:1 | -LL | #[derive()] //~ WARNING empty trait list in `derive` +LL | #[derive()] | ^^^^^^^^^^^ diff --git a/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr b/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr index 02ea6321eb8f..3206eecbe30e 100644 --- a/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr +++ b/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr @@ -1,7 +1,7 @@ error[E0369]: binary operation `==` cannot be applied to type `NoCloneOrEq` --> $DIR/deriving-no-inner-impl-error-message.rs:5:5 | -LL | x: NoCloneOrEq //~ ERROR binary operation `==` cannot be applied to type `NoCloneOrEq` +LL | x: NoCloneOrEq | ^^^^^^^^^^^^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `NoCloneOrEq` @@ -9,7 +9,7 @@ LL | x: NoCloneOrEq //~ ERROR binary operation `==` cannot be applied to typ error[E0369]: binary operation `!=` cannot be applied to type `NoCloneOrEq` --> $DIR/deriving-no-inner-impl-error-message.rs:5:5 | -LL | x: NoCloneOrEq //~ ERROR binary operation `==` cannot be applied to type `NoCloneOrEq` +LL | x: NoCloneOrEq | ^^^^^^^^^^^^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `NoCloneOrEq` diff --git a/src/test/ui/derives/deriving-non-type.stderr b/src/test/ui/derives/deriving-non-type.stderr index 98594542653c..563e76dc6094 100644 --- a/src/test/ui/derives/deriving-non-type.stderr +++ b/src/test/ui/derives/deriving-non-type.stderr @@ -1,55 +1,55 @@ error: `derive` may only be applied to structs, enums and unions --> $DIR/deriving-non-type.rs:5:1 | -LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions +LL | #[derive(PartialEq)] | ^^^^^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions --> $DIR/deriving-non-type.rs:8:1 | -LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions +LL | #[derive(PartialEq)] | ^^^^^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions --> $DIR/deriving-non-type.rs:11:1 | -LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions +LL | #[derive(PartialEq)] | ^^^^^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions --> $DIR/deriving-non-type.rs:14:1 | -LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions +LL | #[derive(PartialEq)] | ^^^^^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions --> $DIR/deriving-non-type.rs:17:1 | -LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions +LL | #[derive(PartialEq)] | ^^^^^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions --> $DIR/deriving-non-type.rs:20:1 | -LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions +LL | #[derive(PartialEq)] | ^^^^^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions --> $DIR/deriving-non-type.rs:23:1 | -LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions +LL | #[derive(PartialEq)] | ^^^^^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions --> $DIR/deriving-non-type.rs:26:1 | -LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions +LL | #[derive(PartialEq)] | ^^^^^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions --> $DIR/deriving-non-type.rs:29:1 | -LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions +LL | #[derive(PartialEq)] | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to 9 previous errors diff --git a/src/test/ui/derives/deriving-primitive.stderr b/src/test/ui/derives/deriving-primitive.stderr index 377f4e870822..d1b444976ddc 100644 --- a/src/test/ui/derives/deriving-primitive.stderr +++ b/src/test/ui/derives/deriving-primitive.stderr @@ -1,7 +1,7 @@ error: cannot find derive macro `FromPrimitive` in this scope --> $DIR/deriving-primitive.rs:1:10 | -LL | #[derive(FromPrimitive)] //~ ERROR cannot find derive macro `FromPrimitive` in this scope +LL | #[derive(FromPrimitive)] | ^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/derives/deriving-with-repr-packed.stderr b/src/test/ui/derives/deriving-with-repr-packed.stderr index 4ab14a1df84d..9d96908a0562 100644 --- a/src/test/ui/derives/deriving-with-repr-packed.stderr +++ b/src/test/ui/derives/deriving-with-repr-packed.stderr @@ -1,4 +1,4 @@ -error: #[derive] can't be used on a #[repr(packed)] struct with type parameters (error E0133) +error: #[derive] can't be used on a #[repr(packed)] struct with type or const parameters (error E0133) --> $DIR/deriving-with-repr-packed.rs:8:16 | LL | #[derive(Copy, Clone, PartialEq, Eq)] @@ -12,7 +12,7 @@ LL | #![deny(safe_packed_borrows)] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #46043 -error: #[derive] can't be used on a #[repr(packed)] struct with type parameters (error E0133) +error: #[derive] can't be used on a #[repr(packed)] struct with type or const parameters (error E0133) --> $DIR/deriving-with-repr-packed.rs:8:23 | LL | #[derive(Copy, Clone, PartialEq, Eq)] diff --git a/src/test/ui/destructure-trait-ref.stderr b/src/test/ui/destructure-trait-ref.stderr index 4c93a6781eab..8fc2b76eb111 100644 --- a/src/test/ui/destructure-trait-ref.stderr +++ b/src/test/ui/destructure-trait-ref.stderr @@ -1,19 +1,19 @@ error[E0033]: type `&dyn T` cannot be dereferenced --> $DIR/destructure-trait-ref.rs:26:9 | -LL | let &x = &1isize as &T; //~ ERROR type `&dyn T` cannot be dereferenced +LL | let &x = &1isize as &T; | ^^ type `&dyn T` cannot be dereferenced error[E0033]: type `&dyn T` cannot be dereferenced --> $DIR/destructure-trait-ref.rs:27:10 | -LL | let &&x = &(&1isize as &T); //~ ERROR type `&dyn T` cannot be dereferenced +LL | let &&x = &(&1isize as &T); | ^^ type `&dyn T` cannot be dereferenced error[E0033]: type `std::boxed::Box` cannot be dereferenced --> $DIR/destructure-trait-ref.rs:28:9 | -LL | let box x = box 1isize as Box; //~ ERROR type `std::boxed::Box` cannot be dereferenced +LL | let box x = box 1isize as Box; | ^^^^^ type `std::boxed::Box` cannot be dereferenced error[E0308]: mismatched types diff --git a/src/test/ui/did_you_mean/E0178.stderr b/src/test/ui/did_you_mean/E0178.stderr index ad9bb57c922a..44e6ddd0eac8 100644 --- a/src/test/ui/did_you_mean/E0178.stderr +++ b/src/test/ui/did_you_mean/E0178.stderr @@ -1,25 +1,25 @@ error[E0178]: expected a path on the left-hand side of `+`, not `&'a Foo` --> $DIR/E0178.rs:4:8 | -LL | w: &'a Foo + Copy, //~ ERROR expected a path +LL | w: &'a Foo + Copy, | ^^^^^^^^^^^^^^ help: try adding parentheses: `&'a (Foo + Copy)` error[E0178]: expected a path on the left-hand side of `+`, not `&'a Foo` --> $DIR/E0178.rs:5:8 | -LL | x: &'a Foo + 'a, //~ ERROR expected a path +LL | x: &'a Foo + 'a, | ^^^^^^^^^^^^ help: try adding parentheses: `&'a (Foo + 'a)` error[E0178]: expected a path on the left-hand side of `+`, not `&'a mut Foo` --> $DIR/E0178.rs:6:8 | -LL | y: &'a mut Foo + 'a, //~ ERROR expected a path +LL | y: &'a mut Foo + 'a, | ^^^^^^^^^^^^^^^^ help: try adding parentheses: `&'a mut (Foo + 'a)` error[E0178]: expected a path on the left-hand side of `+`, not `fn() -> Foo` --> $DIR/E0178.rs:7:8 | -LL | z: fn() -> Foo + 'a, //~ ERROR expected a path +LL | z: fn() -> Foo + 'a, | ^^^^^^^^^^^^^^^^ perhaps you forgot parentheses? error: aborting due to 4 previous errors diff --git a/src/test/ui/did_you_mean/issue-31424.nll.stderr b/src/test/ui/did_you_mean/issue-31424.nll.stderr index 91368dded375..147225f1be59 100644 --- a/src/test/ui/did_you_mean/issue-31424.nll.stderr +++ b/src/test/ui/did_you_mean/issue-31424.nll.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable --> $DIR/issue-31424.rs:7:9 | -LL | (&mut self).bar(); //~ ERROR cannot borrow +LL | (&mut self).bar(); | ^^^^^^^^^^^ | | | cannot borrow as mutable @@ -12,8 +12,8 @@ warning: function cannot return without recursing | LL | fn bar(self: &mut Self) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing -LL | //~^ WARN function cannot return without recursing -LL | (&mut self).bar(); //~ ERROR cannot borrow +LL | +LL | (&mut self).bar(); | ----------------- recursive call site | = note: #[warn(unconditional_recursion)] on by default @@ -22,7 +22,7 @@ LL | (&mut self).bar(); //~ ERROR cannot borrow error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable --> $DIR/issue-31424.rs:14:9 | -LL | (&mut self).bar(); //~ ERROR cannot borrow +LL | (&mut self).bar(); | ^^^^^^^^^^^ | | | cannot borrow as mutable diff --git a/src/test/ui/did_you_mean/issue-31424.stderr b/src/test/ui/did_you_mean/issue-31424.stderr index 1442666ef66a..7c351ea9bfe1 100644 --- a/src/test/ui/did_you_mean/issue-31424.stderr +++ b/src/test/ui/did_you_mean/issue-31424.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow immutable argument `self` as mutable --> $DIR/issue-31424.rs:7:15 | -LL | (&mut self).bar(); //~ ERROR cannot borrow +LL | (&mut self).bar(); | ^^^^ | | | cannot reborrow mutably @@ -12,8 +12,8 @@ warning: function cannot return without recursing | LL | fn bar(self: &mut Self) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing -LL | //~^ WARN function cannot return without recursing -LL | (&mut self).bar(); //~ ERROR cannot borrow +LL | +LL | (&mut self).bar(); | ----------------- recursive call site | = note: #[warn(unconditional_recursion)] on by default @@ -22,11 +22,11 @@ LL | (&mut self).bar(); //~ ERROR cannot borrow error[E0596]: cannot borrow immutable argument `self` as mutable --> $DIR/issue-31424.rs:14:15 | -LL | (&mut self).bar(); //~ ERROR cannot borrow +LL | (&mut self).bar(); | ^^^^ cannot borrow mutably help: consider removing the `&mut`, as it is an immutable binding to a mutable reference | -LL | self.bar(); //~ ERROR cannot borrow +LL | self.bar(); | ^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/did_you_mean/issue-34126.nll.stderr b/src/test/ui/did_you_mean/issue-34126.nll.stderr index ed73cca435fd..e738df1b732e 100644 --- a/src/test/ui/did_you_mean/issue-34126.nll.stderr +++ b/src/test/ui/did_you_mean/issue-34126.nll.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow `self` as mutable, as it is not declared as mutable --> $DIR/issue-34126.rs:6:18 | -LL | self.run(&mut self); //~ ERROR cannot borrow +LL | self.run(&mut self); | ^^^^^^^^^ | | | cannot borrow as mutable @@ -10,7 +10,7 @@ LL | self.run(&mut self); //~ ERROR cannot borrow error[E0502]: cannot borrow `self` as mutable because it is also borrowed as immutable --> $DIR/issue-34126.rs:6:18 | -LL | self.run(&mut self); //~ ERROR cannot borrow +LL | self.run(&mut self); | ---- --- ^^^^^^^^^ mutable borrow occurs here | | | | | immutable borrow later used by call diff --git a/src/test/ui/did_you_mean/issue-34126.stderr b/src/test/ui/did_you_mean/issue-34126.stderr index 05ea4ef91ce4..536e295181ac 100644 --- a/src/test/ui/did_you_mean/issue-34126.stderr +++ b/src/test/ui/did_you_mean/issue-34126.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow immutable argument `self` as mutable --> $DIR/issue-34126.rs:6:23 | -LL | self.run(&mut self); //~ ERROR cannot borrow +LL | self.run(&mut self); | ^^^^ | | | cannot reborrow mutably diff --git a/src/test/ui/did_you_mean/issue-34337.nll.stderr b/src/test/ui/did_you_mean/issue-34337.nll.stderr index 5e46889866d4..81f7b6dbf1b2 100644 --- a/src/test/ui/did_you_mean/issue-34337.nll.stderr +++ b/src/test/ui/did_you_mean/issue-34337.nll.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow `key` as mutable, as it is not declared as mutable --> $DIR/issue-34337.rs:6:9 | -LL | get(&mut key); //~ ERROR cannot borrow +LL | get(&mut key); | ^^^^^^^^ | | | cannot borrow as mutable diff --git a/src/test/ui/did_you_mean/issue-34337.stderr b/src/test/ui/did_you_mean/issue-34337.stderr index 4bf988b72cd0..353f409b0740 100644 --- a/src/test/ui/did_you_mean/issue-34337.stderr +++ b/src/test/ui/did_you_mean/issue-34337.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow immutable local variable `key` as mutable --> $DIR/issue-34337.rs:6:14 | -LL | get(&mut key); //~ ERROR cannot borrow +LL | get(&mut key); | ^^^ | | | cannot reborrow mutably diff --git a/src/test/ui/did_you_mean/issue-35937.nll.stderr b/src/test/ui/did_you_mean/issue-35937.nll.stderr index 76fb1e229536..216cb14dcf63 100644 --- a/src/test/ui/did_you_mean/issue-35937.nll.stderr +++ b/src/test/ui/did_you_mean/issue-35937.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `f.v` as mutable, as `f` is not declared as mutable | LL | let f = Foo { v: Vec::new() }; | - help: consider changing this to be mutable: `mut f` -LL | f.v.push("cat".to_string()); //~ ERROR cannot borrow +LL | f.v.push("cat".to_string()); | ^^^ cannot borrow as mutable error[E0594]: cannot assign to `s.x`, as `s` is not declared as mutable @@ -11,7 +11,7 @@ error[E0594]: cannot assign to `s.x`, as `s` is not declared as mutable | LL | let s = S { x: 42 }; | - help: consider changing this to be mutable: `mut s` -LL | s.x += 1; //~ ERROR cannot assign +LL | s.x += 1; | ^^^^^^^^ cannot assign error[E0594]: cannot assign to `s.x`, as `s` is not declared as mutable @@ -19,7 +19,7 @@ error[E0594]: cannot assign to `s.x`, as `s` is not declared as mutable | LL | fn bar(s: S) { | - help: consider changing this to be mutable: `mut s` -LL | s.x += 1; //~ ERROR cannot assign +LL | s.x += 1; | ^^^^^^^^ cannot assign error: aborting due to 3 previous errors diff --git a/src/test/ui/did_you_mean/issue-35937.stderr b/src/test/ui/did_you_mean/issue-35937.stderr index 7499a9475e88..1e70f986e83d 100644 --- a/src/test/ui/did_you_mean/issue-35937.stderr +++ b/src/test/ui/did_you_mean/issue-35937.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow field `f.v` of immutable binding as mutable | LL | let f = Foo { v: Vec::new() }; | - help: make this binding mutable: `mut f` -LL | f.v.push("cat".to_string()); //~ ERROR cannot borrow +LL | f.v.push("cat".to_string()); | ^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field `s.x` of immutable binding @@ -11,7 +11,7 @@ error[E0594]: cannot assign to field `s.x` of immutable binding | LL | let s = S { x: 42 }; | - help: make this binding mutable: `mut s` -LL | s.x += 1; //~ ERROR cannot assign +LL | s.x += 1; | ^^^^^^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to field `s.x` of immutable binding @@ -19,7 +19,7 @@ error[E0594]: cannot assign to field `s.x` of immutable binding | LL | fn bar(s: S) { | - help: make this binding mutable: `mut s` -LL | s.x += 1; //~ ERROR cannot assign +LL | s.x += 1; | ^^^^^^^^ cannot mutably borrow field of immutable binding error: aborting due to 3 previous errors diff --git a/src/test/ui/did_you_mean/issue-36798.stderr b/src/test/ui/did_you_mean/issue-36798.stderr index 8273fad47646..98876e305ca0 100644 --- a/src/test/ui/did_you_mean/issue-36798.stderr +++ b/src/test/ui/did_you_mean/issue-36798.stderr @@ -1,7 +1,7 @@ error[E0609]: no field `baz` on type `Foo` --> $DIR/issue-36798.rs:7:7 | -LL | f.baz; //~ ERROR no field +LL | f.baz; | ^^^ help: a field with a similar name exists: `bar` error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-36798_unknown_field.stderr b/src/test/ui/did_you_mean/issue-36798_unknown_field.stderr index b884d8a53d35..2ed0a0924006 100644 --- a/src/test/ui/did_you_mean/issue-36798_unknown_field.stderr +++ b/src/test/ui/did_you_mean/issue-36798_unknown_field.stderr @@ -1,7 +1,7 @@ error[E0609]: no field `zz` on type `Foo` --> $DIR/issue-36798_unknown_field.rs:7:7 | -LL | f.zz; //~ ERROR no field +LL | f.zz; | ^^ unknown field | = note: available fields are: `bar` diff --git a/src/test/ui/did_you_mean/issue-37139.nll.stderr b/src/test/ui/did_you_mean/issue-37139.nll.stderr index 4d1c8a6b0eb1..163817dd9bf5 100644 --- a/src/test/ui/did_you_mean/issue-37139.nll.stderr +++ b/src/test/ui/did_you_mean/issue-37139.nll.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable --> $DIR/issue-37139.rs:12:18 | -LL | test(&mut x); //~ ERROR cannot borrow immutable +LL | test(&mut x); | ^^^^^^ | | | cannot borrow as mutable diff --git a/src/test/ui/did_you_mean/issue-37139.stderr b/src/test/ui/did_you_mean/issue-37139.stderr index 38617fda2afa..cd42ee8001ab 100644 --- a/src/test/ui/did_you_mean/issue-37139.stderr +++ b/src/test/ui/did_you_mean/issue-37139.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow immutable local variable `x` as mutable --> $DIR/issue-37139.rs:12:23 | -LL | test(&mut x); //~ ERROR cannot borrow immutable +LL | test(&mut x); | ^ | | | cannot reborrow mutably diff --git a/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.stderr b/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.stderr index 1f3f7c475707..852abaed724d 100644 --- a/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.stderr +++ b/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.stderr @@ -1,13 +1,13 @@ error[E0432]: unresolved import `Foo` --> $DIR/issue-38054-do-not-show-unresolved-names.rs:1:5 | -LL | use Foo; //~ ERROR unresolved +LL | use Foo; | ^^^ no `Foo` in the root error[E0432]: unresolved import `Foo1` --> $DIR/issue-38054-do-not-show-unresolved-names.rs:3:5 | -LL | use Foo1; //~ ERROR unresolved +LL | use Foo1; | ^^^^ no `Foo1` in the root error: aborting due to 2 previous errors diff --git a/src/test/ui/did_you_mean/issue-38147-1.nll.stderr b/src/test/ui/did_you_mean/issue-38147-1.nll.stderr index 838673b21d1e..6efac371c028 100644 --- a/src/test/ui/did_you_mean/issue-38147-1.nll.stderr +++ b/src/test/ui/did_you_mean/issue-38147-1.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` referenc | LL | fn f(&self) { | ----- help: consider changing this to be a mutable reference: `&mut self` -LL | self.s.push('x'); //~ ERROR cannot borrow data mutably +LL | self.s.push('x'); | ^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-38147-1.stderr b/src/test/ui/did_you_mean/issue-38147-1.stderr index 74c72edd028b..4311836be341 100644 --- a/src/test/ui/did_you_mean/issue-38147-1.stderr +++ b/src/test/ui/did_you_mean/issue-38147-1.stderr @@ -3,7 +3,7 @@ error[E0389]: cannot borrow data mutably in a `&` reference | LL | fn f(&self) { | ----- use `&mut self` here to make mutable -LL | self.s.push('x'); //~ ERROR cannot borrow data mutably +LL | self.s.push('x'); | ^^^^^^ assignment into an immutable reference error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-38147-4.nll.stderr b/src/test/ui/did_you_mean/issue-38147-4.nll.stderr index 458e41f6aae7..db3e6b894264 100644 --- a/src/test/ui/did_you_mean/issue-38147-4.nll.stderr +++ b/src/test/ui/did_you_mean/issue-38147-4.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `*f.s` as mutable, as it is behind a `&` reference | LL | fn f(x: usize, f: &Foo) { | ---- help: consider changing this to be a mutable reference: `&mut Foo<'_>` -LL | f.s.push('x'); //~ ERROR cannot borrow data mutably +LL | f.s.push('x'); | ^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-38147-4.stderr b/src/test/ui/did_you_mean/issue-38147-4.stderr index 6dc4f101084b..71d44f9abad2 100644 --- a/src/test/ui/did_you_mean/issue-38147-4.stderr +++ b/src/test/ui/did_you_mean/issue-38147-4.stderr @@ -3,7 +3,7 @@ error[E0389]: cannot borrow data mutably in a `&` reference | LL | fn f(x: usize, f: &Foo) { | ---- use `&mut Foo` here to make mutable -LL | f.s.push('x'); //~ ERROR cannot borrow data mutably +LL | f.s.push('x'); | ^^^ assignment into an immutable reference error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-39544.nll.stderr b/src/test/ui/did_you_mean/issue-39544.nll.stderr index 2fb8e3db68cb..899a42b54e61 100644 --- a/src/test/ui/did_you_mean/issue-39544.nll.stderr +++ b/src/test/ui/did_you_mean/issue-39544.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `z.x` as mutable, as `z` is not declared as mutable | LL | let z = Z { x: X::Y }; | - help: consider changing this to be mutable: `mut z` -LL | let _ = &mut z.x; //~ ERROR cannot borrow +LL | let _ = &mut z.x; | ^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference @@ -11,7 +11,7 @@ error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference | LL | fn foo<'z>(&'z self) { | -------- help: consider changing this to be a mutable reference: `&'z mut self` -LL | let _ = &mut self.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference @@ -19,7 +19,7 @@ error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference | LL | fn foo1(&self, other: &Z) { | ----- help: consider changing this to be a mutable reference: `&mut self` -LL | let _ = &mut self.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference @@ -27,8 +27,8 @@ error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` referenc | LL | fn foo1(&self, other: &Z) { | -- help: consider changing this to be a mutable reference: `&mut Z` -LL | let _ = &mut self.x; //~ ERROR cannot borrow -LL | let _ = &mut other.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; +LL | let _ = &mut other.x; | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference @@ -36,7 +36,7 @@ error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference | LL | fn foo2<'a>(&'a self, other: &Z) { | -------- help: consider changing this to be a mutable reference: `&'a mut self` -LL | let _ = &mut self.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference @@ -44,8 +44,8 @@ error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` referenc | LL | fn foo2<'a>(&'a self, other: &Z) { | -- help: consider changing this to be a mutable reference: `&mut Z` -LL | let _ = &mut self.x; //~ ERROR cannot borrow -LL | let _ = &mut other.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; +LL | let _ = &mut other.x; | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference @@ -53,7 +53,7 @@ error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference | LL | fn foo3<'a>(self: &'a Self, other: &Z) { | -------- help: consider changing this to be a mutable reference: `&'a mut Self` -LL | let _ = &mut self.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; | ^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference @@ -61,8 +61,8 @@ error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` referenc | LL | fn foo3<'a>(self: &'a Self, other: &Z) { | -- help: consider changing this to be a mutable reference: `&mut Z` -LL | let _ = &mut self.x; //~ ERROR cannot borrow -LL | let _ = &mut other.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; +LL | let _ = &mut other.x; | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference @@ -70,7 +70,7 @@ error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` referenc | LL | fn foo4(other: &Z) { | -- help: consider changing this to be a mutable reference: `&mut Z` -LL | let _ = &mut other.x; //~ ERROR cannot borrow +LL | let _ = &mut other.x; | ^^^^^^^^^^^^ `other` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `z.x` as mutable, as `z` is not declared as mutable @@ -78,7 +78,7 @@ error[E0596]: cannot borrow `z.x` as mutable, as `z` is not declared as mutable | LL | pub fn with_arg(z: Z, w: &Z) { | - help: consider changing this to be mutable: `mut z` -LL | let _ = &mut z.x; //~ ERROR cannot borrow +LL | let _ = &mut z.x; | ^^^^^^^^ cannot borrow as mutable error[E0596]: cannot borrow `w.x` as mutable, as it is behind a `&` reference @@ -86,8 +86,8 @@ error[E0596]: cannot borrow `w.x` as mutable, as it is behind a `&` reference | LL | pub fn with_arg(z: Z, w: &Z) { | -- help: consider changing this to be a mutable reference: `&mut Z` -LL | let _ = &mut z.x; //~ ERROR cannot borrow -LL | let _ = &mut w.x; //~ ERROR cannot borrow +LL | let _ = &mut z.x; +LL | let _ = &mut w.x; | ^^^^^^^^ `w` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0594]: cannot assign to `*x.0` which is behind a `&` reference diff --git a/src/test/ui/did_you_mean/issue-39544.stderr b/src/test/ui/did_you_mean/issue-39544.stderr index 7d6a672843a2..d86ea896a141 100644 --- a/src/test/ui/did_you_mean/issue-39544.stderr +++ b/src/test/ui/did_you_mean/issue-39544.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow field `z.x` of immutable binding as mutable | LL | let z = Z { x: X::Y }; | - help: make this binding mutable: `mut z` -LL | let _ = &mut z.x; //~ ERROR cannot borrow +LL | let _ = &mut z.x; | ^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `self.x` of immutable binding as mutable @@ -11,7 +11,7 @@ error[E0596]: cannot borrow field `self.x` of immutable binding as mutable | LL | fn foo<'z>(&'z self) { | -------- use `&'z mut self` here to make mutable -LL | let _ = &mut self.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; | ^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `self.x` of immutable binding as mutable @@ -19,7 +19,7 @@ error[E0596]: cannot borrow field `self.x` of immutable binding as mutable | LL | fn foo1(&self, other: &Z) { | ----- use `&mut self` here to make mutable -LL | let _ = &mut self.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; | ^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `other.x` of immutable binding as mutable @@ -27,8 +27,8 @@ error[E0596]: cannot borrow field `other.x` of immutable binding as mutable | LL | fn foo1(&self, other: &Z) { | -- use `&mut Z` here to make mutable -LL | let _ = &mut self.x; //~ ERROR cannot borrow -LL | let _ = &mut other.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; +LL | let _ = &mut other.x; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `self.x` of immutable binding as mutable @@ -36,7 +36,7 @@ error[E0596]: cannot borrow field `self.x` of immutable binding as mutable | LL | fn foo2<'a>(&'a self, other: &Z) { | -------- use `&'a mut self` here to make mutable -LL | let _ = &mut self.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; | ^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `other.x` of immutable binding as mutable @@ -44,8 +44,8 @@ error[E0596]: cannot borrow field `other.x` of immutable binding as mutable | LL | fn foo2<'a>(&'a self, other: &Z) { | -- use `&mut Z` here to make mutable -LL | let _ = &mut self.x; //~ ERROR cannot borrow -LL | let _ = &mut other.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; +LL | let _ = &mut other.x; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `self.x` of immutable binding as mutable @@ -53,7 +53,7 @@ error[E0596]: cannot borrow field `self.x` of immutable binding as mutable | LL | fn foo3<'a>(self: &'a Self, other: &Z) { | -------- use `&'a mut Self` here to make mutable -LL | let _ = &mut self.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; | ^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `other.x` of immutable binding as mutable @@ -61,8 +61,8 @@ error[E0596]: cannot borrow field `other.x` of immutable binding as mutable | LL | fn foo3<'a>(self: &'a Self, other: &Z) { | -- use `&mut Z` here to make mutable -LL | let _ = &mut self.x; //~ ERROR cannot borrow -LL | let _ = &mut other.x; //~ ERROR cannot borrow +LL | let _ = &mut self.x; +LL | let _ = &mut other.x; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `other.x` of immutable binding as mutable @@ -70,7 +70,7 @@ error[E0596]: cannot borrow field `other.x` of immutable binding as mutable | LL | fn foo4(other: &Z) { | -- use `&mut Z` here to make mutable -LL | let _ = &mut other.x; //~ ERROR cannot borrow +LL | let _ = &mut other.x; | ^^^^^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `z.x` of immutable binding as mutable @@ -78,7 +78,7 @@ error[E0596]: cannot borrow field `z.x` of immutable binding as mutable | LL | pub fn with_arg(z: Z, w: &Z) { | - help: make this binding mutable: `mut z` -LL | let _ = &mut z.x; //~ ERROR cannot borrow +LL | let _ = &mut z.x; | ^^^ cannot mutably borrow field of immutable binding error[E0596]: cannot borrow field `w.x` of immutable binding as mutable @@ -86,8 +86,8 @@ error[E0596]: cannot borrow field `w.x` of immutable binding as mutable | LL | pub fn with_arg(z: Z, w: &Z) { | -- use `&mut Z` here to make mutable -LL | let _ = &mut z.x; //~ ERROR cannot borrow -LL | let _ = &mut w.x; //~ ERROR cannot borrow +LL | let _ = &mut z.x; +LL | let _ = &mut w.x; | ^^^ cannot mutably borrow field of immutable binding error[E0594]: cannot assign to borrowed content `*x.0` of immutable binding diff --git a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr index 3411958be62a..cfb1da037dc0 100644 --- a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr +++ b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `i8: Foo` is not satisfied --> $DIR/issue-39802-show-5-trait-impls.rs:24:5 | -LL | Foo::::bar(&1i8); //~ ERROR is not satisfied +LL | Foo::::bar(&1i8); | ^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i8` | = help: the following implementations were found: @@ -19,7 +19,7 @@ LL | fn bar(&self){} error[E0277]: the trait bound `u8: Foo` is not satisfied --> $DIR/issue-39802-show-5-trait-impls.rs:25:5 | -LL | Foo::::bar(&1u8); //~ ERROR is not satisfied +LL | Foo::::bar(&1u8); | ^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `u8` | = help: the following implementations were found: @@ -36,7 +36,7 @@ LL | fn bar(&self){} error[E0277]: the trait bound `bool: Foo` is not satisfied --> $DIR/issue-39802-show-5-trait-impls.rs:26:5 | -LL | Foo::::bar(&true); //~ ERROR is not satisfied +LL | Foo::::bar(&true); | ^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `bool` | = help: the following implementations were found: diff --git a/src/test/ui/did_you_mean/issue-40006.stderr b/src/test/ui/did_you_mean/issue-40006.stderr index 1b9eecb7769b..f6f7fe5fa38c 100644 --- a/src/test/ui/did_you_mean/issue-40006.stderr +++ b/src/test/ui/did_you_mean/issue-40006.stderr @@ -1,16 +1,16 @@ error: missing `fn`, `type`, or `const` for impl-item declaration --> $DIR/issue-40006.rs:1:9 | -LL | impl X { //~ ERROR cannot be made into an object +LL | impl X { | _________^ -LL | | //~^ ERROR missing +LL | | LL | | Y | |____^ missing `fn`, `type`, or `const` error: missing `fn`, `type`, or `const` for trait-item declaration --> $DIR/issue-40006.rs:8:10 | -LL | trait X { //~ ERROR missing +LL | trait X { | __________^ LL | | X() {} | |____^ missing `fn`, `type`, or `const` @@ -18,48 +18,48 @@ LL | | X() {} error: expected `[`, found `#` --> $DIR/issue-40006.rs:10:17 | -LL | fn xxx() { ### } //~ ERROR missing +LL | fn xxx() { ### } | ^ expected `[` error: missing `fn`, `type`, or `const` for trait-item declaration --> $DIR/issue-40006.rs:10:21 | -LL | fn xxx() { ### } //~ ERROR missing +LL | fn xxx() { ### } | _____________________^ -LL | | //~^ ERROR expected -LL | | L = M; //~ ERROR missing +LL | | +LL | | L = M; | |____^ missing `fn`, `type`, or `const` error: missing `fn`, `type`, or `const` for trait-item declaration --> $DIR/issue-40006.rs:12:11 | -LL | L = M; //~ ERROR missing +LL | L = M; | ___________^ -LL | | Z = { 2 + 3 }; //~ ERROR expected one of +LL | | Z = { 2 + 3 }; | |____^ missing `fn`, `type`, or `const` error: expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `;` --> $DIR/issue-40006.rs:13:18 | -LL | Z = { 2 + 3 }; //~ ERROR expected one of +LL | Z = { 2 + 3 }; | ^ expected one of 7 possible tokens here error: expected one of `!` or `::`, found `(` --> $DIR/issue-40006.rs:14:9 | -LL | ::Y (); //~ ERROR expected one of +LL | ::Y (); | ^ expected one of `!` or `::` here error: missing `fn`, `type`, or `const` for impl-item declaration --> $DIR/issue-40006.rs:18:8 | -LL | pub hello_method(&self) { //~ ERROR missing +LL | pub hello_method(&self) { | ^ missing `fn`, `type`, or `const` error[E0038]: the trait `X` cannot be made into an object --> $DIR/issue-40006.rs:1:6 | -LL | impl X { //~ ERROR cannot be made into an object +LL | impl X { | ^ the trait `X` cannot be made into an object | = note: method `xxx` has no receiver diff --git a/src/test/ui/did_you_mean/issue-40823.nll.stderr b/src/test/ui/did_you_mean/issue-40823.nll.stderr index 0389cf5499d9..73473406a9ac 100644 --- a/src/test/ui/did_you_mean/issue-40823.nll.stderr +++ b/src/test/ui/did_you_mean/issue-40823.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `*buf` as mutable, as it is behind a `&` reference | LL | let mut buf = &[1, 2, 3, 4]; | ------------- help: consider changing this to be a mutable reference: `&mut [1, 2, 3, 4]` -LL | buf.iter_mut(); //~ ERROR cannot borrow immutable borrowed content +LL | buf.iter_mut(); | ^^^ `buf` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-40823.stderr b/src/test/ui/did_you_mean/issue-40823.stderr index ee64e79ead93..fa2150a8d7f6 100644 --- a/src/test/ui/did_you_mean/issue-40823.stderr +++ b/src/test/ui/did_you_mean/issue-40823.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow immutable borrowed content `*buf` as mutable --> $DIR/issue-40823.rs:3:5 | -LL | buf.iter_mut(); //~ ERROR cannot borrow immutable borrowed content +LL | buf.iter_mut(); | ^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr b/src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr index d2d9abee22cd..84235ca4d637 100644 --- a/src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr +++ b/src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr @@ -1,7 +1,7 @@ error: `~` cannot be used as a unary operator --> $DIR/issue-41679-tilde-bitwise-negation-attempt.rs:2:13 | -LL | let x = ~1; //~ ERROR cannot be used as a unary operator +LL | let x = ~1; | ^ help: use `!` to perform bitwise negation error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr index e6d10ffaae93..8a0d0096acbb 100644 --- a/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr +++ b/src/test/ui/did_you_mean/issue-43871-enum-instead-of-variant.stderr @@ -1,7 +1,7 @@ error[E0423]: expected function, found enum `Option` --> $DIR/issue-43871-enum-instead-of-variant.rs:4:13 | -LL | let x = Option(1); //~ ERROR expected function, found enum +LL | let x = Option(1); | ^^^^^^ | = note: did you mean to use one of the following variants? @@ -11,7 +11,7 @@ LL | let x = Option(1); //~ ERROR expected function, found enum error[E0532]: expected tuple struct/variant, found enum `Option` --> $DIR/issue-43871-enum-instead-of-variant.rs:6:12 | -LL | if let Option(_) = x { //~ ERROR expected tuple struct/variant, found enum +LL | if let Option(_) = x { | ^^^^^^ | = note: did you mean to use one of the following variants? @@ -21,7 +21,7 @@ LL | if let Option(_) = x { //~ ERROR expected tuple struct/variant, found e error[E0532]: expected tuple struct/variant, found enum `Example` --> $DIR/issue-43871-enum-instead-of-variant.rs:12:12 | -LL | if let Example(_) = y { //~ ERROR expected tuple struct/variant, found enum +LL | if let Example(_) = y { | ^^^^^^^ | = note: did you mean to use one of the following variants? diff --git a/src/test/ui/did_you_mean/multiple-pattern-typo.stderr b/src/test/ui/did_you_mean/multiple-pattern-typo.stderr index 2825ff46825a..a29fa584b292 100644 --- a/src/test/ui/did_you_mean/multiple-pattern-typo.stderr +++ b/src/test/ui/did_you_mean/multiple-pattern-typo.stderr @@ -1,7 +1,7 @@ error: unexpected token `||` after pattern --> $DIR/multiple-pattern-typo.rs:4:15 | -LL | 1 | 2 || 3 => (), //~ ERROR unexpected token `||` after pattern +LL | 1 | 2 || 3 => (), | ^^ help: use a single `|` to specify multiple patterns: `|` error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/pub-macro-rules.stderr b/src/test/ui/did_you_mean/pub-macro-rules.stderr index 7e62fc7c4fc0..0bde5783b8cc 100644 --- a/src/test/ui/did_you_mean/pub-macro-rules.stderr +++ b/src/test/ui/did_you_mean/pub-macro-rules.stderr @@ -1,7 +1,7 @@ error: can't qualify macro_rules invocation with `pub` --> $DIR/pub-macro-rules.rs:2:5 | -LL | pub macro_rules! foo { //~ ERROR can't qualify macro_rules invocation +LL | pub macro_rules! foo { | ^^^ help: try exporting the macro: `#[macro_export]` error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/recursion_limit.stderr b/src/test/ui/did_you_mean/recursion_limit.stderr index 0738c3f65b95..a646d98324e0 100644 --- a/src/test/ui/did_you_mean/recursion_limit.stderr +++ b/src/test/ui/did_you_mean/recursion_limit.stderr @@ -1,7 +1,7 @@ error[E0275]: overflow evaluating the requirement `J: std::marker::Send` --> $DIR/recursion_limit.rs:34:5 | -LL | is_send::(); //~ ERROR overflow evaluating the requirement +LL | is_send::(); | ^^^^^^^^^^^^ | = help: consider adding a `#![recursion_limit="20"]` attribute to your crate diff --git a/src/test/ui/did_you_mean/recursion_limit_deref.stderr b/src/test/ui/did_you_mean/recursion_limit_deref.stderr index f8672b20c786..08e32ade3bc3 100644 --- a/src/test/ui/did_you_mean/recursion_limit_deref.stderr +++ b/src/test/ui/did_you_mean/recursion_limit_deref.stderr @@ -1,7 +1,7 @@ error[E0055]: reached the recursion limit while auto-dereferencing `I` --> $DIR/recursion_limit_deref.rs:50:22 | -LL | let x: &Bottom = &t; //~ ERROR mismatched types +LL | let x: &Bottom = &t; | ^^ deref recursion limit reached | = help: consider adding a `#![recursion_limit="20"]` attribute to your crate @@ -9,7 +9,7 @@ LL | let x: &Bottom = &t; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/recursion_limit_deref.rs:50:22 | -LL | let x: &Bottom = &t; //~ ERROR mismatched types +LL | let x: &Bottom = &t; | ^^ expected struct `Bottom`, found struct `Top` | = note: expected type `&Bottom` diff --git a/src/test/ui/did_you_mean/recursion_limit_macro.stderr b/src/test/ui/did_you_mean/recursion_limit_macro.stderr index 5941d088f3aa..6640ced5c9ec 100644 --- a/src/test/ui/did_you_mean/recursion_limit_macro.stderr +++ b/src/test/ui/did_you_mean/recursion_limit_macro.stderr @@ -1,7 +1,7 @@ error: recursion limit reached while expanding the macro `recurse` --> $DIR/recursion_limit_macro.rs:10:31 | -LL | ($t:tt $($tail:tt)*) => { recurse!($($tail)*) }; //~ ERROR recursion limit +LL | ($t:tt $($tail:tt)*) => { recurse!($($tail)*) }; | ^^^^^^^^^^^^^^^^^^^ ... LL | recurse!(0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9); diff --git a/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr b/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr index 85c052747735..a94260dc42d1 100644 --- a/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr +++ b/src/test/ui/did_you_mean/trait-object-reference-without-parens-suggestion.stderr @@ -1,19 +1,19 @@ error[E0178]: expected a path on the left-hand side of `+`, not `&Copy` --> $DIR/trait-object-reference-without-parens-suggestion.rs:2:12 | -LL | let _: &Copy + 'static; //~ ERROR expected a path +LL | let _: &Copy + 'static; | ^^^^^^^^^^^^^^^ help: try adding parentheses: `&(Copy + 'static)` error[E0178]: expected a path on the left-hand side of `+`, not `&'static Copy` --> $DIR/trait-object-reference-without-parens-suggestion.rs:4:12 | -LL | let _: &'static Copy + 'static; //~ ERROR expected a path +LL | let _: &'static Copy + 'static; | ^^^^^^^^^^^^^^^^^^^^^^^ help: try adding parentheses: `&'static (Copy + 'static)` error[E0038]: the trait `std::marker::Copy` cannot be made into an object --> $DIR/trait-object-reference-without-parens-suggestion.rs:2:12 | -LL | let _: &Copy + 'static; //~ ERROR expected a path +LL | let _: &Copy + 'static; | ^^^^^ the trait `std::marker::Copy` cannot be made into an object | = note: the trait cannot require that `Self : Sized` diff --git a/src/test/ui/directory_ownership/non-inline-mod-restriction.stderr b/src/test/ui/directory_ownership/non-inline-mod-restriction.stderr index 6ceaa2e346a0..46acc7e66d8b 100644 --- a/src/test/ui/directory_ownership/non-inline-mod-restriction.stderr +++ b/src/test/ui/directory_ownership/non-inline-mod-restriction.stderr @@ -1,7 +1,7 @@ error: Cannot declare a non-inline module inside a block unless it has a path attribute --> $DIR/non-inline-mod-restriction.rs:4:9 | -LL | mod foo; //~ ERROR Cannot declare a non-inline module inside a block +LL | mod foo; | ^^^ error: aborting due to previous error diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr index 59cb804a801f..fff3a64ff296 100644 --- a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr +++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr @@ -1,7 +1,7 @@ error[E0509]: cannot move out of type `X`, which implements the `Drop` trait --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:12:22 | -LL | let X { x: y } = x; //~ ERROR cannot move out of type +LL | let X { x: y } = x; | - ^ cannot move out of here | | | data moved here @@ -9,7 +9,7 @@ LL | let X { x: y } = x; //~ ERROR cannot move out of type note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:12:16 | -LL | let X { x: y } = x; //~ ERROR cannot move out of type +LL | let X { x: y } = x; | ^ error: aborting due to previous error diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.stderr b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.stderr index cb32616d6e6f..9984cac7a4a4 100644 --- a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.stderr +++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.stderr @@ -1,7 +1,7 @@ error[E0509]: cannot move out of type `X`, which implements the `Drop` trait --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:12:9 | -LL | let X { x: y } = x; //~ ERROR cannot move out of type +LL | let X { x: y } = x; | ^^^^^^^-^^ | | | | | hint: to prevent move, use `ref y` or `ref mut y` diff --git a/src/test/ui/discrim/discrim-overflow-2.stderr b/src/test/ui/discrim/discrim-overflow-2.stderr index c490509142ac..744324d1f0ff 100644 --- a/src/test/ui/discrim/discrim-overflow-2.stderr +++ b/src/test/ui/discrim/discrim-overflow-2.stderr @@ -1,7 +1,7 @@ error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow-2.rs:17:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 127 | = note: explicitly set `OhNo = -128` if that is desired outcome @@ -9,7 +9,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow-2.rs:26:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 255 | = note: explicitly set `OhNo = 0` if that is desired outcome @@ -17,7 +17,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow-2.rs:35:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 32767 | = note: explicitly set `OhNo = -32768` if that is desired outcome @@ -25,7 +25,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow-2.rs:44:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 65535 | = note: explicitly set `OhNo = 0` if that is desired outcome @@ -33,7 +33,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow-2.rs:53:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 2147483647 | = note: explicitly set `OhNo = -2147483648` if that is desired outcome @@ -41,7 +41,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow-2.rs:62:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 4294967295 | = note: explicitly set `OhNo = 0` if that is desired outcome @@ -49,7 +49,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow-2.rs:71:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 9223372036854775807 | = note: explicitly set `OhNo = -9223372036854775808` if that is desired outcome @@ -57,7 +57,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow-2.rs:80:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 18446744073709551615 | = note: explicitly set `OhNo = 0` if that is desired outcome diff --git a/src/test/ui/discrim/discrim-overflow.stderr b/src/test/ui/discrim/discrim-overflow.stderr index e71df51e36d0..c831fdfe1a34 100644 --- a/src/test/ui/discrim/discrim-overflow.stderr +++ b/src/test/ui/discrim/discrim-overflow.stderr @@ -1,7 +1,7 @@ error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow.rs:15:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 127 | = note: explicitly set `OhNo = -128` if that is desired outcome @@ -9,7 +9,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow.rs:26:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 255 | = note: explicitly set `OhNo = 0` if that is desired outcome @@ -17,7 +17,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow.rs:37:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 32767 | = note: explicitly set `OhNo = -32768` if that is desired outcome @@ -25,7 +25,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow.rs:48:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 65535 | = note: explicitly set `OhNo = 0` if that is desired outcome @@ -33,7 +33,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow.rs:60:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 2147483647 | = note: explicitly set `OhNo = -2147483648` if that is desired outcome @@ -41,7 +41,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow.rs:72:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 4294967295 | = note: explicitly set `OhNo = 0` if that is desired outcome @@ -49,7 +49,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow.rs:84:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 9223372036854775807 | = note: explicitly set `OhNo = -9223372036854775808` if that is desired outcome @@ -57,7 +57,7 @@ LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow.rs:96:9 | -LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] +LL | OhNo, | ^^^^ overflowed on value after 18446744073709551615 | = note: explicitly set `OhNo = 0` if that is desired outcome diff --git a/src/test/ui/diverging-tuple-parts-39485.stderr b/src/test/ui/diverging-tuple-parts-39485.stderr index c399650d3258..70eefeb329db 100644 --- a/src/test/ui/diverging-tuple-parts-39485.stderr +++ b/src/test/ui/diverging-tuple-parts-39485.stderr @@ -1,20 +1,26 @@ error[E0308]: mismatched types --> $DIR/diverging-tuple-parts-39485.rs:8:5 | -LL | fn g() { - | - help: try adding a return type: `-> &_` -LL | &panic!() //~ ERROR mismatched types +LL | &panic!() | ^^^^^^^^^ expected (), found reference | = note: expected type `()` found type `&_` +help: try adding a return type + | +LL | fn g() -> &_ { + | ^^^^^ +help: consider removing the borrow + | +LL | panic!() + | ^^^^^^^^ error[E0308]: mismatched types --> $DIR/diverging-tuple-parts-39485.rs:12:5 | LL | fn f() -> isize { | ----- expected `isize` because of return type -LL | (return 1, return 2) //~ ERROR mismatched types +LL | (return 1, return 2) | ^^^^^^^^^^^^^^^^^^^^ expected isize, found tuple | = note: expected type `isize` diff --git a/src/test/ui/dollar-crate/dollar-crate-is-keyword-2.stderr b/src/test/ui/dollar-crate/dollar-crate-is-keyword-2.stderr index 206af6757b22..f9de5e14e59a 100644 --- a/src/test/ui/dollar-crate/dollar-crate-is-keyword-2.stderr +++ b/src/test/ui/dollar-crate/dollar-crate-is-keyword-2.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: `$crate` in paths can only be used in start position --> $DIR/dollar-crate-is-keyword-2.rs:6:16 | -LL | use a::$crate::b; //~ ERROR `$crate` in paths can only be used in start position +LL | use a::$crate::b; | ^^^^^^ `$crate` in paths can only be used in start position ... LL | m!(); @@ -10,7 +10,7 @@ LL | m!(); error[E0432]: unresolved import `a::$crate` --> $DIR/dollar-crate-is-keyword-2.rs:5:13 | -LL | use a::$crate; //~ ERROR unresolved import `a::$crate` +LL | use a::$crate; | ^^^^^^^^^ no `$crate` in `a` ... LL | m!(); @@ -19,7 +19,7 @@ LL | m!(); error[E0433]: failed to resolve: `$crate` in paths can only be used in start position --> $DIR/dollar-crate-is-keyword-2.rs:7:21 | -LL | type A = a::$crate; //~ ERROR `$crate` in paths can only be used in start position +LL | type A = a::$crate; | ^^^^^^ `$crate` in paths can only be used in start position ... LL | m!(); diff --git a/src/test/ui/dollar-crate/dollar-crate-is-keyword.stderr b/src/test/ui/dollar-crate/dollar-crate-is-keyword.stderr index e94a5fe96ffc..5d4f39086cee 100644 --- a/src/test/ui/dollar-crate/dollar-crate-is-keyword.stderr +++ b/src/test/ui/dollar-crate/dollar-crate-is-keyword.stderr @@ -1,7 +1,7 @@ error: expected identifier, found reserved identifier `$crate` --> $DIR/dollar-crate-is-keyword.rs:6:20 | -LL | struct $crate {} //~ ERROR expected identifier, found reserved identifier `$crate` +LL | struct $crate {} | ^^^^^^ expected identifier, found reserved identifier ... LL | m!(); @@ -10,7 +10,7 @@ LL | m!(); error: expected identifier, found reserved identifier `$crate` --> $DIR/dollar-crate-is-keyword.rs:11:23 | -LL | use $crate as $crate; //~ ERROR expected identifier, found reserved identifier `$crate` +LL | use $crate as $crate; | ^^^^^^ expected identifier, found reserved identifier ... LL | m!(); @@ -30,7 +30,7 @@ LL | m!(); warning: `$crate` may not be imported --> $DIR/dollar-crate-is-keyword.rs:11:9 | -LL | use $crate as $crate; //~ ERROR expected identifier, found reserved identifier `$crate` +LL | use $crate as $crate; | ^^^^^^^^^^^^^^^^^^^^^ ... LL | m!(); diff --git a/src/test/ui/double-import.stderr b/src/test/ui/double-import.stderr index 2fefdc49e9c4..7a4e8e5d3b92 100644 --- a/src/test/ui/double-import.stderr +++ b/src/test/ui/double-import.stderr @@ -3,13 +3,13 @@ error[E0252]: the name `foo` is defined multiple times | LL | use sub1::foo; | --------- previous import of the value `foo` here -LL | use sub2::foo; //~ ERROR the name `foo` is defined multiple times +LL | use sub2::foo; | ^^^^^^^^^ `foo` reimported here | = note: `foo` must be defined only once in the value namespace of this module help: you can use `as` to change the binding name of the import | -LL | use sub2::foo as other_foo; //~ ERROR the name `foo` is defined multiple times +LL | use sub2::foo as other_foo; | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/dropck/drop-with-active-borrows-1.nll.stderr b/src/test/ui/dropck/drop-with-active-borrows-1.nll.stderr index 9c6c9341be77..7fed27adaff2 100644 --- a/src/test/ui/dropck/drop-with-active-borrows-1.nll.stderr +++ b/src/test/ui/dropck/drop-with-active-borrows-1.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `a` because it is borrowed | LL | let b: Vec<&str> = a.lines().collect(); | - borrow of `a` occurs here -LL | drop(a); //~ ERROR cannot move out of `a` because it is borrowed +LL | drop(a); | ^ move out of `a` occurs here LL | for s in &b { | -- borrow later used here diff --git a/src/test/ui/dropck/drop-with-active-borrows-1.stderr b/src/test/ui/dropck/drop-with-active-borrows-1.stderr index a4295f96205a..71960fcecb54 100644 --- a/src/test/ui/dropck/drop-with-active-borrows-1.stderr +++ b/src/test/ui/dropck/drop-with-active-borrows-1.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `a` because it is borrowed | LL | let b: Vec<&str> = a.lines().collect(); | - borrow of `a` occurs here -LL | drop(a); //~ ERROR cannot move out of `a` because it is borrowed +LL | drop(a); | ^ move out of `a` occurs here error: aborting due to previous error diff --git a/src/test/ui/dropck/drop-with-active-borrows-2.stderr b/src/test/ui/dropck/drop-with-active-borrows-2.stderr index 347389cb59d7..ef46c9276be2 100644 --- a/src/test/ui/dropck/drop-with-active-borrows-2.stderr +++ b/src/test/ui/dropck/drop-with-active-borrows-2.stderr @@ -3,7 +3,7 @@ error[E0597]: `raw_lines` does not live long enough | LL | raw_lines.iter().map(|l| l.trim()).collect() | ^^^^^^^^^ borrowed value does not live long enough -LL | //~^ ERROR `raw_lines` does not live long enough +LL | LL | } | - borrowed value only lives until here | diff --git a/src/test/ui/dropck/dropck-eyepatch-implies-unsafe-impl.stderr b/src/test/ui/dropck/dropck-eyepatch-implies-unsafe-impl.stderr index c3139948a07d..49e55be1b49e 100644 --- a/src/test/ui/dropck/dropck-eyepatch-implies-unsafe-impl.stderr +++ b/src/test/ui/dropck/dropck-eyepatch-implies-unsafe-impl.stderr @@ -2,7 +2,7 @@ error[E0569]: requires an `unsafe impl` declaration due to `#[may_dangle]` attri --> $DIR/dropck-eyepatch-implies-unsafe-impl.rs:21:1 | LL | / impl<#[may_dangle] A, B: fmt::Debug> Drop for Pt { -LL | | //~^ ERROR requires an `unsafe impl` declaration due to `#[may_dangle]` attribute +LL | | LL | | LL | | // (unsafe to access self.1 due to #[may_dangle] on A) LL | | fn drop(&mut self) { println!("drop {} {:?}", self.0, self.2); } @@ -13,7 +13,7 @@ error[E0569]: requires an `unsafe impl` declaration due to `#[may_dangle]` attri --> $DIR/dropck-eyepatch-implies-unsafe-impl.rs:27:1 | LL | / impl<#[may_dangle] 'a, 'b, B: fmt::Debug> Drop for Pr<'a, 'b, B> { -LL | | //~^ ERROR requires an `unsafe impl` declaration due to `#[may_dangle]` attribute +LL | | LL | | LL | | // (unsafe to access self.1 due to #[may_dangle] on 'a) LL | | fn drop(&mut self) { println!("drop {} {:?}", self.0, self.2); } diff --git a/src/test/ui/dropck/dropck-union.nll.stderr b/src/test/ui/dropck/dropck-union.nll.stderr index 667bb7221aac..228744326f94 100644 --- a/src/test/ui/dropck/dropck-union.nll.stderr +++ b/src/test/ui/dropck/dropck-union.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `v` does not live long enough --> $DIR/dropck-union.rs:39:18 | -LL | v.0.set(Some(&v)); //~ ERROR: `v` does not live long enough +LL | v.0.set(Some(&v)); | ^^ borrowed value does not live long enough LL | } | - diff --git a/src/test/ui/dropck/dropck-union.stderr b/src/test/ui/dropck/dropck-union.stderr index 6cb3c139132f..4f6cd872449d 100644 --- a/src/test/ui/dropck/dropck-union.stderr +++ b/src/test/ui/dropck/dropck-union.stderr @@ -1,7 +1,7 @@ error[E0597]: `v` does not live long enough --> $DIR/dropck-union.rs:39:19 | -LL | v.0.set(Some(&v)); //~ ERROR: `v` does not live long enough +LL | v.0.set(Some(&v)); | ^ borrowed value does not live long enough LL | } | - `v` dropped here while still borrowed diff --git a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.stderr b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.stderr index 317ac7674311..9bf324412c3a 100644 --- a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.stderr +++ b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.stderr @@ -1,7 +1,7 @@ error[E0320]: overflow while adding drop-check rules for FingerTree --> $DIR/dropck_no_diverge_on_nonregular_1.rs:24:9 | -LL | let ft = //~ ERROR overflow while adding drop-check rules for FingerTree +LL | let ft = | ^^ | = note: overflowed on FingerTree>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> diff --git a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.stderr b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.stderr index b87e7a111493..0a74377ea9fd 100644 --- a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.stderr +++ b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.stderr @@ -1,7 +1,7 @@ error[E0320]: overflow while adding drop-check rules for FingerTree --> $DIR/dropck_no_diverge_on_nonregular_2.rs:23:9 | -LL | let ft = //~ ERROR overflow while adding drop-check rules for FingerTree +LL | let ft = | ^^ | = note: overflowed on FingerTree>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> diff --git a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.stderr b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.stderr index 799ee45a2022..d484e157519c 100644 --- a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.stderr +++ b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.stderr @@ -1,7 +1,7 @@ error[E0320]: overflow while adding drop-check rules for std::option::Option> --> $DIR/dropck_no_diverge_on_nonregular_3.rs:32:9 | -LL | let w = //~ ERROR overflow while adding drop-check rules for std::option +LL | let w = | ^ | = note: overflowed on FingerTree>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> diff --git a/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr b/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr index 28b9656c6fd1..8c669b597c3c 100644 --- a/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr +++ b/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr @@ -3,7 +3,7 @@ error[E0597]: `o2` does not live long enough | LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); | -------- cast requires that `o2` is borrowed for `'static` -LL | o1.set0(&o2); //~ ERROR `o2` does not live long enough +LL | o1.set0(&o2); | ^^^ borrowed value does not live long enough ... LL | } @@ -14,8 +14,8 @@ error[E0597]: `o3` does not live long enough | LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); | -------- cast requires that `o3` is borrowed for `'static` -LL | o1.set0(&o2); //~ ERROR `o2` does not live long enough -LL | o1.set1(&o3); //~ ERROR `o3` does not live long enough +LL | o1.set0(&o2); +LL | o1.set1(&o3); | ^^^ borrowed value does not live long enough ... LL | } @@ -27,7 +27,7 @@ error[E0597]: `o2` does not live long enough LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); | -------- cast requires that `o2` is borrowed for `'static` ... -LL | o2.set0(&o2); //~ ERROR `o2` does not live long enough +LL | o2.set0(&o2); | ^^^ borrowed value does not live long enough ... LL | } @@ -39,7 +39,7 @@ error[E0597]: `o3` does not live long enough LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); | -------- cast requires that `o3` is borrowed for `'static` ... -LL | o2.set1(&o3); //~ ERROR `o3` does not live long enough +LL | o2.set1(&o3); | ^^^ borrowed value does not live long enough ... LL | } @@ -51,9 +51,9 @@ error[E0597]: `o1` does not live long enough LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); | -------- cast requires that `o1` is borrowed for `'static` ... -LL | o3.set0(&o1); //~ ERROR `o1` does not live long enough +LL | o3.set0(&o1); | ^^^ borrowed value does not live long enough -LL | o3.set1(&o2); //~ ERROR `o2` does not live long enough +LL | o3.set1(&o2); LL | } | - `o1` dropped here while still borrowed @@ -63,7 +63,7 @@ error[E0597]: `o2` does not live long enough LL | let (o1, o2, o3): (Box, Box, Box) = (O::new(), O::new(), O::new()); | -------- cast requires that `o2` is borrowed for `'static` ... -LL | o3.set1(&o2); //~ ERROR `o2` does not live long enough +LL | o3.set1(&o2); | ^^^ borrowed value does not live long enough LL | } | - `o2` dropped here while still borrowed diff --git a/src/test/ui/dropck/dropck_trait_cycle_checked.stderr b/src/test/ui/dropck/dropck_trait_cycle_checked.stderr index 0e4bd829a949..792ef46f2443 100644 --- a/src/test/ui/dropck/dropck_trait_cycle_checked.stderr +++ b/src/test/ui/dropck/dropck_trait_cycle_checked.stderr @@ -1,7 +1,7 @@ error[E0597]: `o2` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:111:14 | -LL | o1.set0(&o2); //~ ERROR `o2` does not live long enough +LL | o1.set0(&o2); | ^^ borrowed value does not live long enough ... LL | } @@ -12,7 +12,7 @@ LL | } error[E0597]: `o3` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:112:14 | -LL | o1.set1(&o3); //~ ERROR `o3` does not live long enough +LL | o1.set1(&o3); | ^^ borrowed value does not live long enough ... LL | } @@ -23,7 +23,7 @@ LL | } error[E0597]: `o2` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:113:14 | -LL | o2.set0(&o2); //~ ERROR `o2` does not live long enough +LL | o2.set0(&o2); | ^^ borrowed value does not live long enough ... LL | } @@ -34,7 +34,7 @@ LL | } error[E0597]: `o3` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:114:14 | -LL | o2.set1(&o3); //~ ERROR `o3` does not live long enough +LL | o2.set1(&o3); | ^^ borrowed value does not live long enough ... LL | } @@ -45,9 +45,9 @@ LL | } error[E0597]: `o1` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:115:14 | -LL | o3.set0(&o1); //~ ERROR `o1` does not live long enough +LL | o3.set0(&o1); | ^^ borrowed value does not live long enough -LL | o3.set1(&o2); //~ ERROR `o2` does not live long enough +LL | o3.set1(&o2); LL | } | - borrowed value only lives until here | @@ -56,7 +56,7 @@ LL | } error[E0597]: `o2` does not live long enough --> $DIR/dropck_trait_cycle_checked.rs:116:14 | -LL | o3.set1(&o2); //~ ERROR `o2` does not live long enough +LL | o3.set1(&o2); | ^^ borrowed value does not live long enough LL | } | - borrowed value only lives until here diff --git a/src/test/ui/dst/dst-bad-coerce2.stderr b/src/test/ui/dst/dst-bad-coerce2.stderr index 6fb5c4b32ef1..cae4ec51c37c 100644 --- a/src/test/ui/dst/dst-bad-coerce2.stderr +++ b/src/test/ui/dst/dst-bad-coerce2.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coerce2.rs:15:33 | -LL | let f3: &mut Fat<[isize]> = f2; //~ ERROR mismatched types +LL | let f3: &mut Fat<[isize]> = f2; | ^^ types differ in mutability | = note: expected type `&mut Fat<[isize]>` @@ -10,7 +10,7 @@ LL | let f3: &mut Fat<[isize]> = f2; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/dst-bad-coerce2.rs:20:29 | -LL | let f3: &mut Fat = f2; //~ ERROR mismatched types +LL | let f3: &mut Fat = f2; | ^^ types differ in mutability | = note: expected type `&mut Fat` @@ -19,7 +19,7 @@ LL | let f3: &mut Fat = f2; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/dst-bad-coerce2.rs:25:31 | -LL | let f3: &mut ([isize],) = f2; //~ ERROR mismatched types +LL | let f3: &mut ([isize],) = f2; | ^^ types differ in mutability | = note: expected type `&mut ([isize],)` @@ -28,7 +28,7 @@ LL | let f3: &mut ([isize],) = f2; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/dst-bad-coerce2.rs:30:27 | -LL | let f3: &mut (Bar,) = f2; //~ ERROR mismatched types +LL | let f3: &mut (Bar,) = f2; | ^^ types differ in mutability | = note: expected type `&mut (dyn Bar,)` diff --git a/src/test/ui/dst/dst-bad-coerce3.nll.stderr b/src/test/ui/dst/dst-bad-coerce3.nll.stderr index 8f1289845e37..289d451f02a7 100644 --- a/src/test/ui/dst/dst-bad-coerce3.nll.stderr +++ b/src/test/ui/dst/dst-bad-coerce3.nll.stderr @@ -4,7 +4,7 @@ error[E0597]: `f1` does not live long enough LL | fn baz<'a>() { | -- lifetime `'a` defined here ... -LL | let f2: &Fat<[isize; 3]> = &f1; //~ ERROR `f1` does not live long enough +LL | let f2: &Fat<[isize; 3]> = &f1; | ^^^ borrowed value does not live long enough LL | let f3: &'a Fat<[isize]> = f2; | ---------------- type annotation requires that `f1` is borrowed for `'a` @@ -18,7 +18,7 @@ error[E0597]: `f1` does not live long enough LL | fn baz<'a>() { | -- lifetime `'a` defined here ... -LL | let f2: &Fat = &f1; //~ ERROR `f1` does not live long enough +LL | let f2: &Fat = &f1; | ^^^ borrowed value does not live long enough LL | let f3: &'a Fat = f2; | ------------ type annotation requires that `f1` is borrowed for `'a` @@ -32,7 +32,7 @@ error[E0597]: `f1` does not live long enough LL | fn baz<'a>() { | -- lifetime `'a` defined here ... -LL | let f2: &([isize; 3],) = &f1; //~ ERROR `f1` does not live long enough +LL | let f2: &([isize; 3],) = &f1; | ^^^ borrowed value does not live long enough LL | let f3: &'a ([isize],) = f2; | -------------- type annotation requires that `f1` is borrowed for `'a` @@ -46,7 +46,7 @@ error[E0597]: `f1` does not live long enough LL | fn baz<'a>() { | -- lifetime `'a` defined here ... -LL | let f2: &(Foo,) = &f1; //~ ERROR `f1` does not live long enough +LL | let f2: &(Foo,) = &f1; | ^^^ borrowed value does not live long enough LL | let f3: &'a (Bar,) = f2; | ---------- type annotation requires that `f1` is borrowed for `'a` diff --git a/src/test/ui/dst/dst-bad-coerce3.stderr b/src/test/ui/dst/dst-bad-coerce3.stderr index 701a869ee91e..61473269e50d 100644 --- a/src/test/ui/dst/dst-bad-coerce3.stderr +++ b/src/test/ui/dst/dst-bad-coerce3.stderr @@ -1,7 +1,7 @@ error[E0597]: `f1` does not live long enough --> $DIR/dst-bad-coerce3.rs:16:33 | -LL | let f2: &Fat<[isize; 3]> = &f1; //~ ERROR `f1` does not live long enough +LL | let f2: &Fat<[isize; 3]> = &f1; | ^^ borrowed value does not live long enough ... LL | } @@ -16,7 +16,7 @@ LL | fn baz<'a>() { error[E0597]: `f1` does not live long enough --> $DIR/dst-bad-coerce3.rs:21:26 | -LL | let f2: &Fat = &f1; //~ ERROR `f1` does not live long enough +LL | let f2: &Fat = &f1; | ^^ borrowed value does not live long enough ... LL | } @@ -31,7 +31,7 @@ LL | fn baz<'a>() { error[E0597]: `f1` does not live long enough --> $DIR/dst-bad-coerce3.rs:26:31 | -LL | let f2: &([isize; 3],) = &f1; //~ ERROR `f1` does not live long enough +LL | let f2: &([isize; 3],) = &f1; | ^^ borrowed value does not live long enough ... LL | } @@ -46,7 +46,7 @@ LL | fn baz<'a>() { error[E0597]: `f1` does not live long enough --> $DIR/dst-bad-coerce3.rs:31:24 | -LL | let f2: &(Foo,) = &f1; //~ ERROR `f1` does not live long enough +LL | let f2: &(Foo,) = &f1; | ^^ borrowed value does not live long enough LL | let f3: &'a (Bar,) = f2; LL | } diff --git a/src/test/ui/dst/dst-bad-coercions.stderr b/src/test/ui/dst/dst-bad-coercions.stderr index df223b7cb96b..27016829a07f 100644 --- a/src/test/ui/dst/dst-bad-coercions.stderr +++ b/src/test/ui/dst/dst-bad-coercions.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:14:17 | -LL | let y: &S = x; //~ ERROR mismatched types +LL | let y: &S = x; | ^ expected &S, found *-ptr | = note: expected type `&S` @@ -10,7 +10,7 @@ LL | let y: &S = x; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:15:17 | -LL | let y: &T = x; //~ ERROR mismatched types +LL | let y: &T = x; | ^ | | | expected &dyn T, found *-ptr @@ -22,7 +22,7 @@ LL | let y: &T = x; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:19:17 | -LL | let y: &S = x; //~ ERROR mismatched types +LL | let y: &S = x; | ^ expected &S, found *-ptr | = note: expected type `&S` @@ -31,7 +31,7 @@ LL | let y: &S = x; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:20:17 | -LL | let y: &T = x; //~ ERROR mismatched types +LL | let y: &T = x; | ^ | | | expected &dyn T, found *-ptr @@ -43,7 +43,7 @@ LL | let y: &T = x; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:23:21 | -LL | let x: &mut T = &S; //~ ERROR mismatched types +LL | let x: &mut T = &S; | ^^ types differ in mutability | = note: expected type `&mut dyn T` @@ -52,7 +52,7 @@ LL | let x: &mut T = &S; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:24:21 | -LL | let x: *mut T = &S; //~ ERROR mismatched types +LL | let x: *mut T = &S; | ^^ types differ in mutability | = note: expected type `*mut dyn T` @@ -61,7 +61,7 @@ LL | let x: *mut T = &S; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/dst-bad-coercions.rs:25:21 | -LL | let x: *mut S = &S; //~ ERROR mismatched types +LL | let x: *mut S = &S; | ^^ types differ in mutability | = note: expected type `*mut S` diff --git a/src/test/ui/duplicate/dupe-symbols-1.stderr b/src/test/ui/duplicate/dupe-symbols-1.stderr index 58aa1e433d16..c46ac0c6ed4f 100644 --- a/src/test/ui/duplicate/dupe-symbols-1.stderr +++ b/src/test/ui/duplicate/dupe-symbols-1.stderr @@ -2,7 +2,7 @@ error: symbol `fail` is already defined --> $DIR/dupe-symbols-1.rs:10:1 | LL | / pub fn b() { -LL | | //~^ symbol `fail` is already defined +LL | | LL | | } | |_^ diff --git a/src/test/ui/duplicate/dupe-symbols-2.stderr b/src/test/ui/duplicate/dupe-symbols-2.stderr index 65185cd54290..821bdd03392b 100644 --- a/src/test/ui/duplicate/dupe-symbols-2.stderr +++ b/src/test/ui/duplicate/dupe-symbols-2.stderr @@ -2,7 +2,7 @@ error: symbol `fail` is already defined --> $DIR/dupe-symbols-2.rs:13:5 | LL | / pub extern fn fail() { -LL | | //~^ symbol `fail` is already defined +LL | | LL | | } | |_____^ diff --git a/src/test/ui/duplicate/dupe-symbols-3.stderr b/src/test/ui/duplicate/dupe-symbols-3.stderr index 5cd618bc9f65..f30c88e4760e 100644 --- a/src/test/ui/duplicate/dupe-symbols-3.stderr +++ b/src/test/ui/duplicate/dupe-symbols-3.stderr @@ -2,7 +2,7 @@ error: symbol `fail` is already defined --> $DIR/dupe-symbols-3.rs:10:1 | LL | / pub fn fail() { -LL | | //~^ symbol `fail` is already defined +LL | | LL | | } | |_^ diff --git a/src/test/ui/duplicate/dupe-symbols-5.stderr b/src/test/ui/duplicate/dupe-symbols-5.stderr index 3acfdd22a9a3..cee72660e4ff 100644 --- a/src/test/ui/duplicate/dupe-symbols-5.stderr +++ b/src/test/ui/duplicate/dupe-symbols-5.stderr @@ -2,7 +2,7 @@ error: symbol `fail` is already defined --> $DIR/dupe-symbols-5.rs:9:1 | LL | / pub fn b() { -LL | | //~^ symbol `fail` is already defined +LL | | LL | | } | |_^ diff --git a/src/test/ui/duplicate/duplicate-check-macro-exports.stderr b/src/test/ui/duplicate/duplicate-check-macro-exports.stderr index 97ee9b9b05f7..02f0206c443a 100644 --- a/src/test/ui/duplicate/duplicate-check-macro-exports.stderr +++ b/src/test/ui/duplicate/duplicate-check-macro-exports.stderr @@ -4,7 +4,7 @@ error[E0255]: the name `panic` is defined multiple times LL | pub use std::panic; | ---------- previous import of the macro `panic` here ... -LL | macro_rules! panic { () => {} } //~ ERROR the name `panic` is defined multiple times +LL | macro_rules! panic { () => {} } | ^^^^^^^^^^^^^^^^^^ `panic` redefined here | = note: `panic` must be defined only once in the macro namespace of this module diff --git a/src/test/ui/duplicate_entry_error.stderr b/src/test/ui/duplicate_entry_error.stderr index ddb11e19c03d..1892ad38a594 100644 --- a/src/test/ui/duplicate_entry_error.stderr +++ b/src/test/ui/duplicate_entry_error.stderr @@ -2,7 +2,7 @@ error[E0152]: duplicate lang item found: `panic_impl`. --> $DIR/duplicate_entry_error.rs:10:1 | LL | / fn panic_impl(info: &PanicInfo) -> ! { -LL | | //~^ ERROR: duplicate lang item found: `panic_impl`. +LL | | LL | | loop {} LL | | } | |_^ diff --git a/src/test/ui/e0119/complex-impl.stderr b/src/test/ui/e0119/complex-impl.stderr index fb0c94dcc3df..f211530dcf48 100644 --- a/src/test/ui/e0119/complex-impl.stderr +++ b/src/test/ui/e0119/complex-impl.stderr @@ -1,7 +1,7 @@ error[E0119]: conflicting implementations of trait `complex_impl_support::External` for type `(Q, complex_impl_support::M<'_, '_, '_, std::boxed::Box<_>, _, _>)`: --> $DIR/complex-impl.rs:9:1 | -LL | impl External for (Q, R) {} //~ ERROR must be used +LL | impl External for (Q, R) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `complex_impl_support`: @@ -11,7 +11,7 @@ LL | impl External for (Q, R) {} //~ ERROR must be used error[E0210]: type parameter `R` must be used as the type parameter for some local type (e.g., `MyStruct`) --> $DIR/complex-impl.rs:9:1 | -LL | impl External for (Q, R) {} //~ ERROR must be used +LL | impl External for (Q, R) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `R` must be used as the type parameter for some local type | = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/e0119/conflict-with-std.rs b/src/test/ui/e0119/conflict-with-std.rs index e639bc5db5e0..6dc81f33dfcc 100644 --- a/src/test/ui/e0119/conflict-with-std.rs +++ b/src/test/ui/e0119/conflict-with-std.rs @@ -1,4 +1,3 @@ -#![feature(try_from)] use std::marker::PhantomData; use std::convert::{TryFrom, AsRef}; diff --git a/src/test/ui/e0119/conflict-with-std.stderr b/src/test/ui/e0119/conflict-with-std.stderr index c2ae321aa5e5..8c12b3d0bb9a 100644 --- a/src/test/ui/e0119/conflict-with-std.stderr +++ b/src/test/ui/e0119/conflict-with-std.stderr @@ -1,7 +1,7 @@ error[E0119]: conflicting implementations of trait `std::convert::AsRef` for type `std::boxed::Box`: - --> $DIR/conflict-with-std.rs:7:1 + --> $DIR/conflict-with-std.rs:6:1 | -LL | impl AsRef for Box { //~ ERROR conflicting implementations +LL | impl AsRef for Box { | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `alloc`: @@ -9,18 +9,18 @@ LL | impl AsRef for Box { //~ ERROR conflicting implementations where T: ?Sized; error[E0119]: conflicting implementations of trait `std::convert::From` for type `S`: - --> $DIR/conflict-with-std.rs:14:1 + --> $DIR/conflict-with-std.rs:13:1 | -LL | impl From for S { //~ ERROR conflicting implementations +LL | impl From for S { | ^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `core`: - impl std::convert::From for T; error[E0119]: conflicting implementations of trait `std::convert::TryFrom` for type `X`: - --> $DIR/conflict-with-std.rs:21:1 + --> $DIR/conflict-with-std.rs:20:1 | -LL | impl TryFrom for X { //~ ERROR conflicting implementations +LL | impl TryFrom for X { | ^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `core`: diff --git a/src/test/ui/e0119/issue-23563.stderr b/src/test/ui/e0119/issue-23563.stderr index 53f9a5e70644..8011689880df 100644 --- a/src/test/ui/e0119/issue-23563.stderr +++ b/src/test/ui/e0119/issue-23563.stderr @@ -1,7 +1,7 @@ error[E0119]: conflicting implementations of trait `a::LolFrom<&[_]>` for type `LocalType<_>`: --> $DIR/issue-23563.rs:13:1 | -LL | impl<'a, T> LolFrom<&'a [T]> for LocalType { //~ ERROR conflicting implementations of trait +LL | impl<'a, T> LolFrom<&'a [T]> for LocalType { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `issue_23563_a`: diff --git a/src/test/ui/e0119/issue-27403.stderr b/src/test/ui/e0119/issue-27403.stderr index 76c326fb2054..cba10432a930 100644 --- a/src/test/ui/e0119/issue-27403.stderr +++ b/src/test/ui/e0119/issue-27403.stderr @@ -1,7 +1,7 @@ error[E0119]: conflicting implementations of trait `std::convert::Into<_>` for type `GenX<_>`: --> $DIR/issue-27403.rs:5:1 | -LL | impl Into for GenX { //~ ERROR conflicting implementations +LL | impl Into for GenX { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `core`: diff --git a/src/test/ui/e0119/issue-28981.stderr b/src/test/ui/e0119/issue-28981.stderr index 8b4cd9acac45..e1e07190d8c6 100644 --- a/src/test/ui/e0119/issue-28981.stderr +++ b/src/test/ui/e0119/issue-28981.stderr @@ -1,7 +1,7 @@ error[E0119]: conflicting implementations of trait `std::ops::Deref` for type `&_`: --> $DIR/issue-28981.rs:5:1 | -LL | impl Deref for Foo { } //~ ERROR must be used +LL | impl Deref for Foo { } | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `core`: @@ -11,7 +11,7 @@ LL | impl Deref for Foo { } //~ ERROR must be used error[E0210]: type parameter `Foo` must be used as the type parameter for some local type (e.g., `MyStruct`) --> $DIR/issue-28981.rs:5:1 | -LL | impl Deref for Foo { } //~ ERROR must be used +LL | impl Deref for Foo { } | ^^^^^^^^^^^^^^^^^^^^^^^ type parameter `Foo` must be used as the type parameter for some local type | = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/e0119/so-37347311.stderr b/src/test/ui/e0119/so-37347311.stderr index eb321668d13f..f2166de71f8d 100644 --- a/src/test/ui/e0119/so-37347311.stderr +++ b/src/test/ui/e0119/so-37347311.stderr @@ -1,7 +1,7 @@ error[E0119]: conflicting implementations of trait `std::convert::From>` for type `MyError<_>`: --> $DIR/so-37347311.rs:11:1 | -LL | impl From for MyError { //~ ERROR conflicting implementations +LL | impl From for MyError { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `core`: diff --git a/src/test/ui/editions/edition-deny-async-fns-2015.rs b/src/test/ui/editions/edition-deny-async-fns-2015.rs new file mode 100644 index 000000000000..2105aa5835d0 --- /dev/null +++ b/src/test/ui/editions/edition-deny-async-fns-2015.rs @@ -0,0 +1,34 @@ +// edition:2015 + +#![feature(futures_api, async_await)] + +async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition + +fn baz() { async fn foo() {} } //~ ERROR `async fn` is not permitted in the 2015 edition + +async fn async_baz() { //~ ERROR `async fn` is not permitted in the 2015 edition + async fn bar() {} //~ ERROR `async fn` is not permitted in the 2015 edition +} + +struct Foo {} + +impl Foo { + async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition +} + +trait Bar { + async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition + //~^ ERROR trait fns cannot be declared `async` +} + +fn main() { + macro_rules! accept_item { ($x:item) => {} } + + accept_item! { + async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition + } + + let inside_closure = || { + async fn bar() {} //~ ERROR `async fn` is not permitted in the 2015 edition + }; +} diff --git a/src/test/ui/editions/edition-deny-async-fns-2015.stderr b/src/test/ui/editions/edition-deny-async-fns-2015.stderr new file mode 100644 index 000000000000..83c8dbc7472f --- /dev/null +++ b/src/test/ui/editions/edition-deny-async-fns-2015.stderr @@ -0,0 +1,58 @@ +error[E0670]: `async fn` is not permitted in the 2015 edition + --> $DIR/edition-deny-async-fns-2015.rs:5:1 + | +LL | async fn foo() {} + | ^^^^^ + +error[E0670]: `async fn` is not permitted in the 2015 edition + --> $DIR/edition-deny-async-fns-2015.rs:7:12 + | +LL | fn baz() { async fn foo() {} } + | ^^^^^ + +error[E0670]: `async fn` is not permitted in the 2015 edition + --> $DIR/edition-deny-async-fns-2015.rs:10:5 + | +LL | async fn bar() {} + | ^^^^^ + +error[E0670]: `async fn` is not permitted in the 2015 edition + --> $DIR/edition-deny-async-fns-2015.rs:9:1 + | +LL | async fn async_baz() { + | ^^^^^ + +error[E0670]: `async fn` is not permitted in the 2015 edition + --> $DIR/edition-deny-async-fns-2015.rs:32:9 + | +LL | async fn bar() {} + | ^^^^^ + +error[E0670]: `async fn` is not permitted in the 2015 edition + --> $DIR/edition-deny-async-fns-2015.rs:28:9 + | +LL | async fn foo() {} + | ^^^^^ + +error[E0670]: `async fn` is not permitted in the 2015 edition + --> $DIR/edition-deny-async-fns-2015.rs:16:5 + | +LL | async fn foo() {} + | ^^^^^ + +error[E0706]: trait fns cannot be declared `async` + --> $DIR/edition-deny-async-fns-2015.rs:20:5 + | +LL | async fn foo() {} + | ^^^^^^^^^^^^^^^^^ + +error[E0670]: `async fn` is not permitted in the 2015 edition + --> $DIR/edition-deny-async-fns-2015.rs:20:5 + | +LL | async fn foo() {} + | ^^^^^ + +error: aborting due to 9 previous errors + +Some errors occurred: E0670, E0706. +For more information about an error, try `rustc --explain E0670`. diff --git a/src/test/ui/editions/edition-imports-2015.stderr b/src/test/ui/editions/edition-imports-2015.stderr index 816ab21d8142..4aba5323cc57 100644 --- a/src/test/ui/editions/edition-imports-2015.stderr +++ b/src/test/ui/editions/edition-imports-2015.stderr @@ -1,7 +1,7 @@ error: cannot glob-import all possible crates --> $DIR/edition-imports-2015.rs:23:5 | -LL | gen_glob!(); //~ ERROR cannot glob-import all possible crates +LL | gen_glob!(); | ^^^^^^^^^^^^ | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/src/test/ui/editions/edition-imports-2018.stderr b/src/test/ui/editions/edition-imports-2018.stderr index 944f42ee0451..6ef49b625605 100644 --- a/src/test/ui/editions/edition-imports-2018.stderr +++ b/src/test/ui/editions/edition-imports-2018.stderr @@ -1,7 +1,7 @@ error: cannot glob-import all possible crates --> $DIR/edition-imports-2018.rs:24:5 | -LL | gen_glob!(); //~ ERROR cannot glob-import all possible crates +LL | gen_glob!(); | ^^^^^^^^^^^^ | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.rs b/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.rs index 53ec3867f011..940b0c3c63db 100644 --- a/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.rs +++ b/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.rs @@ -1,3 +1,4 @@ +// compile-pass // edition:2018 // compile-flags:--extern edition_imports_2015 // aux-build:edition-imports-2015.rs @@ -12,8 +13,7 @@ mod check { pub struct Ambiguous {} fn check() { - edition_imports_2015::gen_ambiguous!(); //~ ERROR `Ambiguous` is ambiguous - //~| ERROR `edition_imports_2015` is ambiguous + edition_imports_2015::gen_ambiguous!(); // OK } } diff --git a/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.stderr b/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.stderr deleted file mode 100644 index ac2bf21c5c0b..000000000000 --- a/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.stderr +++ /dev/null @@ -1,40 +0,0 @@ -error[E0659]: `Ambiguous` is ambiguous (name vs any other name during import resolution) - --> $DIR/edition-imports-virtual-2015-ambiguity.rs:15:9 - | -LL | edition_imports_2015::gen_ambiguous!(); //~ ERROR `Ambiguous` is ambiguous - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name - | -note: `Ambiguous` could refer to the struct defined here - --> $DIR/edition-imports-virtual-2015-ambiguity.rs:9:1 - | -LL | pub struct Ambiguous {} - | ^^^^^^^^^^^^^^^^^^^^^^^ - = help: use `crate::Ambiguous` to refer to this struct unambiguously -note: `Ambiguous` could also refer to the struct defined here - --> $DIR/edition-imports-virtual-2015-ambiguity.rs:12:5 - | -LL | pub struct Ambiguous {} - | ^^^^^^^^^^^^^^^^^^^^^^^ - = help: use `self::Ambiguous` to refer to this struct unambiguously - = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) - -error[E0659]: `edition_imports_2015` is ambiguous (name in the crate root vs extern crate during absolute path resolution) - --> $DIR/edition-imports-virtual-2015-ambiguity.rs:15:9 - | -LL | edition_imports_2015::gen_ambiguous!(); //~ ERROR `Ambiguous` is ambiguous - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name - | - = note: `edition_imports_2015` could refer to an extern crate passed with `--extern` -note: `edition_imports_2015` could also refer to the module defined here - --> $DIR/edition-imports-virtual-2015-ambiguity.rs:5:1 - | -LL | / mod edition_imports_2015 { -LL | | pub struct Path; -LL | | } - | |_^ - = help: use `crate::edition_imports_2015` to refer to this module unambiguously - = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0659`. diff --git a/src/test/ui/editions/edition-imports-virtual-2015-gated.rs b/src/test/ui/editions/edition-imports-virtual-2015-gated.rs index a1bf4f5eb51d..634d3e9a443f 100644 --- a/src/test/ui/editions/edition-imports-virtual-2015-gated.rs +++ b/src/test/ui/editions/edition-imports-virtual-2015-gated.rs @@ -1,12 +1,11 @@ // edition:2018 // aux-build:edition-imports-2015.rs -// error-pattern: imports can only refer to extern crate names passed with `--extern` #[macro_use] extern crate edition_imports_2015; mod check { - gen_gated!(); + gen_gated!(); //~ ERROR unresolved import `E` } fn main() {} diff --git a/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr b/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr index 7c78fbb26a1b..e6d0f18a6772 100644 --- a/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr +++ b/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr @@ -1,20 +1,11 @@ -error: imports can only refer to extern crate names passed with `--extern` in macros originating from 2015 edition - --> <::edition_imports_2015::gen_gated macros>:1:50 - | -LL | ( ) => { fn check_gated ( ) { enum E { A } use E :: * ; } } - | ^ - | - ::: $DIR/edition-imports-virtual-2015-gated.rs:9:5 +error[E0432]: unresolved import `E` + --> $DIR/edition-imports-virtual-2015-gated.rs:8:5 | LL | gen_gated!(); - | ------------- not an extern crate passed with `--extern` + | ^^^^^^^^^^^^^ could not find `E` in `{{root}}` | -note: this import refers to the enum defined here - --> $DIR/edition-imports-virtual-2015-gated.rs:9:5 - | -LL | gen_gated!(); - | ^^^^^^^^^^^^^ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to previous error +For more information about this error, try `rustc --explain E0432`. diff --git a/src/test/ui/editions/edition-keywords-2015-2015-parsing.stderr b/src/test/ui/editions/edition-keywords-2015-2015-parsing.stderr index f2a9da71ca56..3435fdfd7257 100644 --- a/src/test/ui/editions/edition-keywords-2015-2015-parsing.stderr +++ b/src/test/ui/editions/edition-keywords-2015-2015-parsing.stderr @@ -1,13 +1,13 @@ error: no rules expected the token `r#async` --> $DIR/edition-keywords-2015-2015-parsing.rs:16:31 | -LL | r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async` +LL | r#async = consumes_async!(r#async); | ^^^^^^^ no rules expected this token in macro call error: no rules expected the token `async` --> $DIR/edition-keywords-2015-2015-parsing.rs:17:35 | -LL | r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async` +LL | r#async = consumes_async_raw!(async); | ^^^^^ no rules expected this token in macro call error: aborting due to 2 previous errors diff --git a/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr b/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr index af1ac19c837d..9724f78db661 100644 --- a/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr +++ b/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr @@ -1,7 +1,7 @@ error: expected identifier, found reserved keyword `async` --> $DIR/edition-keywords-2015-2018-expansion.rs:8:5 | -LL | produces_async! {} //~ ERROR expected identifier, found reserved keyword +LL | produces_async! {} | ^^^^^^^^^^^^^^^^^^ expected identifier, found reserved keyword | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/src/test/ui/editions/edition-keywords-2015-2018-parsing.stderr b/src/test/ui/editions/edition-keywords-2015-2018-parsing.stderr index fbb3b8bc7569..6e86d746f544 100644 --- a/src/test/ui/editions/edition-keywords-2015-2018-parsing.stderr +++ b/src/test/ui/editions/edition-keywords-2015-2018-parsing.stderr @@ -1,13 +1,13 @@ error: no rules expected the token `r#async` --> $DIR/edition-keywords-2015-2018-parsing.rs:16:31 | -LL | r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async` +LL | r#async = consumes_async!(r#async); | ^^^^^^^ no rules expected this token in macro call error: no rules expected the token `async` --> $DIR/edition-keywords-2015-2018-parsing.rs:17:35 | -LL | r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async` +LL | r#async = consumes_async_raw!(async); | ^^^^^ no rules expected this token in macro call error: aborting due to 2 previous errors diff --git a/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr b/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr index 52399362482b..0d8850c2397c 100644 --- a/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr +++ b/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr @@ -1,33 +1,33 @@ error: expected identifier, found reserved keyword `async` --> $DIR/edition-keywords-2018-2015-parsing.rs:8:13 | -LL | let mut async = 1; //~ ERROR expected identifier, found reserved keyword `async` +LL | let mut async = 1; | ^^^^^ expected identifier, found reserved keyword help: you can escape reserved keywords to use them as identifiers | -LL | let mut r#async = 1; //~ ERROR expected identifier, found reserved keyword `async` +LL | let mut r#async = 1; | ^^^^^^^ error: expected identifier, found reserved keyword `async` --> $DIR/edition-keywords-2018-2015-parsing.rs:18:13 | -LL | module::async(); //~ ERROR expected identifier, found reserved keyword `async` +LL | module::async(); | ^^^^^ expected identifier, found reserved keyword help: you can escape reserved keywords to use them as identifiers | -LL | module::r#async(); //~ ERROR expected identifier, found reserved keyword `async` +LL | module::r#async(); | ^^^^^^^ error: no rules expected the token `r#async` --> $DIR/edition-keywords-2018-2015-parsing.rs:12:31 | -LL | r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async` +LL | r#async = consumes_async!(r#async); | ^^^^^^^ no rules expected this token in macro call error: no rules expected the token `async` --> $DIR/edition-keywords-2018-2015-parsing.rs:13:35 | -LL | r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async` +LL | r#async = consumes_async_raw!(async); | ^^^^^ no rules expected this token in macro call error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||` diff --git a/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr b/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr index d997c3d8a421..ab601c8d8a70 100644 --- a/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr +++ b/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr @@ -1,7 +1,7 @@ error: expected identifier, found reserved keyword `async` --> $DIR/edition-keywords-2018-2018-expansion.rs:8:5 | -LL | produces_async! {} //~ ERROR expected identifier, found reserved keyword `async` +LL | produces_async! {} | ^^^^^^^^^^^^^^^^^^ expected identifier, found reserved keyword | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr b/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr index 1621368870a5..0604b600d23d 100644 --- a/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr +++ b/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr @@ -1,33 +1,33 @@ error: expected identifier, found reserved keyword `async` --> $DIR/edition-keywords-2018-2018-parsing.rs:8:13 | -LL | let mut async = 1; //~ ERROR expected identifier, found reserved keyword `async` +LL | let mut async = 1; | ^^^^^ expected identifier, found reserved keyword help: you can escape reserved keywords to use them as identifiers | -LL | let mut r#async = 1; //~ ERROR expected identifier, found reserved keyword `async` +LL | let mut r#async = 1; | ^^^^^^^ error: expected identifier, found reserved keyword `async` --> $DIR/edition-keywords-2018-2018-parsing.rs:18:13 | -LL | module::async(); //~ ERROR expected identifier, found reserved keyword `async` +LL | module::async(); | ^^^^^ expected identifier, found reserved keyword help: you can escape reserved keywords to use them as identifiers | -LL | module::r#async(); //~ ERROR expected identifier, found reserved keyword `async` +LL | module::r#async(); | ^^^^^^^ error: no rules expected the token `r#async` --> $DIR/edition-keywords-2018-2018-parsing.rs:12:31 | -LL | r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async` +LL | r#async = consumes_async!(r#async); | ^^^^^^^ no rules expected this token in macro call error: no rules expected the token `async` --> $DIR/edition-keywords-2018-2018-parsing.rs:13:35 | -LL | r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async` +LL | r#async = consumes_async_raw!(async); | ^^^^^ no rules expected this token in macro call error: macro expansion ends with an incomplete expression: expected one of `move`, `|`, or `||` diff --git a/src/test/ui/empty/empty-comment.stderr b/src/test/ui/empty/empty-comment.stderr index 908d5710c8a2..116cc83fa9ce 100644 --- a/src/test/ui/empty/empty-comment.stderr +++ b/src/test/ui/empty/empty-comment.stderr @@ -4,7 +4,7 @@ error: unexpected end of macro invocation LL | macro_rules! one_arg_macro { | -------------------------- when calling this macro ... -LL | one_arg_macro!(/**/); //~ ERROR unexpected end +LL | one_arg_macro!(/**/); | ^^^^^^^^^^^^^^^^^^^^^ missing tokens in macro arguments error: aborting due to previous error diff --git a/src/test/ui/empty/empty-linkname.stderr b/src/test/ui/empty/empty-linkname.stderr index a07a4f1c5674..df41cb894139 100644 --- a/src/test/ui/empty/empty-linkname.stderr +++ b/src/test/ui/empty/empty-linkname.stderr @@ -1,7 +1,7 @@ error[E0454]: #[link(name = "")] given with empty name --> $DIR/empty-linkname.rs:1:1 | -LL | #[link(name = "")] //~ ERROR: given with empty name +LL | #[link(name = "")] | ^^^^^^^^^^^^^^^^^^ empty name given error: aborting due to previous error diff --git a/src/test/ui/empty/empty-never-array.stderr b/src/test/ui/empty/empty-never-array.stderr index e409f14d6ce9..f1be4a6edec5 100644 --- a/src/test/ui/empty/empty-never-array.stderr +++ b/src/test/ui/empty/empty-never-array.stderr @@ -1,8 +1,15 @@ error[E0005]: refutable pattern in local binding: `T(_, _)` not covered --> $DIR/empty-never-array.rs:10:9 | -LL | let Helper::U(u) = Helper::T(t, []); - | ^^^^^^^^^^^^ pattern `T(_, _)` not covered +LL | / enum Helper { +LL | | T(T, [!; 0]), +LL | | #[allow(dead_code)] +LL | | U(U), +LL | | } + | |_- `Helper` defined here +... +LL | let Helper::U(u) = Helper::T(t, []); + | ^^^^^^^^^^^^ pattern `T(_, _)` not covered error: aborting due to previous error diff --git a/src/test/ui/empty/empty-struct-braces-expr.stderr b/src/test/ui/empty/empty-struct-braces-expr.stderr index 19844503a480..a20d79982493 100644 --- a/src/test/ui/empty/empty-struct-braces-expr.stderr +++ b/src/test/ui/empty/empty-struct-braces-expr.stderr @@ -1,7 +1,7 @@ error[E0423]: expected value, found struct `Empty1` --> $DIR/empty-struct-braces-expr.rs:15:14 | -LL | let e1 = Empty1; //~ ERROR expected value, found struct `Empty1` +LL | let e1 = Empty1; | ^^^^^^ | | | did you mean `Empty1 { /* fields */ }`? @@ -10,7 +10,7 @@ LL | let e1 = Empty1; //~ ERROR expected value, found struct `Empty1` error[E0423]: expected function, found struct `Empty1` --> $DIR/empty-struct-braces-expr.rs:16:14 | -LL | let e1 = Empty1(); //~ ERROR expected function, found struct `Empty1` +LL | let e1 = Empty1(); | ^^^^^^ | | | did you mean `Empty1 { /* fields */ }`? @@ -19,19 +19,19 @@ LL | let e1 = Empty1(); //~ ERROR expected function, found struct `Empty1` error[E0423]: expected value, found struct variant `E::Empty3` --> $DIR/empty-struct-braces-expr.rs:17:14 | -LL | let e3 = E::Empty3; //~ ERROR expected value, found struct variant `E::Empty3` +LL | let e3 = E::Empty3; | ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`? error[E0423]: expected function, found struct variant `E::Empty3` --> $DIR/empty-struct-braces-expr.rs:18:14 | -LL | let e3 = E::Empty3(); //~ ERROR expected function, found struct variant `E::Empty3` +LL | let e3 = E::Empty3(); | ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`? error[E0423]: expected value, found struct `XEmpty1` --> $DIR/empty-struct-braces-expr.rs:20:15 | -LL | let xe1 = XEmpty1; //~ ERROR expected value, found struct `XEmpty1` +LL | let xe1 = XEmpty1; | ^^^^^^^ | | | did you mean `XEmpty1 { /* fields */ }`? @@ -40,7 +40,7 @@ LL | let xe1 = XEmpty1; //~ ERROR expected value, found struct `XEmpty1` error[E0423]: expected function, found struct `XEmpty1` --> $DIR/empty-struct-braces-expr.rs:21:15 | -LL | let xe1 = XEmpty1(); //~ ERROR expected function, found struct `XEmpty1` +LL | let xe1 = XEmpty1(); | ^^^^^^^ | | | did you mean `XEmpty1 { /* fields */ }`? @@ -49,7 +49,7 @@ LL | let xe1 = XEmpty1(); //~ ERROR expected function, found struct `XEmpty1 error[E0599]: no variant named `Empty3` found for type `empty_struct::XE` in the current scope --> $DIR/empty-struct-braces-expr.rs:22:19 | -LL | let xe3 = XE::Empty3; //~ ERROR no variant named `Empty3` found for type +LL | let xe3 = XE::Empty3; | ----^^^^^^ | | | | | help: did you mean: `XEmpty3` @@ -58,7 +58,7 @@ LL | let xe3 = XE::Empty3; //~ ERROR no variant named `Empty3` found for typ error[E0599]: no variant named `Empty3` found for type `empty_struct::XE` in the current scope --> $DIR/empty-struct-braces-expr.rs:23:19 | -LL | let xe3 = XE::Empty3(); //~ ERROR no variant named `Empty3` found for type +LL | let xe3 = XE::Empty3(); | ----^^^^^^ | | | | | help: did you mean: `XEmpty3` diff --git a/src/test/ui/empty/empty-struct-braces-pat-2.stderr b/src/test/ui/empty/empty-struct-braces-pat-2.stderr index fc2ed79bb2e0..12047b5880c3 100644 --- a/src/test/ui/empty/empty-struct-braces-pat-2.stderr +++ b/src/test/ui/empty/empty-struct-braces-pat-2.stderr @@ -1,7 +1,7 @@ error[E0532]: expected tuple struct/variant, found struct `Empty1` --> $DIR/empty-struct-braces-pat-2.rs:15:9 | -LL | Empty1() => () //~ ERROR expected tuple struct/variant, found struct `Empty1` +LL | Empty1() => () | ^^^^^^ | | | did you mean `Empty1 { /* fields */ }`? @@ -10,7 +10,7 @@ LL | Empty1() => () //~ ERROR expected tuple struct/variant, found struc error[E0532]: expected tuple struct/variant, found struct `XEmpty1` --> $DIR/empty-struct-braces-pat-2.rs:18:9 | -LL | XEmpty1() => () //~ ERROR expected tuple struct/variant, found struct `XEmpty1` +LL | XEmpty1() => () | ^^^^^^^ | | | did you mean `XEmpty1 { /* fields */ }`? @@ -19,7 +19,7 @@ LL | XEmpty1() => () //~ ERROR expected tuple struct/variant, found stru error[E0532]: expected tuple struct/variant, found struct `Empty1` --> $DIR/empty-struct-braces-pat-2.rs:21:9 | -LL | Empty1(..) => () //~ ERROR expected tuple struct/variant, found struct `Empty1` +LL | Empty1(..) => () | ^^^^^^ | | | did you mean `Empty1 { /* fields */ }`? @@ -28,7 +28,7 @@ LL | Empty1(..) => () //~ ERROR expected tuple struct/variant, found str error[E0532]: expected tuple struct/variant, found struct `XEmpty1` --> $DIR/empty-struct-braces-pat-2.rs:24:9 | -LL | XEmpty1(..) => () //~ ERROR expected tuple struct/variant, found struct `XEmpty1` +LL | XEmpty1(..) => () | ^^^^^^^ | | | did you mean `XEmpty1 { /* fields */ }`? diff --git a/src/test/ui/empty/empty-struct-tuple-pat.stderr b/src/test/ui/empty/empty-struct-tuple-pat.stderr index f92c4e5c4634..71a8141b8ddd 100644 --- a/src/test/ui/empty/empty-struct-tuple-pat.stderr +++ b/src/test/ui/empty/empty-struct-tuple-pat.stderr @@ -4,7 +4,7 @@ error[E0530]: match bindings cannot shadow tuple structs LL | struct Empty2(); | ---------------- the tuple struct `Empty2` is defined here ... -LL | Empty2 => () //~ ERROR match bindings cannot shadow tuple structs +LL | Empty2 => () | ^^^^^^ cannot be named the same as a tuple struct error[E0530]: match bindings cannot shadow tuple structs @@ -13,7 +13,7 @@ error[E0530]: match bindings cannot shadow tuple structs LL | use empty_struct::*; | --------------- the tuple struct `XEmpty6` is imported here ... -LL | XEmpty6 => () //~ ERROR match bindings cannot shadow tuple structs +LL | XEmpty6 => () | ^^^^^^^ cannot be named the same as a tuple struct error[E0532]: expected unit struct/variant or constant, found tuple variant `E::Empty4` diff --git a/src/test/ui/empty/empty-struct-unit-expr.stderr b/src/test/ui/empty/empty-struct-unit-expr.stderr index b3519948f64d..696eabe99cff 100644 --- a/src/test/ui/empty/empty-struct-unit-expr.stderr +++ b/src/test/ui/empty/empty-struct-unit-expr.stderr @@ -4,7 +4,7 @@ error[E0618]: expected function, found `Empty2` LL | struct Empty2; | -------------- `Empty2` defined here ... -LL | let e2 = Empty2(); //~ ERROR expected function, found `Empty2` +LL | let e2 = Empty2(); | ^^^^^^-- | | | call expression requires function @@ -27,7 +27,7 @@ LL | let e4 = E::Empty4; error[E0618]: expected function, found `empty_struct::XEmpty2` --> $DIR/empty-struct-unit-expr.rs:18:15 | -LL | let xe2 = XEmpty2(); //~ ERROR expected function, found `empty_struct::XEmpty2` +LL | let xe2 = XEmpty2(); | ^^^^^^^-- | | | call expression requires function diff --git a/src/test/ui/empty/empty-struct-unit-pat.stderr b/src/test/ui/empty/empty-struct-unit-pat.stderr index e62246562be6..268fc7a6e0c1 100644 --- a/src/test/ui/empty/empty-struct-unit-pat.stderr +++ b/src/test/ui/empty/empty-struct-unit-pat.stderr @@ -1,31 +1,31 @@ error[E0532]: expected tuple struct/variant, found unit struct `Empty2` --> $DIR/empty-struct-unit-pat.rs:21:9 | -LL | Empty2() => () //~ ERROR expected tuple struct/variant, found unit struct `Empty2` +LL | Empty2() => () | ^^^^^^ help: a tuple struct with a similar name exists: `XEmpty6` error[E0532]: expected tuple struct/variant, found unit struct `XEmpty2` --> $DIR/empty-struct-unit-pat.rs:24:9 | -LL | XEmpty2() => () //~ ERROR expected tuple struct/variant, found unit struct `XEmpty2` +LL | XEmpty2() => () | ^^^^^^^ help: a tuple struct with a similar name exists: `XEmpty6` error[E0532]: expected tuple struct/variant, found unit struct `Empty2` --> $DIR/empty-struct-unit-pat.rs:27:9 | -LL | Empty2(..) => () //~ ERROR expected tuple struct/variant, found unit struct `Empty2` +LL | Empty2(..) => () | ^^^^^^ help: a tuple struct with a similar name exists: `XEmpty6` error[E0532]: expected tuple struct/variant, found unit struct `XEmpty2` --> $DIR/empty-struct-unit-pat.rs:30:9 | -LL | XEmpty2(..) => () //~ ERROR expected tuple struct/variant, found unit struct `XEmpty2` +LL | XEmpty2(..) => () | ^^^^^^^ help: a tuple struct with a similar name exists: `XEmpty6` error[E0532]: expected tuple struct/variant, found unit variant `E::Empty4` --> $DIR/empty-struct-unit-pat.rs:34:9 | -LL | E::Empty4() => () //~ ERROR expected tuple struct/variant, found unit variant `E::Empty4` +LL | E::Empty4() => () | ^^^^^^^^^ not a tuple struct/variant error[E0532]: expected tuple struct/variant, found unit variant `XE::XEmpty4` @@ -39,7 +39,7 @@ LL | XE::XEmpty4() => (), error[E0532]: expected tuple struct/variant, found unit variant `E::Empty4` --> $DIR/empty-struct-unit-pat.rs:42:9 | -LL | E::Empty4(..) => () //~ ERROR expected tuple struct/variant, found unit variant `E::Empty4` +LL | E::Empty4(..) => () | ^^^^^^^^^ not a tuple struct/variant error[E0532]: expected tuple struct/variant, found unit variant `XE::XEmpty4` diff --git a/src/test/ui/enable-unstable-lib-feature.stderr b/src/test/ui/enable-unstable-lib-feature.stderr index 51cfe7beade2..5b6ebc4c0d99 100644 --- a/src/test/ui/enable-unstable-lib-feature.stderr +++ b/src/test/ui/enable-unstable-lib-feature.stderr @@ -1,7 +1,7 @@ error: function `BOGUS` should have a snake case name --> $DIR/enable-unstable-lib-feature.rs:12:8 | -LL | pub fn BOGUS() { } //~ ERROR +LL | pub fn BOGUS() { } | ^^^^^ help: convert the identifier to snake case: `bogus` | note: lint level defined here diff --git a/src/test/ui/enum/enum-and-module-in-same-scope.stderr b/src/test/ui/enum/enum-and-module-in-same-scope.stderr index 5f42af8f260d..538898c2f2a6 100644 --- a/src/test/ui/enum/enum-and-module-in-same-scope.stderr +++ b/src/test/ui/enum/enum-and-module-in-same-scope.stderr @@ -4,7 +4,7 @@ error[E0428]: the name `Foo` is defined multiple times LL | enum Foo { | -------- previous definition of the type `Foo` here ... -LL | mod Foo { //~ ERROR the name `Foo` is defined multiple times +LL | mod Foo { | ^^^^^^^ `Foo` redefined here | = note: `Foo` must be defined only once in the type namespace of this module diff --git a/src/test/ui/enum/enum-discrim-autosizing.stderr b/src/test/ui/enum/enum-discrim-autosizing.stderr index 67b0d75d787c..8848f984cfb7 100644 --- a/src/test/ui/enum/enum-discrim-autosizing.stderr +++ b/src/test/ui/enum/enum-discrim-autosizing.stderr @@ -3,7 +3,7 @@ error[E0081]: discriminant value `0` already exists | LL | Au64 = 0, | - first use of `0` -LL | Bu64 = 0x8000_0000_0000_0000 //~ERROR already exists +LL | Bu64 = 0x8000_0000_0000_0000 | ^^^^^^^^^^^^^^^^^^^^^ enum already has `0` error: aborting due to previous error diff --git a/src/test/ui/enum/enum-discrim-too-small2.stderr b/src/test/ui/enum/enum-discrim-too-small2.stderr index 31ca01b86bdb..6340f5a856ed 100644 --- a/src/test/ui/enum/enum-discrim-too-small2.stderr +++ b/src/test/ui/enum/enum-discrim-too-small2.stderr @@ -1,7 +1,7 @@ error: literal out of range for i8 --> $DIR/enum-discrim-too-small2.rs:8:11 | -LL | Ci8 = 223, //~ ERROR literal out of range for i8 +LL | Ci8 = 223, | ^^^ | note: lint level defined here @@ -13,19 +13,19 @@ LL | #![deny(overflowing_literals)] error: literal out of range for i16 --> $DIR/enum-discrim-too-small2.rs:15:12 | -LL | Ci16 = 55555, //~ ERROR literal out of range for i16 +LL | Ci16 = 55555, | ^^^^^ error: literal out of range for i32 --> $DIR/enum-discrim-too-small2.rs:22:12 | -LL | Ci32 = 3_000_000_000, //~ ERROR literal out of range for i32 +LL | Ci32 = 3_000_000_000, | ^^^^^^^^^^^^^ error: literal out of range for i64 --> $DIR/enum-discrim-too-small2.rs:29:12 | -LL | Ci64 = 9223372036854775809, //~ ERROR literal out of range for i64 +LL | Ci64 = 9223372036854775809, | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/enum/enum-in-scope.stderr b/src/test/ui/enum/enum-in-scope.stderr index cd0100ec2fc4..49a01abcbd69 100644 --- a/src/test/ui/enum/enum-in-scope.stderr +++ b/src/test/ui/enum/enum-in-scope.stderr @@ -4,7 +4,7 @@ error[E0530]: let bindings cannot shadow tuple structs LL | struct hello(isize); | -------------------- the tuple struct `hello` is defined here ... -LL | let hello = 0; //~ERROR let bindings cannot shadow tuple structs +LL | let hello = 0; | ^^^^^ cannot be named the same as a tuple struct error: aborting due to previous error diff --git a/src/test/ui/enum/enum-size-variance.stderr b/src/test/ui/enum/enum-size-variance.stderr index 5cc0a0d7a8f8..1ebd9b6806f8 100644 --- a/src/test/ui/enum/enum-size-variance.stderr +++ b/src/test/ui/enum/enum-size-variance.stderr @@ -1,7 +1,7 @@ warning: enum variant is more than three times larger (32 bytes) than the next largest --> $DIR/enum-size-variance.rs:18:5 | -LL | L(i64, i64, i64, i64), //~ WARNING three times larger +LL | L(i64, i64, i64, i64), | ^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/enum/enum-to-float-cast-2.stderr b/src/test/ui/enum/enum-to-float-cast-2.stderr index 42d08a11ed1b..2bc414098dcf 100644 --- a/src/test/ui/enum/enum-to-float-cast-2.stderr +++ b/src/test/ui/enum/enum-to-float-cast-2.stderr @@ -1,7 +1,7 @@ error[E0606]: casting `E` as `f32` is invalid --> $DIR/enum-to-float-cast-2.rs:14:13 | -LL | let a = E::L0 as f32; //~ ERROR casting +LL | let a = E::L0 as f32; | ^^^^^^^^^^^^ | = help: cast through an integer first @@ -9,7 +9,7 @@ LL | let a = E::L0 as f32; //~ ERROR casting error[E0606]: casting `F` as `f32` is invalid --> $DIR/enum-to-float-cast-2.rs:15:13 | -LL | let c = F::H1 as f32; //~ ERROR casting +LL | let c = F::H1 as f32; | ^^^^^^^^^^^^ | = help: cast through an integer first diff --git a/src/test/ui/enum/enum-to-float-cast.stderr b/src/test/ui/enum/enum-to-float-cast.stderr index e6cd2ed4d0da..191606d8dc53 100644 --- a/src/test/ui/enum/enum-to-float-cast.stderr +++ b/src/test/ui/enum/enum-to-float-cast.stderr @@ -1,7 +1,7 @@ error[E0606]: casting `E` as `f32` is invalid --> $DIR/enum-to-float-cast.rs:13:18 | -LL | static C0: f32 = E::L0 as f32; //~ ERROR casting +LL | static C0: f32 = E::L0 as f32; | ^^^^^^^^^^^^ | = help: cast through an integer first @@ -9,7 +9,7 @@ LL | static C0: f32 = E::L0 as f32; //~ ERROR casting error[E0606]: casting `F` as `f32` is invalid --> $DIR/enum-to-float-cast.rs:14:18 | -LL | static C1: f32 = F::H1 as f32; //~ ERROR casting +LL | static C1: f32 = F::H1 as f32; | ^^^^^^^^^^^^ | = help: cast through an integer first diff --git a/src/test/ui/enum/enum-variant-type-2.stderr b/src/test/ui/enum/enum-variant-type-2.stderr index 3e7a4edd66e6..7e8453c61f62 100644 --- a/src/test/ui/enum/enum-variant-type-2.stderr +++ b/src/test/ui/enum/enum-variant-type-2.stderr @@ -1,7 +1,7 @@ error[E0573]: expected type, found variant `Foo::Bar` --> $DIR/enum-variant-type-2.rs:7:11 | -LL | fn foo(x: Foo::Bar) {} //~ ERROR expected type, found variant `Foo::Bar` +LL | fn foo(x: Foo::Bar) {} | ^^^^^^^^ | | | not a type diff --git a/src/test/ui/enums-pats-not-idents.stderr b/src/test/ui/enums-pats-not-idents.stderr index 5e12f3b5eadf..6b1e6046260a 100644 --- a/src/test/ui/enums-pats-not-idents.stderr +++ b/src/test/ui/enums-pats-not-idents.stderr @@ -1,7 +1,7 @@ error[E0531]: cannot find tuple struct/variant `a` in this scope --> $DIR/enums-pats-not-idents.rs:2:9 | -LL | let a(1) = 13; //~ ERROR cannot find tuple struct/variant `a` in this scope +LL | let a(1) = 13; | ^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0001.stderr b/src/test/ui/error-codes/E0001.stderr index 0b884c54a82f..992345151827 100644 --- a/src/test/ui/error-codes/E0001.stderr +++ b/src/test/ui/error-codes/E0001.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/E0001.rs:8:9 | -LL | _ => {/* ... */} //~ ERROR unreachable pattern +LL | _ => {/* ... */} | ^ | note: lint level defined here diff --git a/src/test/ui/error-codes/E0004-2.stderr b/src/test/ui/error-codes/E0004-2.stderr index 8b262cc6eb78..db0a2b5a0859 100644 --- a/src/test/ui/error-codes/E0004-2.stderr +++ b/src/test/ui/error-codes/E0004-2.stderr @@ -1,14 +1,10 @@ -error[E0004]: non-exhaustive patterns: type `std::option::Option` is non-empty +error[E0004]: non-exhaustive patterns: multiple patterns of type `std::option::Option` are not handled --> $DIR/E0004-2.rs:4:11 | -LL | match x { } //~ ERROR E0004 +LL | match x { } | ^ | -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - --> $DIR/E0004-2.rs:4:11 - | -LL | match x { } //~ ERROR E0004 - | ^ + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0004.stderr b/src/test/ui/error-codes/E0004.stderr index a66dd9290320..2940ad4bb1e2 100644 --- a/src/test/ui/error-codes/E0004.stderr +++ b/src/test/ui/error-codes/E0004.stderr @@ -1,8 +1,17 @@ error[E0004]: non-exhaustive patterns: `HastaLaVistaBaby` not covered --> $DIR/E0004.rs:9:11 | -LL | match x { //~ ERROR E0004 - | ^ pattern `HastaLaVistaBaby` not covered +LL | / enum Terminator { +LL | | HastaLaVistaBaby, + | | ---------------- not covered +LL | | TalkToMyHand, +LL | | } + | |_- `Terminator` defined here +... +LL | match x { + | ^ pattern `HastaLaVistaBaby` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0005.stderr b/src/test/ui/error-codes/E0005.stderr index 2a38aae0873a..56a4bcffc81a 100644 --- a/src/test/ui/error-codes/E0005.stderr +++ b/src/test/ui/error-codes/E0005.stderr @@ -1,7 +1,7 @@ error[E0005]: refutable pattern in local binding: `None` not covered --> $DIR/E0005.rs:3:9 | -LL | let Some(y) = x; //~ ERROR E0005 +LL | let Some(y) = x; | ^^^^^^^ pattern `None` not covered error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0010-teach.stderr b/src/test/ui/error-codes/E0010-teach.stderr index 77e7b5ec0e86..3e8467fad6fc 100644 --- a/src/test/ui/error-codes/E0010-teach.stderr +++ b/src/test/ui/error-codes/E0010-teach.stderr @@ -1,7 +1,7 @@ error[E0010]: allocations are not allowed in constants --> $DIR/E0010-teach.rs:6:24 | -LL | const CON : Box = box 0; //~ ERROR E0010 +LL | const CON : Box = box 0; | ^^^^^ allocation not allowed in constants | = note: The value of statics and constants must be known at compile time, and they live for the entire lifetime of a program. Creating a boxed value allocates memory on the heap at runtime, and therefore cannot be done at compile time. @@ -9,7 +9,7 @@ LL | const CON : Box = box 0; //~ ERROR E0010 error[E0019]: constant contains unimplemented expression type --> $DIR/E0010-teach.rs:6:28 | -LL | const CON : Box = box 0; //~ ERROR E0010 +LL | const CON : Box = box 0; | ^ | = note: A function call isn't allowed in the const's initialization expression because the expression's value must be known at compile-time. diff --git a/src/test/ui/error-codes/E0010.stderr b/src/test/ui/error-codes/E0010.stderr index 1364693109e0..285570f755ed 100644 --- a/src/test/ui/error-codes/E0010.stderr +++ b/src/test/ui/error-codes/E0010.stderr @@ -1,13 +1,13 @@ error[E0010]: allocations are not allowed in constants --> $DIR/E0010.rs:4:24 | -LL | const CON : Box = box 0; //~ ERROR E0010 +LL | const CON : Box = box 0; | ^^^^^ allocation not allowed in constants error[E0019]: constant contains unimplemented expression type --> $DIR/E0010.rs:4:28 | -LL | const CON : Box = box 0; //~ ERROR E0010 +LL | const CON : Box = box 0; | ^ error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0017.nll.stderr b/src/test/ui/error-codes/E0017.nll.stderr index 0477f06010b0..3c2a07265f4f 100644 --- a/src/test/ui/error-codes/E0017.nll.stderr +++ b/src/test/ui/error-codes/E0017.nll.stderr @@ -1,31 +1,31 @@ error[E0017]: references in constants may only refer to immutable values --> $DIR/E0017.rs:4:30 | -LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017 +LL | const CR: &'static mut i32 = &mut C; | ^^^^^^ constants require immutable values error[E0017]: references in statics may only refer to immutable values --> $DIR/E0017.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ statics require immutable values error: cannot mutate statics in the initializer of another static --> $DIR/E0017.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ error[E0596]: cannot borrow immutable static item `X` as mutable --> $DIR/E0017.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ cannot borrow as mutable error[E0017]: references in statics may only refer to immutable values --> $DIR/E0017.rs:8:38 | -LL | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 +LL | static CONST_REF: &'static mut i32 = &mut C; | ^^^^^^ statics require immutable values error: aborting due to 5 previous errors diff --git a/src/test/ui/error-codes/E0017.stderr b/src/test/ui/error-codes/E0017.stderr index cc202ec912e9..d0bd93eb9089 100644 --- a/src/test/ui/error-codes/E0017.stderr +++ b/src/test/ui/error-codes/E0017.stderr @@ -1,31 +1,31 @@ error[E0017]: references in constants may only refer to immutable values --> $DIR/E0017.rs:4:30 | -LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017 +LL | const CR: &'static mut i32 = &mut C; | ^^^^^^ constants require immutable values error[E0017]: references in statics may only refer to immutable values --> $DIR/E0017.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ statics require immutable values error: cannot mutate statics in the initializer of another static --> $DIR/E0017.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ error[E0596]: cannot borrow immutable static item as mutable --> $DIR/E0017.rs:5:44 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^ error[E0017]: references in statics may only refer to immutable values --> $DIR/E0017.rs:8:38 | -LL | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 +LL | static CONST_REF: &'static mut i32 = &mut C; | ^^^^^^ statics require immutable values error: aborting due to 5 previous errors diff --git a/src/test/ui/error-codes/E0023.stderr b/src/test/ui/error-codes/E0023.stderr index 37704fc3233c..1bc90a995fe3 100644 --- a/src/test/ui/error-codes/E0023.stderr +++ b/src/test/ui/error-codes/E0023.stderr @@ -1,19 +1,19 @@ error[E0023]: this pattern has 1 field, but the corresponding tuple variant has 2 fields --> $DIR/E0023.rs:10:9 | -LL | Fruit::Apple(a) => {}, //~ ERROR E0023 +LL | Fruit::Apple(a) => {}, | ^^^^^^^^^^^^^^^ expected 2 fields, found 1 error[E0023]: this pattern has 3 fields, but the corresponding tuple variant has 2 fields --> $DIR/E0023.rs:11:9 | -LL | Fruit::Apple(a, b, c) => {}, //~ ERROR E0023 +LL | Fruit::Apple(a, b, c) => {}, | ^^^^^^^^^^^^^^^^^^^^^ expected 2 fields, found 3 error[E0023]: this pattern has 2 fields, but the corresponding tuple variant has 1 field --> $DIR/E0023.rs:12:9 | -LL | Fruit::Pear(1, 2) => {}, //~ ERROR E0023 +LL | Fruit::Pear(1, 2) => {}, | ^^^^^^^^^^^^^^^^^ expected 1 field, found 2 error: aborting due to 3 previous errors diff --git a/src/test/ui/error-codes/E0034.stderr b/src/test/ui/error-codes/E0034.stderr index 3c5569eb79f3..816a48f102dc 100644 --- a/src/test/ui/error-codes/E0034.stderr +++ b/src/test/ui/error-codes/E0034.stderr @@ -1,7 +1,7 @@ error[E0034]: multiple applicable items in scope --> $DIR/E0034.rs:20:5 | -LL | Test::foo() //~ ERROR multiple applicable items in scope +LL | Test::foo() | ^^^^^^^^^ multiple `foo` found | note: candidate #1 is defined in an impl of the trait `Trait1` for the type `Test` diff --git a/src/test/ui/error-codes/E0045.stderr b/src/test/ui/error-codes/E0045.stderr index b38bbc169bd6..d163128bc8b6 100644 --- a/src/test/ui/error-codes/E0045.stderr +++ b/src/test/ui/error-codes/E0045.stderr @@ -1,8 +1,8 @@ -error[E0045]: variadic function must have C or cdecl calling convention +error[E0045]: C-variadic function must have C or cdecl calling convention --> $DIR/E0045.rs:1:17 | -LL | extern "Rust" { fn foo(x: u8, ...); } //~ ERROR E0045 - | ^^^^^^^^^^^^^^^^^^^ variadics require C or cdecl calling convention +LL | extern "Rust" { fn foo(x: u8, ...); } + | ^^^^^^^^^^^^^^^^^^^ C-variadics require C or cdecl calling convention error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0049.stderr b/src/test/ui/error-codes/E0049.stderr index 0d132bdbbdda..7e9b9e8efb9a 100644 --- a/src/test/ui/error-codes/E0049.stderr +++ b/src/test/ui/error-codes/E0049.stderr @@ -4,7 +4,7 @@ error[E0049]: method `foo` has 0 type parameters but its trait declaration has 1 LL | fn foo(x: T) -> Self; | --------------------------------- expected 1 type parameter ... -LL | fn foo(x: bool) -> Self { Bar } //~ ERROR E0049 +LL | fn foo(x: bool) -> Self { Bar } | ^^^^^^^^^^^^^^^^^^^^^^^ found 0 type parameters error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0050.stderr b/src/test/ui/error-codes/E0050.stderr index 2c1fd111d26f..fe9ac5e8eb02 100644 --- a/src/test/ui/error-codes/E0050.stderr +++ b/src/test/ui/error-codes/E0050.stderr @@ -4,7 +4,7 @@ error[E0050]: method `foo` has 1 parameter but the declaration in trait `Foo::fo LL | fn foo(&self, x: u8) -> bool; | ------------ trait requires 2 parameters ... -LL | fn foo(&self) -> bool { true } //~ ERROR E0050 +LL | fn foo(&self) -> bool { true } | ^^^^^ expected 2 parameters, found 1 error[E0050]: method `bar` has 1 parameter but the declaration in trait `Foo::bar` has 4 @@ -13,7 +13,7 @@ error[E0050]: method `bar` has 1 parameter but the declaration in trait `Foo::ba LL | fn bar(&self, x: u8, y: u8, z: u8); | -------------------------- trait requires 4 parameters ... -LL | fn bar(&self) { } //~ ERROR E0050 +LL | fn bar(&self) { } | ^^^^^ expected 4 parameters, found 1 error[E0050]: method `less` has 4 parameters but the declaration in trait `Foo::less` has 1 @@ -22,7 +22,7 @@ error[E0050]: method `less` has 4 parameters but the declaration in trait `Foo:: LL | fn less(&self); | ----- trait requires 1 parameter ... -LL | fn less(&self, x: u8, y: u8, z: u8) { } //~ ERROR E0050 +LL | fn less(&self, x: u8, y: u8, z: u8) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 parameter, found 4 error: aborting due to 3 previous errors diff --git a/src/test/ui/error-codes/E0054.stderr b/src/test/ui/error-codes/E0054.stderr index cce32fa29440..6b1092760fb4 100644 --- a/src/test/ui/error-codes/E0054.stderr +++ b/src/test/ui/error-codes/E0054.stderr @@ -1,7 +1,7 @@ error[E0054]: cannot cast as `bool` --> $DIR/E0054.rs:3:24 | -LL | let x_is_nonzero = x as bool; //~ ERROR E0054 +LL | let x_is_nonzero = x as bool; | ^^^^^^^^^ help: compare with zero instead: `x != 0` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0057.stderr b/src/test/ui/error-codes/E0057.stderr index 5906a05c32c9..6b5890cac36c 100644 --- a/src/test/ui/error-codes/E0057.stderr +++ b/src/test/ui/error-codes/E0057.stderr @@ -1,13 +1,13 @@ error[E0057]: this function takes 1 parameter but 0 parameters were supplied --> $DIR/E0057.rs:3:13 | -LL | let a = f(); //~ ERROR E0057 +LL | let a = f(); | ^^^ expected 1 parameter error[E0057]: this function takes 1 parameter but 2 parameters were supplied --> $DIR/E0057.rs:5:13 | -LL | let c = f(2, 3); //~ ERROR E0057 +LL | let c = f(2, 3); | ^^^^^^^ expected 1 parameter error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0059.stderr b/src/test/ui/error-codes/E0059.stderr index a96e1a0beab3..a1b8aeaedbb8 100644 --- a/src/test/ui/error-codes/E0059.stderr +++ b/src/test/ui/error-codes/E0059.stderr @@ -1,7 +1,7 @@ error[E0059]: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit --> $DIR/E0059.rs:3:41 | -LL | fn foo>(f: F) -> F::Output { f(3) } //~ ERROR E0059 +LL | fn foo>(f: F) -> F::Output { f(3) } | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0067.stderr b/src/test/ui/error-codes/E0067.stderr index fd4ca7c9f707..024c8681b550 100644 --- a/src/test/ui/error-codes/E0067.stderr +++ b/src/test/ui/error-codes/E0067.stderr @@ -1,7 +1,7 @@ error[E0368]: binary assignment operation `+=` cannot be applied to type `std::collections::LinkedList<_>` --> $DIR/E0067.rs:4:5 | -LL | LinkedList::new() += 1; //~ ERROR E0368 +LL | LinkedList::new() += 1; | -----------------^^^^^ | | | cannot use `+=` on type `std::collections::LinkedList<_>` @@ -11,7 +11,7 @@ LL | LinkedList::new() += 1; //~ ERROR E0368 error[E0067]: invalid left-hand side expression --> $DIR/E0067.rs:4:5 | -LL | LinkedList::new() += 1; //~ ERROR E0368 +LL | LinkedList::new() += 1; | ^^^^^^^^^^^^^^^^^ invalid expression for left-hand side error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0070.stderr b/src/test/ui/error-codes/E0070.stderr index 4c1cfd858e6c..6592ad328be5 100644 --- a/src/test/ui/error-codes/E0070.stderr +++ b/src/test/ui/error-codes/E0070.stderr @@ -1,19 +1,19 @@ error[E0070]: invalid left-hand side expression --> $DIR/E0070.rs:6:5 | -LL | SOME_CONST = 14; //~ ERROR E0070 +LL | SOME_CONST = 14; | ^^^^^^^^^^^^^^^ left-hand of expression not valid error[E0070]: invalid left-hand side expression --> $DIR/E0070.rs:7:5 | -LL | 1 = 3; //~ ERROR E0070 +LL | 1 = 3; | ^^^^^ left-hand of expression not valid error[E0308]: mismatched types --> $DIR/E0070.rs:8:25 | -LL | some_other_func() = 4; //~ ERROR E0070 +LL | some_other_func() = 4; | ^ expected (), found integer | = note: expected type `()` @@ -22,7 +22,7 @@ LL | some_other_func() = 4; //~ ERROR E0070 error[E0070]: invalid left-hand side expression --> $DIR/E0070.rs:8:5 | -LL | some_other_func() = 4; //~ ERROR E0070 +LL | some_other_func() = 4; | ^^^^^^^^^^^^^^^^^^^^^ left-hand of expression not valid error: aborting due to 4 previous errors diff --git a/src/test/ui/error-codes/E0075.stderr b/src/test/ui/error-codes/E0075.stderr index abf688970969..d8b90d0691da 100644 --- a/src/test/ui/error-codes/E0075.stderr +++ b/src/test/ui/error-codes/E0075.stderr @@ -1,7 +1,7 @@ error[E0075]: SIMD vector cannot be empty --> $DIR/E0075.rs:4:1 | -LL | struct Bad; //~ ERROR E0075 +LL | struct Bad; | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0077.stderr b/src/test/ui/error-codes/E0077.stderr index 9f3e1fa5c358..4f85d175ce65 100644 --- a/src/test/ui/error-codes/E0077.stderr +++ b/src/test/ui/error-codes/E0077.stderr @@ -1,7 +1,7 @@ error[E0077]: SIMD vector element type should be machine type --> $DIR/E0077.rs:4:1 | -LL | struct Bad(String); //~ ERROR E0077 +LL | struct Bad(String); | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0080.stderr b/src/test/ui/error-codes/E0080.stderr index 4d37881c1e12..3113fd2189b4 100644 --- a/src/test/ui/error-codes/E0080.stderr +++ b/src/test/ui/error-codes/E0080.stderr @@ -1,13 +1,13 @@ error[E0080]: evaluation of constant value failed --> $DIR/E0080.rs:2:9 | -LL | X = (1 << 500), //~ ERROR E0080 +LL | X = (1 << 500), | ^^^^^^^^^^ attempt to shift left with overflow error[E0080]: evaluation of constant value failed --> $DIR/E0080.rs:4:9 | -LL | Y = (1 / 0) //~ ERROR E0080 +LL | Y = (1 / 0) | ^^^^^^^ attempt to divide by zero error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0084.stderr b/src/test/ui/error-codes/E0084.stderr index 353c825f5280..1f818da25bb0 100644 --- a/src/test/ui/error-codes/E0084.stderr +++ b/src/test/ui/error-codes/E0084.stderr @@ -1,7 +1,7 @@ error[E0084]: unsupported representation for zero-variant enum --> $DIR/E0084.rs:1:1 | -LL | #[repr(i32)] //~ ERROR: E0084 +LL | #[repr(i32)] | ^^^^^^^^^^^^ LL | enum Foo {} | ----------- zero-variant enum diff --git a/src/test/ui/error-codes/E0091.stderr b/src/test/ui/error-codes/E0091.stderr index d32960f82cbc..a596b75e481d 100644 --- a/src/test/ui/error-codes/E0091.stderr +++ b/src/test/ui/error-codes/E0091.stderr @@ -1,13 +1,13 @@ error[E0091]: type parameter `T` is unused --> $DIR/E0091.rs:1:10 | -LL | type Foo = u32; //~ ERROR E0091 +LL | type Foo = u32; | ^ unused type parameter error[E0091]: type parameter `B` is unused --> $DIR/E0091.rs:2:14 | -LL | type Foo2 = Box; //~ ERROR E0091 +LL | type Foo2 = Box; | ^ unused type parameter error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0092.stderr b/src/test/ui/error-codes/E0092.stderr index a45351775269..2d590a8e1d70 100644 --- a/src/test/ui/error-codes/E0092.stderr +++ b/src/test/ui/error-codes/E0092.stderr @@ -1,7 +1,7 @@ error[E0092]: unrecognized atomic operation function: `foo` --> $DIR/E0092.rs:3:5 | -LL | fn atomic_foo(); //~ ERROR E0092 +LL | fn atomic_foo(); | ^^^^^^^^^^^^^^^^ unrecognized atomic operation error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0094.stderr b/src/test/ui/error-codes/E0094.stderr index 97bdbfbe5ab5..da97f3a014b0 100644 --- a/src/test/ui/error-codes/E0094.stderr +++ b/src/test/ui/error-codes/E0094.stderr @@ -1,7 +1,7 @@ error[E0094]: intrinsic has wrong number of type parameters: found 2, expected 1 --> $DIR/E0094.rs:3:15 | -LL | fn size_of() -> usize; //~ ERROR E0094 +LL | fn size_of() -> usize; | ^^^^^^ expected 1 type parameter error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0109.stderr b/src/test/ui/error-codes/E0109.stderr index a5508f980857..a807f2d44a6f 100644 --- a/src/test/ui/error-codes/E0109.stderr +++ b/src/test/ui/error-codes/E0109.stderr @@ -1,7 +1,7 @@ error[E0109]: type arguments are not allowed on this entity --> $DIR/E0109.rs:1:14 | -LL | type X = u32; //~ ERROR E0109 +LL | type X = u32; | ^^^ type argument not allowed error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0110.stderr b/src/test/ui/error-codes/E0110.stderr index a644ac92cefb..3bc4775bdc12 100644 --- a/src/test/ui/error-codes/E0110.stderr +++ b/src/test/ui/error-codes/E0110.stderr @@ -1,7 +1,7 @@ error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/E0110.rs:1:14 | -LL | type X = u32<'static>; //~ ERROR E0110 +LL | type X = u32<'static>; | ^^^^^^^ lifetime argument not allowed error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0117.stderr b/src/test/ui/error-codes/E0117.stderr index b007ca05ab2c..80b3a4e714ae 100644 --- a/src/test/ui/error-codes/E0117.stderr +++ b/src/test/ui/error-codes/E0117.stderr @@ -1,13 +1,13 @@ error[E0120]: the Drop trait may only be implemented on structures --> $DIR/E0117.rs:1:15 | -LL | impl Drop for u32 {} //~ ERROR E0117 +LL | impl Drop for u32 {} | ^^^ implementing Drop requires a struct error[E0117]: only traits defined in the current crate can be implemented for arbitrary types --> $DIR/E0117.rs:1:1 | -LL | impl Drop for u32 {} //~ ERROR E0117 +LL | impl Drop for u32 {} | ^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | = note: the impl does not reference only types defined in this crate diff --git a/src/test/ui/error-codes/E0118.stderr b/src/test/ui/error-codes/E0118.stderr index 787f8caec7f4..b0afaeb5c1fa 100644 --- a/src/test/ui/error-codes/E0118.stderr +++ b/src/test/ui/error-codes/E0118.stderr @@ -1,7 +1,7 @@ error[E0118]: no base type found for inherent implementation --> $DIR/E0118.rs:1:6 | -LL | impl (u8, u8) { //~ ERROR E0118 +LL | impl (u8, u8) { | ^^^^^^^^ impl requires a base type | = note: either implement a trait on it or create a newtype to wrap it instead diff --git a/src/test/ui/error-codes/E0119.stderr b/src/test/ui/error-codes/E0119.stderr index af9acb294bcd..e7690aa30bd2 100644 --- a/src/test/ui/error-codes/E0119.stderr +++ b/src/test/ui/error-codes/E0119.stderr @@ -4,7 +4,7 @@ error[E0119]: conflicting implementations of trait `MyTrait` for type `Foo`: LL | impl MyTrait for T { | --------------------- first implementation here ... -LL | impl MyTrait for Foo { //~ ERROR E0119 +LL | impl MyTrait for Foo { | ^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Foo` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0121.stderr b/src/test/ui/error-codes/E0121.stderr index 75e03c659b77..b7f4ce4d230e 100644 --- a/src/test/ui/error-codes/E0121.stderr +++ b/src/test/ui/error-codes/E0121.stderr @@ -1,13 +1,13 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/E0121.rs:1:13 | -LL | fn foo() -> _ { 5 } //~ ERROR E0121 +LL | fn foo() -> _ { 5 } | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/E0121.rs:3:13 | -LL | static BAR: _ = "test"; //~ ERROR E0121 +LL | static BAR: _ = "test"; | ^ not allowed in type signatures error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0128.stderr b/src/test/ui/error-codes/E0128.stderr index 9ea3c09e63f5..253aa166bd37 100644 --- a/src/test/ui/error-codes/E0128.stderr +++ b/src/test/ui/error-codes/E0128.stderr @@ -1,7 +1,7 @@ error[E0128]: type parameters with a default cannot use forward declared identifiers --> $DIR/E0128.rs:1:14 | -LL | struct Foo { //~ ERROR E0128 +LL | struct Foo { | ^ defaulted type parameters cannot be forward declared error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0132.stderr b/src/test/ui/error-codes/E0132.stderr index e19b421bfdb9..c21363756b3e 100644 --- a/src/test/ui/error-codes/E0132.stderr +++ b/src/test/ui/error-codes/E0132.stderr @@ -1,7 +1,7 @@ error[E0132]: start function is not allowed to have type parameters --> $DIR/E0132.rs:4:5 | -LL | fn f< T >() {} //~ ERROR E0132 +LL | fn f< T >() {} | ^^^^^ start function cannot have type parameters error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0152.stderr b/src/test/ui/error-codes/E0152.stderr index 401c1755fa8b..26e6e2e1bce7 100644 --- a/src/test/ui/error-codes/E0152.stderr +++ b/src/test/ui/error-codes/E0152.stderr @@ -1,7 +1,7 @@ error[E0152]: duplicate lang item found: `arc`. --> $DIR/E0152.rs:4:1 | -LL | struct Foo; //~ ERROR E0152 +LL | struct Foo; | ^^^^^^^^^^^ | = note: first defined in crate `alloc`. diff --git a/src/test/ui/error-codes/E0161.stderr b/src/test/ui/error-codes/E0161.stderr deleted file mode 100644 index 0135e495c16b..000000000000 --- a/src/test/ui/error-codes/E0161.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0161]: cannot move a value of type str: the size of str cannot be statically determined - --> $DIR/E0161.rs:14:28 - | -LL | let _x: Box = box *"hello"; //~ ERROR E0161 - | ^^^^^^^^ - -error[E0507]: cannot move out of borrowed content - --> $DIR/E0161.rs:14:28 - | -LL | let _x: Box = box *"hello"; //~ ERROR E0161 - | ^^^^^^^^ cannot move out of borrowed content - -error: aborting due to 2 previous errors - -Some errors occurred: E0161, E0507. -For more information about an error, try `rustc --explain E0161`. diff --git a/src/test/ui/error-codes/E0164.stderr b/src/test/ui/error-codes/E0164.stderr index 0debc8092e86..0a153d85b421 100644 --- a/src/test/ui/error-codes/E0164.stderr +++ b/src/test/ui/error-codes/E0164.stderr @@ -1,7 +1,7 @@ error[E0164]: expected tuple struct/variant, found associated constant `::B` --> $DIR/E0164.rs:9:9 | -LL | Foo::B(i) => i, //~ ERROR E0164 +LL | Foo::B(i) => i, | ^^^^^^^^^ not a tuple variant or struct error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0184.stderr b/src/test/ui/error-codes/E0184.stderr index 471ba3870e21..b4128b956066 100644 --- a/src/test/ui/error-codes/E0184.stderr +++ b/src/test/ui/error-codes/E0184.stderr @@ -1,7 +1,7 @@ error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor --> $DIR/E0184.rs:1:10 | -LL | #[derive(Copy)] //~ ERROR E0184 +LL | #[derive(Copy)] | ^^^^ Copy not allowed on types with destructors error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0186.stderr b/src/test/ui/error-codes/E0186.stderr index 7fed0426ee87..8971d61fc758 100644 --- a/src/test/ui/error-codes/E0186.stderr +++ b/src/test/ui/error-codes/E0186.stderr @@ -1,10 +1,10 @@ error[E0186]: method `foo` has a `&self` declaration in the trait, but not in the impl --> $DIR/E0186.rs:8:5 | -LL | fn foo(&self); //~ `&self` used in trait +LL | fn foo(&self); | -------------- `&self` used in trait ... -LL | fn foo() {} //~ ERROR E0186 +LL | fn foo() {} | ^^^^^^^^ expected `&self` in impl error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0191.stderr b/src/test/ui/error-codes/E0191.stderr index 570b0ddc3131..2d9fdfe5d29c 100644 --- a/src/test/ui/error-codes/E0191.stderr +++ b/src/test/ui/error-codes/E0191.stderr @@ -4,7 +4,7 @@ error[E0191]: the value of the associated type `Bar` (from the trait `Trait`) mu LL | type Bar; | --------- `Bar` defined here ... -LL | type Foo = Trait; //~ ERROR E0191 +LL | type Foo = Trait; | ^^^^^ associated type `Bar` must be specified error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0192.stderr b/src/test/ui/error-codes/E0192.stderr index bdfe717afe27..8faa550a5093 100644 --- a/src/test/ui/error-codes/E0192.stderr +++ b/src/test/ui/error-codes/E0192.stderr @@ -1,7 +1,7 @@ error[E0192]: negative impls are only allowed for auto traits (e.g., `Send` and `Sync`) --> $DIR/E0192.rs:9:1 | -LL | impl !Trait for Foo { } //~ ERROR E0192 +LL | impl !Trait for Foo { } | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0195.stderr b/src/test/ui/error-codes/E0195.stderr index 57032c6b0c84..6eaa1750ee35 100644 --- a/src/test/ui/error-codes/E0195.stderr +++ b/src/test/ui/error-codes/E0195.stderr @@ -4,7 +4,7 @@ error[E0195]: lifetime parameters or bounds on method `bar` do not match the tra LL | fn bar<'a,'b:'a>(x: &'a str, y: &'b str); | ---------- lifetimes in impl do not match this method in trait ... -LL | fn bar<'a,'b>(x: &'a str, y: &'b str) { //~ ERROR E0195 +LL | fn bar<'a,'b>(x: &'a str, y: &'b str) { | ^^^^^^^ lifetimes do not match method in trait error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0197.stderr b/src/test/ui/error-codes/E0197.stderr index f58dcd791da1..bb7b6474d3e3 100644 --- a/src/test/ui/error-codes/E0197.stderr +++ b/src/test/ui/error-codes/E0197.stderr @@ -1,7 +1,7 @@ error[E0197]: inherent impls cannot be unsafe --> $DIR/E0197.rs:3:1 | -LL | unsafe impl Foo { } //~ ERROR E0197 +LL | unsafe impl Foo { } | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0198.stderr b/src/test/ui/error-codes/E0198.stderr index e182cbd2ec15..0d3706336a9c 100644 --- a/src/test/ui/error-codes/E0198.stderr +++ b/src/test/ui/error-codes/E0198.stderr @@ -1,7 +1,7 @@ error[E0198]: negative impls cannot be unsafe --> $DIR/E0198.rs:5:1 | -LL | unsafe impl !Send for Foo { } //~ ERROR E0198 +LL | unsafe impl !Send for Foo { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0199.stderr b/src/test/ui/error-codes/E0199.stderr index ba55c4a58e47..3632d26cd32e 100644 --- a/src/test/ui/error-codes/E0199.stderr +++ b/src/test/ui/error-codes/E0199.stderr @@ -1,7 +1,7 @@ error[E0199]: implementing the trait `Bar` is not unsafe --> $DIR/E0199.rs:6:1 | -LL | unsafe impl Bar for Foo { } //~ ERROR implementing the trait `Bar` is not unsafe [E0199] +LL | unsafe impl Bar for Foo { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0200.stderr b/src/test/ui/error-codes/E0200.stderr index f6a8f32d2384..677271aad445 100644 --- a/src/test/ui/error-codes/E0200.stderr +++ b/src/test/ui/error-codes/E0200.stderr @@ -1,7 +1,7 @@ error[E0200]: the trait `Bar` requires an `unsafe impl` declaration --> $DIR/E0200.rs:5:1 | -LL | impl Bar for Foo { } //~ ERROR E0200 +LL | impl Bar for Foo { } | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0201.stderr b/src/test/ui/error-codes/E0201.stderr index 5d2f9f3e362e..89cfd4024230 100644 --- a/src/test/ui/error-codes/E0201.stderr +++ b/src/test/ui/error-codes/E0201.stderr @@ -3,7 +3,7 @@ error[E0201]: duplicate definitions with name `bar`: | LL | fn bar(&self) -> bool { self.0 > 5 } | ------------------------------------ previous definition of `bar` here -LL | fn bar() {} //~ ERROR E0201 +LL | fn bar() {} | ^^^^^^^^^^^ duplicate definition error[E0201]: duplicate definitions with name `baz`: @@ -11,7 +11,7 @@ error[E0201]: duplicate definitions with name `baz`: | LL | fn baz(&self) -> bool { true } | ------------------------------ previous definition of `baz` here -LL | fn baz(&self) -> bool { self.0 > 5 } //~ ERROR E0201 +LL | fn baz(&self) -> bool { self.0 > 5 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate definition error[E0201]: duplicate definitions with name `Quux`: @@ -20,7 +20,7 @@ error[E0201]: duplicate definitions with name `Quux`: LL | type Quux = u32; | ---------------- previous definition of `Quux` here ... -LL | type Quux = u32; //~ ERROR E0201 +LL | type Quux = u32; | ^^^^^^^^^^^^^^^^ duplicate definition error: aborting due to 3 previous errors diff --git a/src/test/ui/error-codes/E0207.stderr b/src/test/ui/error-codes/E0207.stderr index c82859a9867e..5ef51ed86926 100644 --- a/src/test/ui/error-codes/E0207.stderr +++ b/src/test/ui/error-codes/E0207.stderr @@ -1,7 +1,7 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates --> $DIR/E0207.rs:3:6 | -LL | impl Foo { //~ ERROR E0207 +LL | impl Foo { | ^ unconstrained type parameter error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0220.stderr b/src/test/ui/error-codes/E0220.stderr index 0eb812a5ef07..43949833e21d 100644 --- a/src/test/ui/error-codes/E0220.stderr +++ b/src/test/ui/error-codes/E0220.stderr @@ -1,7 +1,7 @@ error[E0220]: associated type `F` not found for `Trait` --> $DIR/E0220.rs:5:18 | -LL | type Foo = Trait; //~ ERROR E0220 +LL | type Foo = Trait; | ^^^^^ associated type `F` not found error[E0191]: the value of the associated type `Bar` (from the trait `Trait`) must be specified @@ -10,7 +10,7 @@ error[E0191]: the value of the associated type `Bar` (from the trait `Trait`) mu LL | type Bar; | --------- `Bar` defined here ... -LL | type Foo = Trait; //~ ERROR E0220 +LL | type Foo = Trait; | ^^^^^^^^^^^^ associated type `Bar` must be specified error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0252.stderr b/src/test/ui/error-codes/E0252.stderr index bd06241fc76d..8486806c6729 100644 --- a/src/test/ui/error-codes/E0252.stderr +++ b/src/test/ui/error-codes/E0252.stderr @@ -3,13 +3,13 @@ error[E0252]: the name `baz` is defined multiple times | LL | use foo::baz; | -------- previous import of the type `baz` here -LL | use bar::baz; //~ ERROR E0252 +LL | use bar::baz; | ^^^^^^^^ `baz` reimported here | = note: `baz` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use bar::baz as other_baz; //~ ERROR E0252 +LL | use bar::baz as other_baz; | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0255.stderr b/src/test/ui/error-codes/E0255.stderr index a47aa7c6592d..36e4eeeaeea7 100644 --- a/src/test/ui/error-codes/E0255.stderr +++ b/src/test/ui/error-codes/E0255.stderr @@ -4,7 +4,7 @@ error[E0255]: the name `foo` is defined multiple times LL | use bar::foo; | -------- previous import of the value `foo` here LL | -LL | fn foo() {} //~ ERROR E0255 +LL | fn foo() {} | ^^^^^^^^ `foo` redefined here | = note: `foo` must be defined only once in the value namespace of this module diff --git a/src/test/ui/error-codes/E0261.stderr b/src/test/ui/error-codes/E0261.stderr index 9e64f6c3f149..3bf5e9d81548 100644 --- a/src/test/ui/error-codes/E0261.stderr +++ b/src/test/ui/error-codes/E0261.stderr @@ -1,13 +1,13 @@ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/E0261.rs:1:12 | -LL | fn foo(x: &'a str) { } //~ ERROR E0261 +LL | fn foo(x: &'a str) { } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/E0261.rs:5:9 | -LL | x: &'a str, //~ ERROR E0261 +LL | x: &'a str, | ^^ undeclared lifetime error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0262.stderr b/src/test/ui/error-codes/E0262.stderr index 8f01889a470b..ad90b7171266 100644 --- a/src/test/ui/error-codes/E0262.stderr +++ b/src/test/ui/error-codes/E0262.stderr @@ -1,7 +1,7 @@ error[E0262]: invalid lifetime parameter name: `'static` --> $DIR/E0262.rs:1:8 | -LL | fn foo<'static>(x: &'static str) { } //~ ERROR E0262 +LL | fn foo<'static>(x: &'static str) { } | ^^^^^^^ 'static is a reserved lifetime name error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0264.stderr b/src/test/ui/error-codes/E0264.stderr index bc6a0d9f96c3..403c0aa4146c 100644 --- a/src/test/ui/error-codes/E0264.stderr +++ b/src/test/ui/error-codes/E0264.stderr @@ -1,7 +1,7 @@ error[E0264]: unknown external lang item: `cake` --> $DIR/E0264.rs:5:5 | -LL | fn cake(); //~ ERROR E0264 +LL | fn cake(); | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0267.stderr b/src/test/ui/error-codes/E0267.stderr index 3506c1c0f165..b14cfd1a52d4 100644 --- a/src/test/ui/error-codes/E0267.stderr +++ b/src/test/ui/error-codes/E0267.stderr @@ -1,7 +1,7 @@ error[E0267]: `break` inside of a closure --> $DIR/E0267.rs:2:18 | -LL | let w = || { break; }; //~ ERROR E0267 +LL | let w = || { break; }; | ^^^^^ cannot break inside of a closure error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0268.stderr b/src/test/ui/error-codes/E0268.stderr index 3e276bd1acb0..3c77e7f3df2b 100644 --- a/src/test/ui/error-codes/E0268.stderr +++ b/src/test/ui/error-codes/E0268.stderr @@ -1,7 +1,7 @@ error[E0268]: `break` outside of loop --> $DIR/E0268.rs:2:5 | -LL | break; //~ ERROR E0268 +LL | break; | ^^^^^ cannot break outside of a loop error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0271.stderr b/src/test/ui/error-codes/E0271.stderr index 8fcb68e434f8..16c3ab9d7425 100644 --- a/src/test/ui/error-codes/E0271.stderr +++ b/src/test/ui/error-codes/E0271.stderr @@ -1,7 +1,7 @@ error[E0271]: type mismatch resolving `::AssociatedType == u32` --> $DIR/E0271.rs:10:5 | -LL | foo(3_i8); //~ ERROR E0271 +LL | foo(3_i8); | ^^^ expected reference, found u32 | = note: expected type `&'static str` diff --git a/src/test/ui/error-codes/E0275.stderr b/src/test/ui/error-codes/E0275.stderr index f2b0f392bc8b..01a923a53a2b 100644 --- a/src/test/ui/error-codes/E0275.stderr +++ b/src/test/ui/error-codes/E0275.stderr @@ -1,7 +1,7 @@ error[E0275]: overflow evaluating the requirement `Bar>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` --> $DIR/E0275.rs:5:1 | -LL | impl Foo for T where Bar: Foo {} //~ ERROR E0275 +LL | impl Foo for T where Bar: Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider adding a `#![recursion_limit="128"]` attribute to your crate diff --git a/src/test/ui/error-codes/E0276.stderr b/src/test/ui/error-codes/E0276.stderr index 393ad8c81a07..a8b016ebf52a 100644 --- a/src/test/ui/error-codes/E0276.stderr +++ b/src/test/ui/error-codes/E0276.stderr @@ -4,7 +4,7 @@ error[E0276]: impl has stricter requirements than trait LL | fn foo(x: T); | ---------------- definition of `foo` from trait ... -LL | fn foo(x: T) where T: Copy {} //~ ERROR E0276 +LL | fn foo(x: T) where T: Copy {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `T: std::marker::Copy` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0282.stderr b/src/test/ui/error-codes/E0282.stderr index 49165d1e42bb..3a5040eb6daa 100644 --- a/src/test/ui/error-codes/E0282.stderr +++ b/src/test/ui/error-codes/E0282.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/E0282.rs:2:9 | -LL | let x = "hello".chars().rev().collect(); //~ ERROR E0282 +LL | let x = "hello".chars().rev().collect(); | ^ | | | cannot infer type diff --git a/src/test/ui/error-codes/E0283.stderr b/src/test/ui/error-codes/E0283.stderr index 598ec672ce63..e1f53e592fc8 100644 --- a/src/test/ui/error-codes/E0283.stderr +++ b/src/test/ui/error-codes/E0283.stderr @@ -1,7 +1,7 @@ error[E0283]: type annotations required: cannot resolve `_: Generator` --> $DIR/E0283.rs:18:21 | -LL | let cont: u32 = Generator::create(); //~ ERROR E0283 +LL | let cont: u32 = Generator::create(); | ^^^^^^^^^^^^^^^^^ | note: required by `Generator::create` diff --git a/src/test/ui/error-codes/E0301.nll.stderr b/src/test/ui/error-codes/E0301.nll.stderr index 898c30a75b28..24234c9929e4 100644 --- a/src/test/ui/error-codes/E0301.nll.stderr +++ b/src/test/ui/error-codes/E0301.nll.stderr @@ -1,7 +1,7 @@ error[E0301]: cannot mutably borrow in a pattern guard --> $DIR/E0301.rs:4:19 | -LL | option if option.take().is_none() => {}, //~ ERROR E0301 +LL | option if option.take().is_none() => {}, | ^^^^^^ borrowed mutably in pattern guard | = help: add #![feature(bind_by_move_pattern_guards)] to the crate attributes to enable diff --git a/src/test/ui/error-codes/E0301.stderr b/src/test/ui/error-codes/E0301.stderr index 3cfacd5983f0..80ee681a5179 100644 --- a/src/test/ui/error-codes/E0301.stderr +++ b/src/test/ui/error-codes/E0301.stderr @@ -1,7 +1,7 @@ error[E0301]: cannot mutably borrow in a pattern guard --> $DIR/E0301.rs:4:19 | -LL | option if option.take().is_none() => {}, //~ ERROR E0301 +LL | option if option.take().is_none() => {}, | ^^^^^^ borrowed mutably in pattern guard error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0302.stderr b/src/test/ui/error-codes/E0302.stderr index 66b31361762d..69ebb6bb9c9f 100644 --- a/src/test/ui/error-codes/E0302.stderr +++ b/src/test/ui/error-codes/E0302.stderr @@ -1,7 +1,7 @@ error[E0302]: cannot assign in a pattern guard --> $DIR/E0302.rs:4:21 | -LL | option if { option = None; false } => { }, //~ ERROR E0302 +LL | option if { option = None; false } => { }, | ^^^^^^^^^^^^^ assignment in pattern guard error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0308-4.stderr b/src/test/ui/error-codes/E0308-4.stderr index f69a38933659..3c51106cae8c 100644 --- a/src/test/ui/error-codes/E0308-4.stderr +++ b/src/test/ui/error-codes/E0308-4.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | match x { | - this match expression has type `u8` -LL | 0u8..=3i8 => (), //~ ERROR E0308 +LL | 0u8..=3i8 => (), | ^^^^^^^^^ expected u8, found i8 error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0308.stderr b/src/test/ui/error-codes/E0308.stderr index 8c71747fbcdf..bd9834ceb9fe 100644 --- a/src/test/ui/error-codes/E0308.stderr +++ b/src/test/ui/error-codes/E0308.stderr @@ -1,7 +1,7 @@ error[E0308]: intrinsic has wrong type --> $DIR/E0308.rs:4:5 | -LL | fn size_of(); //~ ERROR E0308 +LL | fn size_of(); | ^^^^^^^^^^^^^^^^ expected (), found usize | = note: expected type `extern "rust-intrinsic" fn()` diff --git a/src/test/ui/error-codes/E0370.stderr b/src/test/ui/error-codes/E0370.stderr index cd1903bd7e26..7fb622ee80bb 100644 --- a/src/test/ui/error-codes/E0370.stderr +++ b/src/test/ui/error-codes/E0370.stderr @@ -1,7 +1,7 @@ error[E0370]: enum discriminant overflowed --> $DIR/E0370.rs:7:5 | -LL | Y, //~ ERROR E0370 +LL | Y, | ^ overflowed on value after 9223372036854775807 | = note: explicitly set `Y = -9223372036854775808` if that is desired outcome diff --git a/src/test/ui/error-codes/E0374.stderr b/src/test/ui/error-codes/E0374.stderr index 9226ca0e478d..7ab0f82fc236 100644 --- a/src/test/ui/error-codes/E0374.stderr +++ b/src/test/ui/error-codes/E0374.stderr @@ -1,7 +1,7 @@ error[E0374]: the trait `CoerceUnsized` may only be implemented for a coercion between structures with one field being coerced, none found --> $DIR/E0374.rs:8:1 | -LL | / impl CoerceUnsized> for Foo //~ ERROR E0374 +LL | / impl CoerceUnsized> for Foo LL | | where T: CoerceUnsized {} | |________________________________^ diff --git a/src/test/ui/error-codes/E0376.stderr b/src/test/ui/error-codes/E0376.stderr index 2894a9196320..015448c39eaa 100644 --- a/src/test/ui/error-codes/E0376.stderr +++ b/src/test/ui/error-codes/E0376.stderr @@ -1,7 +1,7 @@ error[E0376]: the trait `CoerceUnsized` may only be implemented for a coercion between structures --> $DIR/E0376.rs:8:1 | -LL | impl CoerceUnsized for Foo {} //~ ERROR E0376 +LL | impl CoerceUnsized for Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0388.nll.stderr b/src/test/ui/error-codes/E0388.nll.stderr index a898d60a9859..0fc8a76820cf 100644 --- a/src/test/ui/error-codes/E0388.nll.stderr +++ b/src/test/ui/error-codes/E0388.nll.stderr @@ -1,31 +1,31 @@ error[E0017]: references in constants may only refer to immutable values --> $DIR/E0388.rs:4:30 | -LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017 +LL | const CR: &'static mut i32 = &mut C; | ^^^^^^ constants require immutable values error[E0017]: references in statics may only refer to immutable values --> $DIR/E0388.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ statics require immutable values error: cannot mutate statics in the initializer of another static --> $DIR/E0388.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ error[E0596]: cannot borrow immutable static item `X` as mutable --> $DIR/E0388.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ cannot borrow as mutable error[E0017]: references in statics may only refer to immutable values --> $DIR/E0388.rs:8:38 | -LL | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 +LL | static CONST_REF: &'static mut i32 = &mut C; | ^^^^^^ statics require immutable values error: aborting due to 5 previous errors diff --git a/src/test/ui/error-codes/E0388.stderr b/src/test/ui/error-codes/E0388.stderr index f641830ae9ff..3f662459c841 100644 --- a/src/test/ui/error-codes/E0388.stderr +++ b/src/test/ui/error-codes/E0388.stderr @@ -1,31 +1,31 @@ error[E0017]: references in constants may only refer to immutable values --> $DIR/E0388.rs:4:30 | -LL | const CR: &'static mut i32 = &mut C; //~ ERROR E0017 +LL | const CR: &'static mut i32 = &mut C; | ^^^^^^ constants require immutable values error[E0017]: references in statics may only refer to immutable values --> $DIR/E0388.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ statics require immutable values error: cannot mutate statics in the initializer of another static --> $DIR/E0388.rs:5:39 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^^^^^^ error[E0596]: cannot borrow immutable static item as mutable --> $DIR/E0388.rs:5:44 | -LL | static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 +LL | static STATIC_REF: &'static mut i32 = &mut X; | ^ error[E0017]: references in statics may only refer to immutable values --> $DIR/E0388.rs:8:38 | -LL | static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 +LL | static CONST_REF: &'static mut i32 = &mut C; | ^^^^^^ statics require immutable values error: aborting due to 5 previous errors diff --git a/src/test/ui/error-codes/E0389.nll.stderr b/src/test/ui/error-codes/E0389.nll.stderr index 13d2f8cfaa59..c47750b6f4e6 100644 --- a/src/test/ui/error-codes/E0389.nll.stderr +++ b/src/test/ui/error-codes/E0389.nll.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `fancy_ref.num` which is behind a `&` reference | LL | let fancy_ref = &(&mut fancy); | ------------- help: consider changing this to be a mutable reference: `&mut (&mut fancy)` -LL | fancy_ref.num = 6; //~ ERROR E0389 +LL | fancy_ref.num = 6; | ^^^^^^^^^^^^^^^^^ `fancy_ref` is a `&` reference, so the data it refers to cannot be written error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0389.stderr b/src/test/ui/error-codes/E0389.stderr index cc8914ef3a6f..927eace727ee 100644 --- a/src/test/ui/error-codes/E0389.stderr +++ b/src/test/ui/error-codes/E0389.stderr @@ -1,7 +1,7 @@ error[E0389]: cannot assign to data in a `&` reference --> $DIR/E0389.rs:8:5 | -LL | fancy_ref.num = 6; //~ ERROR E0389 +LL | fancy_ref.num = 6; | ^^^^^^^^^^^^^^^^^ assignment into an immutable reference error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0390.stderr b/src/test/ui/error-codes/E0390.stderr index 7632229360ee..3ca3a77c74fb 100644 --- a/src/test/ui/error-codes/E0390.stderr +++ b/src/test/ui/error-codes/E0390.stderr @@ -1,13 +1,13 @@ error[E0390]: only a single inherent implementation marked with `#[lang = "mut_ptr"]` is allowed for the `*mut T` primitive --> $DIR/E0390.rs:5:1 | -LL | impl *mut Foo {} //~ ERROR E0390 +LL | impl *mut Foo {} | ^^^^^^^^^^^^^^^^ | help: consider using a trait to implement these methods --> $DIR/E0390.rs:5:1 | -LL | impl *mut Foo {} //~ ERROR E0390 +LL | impl *mut Foo {} | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0392.stderr b/src/test/ui/error-codes/E0392.stderr index 4bb3b87bb4a2..18419572233e 100644 --- a/src/test/ui/error-codes/E0392.stderr +++ b/src/test/ui/error-codes/E0392.stderr @@ -1,7 +1,7 @@ error[E0392]: parameter `T` is never used --> $DIR/E0392.rs:1:10 | -LL | enum Foo { Bar } //~ ERROR E0392 +LL | enum Foo { Bar } | ^ unused type parameter | = help: consider removing `T` or using a marker such as `std::marker::PhantomData` diff --git a/src/test/ui/error-codes/E0395.stderr b/src/test/ui/error-codes/E0395.stderr index cc7d94e22eb6..9d80acb515d5 100644 --- a/src/test/ui/error-codes/E0395.stderr +++ b/src/test/ui/error-codes/E0395.stderr @@ -1,7 +1,7 @@ error[E0658]: comparing raw pointers inside static (see issue #53020) --> $DIR/E0395.rs:6:29 | -LL | static BAZ: bool = unsafe { (&FOO as *const i32) == (&BAR as *const i32) }; //~ ERROR issue #53020 +LL | static BAZ: bool = unsafe { (&FOO as *const i32) == (&BAR as *const i32) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_compare_raw_pointers)] to the crate attributes to enable diff --git a/src/test/ui/error-codes/E0401.stderr b/src/test/ui/error-codes/E0401.stderr index 27f281ee4378..7c54e5b4edba 100644 --- a/src/test/ui/error-codes/E0401.stderr +++ b/src/test/ui/error-codes/E0401.stderr @@ -3,7 +3,7 @@ error[E0401]: can't use generic parameters from outer function | LL | fn foo(x: T) { | - type variable from outer function -LL | fn bfnr, W: Fn()>(y: T) { //~ ERROR E0401 +LL | fn bfnr, W: Fn()>(y: T) { | --------------------------- ^ use of generic parameter from outer function | | | help: try using a local generic parameter instead: `bfnr, W: Fn(), T>` @@ -17,7 +17,7 @@ LL | fn foo(x: T) { LL | fn baz Iterator for A { | ---- `Self` type implicitly declared here, by this `impl` ... -LL | fn helper(sel: &Self) -> u8 { //~ ERROR E0401 +LL | fn helper(sel: &Self) -> u8 { | ^^^^ | | | use of generic parameter from outer function diff --git a/src/test/ui/error-codes/E0403.stderr b/src/test/ui/error-codes/E0403.stderr index b92464750296..2bd7de6c2461 100644 --- a/src/test/ui/error-codes/E0403.stderr +++ b/src/test/ui/error-codes/E0403.stderr @@ -1,7 +1,7 @@ error[E0403]: the name `T` is already used for a generic parameter in this list of generic parameters --> $DIR/E0403.rs:1:11 | -LL | fn foo(s: T, u: T) {} //~ ERROR E0403 +LL | fn foo(s: T, u: T) {} | - ^ already used | | | first use of `T` diff --git a/src/test/ui/error-codes/E0404.stderr b/src/test/ui/error-codes/E0404.stderr index f84fd52c851a..4ccb6c5728e8 100644 --- a/src/test/ui/error-codes/E0404.stderr +++ b/src/test/ui/error-codes/E0404.stderr @@ -1,13 +1,13 @@ error[E0404]: expected trait, found struct `Foo` --> $DIR/E0404.rs:4:6 | -LL | impl Foo for Bar {} //~ ERROR E0404 +LL | impl Foo for Bar {} | ^^^ not a trait error[E0404]: expected trait, found struct `Foo` --> $DIR/E0404.rs:8:11 | -LL | fn baz(_: T) {} //~ ERROR E0404 +LL | fn baz(_: T) {} | ^^^ not a trait error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0405.stderr b/src/test/ui/error-codes/E0405.stderr index 2f09a525e450..a22afe6f3e8c 100644 --- a/src/test/ui/error-codes/E0405.stderr +++ b/src/test/ui/error-codes/E0405.stderr @@ -1,7 +1,7 @@ error[E0405]: cannot find trait `SomeTrait` in this scope --> $DIR/E0405.rs:3:6 | -LL | impl SomeTrait for Foo {} //~ ERROR E0405 +LL | impl SomeTrait for Foo {} | ^^^^^^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0408.stderr b/src/test/ui/error-codes/E0408.stderr index dc0a41e6eb0f..132a9432254f 100644 --- a/src/test/ui/error-codes/E0408.stderr +++ b/src/test/ui/error-codes/E0408.stderr @@ -1,7 +1,7 @@ error[E0408]: variable `y` is not bound in all patterns --> $DIR/E0408.rs:5:19 | -LL | Some(y) | None => {} //~ ERROR variable `y` is not bound in all patterns +LL | Some(y) | None => {} | - ^^^^ pattern doesn't bind `y` | | | variable not in all patterns diff --git a/src/test/ui/error-codes/E0411.stderr b/src/test/ui/error-codes/E0411.stderr index fe78d8d957ea..c1c25e835c14 100644 --- a/src/test/ui/error-codes/E0411.stderr +++ b/src/test/ui/error-codes/E0411.stderr @@ -1,7 +1,7 @@ error[E0411]: cannot find type `Self` in this scope --> $DIR/E0411.rs:2:6 | -LL | ::foo; //~ ERROR E0411 +LL | ::foo; | ^^^^ `Self` is only available in impls, traits, and type definitions error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0412.stderr b/src/test/ui/error-codes/E0412.stderr index 68d636ffae0b..7bdaa1807307 100644 --- a/src/test/ui/error-codes/E0412.stderr +++ b/src/test/ui/error-codes/E0412.stderr @@ -1,7 +1,7 @@ error[E0412]: cannot find type `Something` in this scope --> $DIR/E0412.rs:1:6 | -LL | impl Something {} //~ ERROR E0412 +LL | impl Something {} | ^^^^^^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0415.stderr b/src/test/ui/error-codes/E0415.stderr index 6e848f9bfd39..c2b8fdc7c558 100644 --- a/src/test/ui/error-codes/E0415.stderr +++ b/src/test/ui/error-codes/E0415.stderr @@ -1,7 +1,7 @@ error[E0415]: identifier `f` is bound more than once in this parameter list --> $DIR/E0415.rs:1:16 | -LL | fn foo(f: i32, f: i32) {} //~ ERROR E0415 +LL | fn foo(f: i32, f: i32) {} | ^ used as parameter more than once error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0416.stderr b/src/test/ui/error-codes/E0416.stderr index 4baf5006cf40..78acac5c6617 100644 --- a/src/test/ui/error-codes/E0416.stderr +++ b/src/test/ui/error-codes/E0416.stderr @@ -1,7 +1,7 @@ error[E0416]: identifier `x` is bound more than once in the same pattern --> $DIR/E0416.rs:3:13 | -LL | (x, x) => {} //~ ERROR E0416 +LL | (x, x) => {} | ^ used in a pattern more than once error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0423.stderr b/src/test/ui/error-codes/E0423.stderr index d0deb8ce7ea2..bdcfaae60a01 100644 --- a/src/test/ui/error-codes/E0423.stderr +++ b/src/test/ui/error-codes/E0423.stderr @@ -19,7 +19,7 @@ LL | for _ in std::ops::Range { start: 0, end: 10 } {} error[E0423]: expected function, found struct `Foo` --> $DIR/E0423.rs:4:13 | -LL | let f = Foo(); //~ ERROR E0423 +LL | let f = Foo(); | ^^^ | | | did you mean `Foo { /* fields */ }`? diff --git a/src/test/ui/error-codes/E0424.stderr b/src/test/ui/error-codes/E0424.stderr index b91f061db345..d67a2660dac3 100644 --- a/src/test/ui/error-codes/E0424.stderr +++ b/src/test/ui/error-codes/E0424.stderr @@ -1,13 +1,13 @@ error[E0424]: expected value, found module `self` --> $DIR/E0424.rs:7:9 | -LL | self.bar(); //~ ERROR E0424 +LL | self.bar(); | ^^^^ `self` value is a keyword only available in methods with `self` parameter error[E0424]: expected unit struct/variant or constant, found module `self` --> $DIR/E0424.rs:12:9 | -LL | let self = "self"; //~ ERROR E0424 +LL | let self = "self"; | ^^^^ `self` value is a keyword and may not be bound to variables or shadowed error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0425.stderr b/src/test/ui/error-codes/E0425.stderr index 391027a51840..9ef4608da7da 100644 --- a/src/test/ui/error-codes/E0425.stderr +++ b/src/test/ui/error-codes/E0425.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `elf` in this scope --> $DIR/E0425.rs:3:9 | -LL | elf; //~ ERROR E0425 +LL | elf; | ^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0428.stderr b/src/test/ui/error-codes/E0428.stderr index 2154cb0ead28..205bcf342f1a 100644 --- a/src/test/ui/error-codes/E0428.stderr +++ b/src/test/ui/error-codes/E0428.stderr @@ -1,9 +1,9 @@ error[E0428]: the name `Bar` is defined multiple times --> $DIR/E0428.rs:2:1 | -LL | struct Bar; //~ previous definition of the type `Bar` here +LL | struct Bar; | ----------- previous definition of the type `Bar` here -LL | struct Bar; //~ ERROR E0428 +LL | struct Bar; | ^^^^^^^^^^^ `Bar` redefined here | = note: `Bar` must be defined only once in the type namespace of this module diff --git a/src/test/ui/error-codes/E0429.stderr b/src/test/ui/error-codes/E0429.stderr index 13cdb0d8861f..b5f76a1fcd84 100644 --- a/src/test/ui/error-codes/E0429.stderr +++ b/src/test/ui/error-codes/E0429.stderr @@ -1,7 +1,7 @@ error[E0429]: `self` imports are only allowed within a { } list --> $DIR/E0429.rs:1:5 | -LL | use std::fmt::self; //~ ERROR E0429 +LL | use std::fmt::self; | ^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0430.stderr b/src/test/ui/error-codes/E0430.stderr index 78e4e43ac2f3..9f8b053de2ca 100644 --- a/src/test/ui/error-codes/E0430.stderr +++ b/src/test/ui/error-codes/E0430.stderr @@ -1,7 +1,7 @@ error[E0430]: `self` import can only appear once in an import list --> $DIR/E0430.rs:1:16 | -LL | use std::fmt::{self, self}; //~ ERROR E0430 +LL | use std::fmt::{self, self}; | ^^^^ ---- another `self` import appears here | | | can only appear once in an import list @@ -9,7 +9,7 @@ LL | use std::fmt::{self, self}; //~ ERROR E0430 error[E0252]: the name `fmt` is defined multiple times --> $DIR/E0430.rs:1:22 | -LL | use std::fmt::{self, self}; //~ ERROR E0430 +LL | use std::fmt::{self, self}; | ------^^^^ | | | | | | | `fmt` reimported here diff --git a/src/test/ui/error-codes/E0431.stderr b/src/test/ui/error-codes/E0431.stderr index 240e6bd4a829..adfd2d923c78 100644 --- a/src/test/ui/error-codes/E0431.stderr +++ b/src/test/ui/error-codes/E0431.stderr @@ -1,7 +1,7 @@ error[E0431]: `self` import can only appear in an import list with a non-empty prefix --> $DIR/E0431.rs:1:6 | -LL | use {self}; //~ ERROR E0431 +LL | use {self}; | ^^^^ can only appear in an import list with a non-empty prefix error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0432.stderr b/src/test/ui/error-codes/E0432.stderr index bb6b31242cb5..137a1af6f95b 100644 --- a/src/test/ui/error-codes/E0432.stderr +++ b/src/test/ui/error-codes/E0432.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `something` --> $DIR/E0432.rs:1:5 | -LL | use something::Foo; //~ ERROR E0432 +LL | use something::Foo; | ^^^^^^^^^ maybe a missing `extern crate something;`? error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0433.stderr b/src/test/ui/error-codes/E0433.stderr index 7fbb7fa0413b..d852e1883844 100644 --- a/src/test/ui/error-codes/E0433.stderr +++ b/src/test/ui/error-codes/E0433.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: use of undeclared type or module `HashMap` --> $DIR/E0433.rs:2:15 | -LL | let map = HashMap::new(); //~ ERROR E0433 +LL | let map = HashMap::new(); | ^^^^^^^ use of undeclared type or module `HashMap` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0434.stderr b/src/test/ui/error-codes/E0434.stderr index 0e2bc701b7fb..14508ccbc9a7 100644 --- a/src/test/ui/error-codes/E0434.stderr +++ b/src/test/ui/error-codes/E0434.stderr @@ -1,7 +1,7 @@ error[E0434]: can't capture dynamic environment in a fn item --> $DIR/E0434.rs:4:9 | -LL | y //~ ERROR E0434 +LL | y | ^ | = help: use the `|| { ... }` closure form instead diff --git a/src/test/ui/error-codes/E0435.stderr b/src/test/ui/error-codes/E0435.stderr index 09c9d19e1140..349aa0d07c5d 100644 --- a/src/test/ui/error-codes/E0435.stderr +++ b/src/test/ui/error-codes/E0435.stderr @@ -1,7 +1,7 @@ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/E0435.rs:3:17 | -LL | let _: [u8; foo]; //~ ERROR E0435 +LL | let _: [u8; foo]; | ^^^ non-constant value error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0437.stderr b/src/test/ui/error-codes/E0437.stderr index 9470cbf176ae..217b164036f8 100644 --- a/src/test/ui/error-codes/E0437.stderr +++ b/src/test/ui/error-codes/E0437.stderr @@ -1,7 +1,7 @@ error[E0437]: type `Bar` is not a member of trait `Foo` --> $DIR/E0437.rs:4:5 | -LL | type Bar = bool; //~ ERROR E0437 +LL | type Bar = bool; | ^^^^^^^^^^^^^^^^ not a member of trait `Foo` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0438.stderr b/src/test/ui/error-codes/E0438.stderr index 6a11577bb0f3..853f0c3c2399 100644 --- a/src/test/ui/error-codes/E0438.stderr +++ b/src/test/ui/error-codes/E0438.stderr @@ -1,7 +1,7 @@ error[E0438]: const `BAR` is not a member of trait `Bar` --> $DIR/E0438.rs:4:5 | -LL | const BAR: bool = true; //~ ERROR E0438 +LL | const BAR: bool = true; | ^^^^^^^^^^^^^^^^^^^^^^^ not a member of trait `Bar` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0439.stderr b/src/test/ui/error-codes/E0439.stderr index e3b8fbfb2536..8021f7d3951a 100644 --- a/src/test/ui/error-codes/E0439.stderr +++ b/src/test/ui/error-codes/E0439.stderr @@ -1,7 +1,7 @@ error[E0439]: invalid `simd_shuffle`, needs length: `simd_shuffle` --> $DIR/E0439.rs:4:5 | -LL | fn simd_shuffle(a: A, b: A, c: [u32; 8]) -> B; //~ ERROR E0439 +LL | fn simd_shuffle(a: A, b: A, c: [u32; 8]) -> B; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0446.stderr b/src/test/ui/error-codes/E0446.stderr index 9c7399515f43..a0f5f7079b34 100644 --- a/src/test/ui/error-codes/E0446.stderr +++ b/src/test/ui/error-codes/E0446.stderr @@ -4,7 +4,7 @@ error[E0446]: private type `foo::Bar` in public interface LL | struct Bar(u32); | - `foo::Bar` declared as private LL | -LL | / pub fn bar() -> Bar { //~ ERROR E0446 +LL | / pub fn bar() -> Bar { LL | | Bar(0) LL | | } | |_____^ can't leak private type diff --git a/src/test/ui/error-codes/E0449.stderr b/src/test/ui/error-codes/E0449.stderr index d623c8abbd92..8221a5e0ad67 100644 --- a/src/test/ui/error-codes/E0449.stderr +++ b/src/test/ui/error-codes/E0449.stderr @@ -1,7 +1,7 @@ error[E0449]: unnecessary visibility qualifier --> $DIR/E0449.rs:7:1 | -LL | pub impl Bar {} //~ ERROR E0449 +LL | pub impl Bar {} | ^^^ `pub` not permitted here because it's implied | = note: place qualifiers on individual impl items instead @@ -9,13 +9,13 @@ LL | pub impl Bar {} //~ ERROR E0449 error[E0449]: unnecessary visibility qualifier --> $DIR/E0449.rs:9:1 | -LL | pub impl Foo for Bar { //~ ERROR E0449 +LL | pub impl Foo for Bar { | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/E0449.rs:10:5 | -LL | pub fn foo() {} //~ ERROR E0449 +LL | pub fn foo() {} | ^^^ `pub` not permitted here because it's implied error: aborting due to 3 previous errors diff --git a/src/test/ui/error-codes/E0451.stderr b/src/test/ui/error-codes/E0451.stderr index 11f086772462..655f3a98d7f0 100644 --- a/src/test/ui/error-codes/E0451.stderr +++ b/src/test/ui/error-codes/E0451.stderr @@ -1,13 +1,13 @@ error[E0451]: field `b` of struct `bar::Foo` is private --> $DIR/E0451.rs:14:21 | -LL | let bar::Foo{a, b} = foo; //~ ERROR E0451 +LL | let bar::Foo{a, b} = foo; | ^ field `b` is private error[E0451]: field `b` of struct `bar::Foo` is private --> $DIR/E0451.rs:18:29 | -LL | let f = bar::Foo{ a: 0, b: 0 }; //~ ERROR E0451 +LL | let f = bar::Foo{ a: 0, b: 0 }; | ^^^^ field `b` is private error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0452.stderr b/src/test/ui/error-codes/E0452.stderr index 62f268cd432b..7c3093309f9e 100644 --- a/src/test/ui/error-codes/E0452.stderr +++ b/src/test/ui/error-codes/E0452.stderr @@ -1,7 +1,7 @@ error[E0452]: malformed lint attribute --> $DIR/E0452.rs:1:10 | -LL | #![allow(foo = "")] //~ ERROR E0452 +LL | #![allow(foo = "")] | ^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0458.stderr b/src/test/ui/error-codes/E0458.stderr index 8b071e0b315e..9cfe7cccac1a 100644 --- a/src/test/ui/error-codes/E0458.stderr +++ b/src/test/ui/error-codes/E0458.stderr @@ -1,7 +1,7 @@ error[E0458]: unknown kind: `wonderful_unicorn` --> $DIR/E0458.rs:1:1 | -LL | #[link(kind = "wonderful_unicorn")] extern {} //~ ERROR E0458 +LL | #[link(kind = "wonderful_unicorn")] extern {} | ^^^^^^^--------------------------^^ | | | unknown kind @@ -9,7 +9,7 @@ LL | #[link(kind = "wonderful_unicorn")] extern {} //~ ERROR E0458 error[E0459]: #[link(...)] specified without `name = "foo"` --> $DIR/E0458.rs:1:1 | -LL | #[link(kind = "wonderful_unicorn")] extern {} //~ ERROR E0458 +LL | #[link(kind = "wonderful_unicorn")] extern {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `name` argument error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0459.stderr b/src/test/ui/error-codes/E0459.stderr index d3591cd5f606..da7069fbb477 100644 --- a/src/test/ui/error-codes/E0459.stderr +++ b/src/test/ui/error-codes/E0459.stderr @@ -1,7 +1,7 @@ error[E0459]: #[link(...)] specified without `name = "foo"` --> $DIR/E0459.rs:1:1 | -LL | #[link(kind = "dylib")] extern {} //~ ERROR E0459 +LL | #[link(kind = "dylib")] extern {} | ^^^^^^^^^^^^^^^^^^^^^^^ missing `name` argument error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0478.stderr b/src/test/ui/error-codes/E0478.stderr index 5147bf245599..71e490364d7a 100644 --- a/src/test/ui/error-codes/E0478.stderr +++ b/src/test/ui/error-codes/E0478.stderr @@ -1,7 +1,7 @@ error[E0478]: lifetime bound not satisfied --> $DIR/E0478.rs:4:5 | -LL | child: Box + 'SnowWhite>, //~ ERROR E0478 +LL | child: Box + 'SnowWhite>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime 'SnowWhite as defined on the struct at 3:22 diff --git a/src/test/ui/error-codes/E0492.stderr b/src/test/ui/error-codes/E0492.stderr index b73db6c975ea..5f337dd7f422 100644 --- a/src/test/ui/error-codes/E0492.stderr +++ b/src/test/ui/error-codes/E0492.stderr @@ -1,7 +1,7 @@ error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead --> $DIR/E0492.rs:4:34 | -LL | static B: &'static AtomicUsize = &A; //~ ERROR E0492 +LL | static B: &'static AtomicUsize = &A; | ^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0496.stderr b/src/test/ui/error-codes/E0496.stderr index 515d71ba05ec..b0294eef04ef 100644 --- a/src/test/ui/error-codes/E0496.stderr +++ b/src/test/ui/error-codes/E0496.stderr @@ -3,7 +3,7 @@ error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scop | LL | impl<'a> Foo<'a> { | -- first declared here -LL | fn f<'a>(x: &'a i32) { //~ ERROR E0496 +LL | fn f<'a>(x: &'a i32) { | ^^ lifetime 'a already in scope error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0499.nll.stderr b/src/test/ui/error-codes/E0499.nll.stderr index c1acef10e6e6..d56baf722720 100644 --- a/src/test/ui/error-codes/E0499.nll.stderr +++ b/src/test/ui/error-codes/E0499.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `i` as mutable more than once at a time | LL | let mut x = &mut i; | ------ first mutable borrow occurs here -LL | let mut a = &mut i; //~ ERROR E0499 +LL | let mut a = &mut i; | ^^^^^^ second mutable borrow occurs here LL | a.use_mut(); LL | x.use_mut(); diff --git a/src/test/ui/error-codes/E0499.stderr b/src/test/ui/error-codes/E0499.stderr index 92157e4eba6c..82270162b38c 100644 --- a/src/test/ui/error-codes/E0499.stderr +++ b/src/test/ui/error-codes/E0499.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `i` as mutable more than once at a time | LL | let mut x = &mut i; | - first mutable borrow occurs here -LL | let mut a = &mut i; //~ ERROR E0499 +LL | let mut a = &mut i; | ^ second mutable borrow occurs here ... LL | } diff --git a/src/test/ui/error-codes/E0502.nll.stderr b/src/test/ui/error-codes/E0502.nll.stderr index 64ca8f0e6b9a..cade6d71852f 100644 --- a/src/test/ui/error-codes/E0502.nll.stderr +++ b/src/test/ui/error-codes/E0502.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*a` as mutable because it is also borrowed as immut | LL | let ref y = a; | ----- immutable borrow occurs here -LL | bar(a); //~ ERROR E0502 +LL | bar(a); | ^^^^^^ mutable borrow occurs here LL | y.use_ref(); | - immutable borrow later used here diff --git a/src/test/ui/error-codes/E0502.stderr b/src/test/ui/error-codes/E0502.stderr index 9193886b0096..26a2c3bf3534 100644 --- a/src/test/ui/error-codes/E0502.stderr +++ b/src/test/ui/error-codes/E0502.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*a` as mutable because `a` is also borrowed as immu | LL | let ref y = a; | ----- immutable borrow occurs here -LL | bar(a); //~ ERROR E0502 +LL | bar(a); | ^ mutable borrow occurs here LL | y.use_ref(); LL | } diff --git a/src/test/ui/error-codes/E0503.nll.stderr b/src/test/ui/error-codes/E0503.nll.stderr index 7b483a5eaa58..106dda2bc226 100644 --- a/src/test/ui/error-codes/E0503.nll.stderr +++ b/src/test/ui/error-codes/E0503.nll.stderr @@ -3,7 +3,7 @@ error[E0503]: cannot use `value` because it was mutably borrowed | LL | let _borrow = &mut value; | ---------- borrow of `value` occurs here -LL | let _sum = value + 1; //~ ERROR E0503 +LL | let _sum = value + 1; | ^^^^^ use of borrowed `value` LL | _borrow.use_mut(); | ------- borrow later used here diff --git a/src/test/ui/error-codes/E0503.stderr b/src/test/ui/error-codes/E0503.stderr index 83391146b602..62cb3afca783 100644 --- a/src/test/ui/error-codes/E0503.stderr +++ b/src/test/ui/error-codes/E0503.stderr @@ -3,7 +3,7 @@ error[E0503]: cannot use `value` because it was mutably borrowed | LL | let _borrow = &mut value; | ----- borrow of `value` occurs here -LL | let _sum = value + 1; //~ ERROR E0503 +LL | let _sum = value + 1; | ^^^^^ use of borrowed `value` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0504.nll.stderr b/src/test/ui/error-codes/E0504.nll.stderr index 8d7387e86e52..1f2a0407a396 100644 --- a/src/test/ui/error-codes/E0504.nll.stderr +++ b/src/test/ui/error-codes/E0504.nll.stderr @@ -6,7 +6,7 @@ LL | let fancy_ref = &fancy_num; LL | LL | let x = move || { | ^^^^^^^ move out of `fancy_num` occurs here -LL | println!("child function: {}", fancy_num.num); //~ ERROR E0504 +LL | println!("child function: {}", fancy_num.num); | --------- move occurs due to use in closure ... LL | println!("main function: {}", fancy_ref.num); diff --git a/src/test/ui/error-codes/E0504.stderr b/src/test/ui/error-codes/E0504.stderr index 7f4a611c5d53..a987713a11d1 100644 --- a/src/test/ui/error-codes/E0504.stderr +++ b/src/test/ui/error-codes/E0504.stderr @@ -4,7 +4,7 @@ error[E0504]: cannot move `fancy_num` into closure because it is borrowed LL | let fancy_ref = &fancy_num; | --------- borrow of `fancy_num` occurs here ... -LL | println!("child function: {}", fancy_num.num); //~ ERROR E0504 +LL | println!("child function: {}", fancy_num.num); | ^^^^^^^^^ move into closure occurs here error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0505.nll.stderr b/src/test/ui/error-codes/E0505.nll.stderr index 181e5e33d29d..4d9d1ef121c6 100644 --- a/src/test/ui/error-codes/E0505.nll.stderr +++ b/src/test/ui/error-codes/E0505.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | let _ref_to_val: &Value = &x; | -- borrow of `x` occurs here -LL | eat(x); //~ ERROR E0505 +LL | eat(x); | ^ move out of `x` occurs here LL | _ref_to_val.use_ref(); | ----------- borrow later used here diff --git a/src/test/ui/error-codes/E0505.stderr b/src/test/ui/error-codes/E0505.stderr index 268eb8801922..28dfb25986fd 100644 --- a/src/test/ui/error-codes/E0505.stderr +++ b/src/test/ui/error-codes/E0505.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | let _ref_to_val: &Value = &x; | - borrow of `x` occurs here -LL | eat(x); //~ ERROR E0505 +LL | eat(x); | ^ move out of `x` occurs here error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0507.stderr b/src/test/ui/error-codes/E0507.stderr index c24b8ecf61ac..1a596af1572c 100644 --- a/src/test/ui/error-codes/E0507.stderr +++ b/src/test/ui/error-codes/E0507.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/E0507.rs:12:5 | -LL | x.borrow().nothing_is_true(); //~ ERROR E0507 +LL | x.borrow().nothing_is_true(); | ^^^^^^^^^^ cannot move out of borrowed content error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0509.nll.stderr b/src/test/ui/error-codes/E0509.nll.stderr index 0233c7d6d165..e5c0cf6e24e5 100644 --- a/src/test/ui/error-codes/E0509.nll.stderr +++ b/src/test/ui/error-codes/E0509.nll.stderr @@ -1,7 +1,7 @@ error[E0509]: cannot move out of type `DropStruct`, which implements the `Drop` trait --> $DIR/E0509.rs:16:23 | -LL | let fancy_field = drop_struct.fancy; //~ ERROR E0509 +LL | let fancy_field = drop_struct.fancy; | ^^^^^^^^^^^^^^^^^ | | | cannot move out of here diff --git a/src/test/ui/error-codes/E0509.stderr b/src/test/ui/error-codes/E0509.stderr index b1f256d2d9e3..25b6d8a47d28 100644 --- a/src/test/ui/error-codes/E0509.stderr +++ b/src/test/ui/error-codes/E0509.stderr @@ -1,7 +1,7 @@ error[E0509]: cannot move out of type `DropStruct`, which implements the `Drop` trait --> $DIR/E0509.rs:16:23 | -LL | let fancy_field = drop_struct.fancy; //~ ERROR E0509 +LL | let fancy_field = drop_struct.fancy; | ^^^^^^^^^^^^^^^^^ | | | cannot move out of here diff --git a/src/test/ui/error-codes/E0511.stderr b/src/test/ui/error-codes/E0511.stderr index f1e3c0135bfb..1362a3d1f254 100644 --- a/src/test/ui/error-codes/E0511.stderr +++ b/src/test/ui/error-codes/E0511.stderr @@ -1,7 +1,7 @@ error[E0511]: invalid monomorphization of `simd_add` intrinsic: expected SIMD input type, found non-SIMD `i32` --> $DIR/E0511.rs:8:14 | -LL | unsafe { simd_add(0, 1); } //~ ERROR E0511 +LL | unsafe { simd_add(0, 1); } | ^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0512.stderr b/src/test/ui/error-codes/E0512.stderr index 998f6403f0b2..3fecce542ce9 100644 --- a/src/test/ui/error-codes/E0512.stderr +++ b/src/test/ui/error-codes/E0512.stderr @@ -1,7 +1,7 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/E0512.rs:4:23 | -LL | unsafe { takes_u8(::std::mem::transmute(0u16)); } //~ ERROR E0512 +LL | unsafe { takes_u8(::std::mem::transmute(0u16)); } | ^^^^^^^^^^^^^^^^^^^^^ | = note: source type: `u16` (16 bits) diff --git a/src/test/ui/error-codes/E0516.stderr b/src/test/ui/error-codes/E0516.stderr index 034c17933645..2e6de5053d57 100644 --- a/src/test/ui/error-codes/E0516.stderr +++ b/src/test/ui/error-codes/E0516.stderr @@ -1,7 +1,7 @@ error[E0516]: `typeof` is a reserved keyword but unimplemented --> $DIR/E0516.rs:2:12 | -LL | let x: typeof(92) = 92; //~ ERROR E0516 +LL | let x: typeof(92) = 92; | ^^^^^^^^^^ reserved keyword error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0517.stderr b/src/test/ui/error-codes/E0517.stderr index 366ab1bca63f..e256c07de267 100644 --- a/src/test/ui/error-codes/E0517.stderr +++ b/src/test/ui/error-codes/E0517.stderr @@ -1,7 +1,7 @@ error[E0517]: attribute should be applied to struct, enum or union --> $DIR/E0517.rs:1:8 | -LL | #[repr(C)] //~ ERROR: E0517 +LL | #[repr(C)] | ^ LL | type Foo = u8; | -------------- not a struct, enum or union @@ -9,7 +9,7 @@ LL | type Foo = u8; error[E0517]: attribute should be applied to struct or union --> $DIR/E0517.rs:4:8 | -LL | #[repr(packed)] //~ ERROR: E0517 +LL | #[repr(packed)] | ^^^^^^ LL | enum Foo2 {Bar, Baz} | -------------------- not a struct or union @@ -17,7 +17,7 @@ LL | enum Foo2 {Bar, Baz} error[E0517]: attribute should be applied to enum --> $DIR/E0517.rs:7:8 | -LL | #[repr(u8)] //~ ERROR: E0517 +LL | #[repr(u8)] | ^^ LL | struct Foo3 {bar: bool, baz: bool} | ---------------------------------- not an enum @@ -25,7 +25,7 @@ LL | struct Foo3 {bar: bool, baz: bool} error[E0517]: attribute should be applied to struct, enum or union --> $DIR/E0517.rs:10:8 | -LL | #[repr(C)] //~ ERROR: E0517 +LL | #[repr(C)] | ^ LL | / impl Foo3 { LL | | } diff --git a/src/test/ui/error-codes/E0518.stderr b/src/test/ui/error-codes/E0518.stderr index 6391a69c24e8..561446f8175d 100644 --- a/src/test/ui/error-codes/E0518.stderr +++ b/src/test/ui/error-codes/E0518.stderr @@ -1,7 +1,7 @@ error[E0518]: attribute should be applied to function or closure --> $DIR/E0518.rs:1:1 | -LL | #[inline(always)] //~ ERROR: E0518 +LL | #[inline(always)] | ^^^^^^^^^^^^^^^^^ LL | struct Foo; | ----------- not a function or closure @@ -9,7 +9,7 @@ LL | struct Foo; error[E0518]: attribute should be applied to function or closure --> $DIR/E0518.rs:4:1 | -LL | #[inline(never)] //~ ERROR: E0518 +LL | #[inline(never)] | ^^^^^^^^^^^^^^^^ LL | / impl Foo { LL | | } diff --git a/src/test/ui/error-codes/E0530.stderr b/src/test/ui/error-codes/E0530.stderr index 2ef80253eaf5..c312144132d3 100644 --- a/src/test/ui/error-codes/E0530.stderr +++ b/src/test/ui/error-codes/E0530.stderr @@ -4,7 +4,7 @@ error[E0530]: match bindings cannot shadow statics LL | static TEST: i32 = 0; | --------------------- the static `TEST` is defined here ... -LL | TEST => {} //~ ERROR E0530 +LL | TEST => {} | ^^^^ cannot be named the same as a static error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0534.stderr b/src/test/ui/error-codes/E0534.stderr index d2829e1643bb..23f9cd7ce2db 100644 --- a/src/test/ui/error-codes/E0534.stderr +++ b/src/test/ui/error-codes/E0534.stderr @@ -1,7 +1,7 @@ error[E0534]: expected one argument --> $DIR/E0534.rs:1:1 | -LL | #[inline()] //~ ERROR E0534 +LL | #[inline()] | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0565-1.stderr b/src/test/ui/error-codes/E0565-1.stderr index c320918a3bfd..1283a9c5ef65 100644 --- a/src/test/ui/error-codes/E0565-1.stderr +++ b/src/test/ui/error-codes/E0565-1.stderr @@ -1,7 +1,7 @@ error[E0565]: item in `deprecated` must be a key/value pair --> $DIR/E0565-1.rs:2:14 | -LL | #[deprecated("since")] //~ ERROR E0565 +LL | #[deprecated("since")] | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0565-2.stderr b/src/test/ui/error-codes/E0565-2.stderr index 8e2ce09059a3..bb30bd7befb3 100644 --- a/src/test/ui/error-codes/E0565-2.stderr +++ b/src/test/ui/error-codes/E0565-2.stderr @@ -1,7 +1,7 @@ error[E0565]: literal in `deprecated` value must be a string --> $DIR/E0565-2.rs:2:22 | -LL | #[deprecated(since = b"1.29", note = "hi")] //~ ERROR E0565 +LL | #[deprecated(since = b"1.29", note = "hi")] | ^^^^^^^ help: consider removing the prefix: `"1.29"` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0565.stderr b/src/test/ui/error-codes/E0565.stderr index 2c172f811496..6ed90c0ae4ff 100644 --- a/src/test/ui/error-codes/E0565.stderr +++ b/src/test/ui/error-codes/E0565.stderr @@ -1,7 +1,7 @@ error[E0565]: meta item in `repr` must be an identifier --> $DIR/E0565.rs:2:8 | -LL | #[repr("C")] //~ ERROR E0565 +LL | #[repr("C")] | ^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0572.stderr b/src/test/ui/error-codes/E0572.stderr index 295a518c336d..36619f8dee4c 100644 --- a/src/test/ui/error-codes/E0572.stderr +++ b/src/test/ui/error-codes/E0572.stderr @@ -1,7 +1,7 @@ error[E0572]: return statement outside of function body --> $DIR/E0572.rs:1:18 | -LL | const FOO: u32 = return 0; //~ ERROR E0572 +LL | const FOO: u32 = return 0; | ^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0586.stderr b/src/test/ui/error-codes/E0586.stderr index 394b4be3340f..d1e7e3f47442 100644 --- a/src/test/ui/error-codes/E0586.stderr +++ b/src/test/ui/error-codes/E0586.stderr @@ -1,7 +1,7 @@ error[E0586]: inclusive range with no end --> $DIR/E0586.rs:3:22 | -LL | let x = &tmp[1..=]; //~ ERROR E0586 +LL | let x = &tmp[1..=]; | ^ | = help: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) diff --git a/src/test/ui/error-codes/E0597.nll.stderr b/src/test/ui/error-codes/E0597.nll.stderr index 88a8a46930d2..b4a1180ad546 100644 --- a/src/test/ui/error-codes/E0597.nll.stderr +++ b/src/test/ui/error-codes/E0597.nll.stderr @@ -3,7 +3,7 @@ error[E0597]: `y` does not live long enough | LL | x.x = Some(&y); | ^^ borrowed value does not live long enough -LL | //~^ `y` does not live long enough [E0597] +LL | LL | } | - | | diff --git a/src/test/ui/error-codes/E0597.stderr b/src/test/ui/error-codes/E0597.stderr index a5b0cc49d0c8..cab978585310 100644 --- a/src/test/ui/error-codes/E0597.stderr +++ b/src/test/ui/error-codes/E0597.stderr @@ -3,7 +3,7 @@ error[E0597]: `y` does not live long enough | LL | x.x = Some(&y); | ^ borrowed value does not live long enough -LL | //~^ `y` does not live long enough [E0597] +LL | LL | } | - `y` dropped here while still borrowed | diff --git a/src/test/ui/error-codes/E0599.stderr b/src/test/ui/error-codes/E0599.stderr index 85110889e9a7..6fb53e727630 100644 --- a/src/test/ui/error-codes/E0599.stderr +++ b/src/test/ui/error-codes/E0599.stderr @@ -4,7 +4,7 @@ error[E0599]: no associated item named `NotEvenReal` found for type `Foo` in the LL | struct Foo; | ----------- associated item `NotEvenReal` not found for this ... -LL | || if let Foo::NotEvenReal() = Foo {}; //~ ERROR E0599 +LL | || if let Foo::NotEvenReal() = Foo {}; | -----^^^^^^^^^^^-- associated item not found in `Foo` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0600.stderr b/src/test/ui/error-codes/E0600.stderr index 6c6d922290fc..95ac4510ca88 100644 --- a/src/test/ui/error-codes/E0600.stderr +++ b/src/test/ui/error-codes/E0600.stderr @@ -1,7 +1,7 @@ error[E0600]: cannot apply unary operator `!` to type `&'static str` --> $DIR/E0600.rs:2:5 | -LL | !"a"; //~ ERROR E0600 +LL | !"a"; | ^^^^ cannot apply unary operator `!` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0603.stderr b/src/test/ui/error-codes/E0603.stderr index ee8fd2809bc7..444005e086f1 100644 --- a/src/test/ui/error-codes/E0603.stderr +++ b/src/test/ui/error-codes/E0603.stderr @@ -1,7 +1,7 @@ error[E0603]: constant `PRIVATE` is private --> $DIR/E0603.rs:6:17 | -LL | SomeModule::PRIVATE; //~ ERROR E0603 +LL | SomeModule::PRIVATE; | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0604.stderr b/src/test/ui/error-codes/E0604.stderr index 2bd92db86e36..5861bdcb7a95 100644 --- a/src/test/ui/error-codes/E0604.stderr +++ b/src/test/ui/error-codes/E0604.stderr @@ -1,7 +1,7 @@ error[E0604]: only `u8` can be cast as `char`, not `u32` --> $DIR/E0604.rs:2:5 | -LL | 1u32 as char; //~ ERROR E0604 +LL | 1u32 as char; | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0605.stderr b/src/test/ui/error-codes/E0605.stderr index 4dc074b222ac..95e899db8b7e 100644 --- a/src/test/ui/error-codes/E0605.stderr +++ b/src/test/ui/error-codes/E0605.stderr @@ -1,7 +1,7 @@ error[E0605]: non-primitive cast: `u8` as `std::vec::Vec` --> $DIR/E0605.rs:3:5 | -LL | x as Vec; //~ ERROR E0605 +LL | x as Vec; | ^^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait @@ -9,7 +9,7 @@ LL | x as Vec; //~ ERROR E0605 error[E0605]: non-primitive cast: `*const u8` as `&u8` --> $DIR/E0605.rs:6:5 | -LL | v as &u8; //~ ERROR E0605 +LL | v as &u8; | ^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait diff --git a/src/test/ui/error-codes/E0606.stderr b/src/test/ui/error-codes/E0606.stderr index 89ec4896a2b4..fce24886eb0d 100644 --- a/src/test/ui/error-codes/E0606.stderr +++ b/src/test/ui/error-codes/E0606.stderr @@ -1,7 +1,7 @@ error[E0606]: casting `&u8` as `u8` is invalid --> $DIR/E0606.rs:2:5 | -LL | &0u8 as u8; //~ ERROR E0606 +LL | &0u8 as u8; | ----^^^^^^ | | | cannot cast `&u8` as `u8` diff --git a/src/test/ui/error-codes/E0607.stderr b/src/test/ui/error-codes/E0607.stderr index 1fbe4b9c5bcc..a0fe02c1c4d9 100644 --- a/src/test/ui/error-codes/E0607.stderr +++ b/src/test/ui/error-codes/E0607.stderr @@ -1,7 +1,7 @@ error[E0607]: cannot cast thin pointer `*const u8` to fat pointer `*const [u8]` --> $DIR/E0607.rs:3:5 | -LL | v as *const [u8]; //~ ERROR E0607 +LL | v as *const [u8]; | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0608.stderr b/src/test/ui/error-codes/E0608.stderr index b228b2eddfd9..3aec509934bc 100644 --- a/src/test/ui/error-codes/E0608.stderr +++ b/src/test/ui/error-codes/E0608.stderr @@ -1,7 +1,7 @@ error[E0608]: cannot index into a value of type `u8` --> $DIR/E0608.rs:2:5 | -LL | 0u8[2]; //~ ERROR E0608 +LL | 0u8[2]; | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0609.stderr b/src/test/ui/error-codes/E0609.stderr index b5cf09b2201d..797e95d02dda 100644 --- a/src/test/ui/error-codes/E0609.stderr +++ b/src/test/ui/error-codes/E0609.stderr @@ -1,7 +1,7 @@ error[E0609]: no field `foo` on type `Foo` --> $DIR/E0609.rs:8:15 | -LL | let _ = x.foo; //~ ERROR E0609 +LL | let _ = x.foo; | ^^^ unknown field | = note: available fields are: `x` @@ -9,7 +9,7 @@ LL | let _ = x.foo; //~ ERROR E0609 error[E0609]: no field `1` on type `Bar` --> $DIR/E0609.rs:11:7 | -LL | y.1; //~ ERROR E0609 +LL | y.1; | ^ unknown field error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0610.stderr b/src/test/ui/error-codes/E0610.stderr index c46b1f2b2d56..a2966eea44c0 100644 --- a/src/test/ui/error-codes/E0610.stderr +++ b/src/test/ui/error-codes/E0610.stderr @@ -1,7 +1,7 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/E0610.rs:3:15 | -LL | let _ = x.foo; //~ ERROR E0610 +LL | let _ = x.foo; | ^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0614.stderr b/src/test/ui/error-codes/E0614.stderr index 5b1a4a93c4c0..598117c2b605 100644 --- a/src/test/ui/error-codes/E0614.stderr +++ b/src/test/ui/error-codes/E0614.stderr @@ -1,7 +1,7 @@ error[E0614]: type `u32` cannot be dereferenced --> $DIR/E0614.rs:3:5 | -LL | *y; //~ ERROR E0614 +LL | *y; | ^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0615.stderr b/src/test/ui/error-codes/E0615.stderr index d86ee5b9b4b9..772058719ae0 100644 --- a/src/test/ui/error-codes/E0615.stderr +++ b/src/test/ui/error-codes/E0615.stderr @@ -1,7 +1,7 @@ error[E0615]: attempted to take value of method `method` on type `Foo` --> $DIR/E0615.rs:11:7 | -LL | f.method; //~ ERROR E0615 +LL | f.method; | ^^^^^^ help: use parentheses to call the method: `method()` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0616.stderr b/src/test/ui/error-codes/E0616.stderr index f600bfa8cd31..556e5db10a94 100644 --- a/src/test/ui/error-codes/E0616.stderr +++ b/src/test/ui/error-codes/E0616.stderr @@ -1,7 +1,7 @@ error[E0616]: field `x` of struct `a::Foo` is private --> $DIR/E0616.rs:13:5 | -LL | f.x; //~ ERROR E0616 +LL | f.x; | ^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0617.rs b/src/test/ui/error-codes/E0617.rs index 9eed1225ab82..51f13c7dbd54 100644 --- a/src/test/ui/error-codes/E0617.rs +++ b/src/test/ui/error-codes/E0617.rs @@ -22,7 +22,7 @@ fn main() { //~^ ERROR can't pass `u16` to variadic function //~| HELP cast the value to `c_uint` printf(::std::ptr::null(), printf); - //~^ ERROR can't pass `unsafe extern "C" fn(*const i8, ...) {printf}` to variadic function - //~| HELP cast the value to `unsafe extern "C" fn(*const i8, ...)` + //~^ ERROR can't pass `for<'r> unsafe extern "C" fn(*const i8, std::ffi::VaList<'r>, ...) {printf}` to variadic function + //~| HELP cast the value to `for<'r> unsafe extern "C" fn(*const i8, std::ffi::VaList<'r>, ...)` } } diff --git a/src/test/ui/error-codes/E0617.stderr b/src/test/ui/error-codes/E0617.stderr index 486ca1fa92f1..8387d5c7e93a 100644 --- a/src/test/ui/error-codes/E0617.stderr +++ b/src/test/ui/error-codes/E0617.stderr @@ -28,15 +28,15 @@ error[E0617]: can't pass `u16` to variadic function LL | printf(::std::ptr::null(), 0u16); | ^^^^ help: cast the value to `c_uint`: `0u16 as c_uint` -error[E0617]: can't pass `unsafe extern "C" fn(*const i8, ...) {printf}` to variadic function +error[E0617]: can't pass `for<'r> unsafe extern "C" fn(*const i8, std::ffi::VaList<'r>, ...) {printf}` to variadic function --> $DIR/E0617.rs:24:36 | LL | printf(::std::ptr::null(), printf); | ^^^^^^ -help: cast the value to `unsafe extern "C" fn(*const i8, ...)` +help: cast the value to `for<'r> unsafe extern "C" fn(*const i8, std::ffi::VaList<'r>, ...)` | -LL | printf(::std::ptr::null(), printf as unsafe extern "C" fn(*const i8, ...)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | printf(::std::ptr::null(), printf as for<'r> unsafe extern "C" fn(*const i8, std::ffi::VaList<'r>, ...)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/error-codes/E0620.stderr b/src/test/ui/error-codes/E0620.stderr index f7319a878c27..65152b2b74dd 100644 --- a/src/test/ui/error-codes/E0620.stderr +++ b/src/test/ui/error-codes/E0620.stderr @@ -1,13 +1,13 @@ error[E0620]: cast to unsized type: `&[usize; 2]` as `[usize]` --> $DIR/E0620.rs:2:16 | -LL | let _foo = &[1_usize, 2] as [usize]; //~ ERROR E0620 +LL | let _foo = &[1_usize, 2] as [usize]; | ^^^^^^^^^^^^^^^^^^^^^^^^ | help: consider using an implicit coercion to `&[usize]` instead --> $DIR/E0620.rs:2:16 | -LL | let _foo = &[1_usize, 2] as [usize]; //~ ERROR E0620 +LL | let _foo = &[1_usize, 2] as [usize]; | ^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.stderr b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.stderr index f763c82eff80..feca7f10b706 100644 --- a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.stderr +++ b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.stderr @@ -1,28 +1,28 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements --> $DIR/E0621-does-not-trigger-for-closures.rs:15:5 | -LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495 +LL | invoke(&x, |a, b| if a > b { a } else { b }); | ^^^^^^ | note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 15:16... --> $DIR/E0621-does-not-trigger-for-closures.rs:15:16 | -LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495 +LL | invoke(&x, |a, b| if a > b { a } else { b }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...so that reference does not outlive borrowed content --> $DIR/E0621-does-not-trigger-for-closures.rs:15:45 | -LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495 +LL | invoke(&x, |a, b| if a > b { a } else { b }); | ^ note: but, the lifetime must be valid for the call at 15:5... --> $DIR/E0621-does-not-trigger-for-closures.rs:15:5 | -LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495 +LL | invoke(&x, |a, b| if a > b { a } else { b }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...so type `&i32` of expression is valid during the expression --> $DIR/E0621-does-not-trigger-for-closures.rs:15:5 | -LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495 +LL | invoke(&x, |a, b| if a > b { a } else { b }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0624.stderr b/src/test/ui/error-codes/E0624.stderr index 31a2f607e582..01ac24cfbbe1 100644 --- a/src/test/ui/error-codes/E0624.stderr +++ b/src/test/ui/error-codes/E0624.stderr @@ -1,7 +1,7 @@ error[E0624]: method `method` is private --> $DIR/E0624.rs:11:9 | -LL | foo.method(); //~ ERROR method `method` is private [E0624] +LL | foo.method(); | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0637.stderr b/src/test/ui/error-codes/E0637.stderr index f744520ef6ee..d19ebfd15a52 100644 --- a/src/test/ui/error-codes/E0637.stderr +++ b/src/test/ui/error-codes/E0637.stderr @@ -1,19 +1,19 @@ error[E0637]: `'_` cannot be used here --> $DIR/E0637.rs:1:16 | -LL | struct Foo<'a: '_>(&'a u8); //~ ERROR cannot be used here +LL | struct Foo<'a: '_>(&'a u8); | ^^ `'_` is a reserved lifetime name error[E0637]: `'_` cannot be used here --> $DIR/E0637.rs:2:12 | -LL | fn foo<'a: '_>(_: &'a u8) {} //~ ERROR cannot be used here +LL | fn foo<'a: '_>(_: &'a u8) {} | ^^ `'_` is a reserved lifetime name error[E0637]: `'_` cannot be used here --> $DIR/E0637.rs:5:10 | -LL | impl<'a: '_> Bar<'a> { //~ ERROR cannot be used here +LL | impl<'a: '_> Bar<'a> { | ^^ `'_` is a reserved lifetime name error: aborting due to 3 previous errors diff --git a/src/test/ui/error-codes/E0646.stderr b/src/test/ui/error-codes/E0646.stderr index 502200c1d008..976cdd45f576 100644 --- a/src/test/ui/error-codes/E0646.stderr +++ b/src/test/ui/error-codes/E0646.stderr @@ -1,7 +1,7 @@ error[E0646]: `main` function is not allowed to have a `where` clause --> $DIR/E0646.rs:1:17 | -LL | fn main() where (): Copy {} //~ ERROR [E0646] +LL | fn main() where (): Copy {} | ^^^^^^^^ `main` cannot have a `where` clause error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0647.stderr b/src/test/ui/error-codes/E0647.stderr index da9ba5bf34bc..465cc7702eef 100644 --- a/src/test/ui/error-codes/E0647.stderr +++ b/src/test/ui/error-codes/E0647.stderr @@ -1,7 +1,7 @@ error[E0647]: start function is not allowed to have a `where` clause --> $DIR/E0647.rs:7:56 | -LL | fn start(_: isize, _: *const *const u8) -> isize where (): Copy { //~ ERROR [E0647] +LL | fn start(_: isize, _: *const *const u8) -> isize where (): Copy { | ^^^^^^^^ start function cannot have a `where` clause error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0648.stderr b/src/test/ui/error-codes/E0648.stderr index 090157fb0d77..f682b4f41e52 100644 --- a/src/test/ui/error-codes/E0648.stderr +++ b/src/test/ui/error-codes/E0648.stderr @@ -1,7 +1,7 @@ error[E0648]: `export_name` may not contain null characters --> $DIR/E0648.rs:1:1 | -LL | #[export_name="/0foo"] //~ ERROR E0648 +LL | #[export_name="/0foo"] | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0658.stderr b/src/test/ui/error-codes/E0658.stderr index 58802b23db38..292c49fa84e5 100644 --- a/src/test/ui/error-codes/E0658.stderr +++ b/src/test/ui/error-codes/E0658.stderr @@ -1,7 +1,7 @@ error[E0658]: repr with 128-bit type is unstable (see issue #35118) --> $DIR/E0658.rs:2:1 | -LL | / enum Foo { //~ ERROR E0658 +LL | / enum Foo { LL | | Bar(u64), LL | | } | |_^ diff --git a/src/test/ui/error-codes/E0659.stderr b/src/test/ui/error-codes/E0659.stderr index b5aa1b21b096..2f01f54c2d1c 100644 --- a/src/test/ui/error-codes/E0659.stderr +++ b/src/test/ui/error-codes/E0659.stderr @@ -1,7 +1,7 @@ error[E0659]: `foo` is ambiguous (glob import vs glob import in the same module) --> $DIR/E0659.rs:15:15 | -LL | collider::foo(); //~ ERROR E0659 +LL | collider::foo(); | ^^^ ambiguous name | note: `foo` could refer to the function imported here diff --git a/src/test/ui/error-codes/E0718.stderr b/src/test/ui/error-codes/E0718.stderr index 4f9734d1acff..412c856ce065 100644 --- a/src/test/ui/error-codes/E0718.stderr +++ b/src/test/ui/error-codes/E0718.stderr @@ -1,7 +1,7 @@ error[E0718]: `arc` language item must be applied to a struct --> $DIR/E0718.rs:4:1 | -LL | #[lang = "arc"] //~ ERROR language item must be applied to a struct +LL | #[lang = "arc"] | ^^^^^^^^^^^^^^^ attribute should be applied to a struct, not a static item error: aborting due to previous error diff --git a/src/test/ui/error-codes/ex-E0611.stderr b/src/test/ui/error-codes/ex-E0611.stderr index f8c7cd8c1464..8bd00a392d4f 100644 --- a/src/test/ui/error-codes/ex-E0611.stderr +++ b/src/test/ui/error-codes/ex-E0611.stderr @@ -1,7 +1,7 @@ error[E0616]: field `0` of struct `a::Foo` is private --> $DIR/ex-E0611.rs:11:4 | -LL | y.0; //~ ERROR field `0` of struct `a::Foo` is private +LL | y.0; | ^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/ex-E0612.stderr b/src/test/ui/error-codes/ex-E0612.stderr index 0f498d164390..b21b6fdfcf1f 100644 --- a/src/test/ui/error-codes/ex-E0612.stderr +++ b/src/test/ui/error-codes/ex-E0612.stderr @@ -1,7 +1,7 @@ error[E0609]: no field `1` on type `Foo` --> $DIR/ex-E0612.rs:5:6 | -LL | y.1; //~ ERROR no field `1` on type `Foo` +LL | y.1; | ^ help: a field with a similar name exists: `0` error: aborting due to previous error diff --git a/src/test/ui/error-should-say-copy-not-pod.stderr b/src/test/ui/error-should-say-copy-not-pod.stderr index d42fea708128..7143f8c914dd 100644 --- a/src/test/ui/error-should-say-copy-not-pod.stderr +++ b/src/test/ui/error-should-say-copy-not-pod.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied --> $DIR/error-should-say-copy-not-pod.rs:6:5 | -LL | check_bound("nocopy".to_string()); //~ ERROR : std::marker::Copy` is not satisfied +LL | check_bound("nocopy".to_string()); | ^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String` | note: required by `check_bound` diff --git a/src/test/ui/estr-subtyping.stderr b/src/test/ui/estr-subtyping.stderr index 7a7dce98f2d1..29f210803dd1 100644 --- a/src/test/ui/estr-subtyping.stderr +++ b/src/test/ui/estr-subtyping.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/estr-subtyping.rs:10:15 | -LL | wants_uniq(x); //~ ERROR mismatched types +LL | wants_uniq(x); | ^ | | | expected struct `std::string::String`, found &str diff --git a/src/test/ui/exclusive-drop-and-copy.stderr b/src/test/ui/exclusive-drop-and-copy.stderr index 2fbeaec23a79..9983aac4f9c0 100644 --- a/src/test/ui/exclusive-drop-and-copy.stderr +++ b/src/test/ui/exclusive-drop-and-copy.stderr @@ -1,13 +1,13 @@ error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor --> $DIR/exclusive-drop-and-copy.rs:3:10 | -LL | #[derive(Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented +LL | #[derive(Copy, Clone)] | ^^^^ Copy not allowed on types with destructors error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor --> $DIR/exclusive-drop-and-copy.rs:10:10 | -LL | #[derive(Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented +LL | #[derive(Copy, Clone)] | ^^^^ Copy not allowed on types with destructors error: aborting due to 2 previous errors diff --git a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.stderr b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.stderr index 01c7e8817568..03867a8e43b1 100644 --- a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.stderr +++ b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.stderr @@ -1,7 +1,7 @@ error: unexpected token: `,` --> $DIR/exclusive_range_pattern_syntax_collision.rs:5:15 | -LL | [_, 99.., _] => {}, //~ ERROR unexpected token: `,` +LL | [_, 99.., _] => {}, | ^^ error: aborting due to previous error diff --git a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.stderr b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.stderr index 91109a645664..5ac435bf011e 100644 --- a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.stderr +++ b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.stderr @@ -1,7 +1,7 @@ error: unexpected token: `]` --> $DIR/exclusive_range_pattern_syntax_collision2.rs:5:15 | -LL | [_, 99..] => {}, //~ ERROR unexpected token: `]` +LL | [_, 99..] => {}, | ^^ error: aborting due to previous error diff --git a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.stderr b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.stderr index 9c76a66c265b..a09ba3562e09 100644 --- a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.stderr +++ b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.stderr @@ -1,7 +1,7 @@ error: expected one of `,` or `]`, found `9` --> $DIR/exclusive_range_pattern_syntax_collision3.rs:5:12 | -LL | [..9, 99..100, _] => {}, //~ ERROR expected one of `,` or `]`, found `9` +LL | [..9, 99..100, _] => {}, | ^ expected one of `,` or `]` here error: aborting due to previous error diff --git a/src/test/ui/exhaustive_integer_patterns.stderr b/src/test/ui/exhaustive_integer_patterns.stderr index 7b873f7ba425..82b0b4841446 100644 --- a/src/test/ui/exhaustive_integer_patterns.stderr +++ b/src/test/ui/exhaustive_integer_patterns.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/exhaustive_integer_patterns.rs:23:9 | -LL | 200 => {} //~ ERROR unreachable pattern +LL | 200 => {} | ^^^ | note: lint level defined here @@ -13,74 +13,96 @@ LL | #![deny(unreachable_patterns)] error[E0004]: non-exhaustive patterns: `128u8..=255u8` not covered --> $DIR/exhaustive_integer_patterns.rs:28:11 | -LL | match x { //~ ERROR non-exhaustive patterns +LL | match x { | ^ pattern `128u8..=255u8` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `11u8..=19u8`, `31u8..=34u8`, `36u8..=69u8` and 1 more not covered --> $DIR/exhaustive_integer_patterns.rs:33:11 | -LL | match x { //~ ERROR non-exhaustive patterns +LL | match x { | ^ patterns `11u8..=19u8`, `31u8..=34u8`, `36u8..=69u8` and 1 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: unreachable pattern --> $DIR/exhaustive_integer_patterns.rs:44:9 | -LL | -2..=20 => {} //~ ERROR unreachable pattern +LL | -2..=20 => {} | ^^^^^^^ error[E0004]: non-exhaustive patterns: `-128i8..=-8i8`, `-6i8`, `121i8..=124i8` and 1 more not covered --> $DIR/exhaustive_integer_patterns.rs:41:11 | -LL | match x { //~ ERROR non-exhaustive patterns +LL | match x { | ^ patterns `-128i8..=-8i8`, `-6i8`, `121i8..=124i8` and 1 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `-128i8` not covered --> $DIR/exhaustive_integer_patterns.rs:82:11 | -LL | match 0i8 { //~ ERROR non-exhaustive patterns +LL | match 0i8 { | ^^^ pattern `-128i8` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `0i16` not covered --> $DIR/exhaustive_integer_patterns.rs:90:11 | -LL | match 0i16 { //~ ERROR non-exhaustive patterns +LL | match 0i16 { | ^^^^ pattern `0i16` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `128u8..=255u8` not covered --> $DIR/exhaustive_integer_patterns.rs:108:11 | -LL | match 0u8 { //~ ERROR non-exhaustive patterns +LL | match 0u8 { | ^^^ pattern `128u8..=255u8` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `(0u8, Some(_))` and `(2u8..=255u8, Some(_))` not covered --> $DIR/exhaustive_integer_patterns.rs:120:11 | -LL | match (0u8, Some(())) { //~ ERROR non-exhaustive patterns +LL | match (0u8, Some(())) { | ^^^^^^^^^^^^^^^ patterns `(0u8, Some(_))` and `(2u8..=255u8, Some(_))` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `(126u8..=127u8, false)` not covered --> $DIR/exhaustive_integer_patterns.rs:125:11 | -LL | match (0u8, true) { //~ ERROR non-exhaustive patterns +LL | match (0u8, true) { | ^^^^^^^^^^^ pattern `(126u8..=127u8, false)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `340282366920938463463374607431768211455u128` not covered --> $DIR/exhaustive_integer_patterns.rs:145:11 | -LL | match 0u128 { //~ ERROR non-exhaustive patterns +LL | match 0u128 { | ^^^^^ pattern `340282366920938463463374607431768211455u128` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `5u128..=340282366920938463463374607431768211455u128` not covered --> $DIR/exhaustive_integer_patterns.rs:149:11 | -LL | match 0u128 { //~ ERROR non-exhaustive patterns +LL | match 0u128 { | ^^^^^ pattern `5u128..=340282366920938463463374607431768211455u128` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `0u128..=3u128` not covered --> $DIR/exhaustive_integer_patterns.rs:153:11 | -LL | match 0u128 { //~ ERROR non-exhaustive patterns +LL | match 0u128 { | ^^^^^ pattern `0u128..=3u128` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to 13 previous errors diff --git a/src/test/ui/existential_types/bound_reduction2.stderr b/src/test/ui/existential_types/bound_reduction2.stderr index f51f1c9a4e56..b8bad7db6b65 100644 --- a/src/test/ui/existential_types/bound_reduction2.stderr +++ b/src/test/ui/existential_types/bound_reduction2.stderr @@ -1,7 +1,7 @@ error: defining existential type use does not fully define existential type --> $DIR/bound_reduction2.rs:17:1 | -LL | / fn foo_desugared(_: T) -> Foo { //~ ERROR does not fully define +LL | / fn foo_desugared(_: T) -> Foo { LL | | () LL | | } | |_^ diff --git a/src/test/ui/existential_types/declared_but_never_defined.stderr b/src/test/ui/existential_types/declared_but_never_defined.stderr index 681b1cf0fa7c..7294a074db65 100644 --- a/src/test/ui/existential_types/declared_but_never_defined.stderr +++ b/src/test/ui/existential_types/declared_but_never_defined.stderr @@ -1,7 +1,7 @@ error: could not find defining uses --> $DIR/declared_but_never_defined.rs:6:1 | -LL | existential type Bar: std::fmt::Debug; //~ ERROR could not find defining uses +LL | existential type Bar: std::fmt::Debug; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/existential_types/declared_but_not_defined_in_scope.stderr b/src/test/ui/existential_types/declared_but_not_defined_in_scope.stderr index e9cc92d78ea7..a72709f71943 100644 --- a/src/test/ui/existential_types/declared_but_not_defined_in_scope.stderr +++ b/src/test/ui/existential_types/declared_but_not_defined_in_scope.stderr @@ -1,7 +1,7 @@ error: could not find defining uses --> $DIR/declared_but_not_defined_in_scope.rs:7:5 | -LL | pub existential type Boo: ::std::fmt::Debug; //~ ERROR could not find defining uses +LL | pub existential type Boo: ::std::fmt::Debug; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/existential_types/different_defining_uses.stderr b/src/test/ui/existential_types/different_defining_uses.stderr index 3f9ed96400b5..fddba584798b 100644 --- a/src/test/ui/existential_types/different_defining_uses.stderr +++ b/src/test/ui/existential_types/different_defining_uses.stderr @@ -1,7 +1,7 @@ error: concrete type differs from previous defining existential type use --> $DIR/different_defining_uses.rs:12:1 | -LL | / fn bar() -> Foo { //~ ERROR concrete type differs from previous +LL | / fn bar() -> Foo { LL | | 42i32 LL | | } | |_^ expected `&'static str`, got `i32` 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 e29256a5014f..14b7a810be2e 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,7 +1,7 @@ error: concrete type differs from previous defining existential type use --> $DIR/different_defining_uses_never_type.rs:12:1 | -LL | / fn bar() -> Foo { //~ ERROR concrete type differs from previous +LL | / fn bar() -> Foo { LL | | panic!() LL | | } | |_^ expected `&'static str`, got `()` @@ -17,7 +17,7 @@ LL | | } error: concrete type differs from previous defining existential type use --> $DIR/different_defining_uses_never_type.rs:16:1 | -LL | / fn boo() -> Foo { //~ ERROR concrete type differs from previous +LL | / fn boo() -> Foo { LL | | loop {} LL | | } | |_^ expected `&'static str`, got `()` 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 3f129658b8fd..e5b1539ccbb9 100644 --- a/src/test/ui/existential_types/generic_different_defining_uses.stderr +++ b/src/test/ui/existential_types/generic_different_defining_uses.stderr @@ -1,7 +1,7 @@ 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 concrete type differs from previous +LL | / fn my_iter2(t: T) -> MyIter { LL | | Some(t).into_iter() LL | | } | |_^ expected `std::iter::Once`, got `std::option::IntoIter` diff --git a/src/test/ui/existential_types/generic_duplicate_lifetime_param.stderr b/src/test/ui/existential_types/generic_duplicate_lifetime_param.stderr index 7b09d3ceab0b..29bd252babe5 100644 --- a/src/test/ui/existential_types/generic_duplicate_lifetime_param.stderr +++ b/src/test/ui/existential_types/generic_duplicate_lifetime_param.stderr @@ -1,7 +1,7 @@ error: non-defining existential type use in defining scope --> $DIR/generic_duplicate_lifetime_param.rs:7:1 | -LL | / fn one<'a>(t: &'a ()) -> Two<'a, 'a> { //~ ERROR non-defining existential type use +LL | / fn one<'a>(t: &'a ()) -> Two<'a, 'a> { LL | | t LL | | } | |_^ 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 d4deda999da1..a3827943b6df 100644 --- a/src/test/ui/existential_types/generic_duplicate_param_use.stderr +++ b/src/test/ui/existential_types/generic_duplicate_param_use.stderr @@ -2,7 +2,7 @@ error: defining existential type use restricts existential type by using the gen --> $DIR/generic_duplicate_param_use.rs:11:1 | LL | / fn one(t: T) -> Two { -LL | | //~^ ERROR defining existential type use restricts existential type +LL | | LL | | t LL | | } | |_^ diff --git a/src/test/ui/existential_types/generic_duplicate_param_use2.stderr b/src/test/ui/existential_types/generic_duplicate_param_use2.stderr index 0a8be3218c75..74f2802449a7 100644 --- a/src/test/ui/existential_types/generic_duplicate_param_use2.stderr +++ b/src/test/ui/existential_types/generic_duplicate_param_use2.stderr @@ -2,7 +2,7 @@ error: defining existential type use restricts existential type by using the gen --> $DIR/generic_duplicate_param_use2.rs:10:1 | LL | / fn one(t: T) -> Two { -LL | | //~^ defining existential type use restricts existential type +LL | | LL | | t LL | | } | |_^ diff --git a/src/test/ui/existential_types/generic_duplicate_param_use3.stderr b/src/test/ui/existential_types/generic_duplicate_param_use3.stderr index 1c96c15a7691..22d5467c363f 100644 --- a/src/test/ui/existential_types/generic_duplicate_param_use3.stderr +++ b/src/test/ui/existential_types/generic_duplicate_param_use3.stderr @@ -2,7 +2,7 @@ error: defining existential type use restricts existential type by using the gen --> $DIR/generic_duplicate_param_use3.rs:10:1 | LL | / fn one(t: T) -> Two { -LL | | //~^ defining existential type use restricts existential type +LL | | LL | | t LL | | } | |_^ @@ -11,7 +11,7 @@ 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 | | LL | | u LL | | } | |_^ expected [`T`], got [`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 index 24b1caf7c1bf..d7e695578d39 100644 --- a/src/test/ui/existential_types/generic_duplicate_param_use4.stderr +++ b/src/test/ui/existential_types/generic_duplicate_param_use4.stderr @@ -2,7 +2,7 @@ error: defining existential type use restricts existential type by using the gen --> $DIR/generic_duplicate_param_use4.rs:10:1 | LL | / fn one(t: T) -> Two { -LL | | //~^ ERROR defining existential type use restricts existential type +LL | | LL | | t LL | | } | |_^ diff --git a/src/test/ui/existential_types/generic_duplicate_param_use5.stderr b/src/test/ui/existential_types/generic_duplicate_param_use5.stderr index 166623801c24..cf4535d6c2c6 100644 --- a/src/test/ui/existential_types/generic_duplicate_param_use5.stderr +++ b/src/test/ui/existential_types/generic_duplicate_param_use5.stderr @@ -2,7 +2,7 @@ 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 | | LL | | (u, t) LL | | } | |_^ expected `(T, U)`, got `(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 index da49a83be1f7..1f767dacea8d 100644 --- a/src/test/ui/existential_types/generic_duplicate_param_use6.stderr +++ b/src/test/ui/existential_types/generic_duplicate_param_use6.stderr @@ -2,7 +2,7 @@ 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 | | LL | | (u, t) LL | | } | |_^ expected `(T, T)`, got `(U, T)` diff --git a/src/test/ui/existential_types/generic_duplicate_param_use8.stderr b/src/test/ui/existential_types/generic_duplicate_param_use8.stderr index 80c7441c857d..58f4f97b2411 100644 --- a/src/test/ui/existential_types/generic_duplicate_param_use8.stderr +++ b/src/test/ui/existential_types/generic_duplicate_param_use8.stderr @@ -2,7 +2,7 @@ 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 | | LL | | (u, 4u32) LL | | } | |_^ expected `(T, u32)`, got `(U, u32)` diff --git a/src/test/ui/existential_types/generic_duplicate_param_use9.stderr b/src/test/ui/existential_types/generic_duplicate_param_use9.stderr index a3ce480d66dc..fe4ae6cfdd07 100644 --- a/src/test/ui/existential_types/generic_duplicate_param_use9.stderr +++ b/src/test/ui/existential_types/generic_duplicate_param_use9.stderr @@ -2,7 +2,7 @@ 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 | | (t, u, 42) LL | | } | |_^ expected `(A, B, ::Bar)`, got `(A, B, i32)` | diff --git a/src/test/ui/existential_types/generic_nondefining_use.stderr b/src/test/ui/existential_types/generic_nondefining_use.stderr index 8dd88006be9c..ef579260f061 100644 --- a/src/test/ui/existential_types/generic_nondefining_use.stderr +++ b/src/test/ui/existential_types/generic_nondefining_use.stderr @@ -1,7 +1,7 @@ error: defining existential type use does not fully define existential type --> $DIR/generic_nondefining_use.rs:9:1 | -LL | / fn cmp() -> Cmp { //~ ERROR defining existential type use does not fully define +LL | / fn cmp() -> Cmp { LL | | 5u32 LL | | } | |_^ diff --git a/src/test/ui/existential_types/generic_not_used.stderr b/src/test/ui/existential_types/generic_not_used.stderr index b22cffeea289..1ae4ab65929f 100644 --- a/src/test/ui/existential_types/generic_not_used.stderr +++ b/src/test/ui/existential_types/generic_not_used.stderr @@ -3,7 +3,7 @@ error: type parameter `V` is part of concrete type but not used in parameter lis | LL | fn wrong_generic(_: U, v: V) -> WrongGeneric { | _________________________________________________________________________^ -LL | | //~^ ERROR type parameter `V` is part of concrete type but not used in parameter list +LL | | LL | | v LL | | } | |_^ diff --git a/src/test/ui/existential_types/generic_type_does_not_live_long_enough.stderr b/src/test/ui/existential_types/generic_type_does_not_live_long_enough.stderr index d9bb37328bd5..e3e5481a96c5 100644 --- a/src/test/ui/existential_types/generic_type_does_not_live_long_enough.stderr +++ b/src/test/ui/existential_types/generic_type_does_not_live_long_enough.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/generic_type_does_not_live_long_enough.rs:6:18 | -LL | let z: i32 = x; //~ ERROR mismatched types +LL | let z: i32 = x; | ^ expected i32, found opaque type | = note: expected type `i32` diff --git a/src/test/ui/existential_types/generic_underconstrained.stderr b/src/test/ui/existential_types/generic_underconstrained.stderr index 57924e0ce213..8551a939e8ed 100644 --- a/src/test/ui/existential_types/generic_underconstrained.stderr +++ b/src/test/ui/existential_types/generic_underconstrained.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: Trait` is not satisfied --> $DIR/generic_underconstrained.rs:6:1 | -LL | existential type Underconstrained: 'static; //~ ERROR the trait bound `T: Trait` +LL | existential type Underconstrained: 'static; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `T` | = help: consider adding a `where T: Trait` bound diff --git a/src/test/ui/existential_types/never_reveal_concrete_type.stderr b/src/test/ui/existential_types/never_reveal_concrete_type.stderr index 33a71fc4356b..81b6584ae90d 100644 --- a/src/test/ui/existential_types/never_reveal_concrete_type.stderr +++ b/src/test/ui/existential_types/never_reveal_concrete_type.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/never_reveal_concrete_type.rs:13:27 | -LL | let _: &'static str = x; //~ mismatched types +LL | let _: &'static str = x; | ^ expected reference, found opaque type | = note: expected type `&'static str` @@ -10,7 +10,7 @@ LL | let _: &'static str = x; //~ mismatched types error[E0605]: non-primitive cast: `NoReveal` as `&'static str` --> $DIR/never_reveal_concrete_type.rs:14:13 | -LL | let _ = x as &'static str; //~ non-primitive cast +LL | let _ = x as &'static str; | ^^^^^^^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait diff --git a/src/test/ui/existential_types/no_inferrable_concrete_type.stderr b/src/test/ui/existential_types/no_inferrable_concrete_type.stderr index fab61bd9ed06..4605332ef5b3 100644 --- a/src/test/ui/existential_types/no_inferrable_concrete_type.stderr +++ b/src/test/ui/existential_types/no_inferrable_concrete_type.stderr @@ -1,7 +1,7 @@ error[E0391]: cycle detected when processing `Foo` --> $DIR/no_inferrable_concrete_type.rs:6:1 | -LL | existential type Foo: Copy; //~ cycle detected +LL | existential type Foo: Copy; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...which requires processing `bar`... @@ -15,7 +15,7 @@ note: cycle used when collecting item types in top-level module | LL | / #![feature(existential_type)] LL | | -LL | | existential type Foo: Copy; //~ cycle detected +LL | | existential type Foo: Copy; LL | | ... | LL | | let _: Foo = std::mem::transmute(0u8); diff --git a/src/test/ui/existential_types/no_revealing_outside_defining_module.stderr b/src/test/ui/existential_types/no_revealing_outside_defining_module.stderr index 4ffce58f8de7..5e5826978fc7 100644 --- a/src/test/ui/existential_types/no_revealing_outside_defining_module.stderr +++ b/src/test/ui/existential_types/no_revealing_outside_defining_module.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/no_revealing_outside_defining_module.rs:15:19 | -LL | let _: &str = bomp(); //~ ERROR mismatched types +LL | let _: &str = bomp(); | ^^^^^^ expected &str, found opaque type | = note: expected type `&str` @@ -12,7 +12,7 @@ error[E0308]: mismatched types | LL | fn bomp() -> boo::Boo { | -------- expected `Boo` because of return type -LL | "" //~ ERROR mismatched types +LL | "" | ^^ expected opaque type, found reference | = note: expected type `Boo` diff --git a/src/test/ui/existential_types/not_a_defining_use.stderr b/src/test/ui/existential_types/not_a_defining_use.stderr index 288a32fc14ed..f315811cdb42 100644 --- a/src/test/ui/existential_types/not_a_defining_use.stderr +++ b/src/test/ui/existential_types/not_a_defining_use.stderr @@ -2,7 +2,7 @@ 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 | | LL | | (t, 4i8) LL | | } | |_^ @@ -10,7 +10,7 @@ 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 | / fn four(t: T) -> Two { LL | | (t, ::FOO) LL | | } | |_^ expected `(T, i8)`, got `(T, ::Blub)` diff --git a/src/test/ui/existential_types/not_well_formed.stderr b/src/test/ui/existential_types/not_well_formed.stderr index 17ea57805d2b..05f84d576234 100644 --- a/src/test/ui/existential_types/not_well_formed.stderr +++ b/src/test/ui/existential_types/not_well_formed.stderr @@ -1,7 +1,7 @@ error[E0220]: associated type `Assoc` not found for `V` --> $DIR/not_well_formed.rs:10:32 | -LL | existential type Foo: Trait; //~ associated type `Assoc` not found for `V` +LL | existential type Foo: Trait; | ^^^^^^^^ associated type `Assoc` not found error: aborting due to previous error diff --git a/src/test/ui/explicit/explicit-call-to-dtor.stderr b/src/test/ui/explicit/explicit-call-to-dtor.stderr index db09b23bf26e..cbbe967179ef 100644 --- a/src/test/ui/explicit/explicit-call-to-dtor.stderr +++ b/src/test/ui/explicit/explicit-call-to-dtor.stderr @@ -1,7 +1,7 @@ error[E0040]: explicit use of destructor method --> $DIR/explicit-call-to-dtor.rs:13:7 | -LL | x.drop(); //~ ERROR explicit use of destructor method +LL | x.drop(); | ^^^^ explicit destructor calls not allowed error: aborting due to previous error diff --git a/src/test/ui/explicit/explicit-call-to-supertrait-dtor.stderr b/src/test/ui/explicit/explicit-call-to-supertrait-dtor.stderr index dfd122b3ea40..0b302e30b64f 100644 --- a/src/test/ui/explicit/explicit-call-to-supertrait-dtor.stderr +++ b/src/test/ui/explicit/explicit-call-to-supertrait-dtor.stderr @@ -1,7 +1,7 @@ error[E0040]: explicit use of destructor method --> $DIR/explicit-call-to-supertrait-dtor.rs:17:14 | -LL | self.drop(); //~ ERROR explicit use of destructor method +LL | self.drop(); | ^^^^ explicit destructor calls not allowed error: aborting due to previous error diff --git a/src/test/ui/explore-issue-38412.stderr b/src/test/ui/explore-issue-38412.stderr index e3ce6c1317f5..5e5d952bcec8 100644 --- a/src/test/ui/explore-issue-38412.stderr +++ b/src/test/ui/explore-issue-38412.stderr @@ -9,7 +9,7 @@ LL | let Record { a_stable_pub: _, a_unstable_declared_pub: _, a_unstable_un error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) --> $DIR/explore-issue-38412.rs:30:5 | -LL | r.a_unstable_undeclared_pub; //~ ERROR use of unstable library feature +LL | r.a_unstable_undeclared_pub; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_undeclared)] to the crate attributes to enable @@ -17,25 +17,25 @@ LL | r.a_unstable_undeclared_pub; //~ ERROR use of unstable library feature error[E0616]: field `b_crate` of struct `pub_and_stability::Record` is private --> $DIR/explore-issue-38412.rs:31:5 | -LL | r.b_crate; //~ ERROR is private +LL | r.b_crate; | ^^^^^^^^^ error[E0616]: field `c_mod` of struct `pub_and_stability::Record` is private --> $DIR/explore-issue-38412.rs:32:5 | -LL | r.c_mod; //~ ERROR is private +LL | r.c_mod; | ^^^^^^^ error[E0616]: field `d_priv` of struct `pub_and_stability::Record` is private --> $DIR/explore-issue-38412.rs:33:5 | -LL | r.d_priv; //~ ERROR is private +LL | r.d_priv; | ^^^^^^^^ error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) --> $DIR/explore-issue-38412.rs:37:5 | -LL | t.2; //~ ERROR use of unstable library feature +LL | t.2; | ^^^ | = help: add #![feature(unstable_undeclared)] to the crate attributes to enable @@ -43,25 +43,25 @@ LL | t.2; //~ ERROR use of unstable library feature error[E0616]: field `3` of struct `pub_and_stability::Tuple` is private --> $DIR/explore-issue-38412.rs:38:5 | -LL | t.3; //~ ERROR is private +LL | t.3; | ^^^ error[E0616]: field `4` of struct `pub_and_stability::Tuple` is private --> $DIR/explore-issue-38412.rs:39:5 | -LL | t.4; //~ ERROR is private +LL | t.4; | ^^^ error[E0616]: field `5` of struct `pub_and_stability::Tuple` is private --> $DIR/explore-issue-38412.rs:40:5 | -LL | t.5; //~ ERROR is private +LL | t.5; | ^^^ error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) --> $DIR/explore-issue-38412.rs:44:7 | -LL | r.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature +LL | r.unstable_undeclared_trait_method(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_undeclared)] to the crate attributes to enable @@ -69,7 +69,7 @@ LL | r.unstable_undeclared_trait_method(); //~ ERROR use of unstable library error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) --> $DIR/explore-issue-38412.rs:48:7 | -LL | r.unstable_undeclared(); //~ ERROR use of unstable library feature +LL | r.unstable_undeclared(); | ^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_undeclared)] to the crate attributes to enable @@ -77,25 +77,25 @@ LL | r.unstable_undeclared(); //~ ERROR use of unstable library error[E0624]: method `pub_crate` is private --> $DIR/explore-issue-38412.rs:50:7 | -LL | r.pub_crate(); //~ ERROR `pub_crate` is private +LL | r.pub_crate(); | ^^^^^^^^^ error[E0624]: method `pub_mod` is private --> $DIR/explore-issue-38412.rs:51:7 | -LL | r.pub_mod(); //~ ERROR `pub_mod` is private +LL | r.pub_mod(); | ^^^^^^^ error[E0624]: method `private` is private --> $DIR/explore-issue-38412.rs:52:7 | -LL | r.private(); //~ ERROR `private` is private +LL | r.private(); | ^^^^^^^ error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) --> $DIR/explore-issue-38412.rs:57:7 | -LL | t.unstable_undeclared_trait_method(); //~ ERROR use of unstable library feature +LL | t.unstable_undeclared_trait_method(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_undeclared)] to the crate attributes to enable @@ -103,7 +103,7 @@ LL | t.unstable_undeclared_trait_method(); //~ ERROR use of unstable library error[E0658]: use of unstable library feature 'unstable_undeclared' (see issue #38412) --> $DIR/explore-issue-38412.rs:61:7 | -LL | t.unstable_undeclared(); //~ ERROR use of unstable library feature +LL | t.unstable_undeclared(); | ^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_undeclared)] to the crate attributes to enable @@ -111,19 +111,19 @@ LL | t.unstable_undeclared(); //~ ERROR use of unstable library error[E0624]: method `pub_crate` is private --> $DIR/explore-issue-38412.rs:63:7 | -LL | t.pub_crate(); //~ ERROR `pub_crate` is private +LL | t.pub_crate(); | ^^^^^^^^^ error[E0624]: method `pub_mod` is private --> $DIR/explore-issue-38412.rs:64:7 | -LL | t.pub_mod(); //~ ERROR `pub_mod` is private +LL | t.pub_mod(); | ^^^^^^^ error[E0624]: method `private` is private --> $DIR/explore-issue-38412.rs:65:7 | -LL | t.private(); //~ ERROR `private` is private +LL | t.private(); | ^^^^^^^ error: aborting due to 19 previous errors diff --git a/src/test/ui/export-fully-qualified.stderr b/src/test/ui/export-fully-qualified.stderr index dd7e3219c76a..c2ec1600868a 100644 --- a/src/test/ui/export-fully-qualified.stderr +++ b/src/test/ui/export-fully-qualified.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: use of undeclared type or module `foo` --> $DIR/export-fully-qualified.rs:6:20 | -LL | pub fn bar() { foo::baz(); } //~ ERROR failed to resolve: use of undeclared type or module `foo` +LL | pub fn bar() { foo::baz(); } | ^^^ use of undeclared type or module `foo` error: aborting due to previous error diff --git a/src/test/ui/export-tag-variant.stderr b/src/test/ui/export-tag-variant.stderr index eb202b3b31b0..b5a2c12c436d 100644 --- a/src/test/ui/export-tag-variant.stderr +++ b/src/test/ui/export-tag-variant.stderr @@ -1,7 +1,7 @@ error[E0603]: enum `Y` is private --> $DIR/export-tag-variant.rs:7:26 | -LL | fn main() { let z = foo::Y::Y1; } //~ ERROR: enum `Y` is private +LL | fn main() { let z = foo::Y::Y1; } | ^ error: aborting due to previous error diff --git a/src/test/ui/export.stderr b/src/test/ui/export.stderr index ff7763bbd899..76ec91e181d5 100644 --- a/src/test/ui/export.stderr +++ b/src/test/ui/export.stderr @@ -25,7 +25,7 @@ LL | fn z(y: isize) { log(debug, y); } error[E0603]: function `z` is private --> $DIR/export.rs:10:18 | -LL | fn main() { foo::z(10); } //~ ERROR function `z` is private +LL | fn main() { foo::z(10); } | ^ error: aborting due to 5 previous errors diff --git a/src/test/ui/export2.stderr b/src/test/ui/export2.stderr index 6233c6d074e6..e0cd4404d377 100644 --- a/src/test/ui/export2.stderr +++ b/src/test/ui/export2.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: use of undeclared type or module `bar` --> $DIR/export2.rs:2:18 | -LL | pub fn x() { bar::x(); } //~ ERROR failed to resolve: use of undeclared type or module `bar` +LL | pub fn x() { bar::x(); } | ^^^ use of undeclared type or module `bar` error: aborting due to previous error diff --git a/src/test/ui/expr_attr_paren_order.stderr b/src/test/ui/expr_attr_paren_order.stderr index 8155514191ce..89f615f53ddd 100644 --- a/src/test/ui/expr_attr_paren_order.stderr +++ b/src/test/ui/expr_attr_paren_order.stderr @@ -1,7 +1,7 @@ error: variable `X` should have a snake case name --> $DIR/expr_attr_paren_order.rs:19:17 | -LL | let X = 0; //~ ERROR snake case name +LL | let X = 0; | ^ help: convert the identifier to snake case: `x` | note: lint level defined here diff --git a/src/test/ui/extenv/extenv-arg-2-not-string-literal.stderr b/src/test/ui/extenv/extenv-arg-2-not-string-literal.stderr index 92c04f9fe8a5..258e2b347fba 100644 --- a/src/test/ui/extenv/extenv-arg-2-not-string-literal.stderr +++ b/src/test/ui/extenv/extenv-arg-2-not-string-literal.stderr @@ -1,7 +1,7 @@ error: expected string literal --> $DIR/extenv-arg-2-not-string-literal.rs:1:25 | -LL | fn main() { env!("one", 10); } //~ ERROR: expected string literal +LL | fn main() { env!("one", 10); } | ^^ error: aborting due to previous error diff --git a/src/test/ui/extenv/extenv-no-args.stderr b/src/test/ui/extenv/extenv-no-args.stderr index 7ae8a6f1858a..acdde84afa4d 100644 --- a/src/test/ui/extenv/extenv-no-args.stderr +++ b/src/test/ui/extenv/extenv-no-args.stderr @@ -1,7 +1,7 @@ error: env! takes 1 or 2 arguments --> $DIR/extenv-no-args.rs:1:13 | -LL | fn main() { env!(); } //~ ERROR: env! takes 1 or 2 arguments +LL | fn main() { env!(); } | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/extenv/extenv-not-defined-custom.stderr b/src/test/ui/extenv/extenv-not-defined-custom.stderr index 34e5b7f9f236..523982dd0196 100644 --- a/src/test/ui/extenv/extenv-not-defined-custom.stderr +++ b/src/test/ui/extenv/extenv-not-defined-custom.stderr @@ -1,7 +1,7 @@ error: my error message --> $DIR/extenv-not-defined-custom.rs:1:13 | -LL | fn main() { env!("__HOPEFULLY_NOT_DEFINED__", "my error message"); } //~ ERROR: my error message +LL | fn main() { env!("__HOPEFULLY_NOT_DEFINED__", "my error message"); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/extenv/extenv-not-string-literal.stderr b/src/test/ui/extenv/extenv-not-string-literal.stderr index 66645b24a49a..342a9f7096e7 100644 --- a/src/test/ui/extenv/extenv-not-string-literal.stderr +++ b/src/test/ui/extenv/extenv-not-string-literal.stderr @@ -1,7 +1,7 @@ error: expected string literal --> $DIR/extenv-not-string-literal.rs:1:18 | -LL | fn main() { env!(10, "two"); } //~ ERROR: expected string literal +LL | fn main() { env!(10, "two"); } | ^^ error: aborting due to previous error diff --git a/src/test/ui/extenv/extenv-too-many-args.stderr b/src/test/ui/extenv/extenv-too-many-args.stderr index 43695d88eaf6..3351da0d5476 100644 --- a/src/test/ui/extenv/extenv-too-many-args.stderr +++ b/src/test/ui/extenv/extenv-too-many-args.stderr @@ -1,7 +1,7 @@ error: env! takes 1 or 2 arguments --> $DIR/extenv-too-many-args.rs:1:13 | -LL | fn main() { env!("one", "two", "three"); } //~ ERROR: env! takes 1 or 2 arguments +LL | fn main() { env!("one", "two", "three"); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/extenv/issue-55897.stderr b/src/test/ui/extenv/issue-55897.stderr index 4d2e35dff462..9f6570ab2a0f 100644 --- a/src/test/ui/extenv/issue-55897.stderr +++ b/src/test/ui/extenv/issue-55897.stderr @@ -7,8 +7,11 @@ LL | include!(concat!(env!("NON_EXISTENT"), "/data.rs")); error[E0432]: unresolved import `prelude` --> $DIR/issue-55897.rs:1:5 | -LL | use prelude::*; //~ ERROR unresolved import `prelude` - | ^^^^^^^ did you mean `std::prelude`? +LL | use prelude::*; + | ^^^^^^^ + | | + | unresolved import + | help: a similar path exists: `std::prelude` error: cannot determine resolution for the macro `env` --> $DIR/issue-55897.rs:6:22 diff --git a/src/test/ui/extern/extern-const.stderr b/src/test/ui/extern/extern-const.stderr index 7ebaec0368e3..77406be2095c 100644 --- a/src/test/ui/extern/extern-const.stderr +++ b/src/test/ui/extern/extern-const.stderr @@ -1,7 +1,7 @@ error: extern items cannot be `const` --> $DIR/extern-const.rs:15:5 | -LL | const rust_dbg_static_mut: libc::c_int; //~ ERROR extern items cannot be `const` +LL | const rust_dbg_static_mut: libc::c_int; | ^^^^^ help: try using a static value: `static` error: aborting due to previous error diff --git a/src/test/ui/extern/extern-crate-rename.stderr b/src/test/ui/extern/extern-crate-rename.stderr index 204e7dd64df4..787c11f2a81a 100644 --- a/src/test/ui/extern/extern-crate-rename.stderr +++ b/src/test/ui/extern/extern-crate-rename.stderr @@ -3,13 +3,13 @@ error[E0259]: the name `m1` is defined multiple times | LL | extern crate m1; | ---------------- previous import of the extern crate `m1` here -LL | extern crate m2 as m1; //~ ERROR is defined multiple times +LL | extern crate m2 as m1; | ^^^^^^^^^^^^^^^^^^^^^^ `m1` reimported here | = note: `m1` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | extern crate m2 as other_m1; //~ ERROR is defined multiple times +LL | extern crate m2 as other_m1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/extern/extern-crate-visibility.stderr b/src/test/ui/extern/extern-crate-visibility.stderr index 8baac1a902b8..8bc9f9a67e7e 100644 --- a/src/test/ui/extern/extern-crate-visibility.stderr +++ b/src/test/ui/extern/extern-crate-visibility.stderr @@ -1,13 +1,13 @@ error[E0603]: extern crate `core` is private --> $DIR/extern-crate-visibility.rs:6:10 | -LL | use foo::core::cell; //~ ERROR extern crate `core` is private +LL | use foo::core::cell; | ^^^^ error[E0603]: extern crate `core` is private --> $DIR/extern-crate-visibility.rs:9:10 | -LL | foo::core::cell::Cell::new(0); //~ ERROR extern crate `core` is private +LL | foo::core::cell::Cell::new(0); | ^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/extern/extern-macro.stderr b/src/test/ui/extern/extern-macro.stderr index d70b6ef79ea8..5b7a720736a1 100644 --- a/src/test/ui/extern/extern-macro.stderr +++ b/src/test/ui/extern/extern-macro.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: partially resolved path in a macro --> $DIR/extern-macro.rs:5:13 | -LL | let _ = Foo::bar!(); //~ ERROR failed to resolve: partially resolved path in a macro +LL | let _ = Foo::bar!(); | ^^^^^^^^ partially resolved path in a macro error: aborting due to previous error diff --git a/src/test/ui/extern/extern-main-fn.stderr b/src/test/ui/extern/extern-main-fn.stderr index f2134701deee..14f064060a62 100644 --- a/src/test/ui/extern/extern-main-fn.stderr +++ b/src/test/ui/extern/extern-main-fn.stderr @@ -1,7 +1,7 @@ error[E0580]: main function has wrong type --> $DIR/extern-main-fn.rs:1:1 | -LL | extern fn main() {} //~ ERROR: main function has wrong type [E0580] +LL | extern fn main() {} | ^^^^^^^^^^^^^^^^ expected "Rust" fn, found "C" fn | = note: expected type `fn()` diff --git a/src/test/ui/extern/extern-types-distinct-types.stderr b/src/test/ui/extern/extern-types-distinct-types.stderr index b7b6f2cf04ae..eb632ee395f2 100644 --- a/src/test/ui/extern/extern-types-distinct-types.stderr +++ b/src/test/ui/extern/extern-types-distinct-types.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/extern-types-distinct-types.rs:9:5 | -LL | r //~ ERROR mismatched types +LL | r | ^ expected extern type `B`, found extern type `A` | = note: expected type `&B` diff --git a/src/test/ui/extoption_env-no-args.stderr b/src/test/ui/extoption_env-no-args.stderr index 34fe289cd98a..386d517a4460 100644 --- a/src/test/ui/extoption_env-no-args.stderr +++ b/src/test/ui/extoption_env-no-args.stderr @@ -1,7 +1,7 @@ error: option_env! takes 1 argument --> $DIR/extoption_env-no-args.rs:1:13 | -LL | fn main() { option_env!(); } //~ ERROR: option_env! takes 1 argument +LL | fn main() { option_env!(); } | ^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/extoption_env-not-string-literal.stderr b/src/test/ui/extoption_env-not-string-literal.stderr index 8c97b57e0ab9..272751916f5b 100644 --- a/src/test/ui/extoption_env-not-string-literal.stderr +++ b/src/test/ui/extoption_env-not-string-literal.stderr @@ -1,7 +1,7 @@ error: argument must be a string literal --> $DIR/extoption_env-not-string-literal.rs:1:25 | -LL | fn main() { option_env!(10); } //~ ERROR: argument must be a string literal +LL | fn main() { option_env!(10); } | ^^ error: aborting due to previous error diff --git a/src/test/ui/extoption_env-too-many-args.stderr b/src/test/ui/extoption_env-too-many-args.stderr index 6b5ade6daef2..2ec559470326 100644 --- a/src/test/ui/extoption_env-too-many-args.stderr +++ b/src/test/ui/extoption_env-too-many-args.stderr @@ -1,7 +1,7 @@ error: option_env! takes 1 argument --> $DIR/extoption_env-too-many-args.rs:1:13 | -LL | fn main() { option_env!("one", "two"); } //~ ERROR: option_env! takes 1 argument +LL | fn main() { option_env!("one", "two"); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/fail-no-dead-code-core.stderr b/src/test/ui/fail-no-dead-code-core.stderr index b78aed456830..2540242f9f68 100644 --- a/src/test/ui/fail-no-dead-code-core.stderr +++ b/src/test/ui/fail-no-dead-code-core.stderr @@ -1,7 +1,7 @@ error: function is never used: `foo` --> $DIR/fail-no-dead-code-core.rs:7:1 | -LL | fn foo() { //~ ERROR function is never used +LL | fn foo() { | ^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/fail-no-dead-code.stderr b/src/test/ui/fail-no-dead-code.stderr index a43582959311..8babcffaa8dd 100644 --- a/src/test/ui/fail-no-dead-code.stderr +++ b/src/test/ui/fail-no-dead-code.stderr @@ -1,7 +1,7 @@ error: function is never used: `foo` --> $DIR/fail-no-dead-code.rs:4:1 | -LL | fn foo() { //~ ERROR function is never used +LL | fn foo() { | ^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/fail-simple.stderr b/src/test/ui/fail-simple.stderr index 31be4e2c87a6..26ed918e94d9 100644 --- a/src/test/ui/fail-simple.stderr +++ b/src/test/ui/fail-simple.stderr @@ -1,7 +1,7 @@ error: no rules expected the token `@` --> $DIR/fail-simple.rs:2:12 | -LL | panic!(@); //~ ERROR no rules expected the token `@` +LL | panic!(@); | ^ no rules expected this token in macro call error: aborting due to previous error diff --git a/src/test/ui/fat-ptr-cast.stderr b/src/test/ui/fat-ptr-cast.stderr index 936cdc559bd1..fb1602423938 100644 --- a/src/test/ui/fat-ptr-cast.stderr +++ b/src/test/ui/fat-ptr-cast.stderr @@ -1,7 +1,7 @@ error[E0606]: casting `&[i32]` as `usize` is invalid --> $DIR/fat-ptr-cast.rs:10:5 | -LL | a as usize; //~ ERROR casting +LL | a as usize; | ^^^^^^^^^^ | = help: cast through a raw pointer first @@ -9,7 +9,7 @@ LL | a as usize; //~ ERROR casting error[E0606]: casting `&[i32]` as `isize` is invalid --> $DIR/fat-ptr-cast.rs:11:5 | -LL | a as isize; //~ ERROR casting +LL | a as isize; | ^^^^^^^^^^ | = help: cast through a raw pointer first @@ -17,7 +17,7 @@ LL | a as isize; //~ ERROR casting error[E0606]: casting `&[i32]` as `i16` is invalid --> $DIR/fat-ptr-cast.rs:12:5 | -LL | a as i16; //~ ERROR casting `&[i32]` as `i16` is invalid +LL | a as i16; | ^^^^^^^^ | = help: cast through a raw pointer first @@ -25,7 +25,7 @@ LL | a as i16; //~ ERROR casting `&[i32]` as `i16` is invalid error[E0606]: casting `&[i32]` as `u32` is invalid --> $DIR/fat-ptr-cast.rs:13:5 | -LL | a as u32; //~ ERROR casting `&[i32]` as `u32` is invalid +LL | a as u32; | ^^^^^^^^ | = help: cast through a raw pointer first @@ -33,7 +33,7 @@ LL | a as u32; //~ ERROR casting `&[i32]` as `u32` is invalid error[E0605]: non-primitive cast: `std::boxed::Box<[i32]>` as `usize` --> $DIR/fat-ptr-cast.rs:14:5 | -LL | b as usize; //~ ERROR non-primitive cast +LL | b as usize; | ^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait @@ -49,19 +49,19 @@ LL | p as usize; error[E0607]: cannot cast thin pointer `*const i32` to fat pointer `*const [i32]` --> $DIR/fat-ptr-cast.rs:19:5 | -LL | q as *const [i32]; //~ ERROR cannot cast +LL | q as *const [i32]; | ^^^^^^^^^^^^^^^^^ error[E0606]: casting `usize` as `*mut (dyn Trait + 'static)` is invalid --> $DIR/fat-ptr-cast.rs:22:37 | -LL | let t: *mut (Trait + 'static) = 0 as *mut _; //~ ERROR casting +LL | let t: *mut (Trait + 'static) = 0 as *mut _; | ^^^^^^^^^^^ error[E0606]: casting `usize` as `*const str` is invalid --> $DIR/fat-ptr-cast.rs:23:32 | -LL | let mut fail: *const str = 0 as *const str; //~ ERROR casting +LL | let mut fail: *const str = 0 as *const str; | ^^^^^^^^^^^^^^^ error: aborting due to 9 previous errors diff --git a/src/test/ui/feature-gate-optimize_attribute.stderr b/src/test/ui/feature-gate-optimize_attribute.stderr index ddd4c457d731..7635af6ce46f 100644 --- a/src/test/ui/feature-gate-optimize_attribute.stderr +++ b/src/test/ui/feature-gate-optimize_attribute.stderr @@ -1,7 +1,7 @@ error[E0658]: #[optimize] attribute is an unstable feature (see issue #54882) --> $DIR/feature-gate-optimize_attribute.rs:7:1 | -LL | #[optimize(size)] //~ ERROR #54882 +LL | #[optimize(size)] | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(optimize_attribute)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #[optimize(size)] //~ ERROR #54882 error[E0658]: #[optimize] attribute is an unstable feature (see issue #54882) --> $DIR/feature-gate-optimize_attribute.rs:10:1 | -LL | #[optimize(speed)] //~ ERROR #54882 +LL | #[optimize(speed)] | ^^^^^^^^^^^^^^^^^^ | = help: add #![feature(optimize_attribute)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | #[optimize(banana)] error[E0658]: #[optimize] attribute is an unstable feature (see issue #54882) --> $DIR/feature-gate-optimize_attribute.rs:4:1 | -LL | #[optimize(size)] //~ ERROR #54882 +LL | #[optimize(size)] | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(optimize_attribute)] to the crate attributes to enable @@ -33,7 +33,7 @@ LL | #[optimize(size)] //~ ERROR #54882 error[E0658]: #[optimize] attribute is an unstable feature (see issue #54882) --> $DIR/feature-gate-optimize_attribute.rs:2:1 | -LL | #![optimize(speed)] //~ ERROR #54882 +LL | #![optimize(speed)] | ^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(optimize_attribute)] to the crate attributes to enable diff --git a/src/test/ui/feature-gate/duplicate-features.stderr b/src/test/ui/feature-gate/duplicate-features.stderr index 18adf3a880ac..dbde806f6cc4 100644 --- a/src/test/ui/feature-gate/duplicate-features.stderr +++ b/src/test/ui/feature-gate/duplicate-features.stderr @@ -1,13 +1,13 @@ error[E0636]: the feature `if_let` has already been declared --> $DIR/duplicate-features.rs:7:12 | -LL | #![feature(if_let)] //~ ERROR the feature `if_let` has already been declared +LL | #![feature(if_let)] | ^^^^^^ error[E0636]: the feature `rust1` has already been declared --> $DIR/duplicate-features.rs:4:12 | -LL | #![feature(rust1)] //~ ERROR the feature `rust1` has already been declared +LL | #![feature(rust1)] | ^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/feature-gate/feature-gate-c_variadic.rs b/src/test/ui/feature-gate/feature-gate-c_variadic.rs new file mode 100644 index 000000000000..5801a2a89e2c --- /dev/null +++ b/src/test/ui/feature-gate/feature-gate-c_variadic.rs @@ -0,0 +1,4 @@ +#![crate_type="lib"] + +pub unsafe extern "C" fn test(_: i32, ap: ...) { } +//~^ C-varaidic functions are unstable diff --git a/src/test/ui/feature-gate/feature-gate-c_variadic.stderr b/src/test/ui/feature-gate/feature-gate-c_variadic.stderr new file mode 100644 index 000000000000..a876e16fdea4 --- /dev/null +++ b/src/test/ui/feature-gate/feature-gate-c_variadic.stderr @@ -0,0 +1,11 @@ +error[E0658]: C-varaidic functions are unstable (see issue #44930) + --> $DIR/feature-gate-c_variadic.rs:3:1 + | +LL | pub unsafe extern "C" fn test(_: i32, ap: ...) { } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(c_variadic)] to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr index 4d15ccb300a8..c539e24c01b1 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr @@ -1,7 +1,7 @@ warning: unknown lint: `x5400` --> $DIR/issue-43106-gating-of-builtin-attrs.rs:38:9 | -LL | #![warn(x5400)] //~ WARN unknown lint: `x5400` +LL | #![warn(x5400)] | ^^^^^ | note: lint level defined here @@ -13,19 +13,19 @@ LL | #![warn(unused_attributes, unknown_lints)] warning: unknown lint: `x5300` --> $DIR/issue-43106-gating-of-builtin-attrs.rs:39:10 | -LL | #![allow(x5300)] //~ WARN unknown lint: `x5300` +LL | #![allow(x5300)] | ^^^^^ warning: unknown lint: `x5200` --> $DIR/issue-43106-gating-of-builtin-attrs.rs:40:11 | -LL | #![forbid(x5200)] //~ WARN unknown lint: `x5200` +LL | #![forbid(x5200)] | ^^^^^ warning: unknown lint: `x5100` --> $DIR/issue-43106-gating-of-builtin-attrs.rs:41:9 | -LL | #![deny(x5100)] //~ WARN unknown lint: `x5100` +LL | #![deny(x5100)] | ^^^^^ warning: unknown lint: `x5400` @@ -1113,25 +1113,25 @@ LL | #[type_length_limit="0100"] warning: unused attribute --> $DIR/issue-43106-gating-of-builtin-attrs.rs:43:1 | -LL | #![macro_export] //~ WARN unused attribute +LL | #![macro_export] | ^^^^^^^^^^^^^^^^ warning: unused attribute --> $DIR/issue-43106-gating-of-builtin-attrs.rs:44:1 | -LL | #![plugin_registrar] //~ WARN unused attribute +LL | #![plugin_registrar] | ^^^^^^^^^^^^^^^^^^^^ warning: unused attribute --> $DIR/issue-43106-gating-of-builtin-attrs.rs:47:1 | -LL | #![main] //~ WARN unused attribute +LL | #![main] | ^^^^^^^^ warning: unused attribute --> $DIR/issue-43106-gating-of-builtin-attrs.rs:48:1 | -LL | #![start] //~ WARN unused attribute +LL | #![start] | ^^^^^^^^^ warning: unused attribute @@ -1143,37 +1143,37 @@ LL | #![repr()] warning: unused attribute --> $DIR/issue-43106-gating-of-builtin-attrs.rs:53:1 | -LL | #![path = "3800"] //~ WARN unused attribute +LL | #![path = "3800"] | ^^^^^^^^^^^^^^^^^ warning: unused attribute --> $DIR/issue-43106-gating-of-builtin-attrs.rs:54:1 | -LL | #![automatically_derived] //~ WARN unused attribute +LL | #![automatically_derived] | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute --> $DIR/issue-43106-gating-of-builtin-attrs.rs:56:1 | -LL | #![no_link] //~ WARN unused attribute +LL | #![no_link] | ^^^^^^^^^^^ warning: unused attribute --> $DIR/issue-43106-gating-of-builtin-attrs.rs:58:1 | -LL | #![should_panic] //~ WARN unused attribute +LL | #![should_panic] | ^^^^^^^^^^^^^^^^ warning: unused attribute --> $DIR/issue-43106-gating-of-builtin-attrs.rs:59:1 | -LL | #![ignore] //~ WARN unused attribute +LL | #![ignore] | ^^^^^^^^^^ warning: unused attribute --> $DIR/issue-43106-gating-of-builtin-attrs.rs:65:1 | -LL | #![proc_macro_derive()] //~ WARN unused attribute +LL | #![proc_macro_derive()] | ^^^^^^^^^^^^^^^^^^^^^^^ error: invalid windows subsystem `1000`, only `windows` and `console` are allowed diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr index 71e8f11ff078..ef89a887fd44 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr @@ -13,13 +13,13 @@ error[E0518]: attribute should be applied to function or closure | LL | #[inline] | ^^^^^^^^^ -LL | //~^ ERROR attribute should be applied to function or closure +LL | LL | / mod inline { LL | | mod inner { #![inline] } -LL | | //~^ ERROR attribute should be applied to function or closure +LL | | LL | | ... | -LL | | //~^ ERROR attribute should be applied to function or closure +LL | | LL | | } | |_- not a function or closure diff --git a/src/test/ui/feature-gate/issue-49983-see-issue-0.stderr b/src/test/ui/feature-gate/issue-49983-see-issue-0.stderr index 22ad8c8b77e9..83775322a270 100644 --- a/src/test/ui/feature-gate/issue-49983-see-issue-0.stderr +++ b/src/test/ui/feature-gate/issue-49983-see-issue-0.stderr @@ -1,7 +1,7 @@ error[E0658]: use of unstable library feature 'ptr_internals': use NonNull instead and consider PhantomData (if you also use #[may_dangle]), Send, and/or Sync --> $DIR/issue-49983-see-issue-0.rs:4:30 | -LL | #[allow(unused_imports)] use core::ptr::Unique; //~ ERROR use of unstable library feature +LL | #[allow(unused_imports)] use core::ptr::Unique; | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(ptr_internals)] to the crate attributes to enable diff --git a/src/test/ui/feature-gate/unknown-feature.stderr b/src/test/ui/feature-gate/unknown-feature.stderr index 2f8bf20ce467..e5c05872dbf8 100644 --- a/src/test/ui/feature-gate/unknown-feature.stderr +++ b/src/test/ui/feature-gate/unknown-feature.stderr @@ -1,7 +1,7 @@ error[E0635]: unknown feature `unknown_rust_feature` --> $DIR/unknown-feature.rs:1:12 | -LL | #![feature(unknown_rust_feature)] //~ ERROR unknown feature +LL | #![feature(unknown_rust_feature)] | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/feature-gated-feature-in-macro-arg.stderr b/src/test/ui/feature-gated-feature-in-macro-arg.stderr index b262a6f7005e..5cbd1023b3cc 100644 --- a/src/test/ui/feature-gated-feature-in-macro-arg.stderr +++ b/src/test/ui/feature-gated-feature-in-macro-arg.stderr @@ -1,7 +1,7 @@ error[E0658]: intrinsics are subject to change --> $DIR/feature-gated-feature-in-macro-arg.rs:8:9 | -LL | / extern "rust-intrinsic" { //~ ERROR intrinsics are subject to change +LL | / extern "rust-intrinsic" { LL | | fn atomic_fence(); LL | | } | |_________^ diff --git a/src/test/ui/feature-gates/feature-gate-abi.stderr b/src/test/ui/feature-gates/feature-gate-abi.stderr index d528788f7c22..7417f310921d 100644 --- a/src/test/ui/feature-gates/feature-gate-abi.stderr +++ b/src/test/ui/feature-gates/feature-gate-abi.stderr @@ -1,7 +1,7 @@ error[E0658]: intrinsics are subject to change --> $DIR/feature-gate-abi.rs:12:1 | -LL | extern "rust-intrinsic" fn f1() {} //~ ERROR intrinsics are subject to change +LL | extern "rust-intrinsic" fn f1() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(intrinsics)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | extern "rust-intrinsic" fn f1() {} //~ ERROR intrinsics are subject to chan error[E0658]: platform intrinsics are experimental and possibly buggy (see issue #27731) --> $DIR/feature-gate-abi.rs:13:1 | -LL | extern "platform-intrinsic" fn f2() {} //~ ERROR platform intrinsics are experimental +LL | extern "platform-intrinsic" fn f2() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(platform_intrinsics)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | extern "platform-intrinsic" fn f2() {} //~ ERROR platform intrinsics are ex error[E0658]: vectorcall is experimental and subject to change --> $DIR/feature-gate-abi.rs:14:1 | -LL | extern "vectorcall" fn f3() {} //~ ERROR vectorcall is experimental and subject to change +LL | extern "vectorcall" fn f3() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_vectorcall)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | extern "vectorcall" fn f3() {} //~ ERROR vectorcall is experimental and sub error[E0658]: rust-call ABI is subject to change (see issue #29625) --> $DIR/feature-gate-abi.rs:15:1 | -LL | extern "rust-call" fn f4() {} //~ ERROR rust-call ABI is subject to change +LL | extern "rust-call" fn f4() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unboxed_closures)] to the crate attributes to enable @@ -33,7 +33,7 @@ LL | extern "rust-call" fn f4() {} //~ ERROR rust-call ABI is subject to change error[E0658]: msp430-interrupt ABI is experimental and subject to change (see issue #38487) --> $DIR/feature-gate-abi.rs:16:1 | -LL | extern "msp430-interrupt" fn f5() {} //~ ERROR msp430-interrupt ABI is experimental +LL | extern "msp430-interrupt" fn f5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable @@ -41,7 +41,7 @@ LL | extern "msp430-interrupt" fn f5() {} //~ ERROR msp430-interrupt ABI is expe error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788) --> $DIR/feature-gate-abi.rs:17:1 | -LL | extern "ptx-kernel" fn f6() {} //~ ERROR PTX ABIs are experimental and subject to change +LL | extern "ptx-kernel" fn f6() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_ptx)] to the crate attributes to enable @@ -49,7 +49,7 @@ LL | extern "ptx-kernel" fn f6() {} //~ ERROR PTX ABIs are experimental and subj error[E0658]: x86-interrupt ABI is experimental and subject to change (see issue #40180) --> $DIR/feature-gate-abi.rs:18:1 | -LL | extern "x86-interrupt" fn f7() {} //~ ERROR x86-interrupt ABI is experimental +LL | extern "x86-interrupt" fn f7() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable @@ -57,7 +57,7 @@ LL | extern "x86-interrupt" fn f7() {} //~ ERROR x86-interrupt ABI is experiment error[E0658]: thiscall is experimental and subject to change --> $DIR/feature-gate-abi.rs:19:1 | -LL | extern "thiscall" fn f8() {} //~ ERROR thiscall is experimental and subject to change +LL | extern "thiscall" fn f8() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_thiscall)] to the crate attributes to enable @@ -65,7 +65,7 @@ LL | extern "thiscall" fn f8() {} //~ ERROR thiscall is experimental and subject error[E0658]: amdgpu-kernel ABI is experimental and subject to change (see issue #51575) --> $DIR/feature-gate-abi.rs:20:1 | -LL | extern "amdgpu-kernel" fn f9() {} //~ ERROR amdgpu-kernel ABI is experimental and subject to change +LL | extern "amdgpu-kernel" fn f9() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_amdgpu_kernel)] to the crate attributes to enable @@ -73,7 +73,7 @@ LL | extern "amdgpu-kernel" fn f9() {} //~ ERROR amdgpu-kernel ABI is experiment error[E0658]: intrinsics are subject to change --> $DIR/feature-gate-abi.rs:24:5 | -LL | extern "rust-intrinsic" fn m1(); //~ ERROR intrinsics are subject to change +LL | extern "rust-intrinsic" fn m1(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(intrinsics)] to the crate attributes to enable @@ -81,7 +81,7 @@ LL | extern "rust-intrinsic" fn m1(); //~ ERROR intrinsics are subject to ch error[E0658]: platform intrinsics are experimental and possibly buggy (see issue #27731) --> $DIR/feature-gate-abi.rs:25:5 | -LL | extern "platform-intrinsic" fn m2(); //~ ERROR platform intrinsics are experimental +LL | extern "platform-intrinsic" fn m2(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(platform_intrinsics)] to the crate attributes to enable @@ -89,7 +89,7 @@ LL | extern "platform-intrinsic" fn m2(); //~ ERROR platform intrinsics are error[E0658]: vectorcall is experimental and subject to change --> $DIR/feature-gate-abi.rs:26:5 | -LL | extern "vectorcall" fn m3(); //~ ERROR vectorcall is experimental and subject to change +LL | extern "vectorcall" fn m3(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_vectorcall)] to the crate attributes to enable @@ -97,7 +97,7 @@ LL | extern "vectorcall" fn m3(); //~ ERROR vectorcall is experimental and s error[E0658]: rust-call ABI is subject to change (see issue #29625) --> $DIR/feature-gate-abi.rs:27:5 | -LL | extern "rust-call" fn m4(); //~ ERROR rust-call ABI is subject to change +LL | extern "rust-call" fn m4(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unboxed_closures)] to the crate attributes to enable @@ -105,7 +105,7 @@ LL | extern "rust-call" fn m4(); //~ ERROR rust-call ABI is subject to chang error[E0658]: msp430-interrupt ABI is experimental and subject to change (see issue #38487) --> $DIR/feature-gate-abi.rs:28:5 | -LL | extern "msp430-interrupt" fn m5(); //~ ERROR msp430-interrupt ABI is experimental +LL | extern "msp430-interrupt" fn m5(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable @@ -113,7 +113,7 @@ LL | extern "msp430-interrupt" fn m5(); //~ ERROR msp430-interrupt ABI is ex error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788) --> $DIR/feature-gate-abi.rs:29:5 | -LL | extern "ptx-kernel" fn m6(); //~ ERROR PTX ABIs are experimental and subject to change +LL | extern "ptx-kernel" fn m6(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_ptx)] to the crate attributes to enable @@ -121,7 +121,7 @@ LL | extern "ptx-kernel" fn m6(); //~ ERROR PTX ABIs are experimental and su error[E0658]: x86-interrupt ABI is experimental and subject to change (see issue #40180) --> $DIR/feature-gate-abi.rs:30:5 | -LL | extern "x86-interrupt" fn m7(); //~ ERROR x86-interrupt ABI is experimental +LL | extern "x86-interrupt" fn m7(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable @@ -129,7 +129,7 @@ LL | extern "x86-interrupt" fn m7(); //~ ERROR x86-interrupt ABI is experime error[E0658]: thiscall is experimental and subject to change --> $DIR/feature-gate-abi.rs:31:5 | -LL | extern "thiscall" fn m8(); //~ ERROR thiscall is experimental and subject to change +LL | extern "thiscall" fn m8(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_thiscall)] to the crate attributes to enable @@ -137,7 +137,7 @@ LL | extern "thiscall" fn m8(); //~ ERROR thiscall is experimental and subje error[E0658]: amdgpu-kernel ABI is experimental and subject to change (see issue #51575) --> $DIR/feature-gate-abi.rs:32:5 | -LL | extern "amdgpu-kernel" fn m9(); //~ ERROR amdgpu-kernel ABI is experimental and subject to change +LL | extern "amdgpu-kernel" fn m9(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_amdgpu_kernel)] to the crate attributes to enable @@ -145,7 +145,7 @@ LL | extern "amdgpu-kernel" fn m9(); //~ ERROR amdgpu-kernel ABI is experime error[E0658]: intrinsics are subject to change --> $DIR/feature-gate-abi.rs:34:5 | -LL | extern "rust-intrinsic" fn dm1() {} //~ ERROR intrinsics are subject to change +LL | extern "rust-intrinsic" fn dm1() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(intrinsics)] to the crate attributes to enable @@ -153,7 +153,7 @@ LL | extern "rust-intrinsic" fn dm1() {} //~ ERROR intrinsics are subject to error[E0658]: platform intrinsics are experimental and possibly buggy (see issue #27731) --> $DIR/feature-gate-abi.rs:35:5 | -LL | extern "platform-intrinsic" fn dm2() {} //~ ERROR platform intrinsics are experimental +LL | extern "platform-intrinsic" fn dm2() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(platform_intrinsics)] to the crate attributes to enable @@ -161,7 +161,7 @@ LL | extern "platform-intrinsic" fn dm2() {} //~ ERROR platform intrinsics a error[E0658]: vectorcall is experimental and subject to change --> $DIR/feature-gate-abi.rs:36:5 | -LL | extern "vectorcall" fn dm3() {} //~ ERROR vectorcall is experimental and subject to change +LL | extern "vectorcall" fn dm3() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_vectorcall)] to the crate attributes to enable @@ -169,7 +169,7 @@ LL | extern "vectorcall" fn dm3() {} //~ ERROR vectorcall is experimental an error[E0658]: rust-call ABI is subject to change (see issue #29625) --> $DIR/feature-gate-abi.rs:37:5 | -LL | extern "rust-call" fn dm4() {} //~ ERROR rust-call ABI is subject to change +LL | extern "rust-call" fn dm4() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unboxed_closures)] to the crate attributes to enable @@ -177,7 +177,7 @@ LL | extern "rust-call" fn dm4() {} //~ ERROR rust-call ABI is subject to ch error[E0658]: msp430-interrupt ABI is experimental and subject to change (see issue #38487) --> $DIR/feature-gate-abi.rs:38:5 | -LL | extern "msp430-interrupt" fn dm5() {} //~ ERROR msp430-interrupt ABI is experimental +LL | extern "msp430-interrupt" fn dm5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable @@ -185,7 +185,7 @@ LL | extern "msp430-interrupt" fn dm5() {} //~ ERROR msp430-interrupt ABI is error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788) --> $DIR/feature-gate-abi.rs:39:5 | -LL | extern "ptx-kernel" fn dm6() {} //~ ERROR PTX ABIs are experimental and subject to change +LL | extern "ptx-kernel" fn dm6() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_ptx)] to the crate attributes to enable @@ -193,7 +193,7 @@ LL | extern "ptx-kernel" fn dm6() {} //~ ERROR PTX ABIs are experimental and error[E0658]: x86-interrupt ABI is experimental and subject to change (see issue #40180) --> $DIR/feature-gate-abi.rs:40:5 | -LL | extern "x86-interrupt" fn dm7() {} //~ ERROR x86-interrupt ABI is experimental +LL | extern "x86-interrupt" fn dm7() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable @@ -201,7 +201,7 @@ LL | extern "x86-interrupt" fn dm7() {} //~ ERROR x86-interrupt ABI is exper error[E0658]: thiscall is experimental and subject to change --> $DIR/feature-gate-abi.rs:41:5 | -LL | extern "thiscall" fn dm8() {} //~ ERROR thiscall is experimental and subject to change +LL | extern "thiscall" fn dm8() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_thiscall)] to the crate attributes to enable @@ -209,7 +209,7 @@ LL | extern "thiscall" fn dm8() {} //~ ERROR thiscall is experimental and su error[E0658]: amdgpu-kernel ABI is experimental and subject to change (see issue #51575) --> $DIR/feature-gate-abi.rs:42:5 | -LL | extern "amdgpu-kernel" fn dm9() {} //~ ERROR amdgpu-kernel ABI is experimental and subject to change +LL | extern "amdgpu-kernel" fn dm9() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_amdgpu_kernel)] to the crate attributes to enable @@ -217,7 +217,7 @@ LL | extern "amdgpu-kernel" fn dm9() {} //~ ERROR amdgpu-kernel ABI is exper error[E0658]: intrinsics are subject to change --> $DIR/feature-gate-abi.rs:49:5 | -LL | extern "rust-intrinsic" fn m1() {} //~ ERROR intrinsics are subject to change +LL | extern "rust-intrinsic" fn m1() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(intrinsics)] to the crate attributes to enable @@ -225,7 +225,7 @@ LL | extern "rust-intrinsic" fn m1() {} //~ ERROR intrinsics are subject to error[E0658]: platform intrinsics are experimental and possibly buggy (see issue #27731) --> $DIR/feature-gate-abi.rs:50:5 | -LL | extern "platform-intrinsic" fn m2() {} //~ ERROR platform intrinsics are experimental +LL | extern "platform-intrinsic" fn m2() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(platform_intrinsics)] to the crate attributes to enable @@ -233,7 +233,7 @@ LL | extern "platform-intrinsic" fn m2() {} //~ ERROR platform intrinsics ar error[E0658]: vectorcall is experimental and subject to change --> $DIR/feature-gate-abi.rs:51:5 | -LL | extern "vectorcall" fn m3() {} //~ ERROR vectorcall is experimental and subject to change +LL | extern "vectorcall" fn m3() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_vectorcall)] to the crate attributes to enable @@ -241,7 +241,7 @@ LL | extern "vectorcall" fn m3() {} //~ ERROR vectorcall is experimental and error[E0658]: rust-call ABI is subject to change (see issue #29625) --> $DIR/feature-gate-abi.rs:52:5 | -LL | extern "rust-call" fn m4() {} //~ ERROR rust-call ABI is subject to change +LL | extern "rust-call" fn m4() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unboxed_closures)] to the crate attributes to enable @@ -249,7 +249,7 @@ LL | extern "rust-call" fn m4() {} //~ ERROR rust-call ABI is subject to cha error[E0658]: msp430-interrupt ABI is experimental and subject to change (see issue #38487) --> $DIR/feature-gate-abi.rs:53:5 | -LL | extern "msp430-interrupt" fn m5() {} //~ ERROR msp430-interrupt ABI is experimental +LL | extern "msp430-interrupt" fn m5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable @@ -257,7 +257,7 @@ LL | extern "msp430-interrupt" fn m5() {} //~ ERROR msp430-interrupt ABI is error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788) --> $DIR/feature-gate-abi.rs:54:5 | -LL | extern "ptx-kernel" fn m6() {} //~ ERROR PTX ABIs are experimental and subject to change +LL | extern "ptx-kernel" fn m6() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_ptx)] to the crate attributes to enable @@ -265,7 +265,7 @@ LL | extern "ptx-kernel" fn m6() {} //~ ERROR PTX ABIs are experimental and error[E0658]: x86-interrupt ABI is experimental and subject to change (see issue #40180) --> $DIR/feature-gate-abi.rs:55:5 | -LL | extern "x86-interrupt" fn m7() {} //~ ERROR x86-interrupt ABI is experimental +LL | extern "x86-interrupt" fn m7() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable @@ -273,7 +273,7 @@ LL | extern "x86-interrupt" fn m7() {} //~ ERROR x86-interrupt ABI is experi error[E0658]: thiscall is experimental and subject to change --> $DIR/feature-gate-abi.rs:56:5 | -LL | extern "thiscall" fn m8() {} //~ ERROR thiscall is experimental and subject to change +LL | extern "thiscall" fn m8() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_thiscall)] to the crate attributes to enable @@ -281,7 +281,7 @@ LL | extern "thiscall" fn m8() {} //~ ERROR thiscall is experimental and sub error[E0658]: amdgpu-kernel ABI is experimental and subject to change (see issue #51575) --> $DIR/feature-gate-abi.rs:57:5 | -LL | extern "amdgpu-kernel" fn m9() {} //~ ERROR amdgpu-kernel ABI is experimental and subject to change +LL | extern "amdgpu-kernel" fn m9() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_amdgpu_kernel)] to the crate attributes to enable @@ -289,7 +289,7 @@ LL | extern "amdgpu-kernel" fn m9() {} //~ ERROR amdgpu-kernel ABI is experi error[E0658]: intrinsics are subject to change --> $DIR/feature-gate-abi.rs:62:5 | -LL | extern "rust-intrinsic" fn im1() {} //~ ERROR intrinsics are subject to change +LL | extern "rust-intrinsic" fn im1() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(intrinsics)] to the crate attributes to enable @@ -297,7 +297,7 @@ LL | extern "rust-intrinsic" fn im1() {} //~ ERROR intrinsics are subject to error[E0658]: platform intrinsics are experimental and possibly buggy (see issue #27731) --> $DIR/feature-gate-abi.rs:63:5 | -LL | extern "platform-intrinsic" fn im2() {} //~ ERROR platform intrinsics are experimental +LL | extern "platform-intrinsic" fn im2() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(platform_intrinsics)] to the crate attributes to enable @@ -305,7 +305,7 @@ LL | extern "platform-intrinsic" fn im2() {} //~ ERROR platform intrinsics a error[E0658]: vectorcall is experimental and subject to change --> $DIR/feature-gate-abi.rs:64:5 | -LL | extern "vectorcall" fn im3() {} //~ ERROR vectorcall is experimental and subject to change +LL | extern "vectorcall" fn im3() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_vectorcall)] to the crate attributes to enable @@ -313,7 +313,7 @@ LL | extern "vectorcall" fn im3() {} //~ ERROR vectorcall is experimental an error[E0658]: rust-call ABI is subject to change (see issue #29625) --> $DIR/feature-gate-abi.rs:65:5 | -LL | extern "rust-call" fn im4() {} //~ ERROR rust-call ABI is subject to change +LL | extern "rust-call" fn im4() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unboxed_closures)] to the crate attributes to enable @@ -321,7 +321,7 @@ LL | extern "rust-call" fn im4() {} //~ ERROR rust-call ABI is subject to ch error[E0658]: msp430-interrupt ABI is experimental and subject to change (see issue #38487) --> $DIR/feature-gate-abi.rs:66:5 | -LL | extern "msp430-interrupt" fn im5() {} //~ ERROR msp430-interrupt ABI is experimental +LL | extern "msp430-interrupt" fn im5() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable @@ -329,7 +329,7 @@ LL | extern "msp430-interrupt" fn im5() {} //~ ERROR msp430-interrupt ABI is error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788) --> $DIR/feature-gate-abi.rs:67:5 | -LL | extern "ptx-kernel" fn im6() {} //~ ERROR PTX ABIs are experimental and subject to change +LL | extern "ptx-kernel" fn im6() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_ptx)] to the crate attributes to enable @@ -337,7 +337,7 @@ LL | extern "ptx-kernel" fn im6() {} //~ ERROR PTX ABIs are experimental and error[E0658]: x86-interrupt ABI is experimental and subject to change (see issue #40180) --> $DIR/feature-gate-abi.rs:68:5 | -LL | extern "x86-interrupt" fn im7() {} //~ ERROR x86-interrupt ABI is experimental +LL | extern "x86-interrupt" fn im7() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable @@ -345,7 +345,7 @@ LL | extern "x86-interrupt" fn im7() {} //~ ERROR x86-interrupt ABI is exper error[E0658]: thiscall is experimental and subject to change --> $DIR/feature-gate-abi.rs:69:5 | -LL | extern "thiscall" fn im8() {} //~ ERROR thiscall is experimental and subject to change +LL | extern "thiscall" fn im8() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_thiscall)] to the crate attributes to enable @@ -353,7 +353,7 @@ LL | extern "thiscall" fn im8() {} //~ ERROR thiscall is experimental and su error[E0658]: amdgpu-kernel ABI is experimental and subject to change (see issue #51575) --> $DIR/feature-gate-abi.rs:70:5 | -LL | extern "amdgpu-kernel" fn im9() {} //~ ERROR amdgpu-kernel ABI is experimental and subject to change +LL | extern "amdgpu-kernel" fn im9() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_amdgpu_kernel)] to the crate attributes to enable @@ -361,7 +361,7 @@ LL | extern "amdgpu-kernel" fn im9() {} //~ ERROR amdgpu-kernel ABI is exper error[E0658]: intrinsics are subject to change --> $DIR/feature-gate-abi.rs:74:11 | -LL | type A1 = extern "rust-intrinsic" fn(); //~ ERROR intrinsics are subject to change +LL | type A1 = extern "rust-intrinsic" fn(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(intrinsics)] to the crate attributes to enable @@ -369,7 +369,7 @@ LL | type A1 = extern "rust-intrinsic" fn(); //~ ERROR intrinsics are subject to error[E0658]: platform intrinsics are experimental and possibly buggy (see issue #27731) --> $DIR/feature-gate-abi.rs:75:11 | -LL | type A2 = extern "platform-intrinsic" fn(); //~ ERROR platform intrinsics are experimental +LL | type A2 = extern "platform-intrinsic" fn(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(platform_intrinsics)] to the crate attributes to enable @@ -377,7 +377,7 @@ LL | type A2 = extern "platform-intrinsic" fn(); //~ ERROR platform intrinsics a error[E0658]: vectorcall is experimental and subject to change --> $DIR/feature-gate-abi.rs:76:11 | -LL | type A3 = extern "vectorcall" fn(); //~ ERROR vectorcall is experimental and subject to change +LL | type A3 = extern "vectorcall" fn(); | ^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_vectorcall)] to the crate attributes to enable @@ -385,7 +385,7 @@ LL | type A3 = extern "vectorcall" fn(); //~ ERROR vectorcall is experimental an error[E0658]: rust-call ABI is subject to change (see issue #29625) --> $DIR/feature-gate-abi.rs:77:11 | -LL | type A4 = extern "rust-call" fn(); //~ ERROR rust-call ABI is subject to change +LL | type A4 = extern "rust-call" fn(); | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unboxed_closures)] to the crate attributes to enable @@ -393,7 +393,7 @@ LL | type A4 = extern "rust-call" fn(); //~ ERROR rust-call ABI is subject to ch error[E0658]: msp430-interrupt ABI is experimental and subject to change (see issue #38487) --> $DIR/feature-gate-abi.rs:78:11 | -LL | type A5 = extern "msp430-interrupt" fn(); //~ ERROR msp430-interrupt ABI is experimental +LL | type A5 = extern "msp430-interrupt" fn(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable @@ -401,7 +401,7 @@ LL | type A5 = extern "msp430-interrupt" fn(); //~ ERROR msp430-interrupt ABI is error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788) --> $DIR/feature-gate-abi.rs:79:11 | -LL | type A6 = extern "ptx-kernel" fn (); //~ ERROR PTX ABIs are experimental and subject to change +LL | type A6 = extern "ptx-kernel" fn (); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_ptx)] to the crate attributes to enable @@ -409,7 +409,7 @@ LL | type A6 = extern "ptx-kernel" fn (); //~ ERROR PTX ABIs are experimental an error[E0658]: x86-interrupt ABI is experimental and subject to change (see issue #40180) --> $DIR/feature-gate-abi.rs:80:11 | -LL | type A7 = extern "x86-interrupt" fn(); //~ ERROR x86-interrupt ABI is experimental +LL | type A7 = extern "x86-interrupt" fn(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable @@ -417,7 +417,7 @@ LL | type A7 = extern "x86-interrupt" fn(); //~ ERROR x86-interrupt ABI is exper error[E0658]: thiscall is experimental and subject to change --> $DIR/feature-gate-abi.rs:81:11 | -LL | type A8 = extern "thiscall" fn(); //~ ERROR thiscall is experimental and subject to change +LL | type A8 = extern "thiscall" fn(); | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_thiscall)] to the crate attributes to enable @@ -425,7 +425,7 @@ LL | type A8 = extern "thiscall" fn(); //~ ERROR thiscall is experimental and su error[E0658]: amdgpu-kernel ABI is experimental and subject to change (see issue #51575) --> $DIR/feature-gate-abi.rs:82:11 | -LL | type A9 = extern "amdgpu-kernel" fn(); //~ ERROR amdgpu-kernel ABI is experimental and subject to change +LL | type A9 = extern "amdgpu-kernel" fn(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_amdgpu_kernel)] to the crate attributes to enable @@ -433,7 +433,7 @@ LL | type A9 = extern "amdgpu-kernel" fn(); //~ ERROR amdgpu-kernel ABI is exper error[E0658]: intrinsics are subject to change --> $DIR/feature-gate-abi.rs:85:1 | -LL | extern "rust-intrinsic" {} //~ ERROR intrinsics are subject to change +LL | extern "rust-intrinsic" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(intrinsics)] to the crate attributes to enable @@ -441,7 +441,7 @@ LL | extern "rust-intrinsic" {} //~ ERROR intrinsics are subject to change error[E0658]: platform intrinsics are experimental and possibly buggy (see issue #27731) --> $DIR/feature-gate-abi.rs:86:1 | -LL | extern "platform-intrinsic" {} //~ ERROR platform intrinsics are experimental +LL | extern "platform-intrinsic" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(platform_intrinsics)] to the crate attributes to enable @@ -449,7 +449,7 @@ LL | extern "platform-intrinsic" {} //~ ERROR platform intrinsics are experiment error[E0658]: vectorcall is experimental and subject to change --> $DIR/feature-gate-abi.rs:87:1 | -LL | extern "vectorcall" {} //~ ERROR vectorcall is experimental and subject to change +LL | extern "vectorcall" {} | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_vectorcall)] to the crate attributes to enable @@ -457,7 +457,7 @@ LL | extern "vectorcall" {} //~ ERROR vectorcall is experimental and subject to error[E0658]: rust-call ABI is subject to change (see issue #29625) --> $DIR/feature-gate-abi.rs:88:1 | -LL | extern "rust-call" {} //~ ERROR rust-call ABI is subject to change +LL | extern "rust-call" {} | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unboxed_closures)] to the crate attributes to enable @@ -465,7 +465,7 @@ LL | extern "rust-call" {} //~ ERROR rust-call ABI is subject to change error[E0658]: msp430-interrupt ABI is experimental and subject to change (see issue #38487) --> $DIR/feature-gate-abi.rs:89:1 | -LL | extern "msp430-interrupt" {} //~ ERROR msp430-interrupt ABI is experimental +LL | extern "msp430-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_msp430_interrupt)] to the crate attributes to enable @@ -473,7 +473,7 @@ LL | extern "msp430-interrupt" {} //~ ERROR msp430-interrupt ABI is experimental error[E0658]: PTX ABIs are experimental and subject to change (see issue #38788) --> $DIR/feature-gate-abi.rs:90:1 | -LL | extern "ptx-kernel" {} //~ ERROR PTX ABIs are experimental and subject to change +LL | extern "ptx-kernel" {} | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_ptx)] to the crate attributes to enable @@ -481,7 +481,7 @@ LL | extern "ptx-kernel" {} //~ ERROR PTX ABIs are experimental and subject to c error[E0658]: x86-interrupt ABI is experimental and subject to change (see issue #40180) --> $DIR/feature-gate-abi.rs:91:1 | -LL | extern "x86-interrupt" {} //~ ERROR x86-interrupt ABI is experimental +LL | extern "x86-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_x86_interrupt)] to the crate attributes to enable @@ -489,7 +489,7 @@ LL | extern "x86-interrupt" {} //~ ERROR x86-interrupt ABI is experimental error[E0658]: thiscall is experimental and subject to change --> $DIR/feature-gate-abi.rs:92:1 | -LL | extern "thiscall" {} //~ ERROR thiscall is experimental and subject to change +LL | extern "thiscall" {} | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_thiscall)] to the crate attributes to enable @@ -497,7 +497,7 @@ LL | extern "thiscall" {} //~ ERROR thiscall is experimental and subject to chan error[E0658]: amdgpu-kernel ABI is experimental and subject to change (see issue #51575) --> $DIR/feature-gate-abi.rs:93:1 | -LL | extern "amdgpu-kernel" {} //~ ERROR amdgpu-kernel ABI is experimental and subject to change +LL | extern "amdgpu-kernel" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(abi_amdgpu_kernel)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-abi_unadjusted.stderr b/src/test/ui/feature-gates/feature-gate-abi_unadjusted.stderr index 707b6bc75b17..fb32ebb18882 100644 --- a/src/test/ui/feature-gates/feature-gate-abi_unadjusted.stderr +++ b/src/test/ui/feature-gates/feature-gate-abi_unadjusted.stderr @@ -2,7 +2,7 @@ error[E0658]: unadjusted ABI is an implementation detail and perma-unstable --> $DIR/feature-gate-abi_unadjusted.rs:1:1 | LL | / extern "unadjusted" fn foo() { -LL | | //~^ ERROR: unadjusted ABI is an implementation detail and perma-unstable +LL | | LL | | } | |_^ | diff --git a/src/test/ui/feature-gates/feature-gate-alloc-error-handler.stderr b/src/test/ui/feature-gates/feature-gate-alloc-error-handler.stderr index c20b21fa43d6..5e64ac50c3c4 100644 --- a/src/test/ui/feature-gates/feature-gate-alloc-error-handler.stderr +++ b/src/test/ui/feature-gates/feature-gate-alloc-error-handler.stderr @@ -1,7 +1,7 @@ error[E0658]: #[alloc_error_handler] is an unstable feature (see issue #51540) --> $DIR/feature-gate-alloc-error-handler.rs:8:1 | -LL | #[alloc_error_handler] //~ ERROR #[alloc_error_handler] is an unstable feature (see issue #51540) +LL | #[alloc_error_handler] | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(alloc_error_handler)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-allocator_internals.stderr b/src/test/ui/feature-gates/feature-gate-allocator_internals.stderr index 5103b7214f50..c41dca0ec471 100644 --- a/src/test/ui/feature-gates/feature-gate-allocator_internals.stderr +++ b/src/test/ui/feature-gates/feature-gate-allocator_internals.stderr @@ -1,7 +1,7 @@ error[E0658]: the `#[default_lib_allocator]` attribute is an experimental feature --> $DIR/feature-gate-allocator_internals.rs:1:1 | -LL | #![default_lib_allocator] //~ ERROR: attribute is an experimental feature +LL | #![default_lib_allocator] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(allocator_internals)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.stderr b/src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.stderr index 1cadfb28214c..27324d703a8f 100644 --- a/src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.stderr +++ b/src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.stderr @@ -1,7 +1,7 @@ error[E0658]: allow_internal_unsafe side-steps the unsafe_code lint --> $DIR/feature-gate-allow-internal-unsafe-nested-macro.rs:8:9 | -LL | #[allow_internal_unsafe] //~ ERROR allow_internal_unsafe side-steps +LL | #[allow_internal_unsafe] | ^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | bar!(); diff --git a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr index 802c74239d71..76afd217b816 100644 --- a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr +++ b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr @@ -1,7 +1,7 @@ error[E0658]: allow_internal_unstable side-steps feature gating and stability checks --> $DIR/feature-gate-allow-internal-unstable-nested-macro.rs:8:9 | -LL | #[allow_internal_unstable()] //~ ERROR allow_internal_unstable side-steps +LL | #[allow_internal_unstable()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | bar!(); diff --git a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.stderr b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.stderr index d619f1e3239c..d512e56d0a84 100644 --- a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.stderr +++ b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.stderr @@ -1,7 +1,7 @@ error[E0658]: allow_internal_unstable side-steps feature gating and stability checks --> $DIR/feature-gate-allow-internal-unstable-struct.rs:4:1 | -LL | #[allow_internal_unstable()] //~ ERROR allow_internal_unstable side-steps +LL | #[allow_internal_unstable()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(allow_internal_unstable)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.stderr b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.stderr index aa4f6648c4fb..baba7f4bfb5a 100644 --- a/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.stderr +++ b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.stderr @@ -1,7 +1,7 @@ error[E0658]: allow_internal_unstable side-steps feature gating and stability checks --> $DIR/feature-gate-allow-internal-unstable.rs:3:1 | -LL | #[allow_internal_unstable()] //~ ERROR allow_internal_unstable side-steps +LL | #[allow_internal_unstable()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(allow_internal_unstable)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-allow_fail.stderr b/src/test/ui/feature-gates/feature-gate-allow_fail.stderr index 18c7ac9c3c92..5de1706dd4aa 100644 --- a/src/test/ui/feature-gates/feature-gate-allow_fail.stderr +++ b/src/test/ui/feature-gates/feature-gate-allow_fail.stderr @@ -1,7 +1,7 @@ error[E0658]: allow_fail attribute is currently unstable (see issue #46488) --> $DIR/feature-gate-allow_fail.rs:3:1 | -LL | #[allow_fail] //~ ERROR allow_fail attribute is currently unstable +LL | #[allow_fail] | ^^^^^^^^^^^^^ | = help: add #![feature(allow_fail)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.stderr b/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.stderr index 8ec3c682850d..e1089bc345e8 100644 --- a/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.stderr +++ b/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.stderr @@ -1,7 +1,7 @@ error[E0658]: `Ptr` cannot be used as the type of `self` without the `arbitrary_self_types` feature (see issue #44874) --> $DIR/feature-gate-arbitrary-self-types.rs:16:18 | -LL | fn foo(self: Ptr); //~ ERROR `Ptr` cannot be used as the type of `self` without +LL | fn foo(self: Ptr); | ^^^^^^^^^ | = help: add #![feature(arbitrary_self_types)] to the crate attributes to enable @@ -10,7 +10,7 @@ LL | fn foo(self: Ptr); //~ ERROR `Ptr` cannot be used as the ty error[E0658]: `Ptr` cannot be used as the type of `self` without the `arbitrary_self_types` feature (see issue #44874) --> $DIR/feature-gate-arbitrary-self-types.rs:22:18 | -LL | fn foo(self: Ptr) {} //~ ERROR `Ptr` cannot be used as the type of `self` without +LL | fn foo(self: Ptr) {} | ^^^^^^^^^ | = help: add #![feature(arbitrary_self_types)] to the crate attributes to enable @@ -19,7 +19,7 @@ LL | fn foo(self: Ptr) {} //~ ERROR `Ptr` cannot be used as the t error[E0658]: `std::boxed::Box>` cannot be used as the type of `self` without the `arbitrary_self_types` feature (see issue #44874) --> $DIR/feature-gate-arbitrary-self-types.rs:26:18 | -LL | fn bar(self: Box>) {} //~ ERROR `std::boxed::Box>` cannot be used as the +LL | fn bar(self: Box>) {} | ^^^^^^^^^^^^^^ | = help: add #![feature(arbitrary_self_types)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-asm.stderr b/src/test/ui/feature-gates/feature-gate-asm.stderr index eee38e12c2aa..6ad0ea673135 100644 --- a/src/test/ui/feature-gates/feature-gate-asm.stderr +++ b/src/test/ui/feature-gates/feature-gate-asm.stderr @@ -1,7 +1,7 @@ error[E0658]: inline assembly is not stable enough for use and is subject to change (see issue #29722) --> $DIR/feature-gate-asm.rs:3:9 | -LL | asm!(""); //~ ERROR inline assembly is not stable enough +LL | asm!(""); | ^^^^^^^^^ | = help: add #![feature(asm)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-asm2.stderr b/src/test/ui/feature-gates/feature-gate-asm2.stderr index fc4aa57718ce..466f20281987 100644 --- a/src/test/ui/feature-gates/feature-gate-asm2.stderr +++ b/src/test/ui/feature-gates/feature-gate-asm2.stderr @@ -1,7 +1,7 @@ error[E0658]: inline assembly is not stable enough for use and is subject to change (see issue #29722) --> $DIR/feature-gate-asm2.rs:5:26 | -LL | println!("{:?}", asm!("")); //~ ERROR inline assembly is not stable +LL | println!("{:?}", asm!("")); | ^^^^^^^^ | = help: add #![feature(asm)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-assoc-type-defaults.stderr b/src/test/ui/feature-gates/feature-gate-assoc-type-defaults.stderr index a23962fe3189..fe206d3dfca4 100644 --- a/src/test/ui/feature-gates/feature-gate-assoc-type-defaults.stderr +++ b/src/test/ui/feature-gates/feature-gate-assoc-type-defaults.stderr @@ -1,7 +1,7 @@ error[E0658]: associated type defaults are unstable (see issue #29661) --> $DIR/feature-gate-assoc-type-defaults.rs:4:5 | -LL | type Bar = u8; //~ ERROR associated type defaults are unstable +LL | type Bar = u8; | ^^^^^^^^^^^^^^ | = help: add #![feature(associated_type_defaults)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.rs b/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.rs index 84dd1b9f814c..b6ab8ae0a9bc 100644 --- a/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.rs +++ b/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.rs @@ -2,7 +2,8 @@ #![feature(futures_api)] -async fn foo() {} //~ ERROR async fn is unstable +async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition + //~^ ERROR async fn is unstable fn main() { let _ = async {}; //~ ERROR cannot find struct, variant or union type `async` diff --git a/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr b/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr index 450b2c42f119..b67949b61555 100644 --- a/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr +++ b/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr @@ -1,24 +1,30 @@ -error[E0422]: cannot find struct, variant or union type `async` in this scope - --> $DIR/feature-gate-async-await-2015-edition.rs:8:13 +error[E0670]: `async fn` is not permitted in the 2015 edition + --> $DIR/feature-gate-async-await-2015-edition.rs:5:1 | -LL | let _ = async {}; //~ ERROR cannot find struct, variant or union type `async` +LL | async fn foo() {} + | ^^^^^ + +error[E0422]: cannot find struct, variant or union type `async` in this scope + --> $DIR/feature-gate-async-await-2015-edition.rs:9:13 + | +LL | let _ = async {}; | ^^^^^ not found in this scope error[E0425]: cannot find value `async` in this scope - --> $DIR/feature-gate-async-await-2015-edition.rs:9:13 + --> $DIR/feature-gate-async-await-2015-edition.rs:10:13 | -LL | let _ = async || { true }; //~ ERROR cannot find value `async` in this scope +LL | let _ = async || { true }; | ^^^^^ not found in this scope error[E0658]: async fn is unstable (see issue #50547) --> $DIR/feature-gate-async-await-2015-edition.rs:5:1 | -LL | async fn foo() {} //~ ERROR async fn is unstable +LL | async fn foo() {} | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(async_await)] to the crate attributes to enable -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors -Some errors occurred: E0422, E0425, E0658. +Some errors occurred: E0422, E0425, E0658, E0670. For more information about an error, try `rustc --explain E0422`. diff --git a/src/test/ui/feature-gates/feature-gate-async-await.stderr b/src/test/ui/feature-gates/feature-gate-async-await.stderr index 3a3165ba3e69..beec28765c8d 100644 --- a/src/test/ui/feature-gates/feature-gate-async-await.stderr +++ b/src/test/ui/feature-gates/feature-gate-async-await.stderr @@ -1,7 +1,7 @@ error[E0658]: async fn is unstable (see issue #50547) --> $DIR/feature-gate-async-await.rs:5:1 | -LL | async fn foo() {} //~ ERROR async fn is unstable +LL | async fn foo() {} | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(async_await)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | async fn foo() {} //~ ERROR async fn is unstable error[E0658]: async blocks are unstable (see issue #50547) --> $DIR/feature-gate-async-await.rs:8:13 | -LL | let _ = async {}; //~ ERROR async blocks are unstable +LL | let _ = async {}; | ^^^^^^^^ | = help: add #![feature(async_await)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | let _ = async {}; //~ ERROR async blocks are unstable error[E0658]: async closures are unstable (see issue #50547) --> $DIR/feature-gate-async-await.rs:9:13 | -LL | let _ = async || {}; //~ ERROR async closures are unstable +LL | let _ = async || {}; | ^^^^^^^^^^^ | = help: add #![feature(async_await)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-box-expr.stderr b/src/test/ui/feature-gates/feature-gate-box-expr.stderr index 9ebff2e044c9..7b202042878e 100644 --- a/src/test/ui/feature-gates/feature-gate-box-expr.stderr +++ b/src/test/ui/feature-gates/feature-gate-box-expr.stderr @@ -1,7 +1,7 @@ error[E0658]: box expression syntax is experimental; you can call `Box::new` instead. (see issue #49733) --> $DIR/feature-gate-box-expr.rs:12:13 | -LL | let x = box 'c'; //~ ERROR box expression syntax is experimental +LL | let x = box 'c'; | ^^^^^^^ | = help: add #![feature(box_syntax)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-box_patterns.stderr b/src/test/ui/feature-gates/feature-gate-box_patterns.stderr index 1379ba526f5d..39404aa39c85 100644 --- a/src/test/ui/feature-gates/feature-gate-box_patterns.stderr +++ b/src/test/ui/feature-gates/feature-gate-box_patterns.stderr @@ -1,7 +1,7 @@ error[E0658]: box pattern syntax is experimental (see issue #29641) --> $DIR/feature-gate-box_patterns.rs:2:9 | -LL | let box x = Box::new('c'); //~ ERROR box pattern syntax is experimental +LL | let box x = Box::new('c'); | ^^^^^ | = help: add #![feature(box_patterns)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-compiler-builtins.stderr b/src/test/ui/feature-gates/feature-gate-compiler-builtins.stderr index 5bda76e2bfeb..278a184bae21 100644 --- a/src/test/ui/feature-gates/feature-gate-compiler-builtins.stderr +++ b/src/test/ui/feature-gates/feature-gate-compiler-builtins.stderr @@ -1,7 +1,7 @@ error[E0658]: the `#[compiler_builtins]` attribute is used to identify the `compiler_builtins` crate which contains compiler-rt intrinsics and will never be stable --> $DIR/feature-gate-compiler-builtins.rs:1:1 | -LL | #![compiler_builtins] //~ ERROR the `#[compiler_builtins]` attribute is +LL | #![compiler_builtins] | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(compiler_builtins)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-concat_idents.stderr b/src/test/ui/feature-gates/feature-gate-concat_idents.stderr index d465512527a6..3f4ce6d3b94a 100644 --- a/src/test/ui/feature-gates/feature-gate-concat_idents.stderr +++ b/src/test/ui/feature-gates/feature-gate-concat_idents.stderr @@ -1,7 +1,7 @@ error[E0658]: `concat_idents` is not stable enough for use and is subject to change (see issue #29599) --> $DIR/feature-gate-concat_idents.rs:5:13 | -LL | let a = concat_idents!(X, Y_1); //~ ERROR `concat_idents` is not stable +LL | let a = concat_idents!(X, Y_1); | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(concat_idents)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | let a = concat_idents!(X, Y_1); //~ ERROR `concat_idents` is not stable error[E0658]: `concat_idents` is not stable enough for use and is subject to change (see issue #29599) --> $DIR/feature-gate-concat_idents.rs:6:13 | -LL | let b = concat_idents!(X, Y_2); //~ ERROR `concat_idents` is not stable +LL | let b = concat_idents!(X, Y_2); | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(concat_idents)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-concat_idents2.stderr b/src/test/ui/feature-gates/feature-gate-concat_idents2.stderr index cae409019f7a..105b3d5cff5c 100644 --- a/src/test/ui/feature-gates/feature-gate-concat_idents2.stderr +++ b/src/test/ui/feature-gates/feature-gate-concat_idents2.stderr @@ -1,7 +1,7 @@ error[E0658]: `concat_idents` is not stable enough for use and is subject to change (see issue #29599) --> $DIR/feature-gate-concat_idents2.rs:4:5 | -LL | concat_idents!(a, b); //~ ERROR `concat_idents` is not stable enough +LL | concat_idents!(a, b); | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(concat_idents)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | concat_idents!(a, b); //~ ERROR `concat_idents` is not stable enough error[E0425]: cannot find value `ab` in this scope --> $DIR/feature-gate-concat_idents2.rs:4:5 | -LL | concat_idents!(a, b); //~ ERROR `concat_idents` is not stable enough +LL | concat_idents!(a, b); | ^^^^^^^^^^^^^^^^^^^^^ not found in this scope error: aborting due to 2 previous errors diff --git a/src/test/ui/feature-gates/feature-gate-concat_idents3.stderr b/src/test/ui/feature-gates/feature-gate-concat_idents3.stderr index e9b9f240e8cd..9568b1d88019 100644 --- a/src/test/ui/feature-gates/feature-gate-concat_idents3.stderr +++ b/src/test/ui/feature-gates/feature-gate-concat_idents3.stderr @@ -1,7 +1,7 @@ error[E0658]: `concat_idents` is not stable enough for use and is subject to change (see issue #29599) --> $DIR/feature-gate-concat_idents3.rs:7:20 | -LL | assert_eq!(10, concat_idents!(X, Y_1)); //~ ERROR `concat_idents` is not stable +LL | assert_eq!(10, concat_idents!(X, Y_1)); | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(concat_idents)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | assert_eq!(10, concat_idents!(X, Y_1)); //~ ERROR `concat_idents` is no error[E0658]: `concat_idents` is not stable enough for use and is subject to change (see issue #29599) --> $DIR/feature-gate-concat_idents3.rs:8:20 | -LL | assert_eq!(20, concat_idents!(X, Y_2)); //~ ERROR `concat_idents` is not stable +LL | assert_eq!(20, concat_idents!(X, Y_2)); | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(concat_idents)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-const_fn.stderr b/src/test/ui/feature-gates/feature-gate-const_fn.stderr index be5237fbfcf3..7f88d30acc66 100644 --- a/src/test/ui/feature-gates/feature-gate-const_fn.stderr +++ b/src/test/ui/feature-gates/feature-gate-const_fn.stderr @@ -1,25 +1,25 @@ error[E0379]: trait fns cannot be declared const --> $DIR/feature-gate-const_fn.rs:6:5 | -LL | const fn foo() -> u32; //~ ERROR const fn is unstable +LL | const fn foo() -> u32; | ^^^^^ trait fns cannot be const error[E0379]: trait fns cannot be declared const --> $DIR/feature-gate-const_fn.rs:8:5 | -LL | const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable +LL | const fn bar() -> u32 { 0 } | ^^^^^ trait fns cannot be const error[E0379]: trait fns cannot be declared const --> $DIR/feature-gate-const_fn.rs:13:5 | -LL | const fn foo() -> u32 { 0 } //~ ERROR trait fns cannot be declared const +LL | const fn foo() -> u32 { 0 } | ^^^^^ trait fns cannot be const error[E0658]: const fn is unstable (see issue #57563) --> $DIR/feature-gate-const_fn.rs:6:5 | -LL | const fn foo() -> u32; //~ ERROR const fn is unstable +LL | const fn foo() -> u32; | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -27,7 +27,7 @@ LL | const fn foo() -> u32; //~ ERROR const fn is unstable error[E0658]: const fn is unstable (see issue #57563) --> $DIR/feature-gate-const_fn.rs:8:5 | -LL | const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable +LL | const fn bar() -> u32 { 0 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-const_generics.rs b/src/test/ui/feature-gates/feature-gate-const_generics.rs index 907e00b11e55..fe1ded1c4bbc 100644 --- a/src/test/ui/feature-gates/feature-gate-const_generics.rs +++ b/src/test/ui/feature-gates/feature-gate-const_generics.rs @@ -1,7 +1,5 @@ fn foo() {} //~ ERROR const generics are unstable -//~^ const generics in any position are currently unsupported struct Foo([(); X]); //~ ERROR const generics are unstable -//~^ const generics in any position are currently unsupported fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-const_generics.stderr b/src/test/ui/feature-gates/feature-gate-const_generics.stderr index 3ab1aa2367f1..dce400025353 100644 --- a/src/test/ui/feature-gates/feature-gate-const_generics.stderr +++ b/src/test/ui/feature-gates/feature-gate-const_generics.stderr @@ -1,31 +1,19 @@ error[E0658]: const generics are unstable (see issue #44580) --> $DIR/feature-gate-const_generics.rs:1:14 | -LL | fn foo() {} //~ ERROR const generics are unstable +LL | fn foo() {} | ^ | = help: add #![feature(const_generics)] to the crate attributes to enable error[E0658]: const generics are unstable (see issue #44580) - --> $DIR/feature-gate-const_generics.rs:4:18 + --> $DIR/feature-gate-const_generics.rs:3:18 | -LL | struct Foo([(); X]); //~ ERROR const generics are unstable +LL | struct Foo([(); X]); | ^ | = help: add #![feature(const_generics)] to the crate attributes to enable -error: const generics in any position are currently unsupported - --> $DIR/feature-gate-const_generics.rs:1:14 - | -LL | fn foo() {} //~ ERROR const generics are unstable - | ^ - -error: const generics in any position are currently unsupported - --> $DIR/feature-gate-const_generics.rs:4:18 - | -LL | struct Foo([(); X]); //~ ERROR const generics are unstable - | ^ - -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.stderr b/src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.stderr index 2b28bbca6454..25b26de60ef7 100644 --- a/src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.stderr +++ b/src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.stderr @@ -1,7 +1,7 @@ error[E0658]: `crate` visibility modifier is experimental (see issue #53120) --> $DIR/feature-gate-crate_visibility_modifier.rs:1:1 | -LL | crate struct Bender { //~ ERROR `crate` visibility modifier is experimental +LL | crate struct Bender { | ^^^^^ | = help: add #![feature(crate_visibility_modifier)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-custom_attribute.stderr b/src/test/ui/feature-gates/feature-gate-custom_attribute.stderr index 51fefcfaff72..8b79c752e457 100644 --- a/src/test/ui/feature-gates/feature-gate-custom_attribute.stderr +++ b/src/test/ui/feature-gates/feature-gate-custom_attribute.stderr @@ -1,7 +1,7 @@ error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:7:3 | -LL | #[fake_attr] //~ ERROR attribute `fake_attr` is currently unknown +LL | #[fake_attr] | ^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #[fake_attr] //~ ERROR attribute `fake_attr` is currently unknown error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:8:3 | -LL | #[fake_attr(100)] //~ ERROR attribute `fake_attr` is currently unknown +LL | #[fake_attr(100)] | ^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | #[fake_attr(100)] //~ ERROR attribute `fake_attr` is currently unknown error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:9:3 | -LL | #[fake_attr(1, 2, 3)] //~ ERROR attribute `fake_attr` is currently unknown +LL | #[fake_attr(1, 2, 3)] | ^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | #[fake_attr(1, 2, 3)] //~ ERROR attribute `fake_attr` is currently unknown error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:10:3 | -LL | #[fake_attr("hello")] //~ ERROR attribute `fake_attr` is currently unknown +LL | #[fake_attr("hello")] | ^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -33,7 +33,7 @@ LL | #[fake_attr("hello")] //~ ERROR attribute `fake_attr` is currently unknown error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:11:3 | -LL | #[fake_attr(name = "hello")] //~ ERROR attribute `fake_attr` is currently unknown +LL | #[fake_attr(name = "hello")] | ^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -41,7 +41,7 @@ LL | #[fake_attr(name = "hello")] //~ ERROR attribute `fake_attr` is currently u error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:12:3 | -LL | #[fake_attr(1, "hi", key = 12, true, false)] //~ ERROR attribute `fake_attr` is currently unknown +LL | #[fake_attr(1, "hi", key = 12, true, false)] | ^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -49,7 +49,7 @@ LL | #[fake_attr(1, "hi", key = 12, true, false)] //~ ERROR attribute `fake_attr error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:13:3 | -LL | #[fake_attr(key = "hello", val = 10)] //~ ERROR attribute `fake_attr` is currently unknown +LL | #[fake_attr(key = "hello", val = 10)] | ^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -57,7 +57,7 @@ LL | #[fake_attr(key = "hello", val = 10)] //~ ERROR attribute `fake_attr` is cu error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:14:3 | -LL | #[fake_attr(key("hello"), val(10))] //~ ERROR attribute `fake_attr` is currently unknown +LL | #[fake_attr(key("hello"), val(10))] | ^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -65,7 +65,7 @@ LL | #[fake_attr(key("hello"), val(10))] //~ ERROR attribute `fake_attr` is curr error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:15:3 | -LL | #[fake_attr(enabled = true, disabled = false)] //~ ERROR attribute `fake_attr` is currently unknown +LL | #[fake_attr(enabled = true, disabled = false)] | ^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -73,7 +73,7 @@ LL | #[fake_attr(enabled = true, disabled = false)] //~ ERROR attribute `fake_at error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:16:3 | -LL | #[fake_attr(true)] //~ ERROR attribute `fake_attr` is currently unknown +LL | #[fake_attr(true)] | ^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -81,7 +81,7 @@ LL | #[fake_attr(true)] //~ ERROR attribute `fake_attr` is currently unknown error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:17:3 | -LL | #[fake_attr(pi = 3.14159)] //~ ERROR attribute `fake_attr` is currently unknown +LL | #[fake_attr(pi = 3.14159)] | ^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -89,7 +89,7 @@ LL | #[fake_attr(pi = 3.14159)] //~ ERROR attribute `fake_attr` is currently unk error[E0658]: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:18:3 | -LL | #[fake_attr(b"hi")] //~ ERROR attribute `fake_attr` is currently unknown +LL | #[fake_attr(b"hi")] | ^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -97,7 +97,7 @@ LL | #[fake_attr(b"hi")] //~ ERROR attribute `fake_attr` is currently unknown error[E0658]: The attribute `fake_doc` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/feature-gate-custom_attribute.rs:19:3 | -LL | #[fake_doc(r"doc")] //~ ERROR attribute `fake_doc` is currently unknown +LL | #[fake_doc(r"doc")] | ^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-custom_test_frameworks.stderr b/src/test/ui/feature-gates/feature-gate-custom_test_frameworks.stderr index 1aec87f06696..bac23b3a60d2 100644 --- a/src/test/ui/feature-gates/feature-gate-custom_test_frameworks.stderr +++ b/src/test/ui/feature-gates/feature-gate-custom_test_frameworks.stderr @@ -1,7 +1,7 @@ error[E0658]: custom test frameworks are an unstable feature (see issue #50297) --> $DIR/feature-gate-custom_test_frameworks.rs:1:1 | -LL | #![test_runner(main)] //~ ERROR custom test frameworks are an unstable feature +LL | #![test_runner(main)] | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(custom_test_frameworks)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-decl_macro.stderr b/src/test/ui/feature-gates/feature-gate-decl_macro.stderr index 01ec3d8b2e21..2d4b622843d3 100644 --- a/src/test/ui/feature-gates/feature-gate-decl_macro.stderr +++ b/src/test/ui/feature-gates/feature-gate-decl_macro.stderr @@ -1,7 +1,7 @@ error[E0658]: `macro` is experimental (see issue #39412) --> $DIR/feature-gate-decl_macro.rs:3:1 | -LL | macro m() {} //~ ERROR `macro` is experimental (see issue #39412) +LL | macro m() {} | ^^^^^^^^^^^^ | = help: add #![feature(decl_macro)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-doc_alias.stderr b/src/test/ui/feature-gates/feature-gate-doc_alias.stderr index 91845329534e..c585a96adf63 100644 --- a/src/test/ui/feature-gates/feature-gate-doc_alias.stderr +++ b/src/test/ui/feature-gates/feature-gate-doc_alias.stderr @@ -1,7 +1,7 @@ error[E0658]: #[doc(alias = "...")] is experimental (see issue #50146) --> $DIR/feature-gate-doc_alias.rs:1:1 | -LL | #[doc(alias = "foo")] //~ ERROR: #[doc(alias = "...")] is experimental +LL | #[doc(alias = "foo")] | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(doc_alias)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-doc_cfg-cfg-rustdoc.stderr b/src/test/ui/feature-gates/feature-gate-doc_cfg-cfg-rustdoc.stderr index 5bc56adb8adf..f018ff4a9d74 100644 --- a/src/test/ui/feature-gates/feature-gate-doc_cfg-cfg-rustdoc.stderr +++ b/src/test/ui/feature-gates/feature-gate-doc_cfg-cfg-rustdoc.stderr @@ -1,7 +1,7 @@ error[E0658]: `cfg(rustdoc)` is experimental and subject to change (see issue #43781) --> $DIR/feature-gate-doc_cfg-cfg-rustdoc.rs:1:7 | -LL | #[cfg(rustdoc)] //~ ERROR: `cfg(rustdoc)` is experimental and subject to change +LL | #[cfg(rustdoc)] | ^^^^^^^ | = help: add #![feature(doc_cfg)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-doc_cfg.stderr b/src/test/ui/feature-gates/feature-gate-doc_cfg.stderr index 20e3a4dbbca4..2a0aa4ff3c2e 100644 --- a/src/test/ui/feature-gates/feature-gate-doc_cfg.stderr +++ b/src/test/ui/feature-gates/feature-gate-doc_cfg.stderr @@ -1,7 +1,7 @@ error[E0658]: #[doc(cfg(...))] is experimental (see issue #43781) --> $DIR/feature-gate-doc_cfg.rs:1:1 | -LL | #[doc(cfg(unix))] //~ ERROR: #[doc(cfg(...))] is experimental +LL | #[doc(cfg(unix))] | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(doc_cfg)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-doc_keyword.stderr b/src/test/ui/feature-gates/feature-gate-doc_keyword.stderr index 96f165d5a515..c2cc1dceda33 100644 --- a/src/test/ui/feature-gates/feature-gate-doc_keyword.stderr +++ b/src/test/ui/feature-gates/feature-gate-doc_keyword.stderr @@ -1,7 +1,7 @@ error[E0658]: #[doc(keyword = "...")] is experimental (see issue #51315) --> $DIR/feature-gate-doc_keyword.rs:1:1 | -LL | #[doc(keyword = "match")] //~ ERROR: #[doc(keyword = "...")] is experimental +LL | #[doc(keyword = "match")] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(doc_keyword)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-doc_masked.stderr b/src/test/ui/feature-gates/feature-gate-doc_masked.stderr index 044f21a98336..77d3a6f6fb31 100644 --- a/src/test/ui/feature-gates/feature-gate-doc_masked.stderr +++ b/src/test/ui/feature-gates/feature-gate-doc_masked.stderr @@ -1,7 +1,7 @@ error[E0658]: #[doc(masked)] is experimental (see issue #44027) --> $DIR/feature-gate-doc_masked.rs:1:1 | -LL | #[doc(masked)] //~ ERROR: #[doc(masked)] is experimental +LL | #[doc(masked)] | ^^^^^^^^^^^^^^ | = help: add #![feature(doc_masked)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-doc_spotlight.stderr b/src/test/ui/feature-gates/feature-gate-doc_spotlight.stderr index c7101b436e26..60f5c0821881 100644 --- a/src/test/ui/feature-gates/feature-gate-doc_spotlight.stderr +++ b/src/test/ui/feature-gates/feature-gate-doc_spotlight.stderr @@ -1,7 +1,7 @@ error[E0658]: #[doc(spotlight)] is experimental (see issue #45040) --> $DIR/feature-gate-doc_spotlight.rs:1:1 | -LL | #[doc(spotlight)] //~ ERROR: #[doc(spotlight)] is experimental +LL | #[doc(spotlight)] | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(doc_spotlight)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.stderr b/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.stderr index 2b43a480c6b9..afb402174fb1 100644 --- a/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.stderr +++ b/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.stderr @@ -1,7 +1,7 @@ error[E0658]: exclusive range pattern syntax is experimental (see issue #37854) --> $DIR/feature-gate-exclusive-range-pattern.rs:3:9 | -LL | 0 .. 3 => {} //~ ERROR exclusive range pattern syntax is experimental +LL | 0 .. 3 => {} | ^^^^^^ | = help: add #![feature(exclusive_range_pattern)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr index cbe6d5677559..dd4ca1f67e33 100644 --- a/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr +++ b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr @@ -1,7 +1,7 @@ error[E0005]: refutable pattern in local binding: `Err(_)` not covered --> $DIR/feature-gate-exhaustive-patterns.rs:7:9 | -LL | let Ok(_x) = foo(); //~ ERROR refutable pattern in local binding +LL | let Ok(_x) = foo(); | ^^^^^^ pattern `Err(_)` not covered error: aborting due to previous error diff --git a/src/test/ui/feature-gates/feature-gate-existential-type.stderr b/src/test/ui/feature-gates/feature-gate-existential-type.stderr index e83d5cdbde1e..6b8b850b5cc0 100644 --- a/src/test/ui/feature-gates/feature-gate-existential-type.stderr +++ b/src/test/ui/feature-gates/feature-gate-existential-type.stderr @@ -1,7 +1,7 @@ error[E0658]: existential types are unstable (see issue #34511) --> $DIR/feature-gate-existential-type.rs:3:1 | -LL | existential type Foo: std::fmt::Debug; //~ ERROR existential types are unstable +LL | existential type Foo: std::fmt::Debug; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(existential_type)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | existential type Foo: std::fmt::Debug; //~ ERROR existential types are unst error[E0658]: existential types are unstable (see issue #34511) --> $DIR/feature-gate-existential-type.rs:11:5 | -LL | existential type Baa: std::fmt::Debug; //~ ERROR existential types are unstable +LL | existential type Baa: std::fmt::Debug; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(existential_type)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.stderr b/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.stderr index 1629547acb1c..e31d888f0078 100644 --- a/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.stderr +++ b/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.stderr @@ -1,13 +1,13 @@ error[E0432]: unresolved import `core` --> $DIR/feature-gate-extern_absolute_paths.rs:1:5 | -LL | use core::default; //~ ERROR unresolved import `core` +LL | use core::default; | ^^^^ maybe a missing `extern crate core;`? error[E0433]: failed to resolve: maybe a missing `extern crate core;`? --> $DIR/feature-gate-extern_absolute_paths.rs:4:19 | -LL | let _: u8 = ::core::default::Default(); //~ ERROR failed to resolve +LL | let _: u8 = ::core::default::Default(); | ^^^^ maybe a missing `extern crate core;`? error: aborting due to 2 previous errors diff --git a/src/test/ui/feature-gates/feature-gate-extern_prelude.stderr b/src/test/ui/feature-gates/feature-gate-extern_prelude.stderr index 7a13f61a27ea..c15a8b33037f 100644 --- a/src/test/ui/feature-gates/feature-gate-extern_prelude.stderr +++ b/src/test/ui/feature-gates/feature-gate-extern_prelude.stderr @@ -1,7 +1,7 @@ error: expected one of `!` or `::`, found `-` --> $DIR/feature-gate-extern_prelude.rs:1:4 | -LL | can-only-test-this-in-run-make-fulldeps //~ ERROR expected one of `!` or `::`, found `-` +LL | can-only-test-this-in-run-make-fulldeps | ^ expected one of `!` or `::` here error: aborting due to previous error diff --git a/src/test/ui/feature-gates/feature-gate-extern_types.stderr b/src/test/ui/feature-gates/feature-gate-extern_types.stderr index 70ba06cde45c..7035d85ec2a8 100644 --- a/src/test/ui/feature-gates/feature-gate-extern_types.stderr +++ b/src/test/ui/feature-gates/feature-gate-extern_types.stderr @@ -1,7 +1,7 @@ error[E0658]: extern types are experimental (see issue #43467) --> $DIR/feature-gate-extern_types.rs:2:5 | -LL | type T; //~ ERROR extern types are experimental +LL | type T; | ^^^^^^^ | = help: add #![feature(extern_types)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-external_doc.stderr b/src/test/ui/feature-gates/feature-gate-external_doc.stderr index b5cb9f564a3b..16507bf596f1 100644 --- a/src/test/ui/feature-gates/feature-gate-external_doc.stderr +++ b/src/test/ui/feature-gates/feature-gate-external_doc.stderr @@ -1,7 +1,7 @@ error[E0658]: #[doc(include = "...")] is experimental (see issue #44732) --> $DIR/feature-gate-external_doc.rs:1:1 | -LL | #[doc(include="asdf.md")] //~ ERROR: #[doc(include = "...")] is experimental +LL | #[doc(include="asdf.md")] | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(external_doc)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-feature-gate.stderr b/src/test/ui/feature-gates/feature-gate-feature-gate.stderr index aee4f7ba47db..d79404263e45 100644 --- a/src/test/ui/feature-gates/feature-gate-feature-gate.stderr +++ b/src/test/ui/feature-gates/feature-gate-feature-gate.stderr @@ -1,7 +1,7 @@ error: unstable feature --> $DIR/feature-gate-feature-gate.rs:2:12 | -LL | #![feature(intrinsics)] //~ ERROR unstable feature +LL | #![feature(intrinsics)] | ^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/feature-gates/feature-gate-ffi_returns_twice.stderr b/src/test/ui/feature-gates/feature-gate-ffi_returns_twice.stderr index 5c111fe78f48..f85ce8eeeace 100644 --- a/src/test/ui/feature-gates/feature-gate-ffi_returns_twice.stderr +++ b/src/test/ui/feature-gates/feature-gate-ffi_returns_twice.stderr @@ -1,7 +1,7 @@ error[E0658]: the `#[ffi_returns_twice]` attribute is an experimental feature (see issue #58314) --> $DIR/feature-gate-ffi_returns_twice.rs:5:5 | -LL | #[ffi_returns_twice] //~ ERROR the `#[ffi_returns_twice]` attribute is an experimental feature (see issue #58314) +LL | #[ffi_returns_twice] | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(ffi_returns_twice)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-format_args_nl.stderr b/src/test/ui/feature-gates/feature-gate-format_args_nl.stderr index 135ec5eb0c09..58d2c790ffe8 100644 --- a/src/test/ui/feature-gates/feature-gate-format_args_nl.stderr +++ b/src/test/ui/feature-gates/feature-gate-format_args_nl.stderr @@ -1,7 +1,7 @@ error[E0658]: `format_args_nl` is only for internal language use and is subject to change --> $DIR/feature-gate-format_args_nl.rs:2:5 | -LL | format_args_nl!(""); //~ ERROR `format_args_nl` is only for internal language use +LL | format_args_nl!(""); | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(format_args_nl)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-fundamental.stderr b/src/test/ui/feature-gates/feature-gate-fundamental.stderr index 47cf241cc3f9..9faf2a88a6b1 100644 --- a/src/test/ui/feature-gates/feature-gate-fundamental.stderr +++ b/src/test/ui/feature-gates/feature-gate-fundamental.stderr @@ -1,7 +1,7 @@ error[E0658]: the `#[fundamental]` attribute is an experimental feature (see issue #29635) --> $DIR/feature-gate-fundamental.rs:1:1 | -LL | #[fundamental] //~ ERROR the `#[fundamental]` attribute is an experimental feature +LL | #[fundamental] | ^^^^^^^^^^^^^^ | = help: add #![feature(fundamental)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-generators.stderr b/src/test/ui/feature-gates/feature-gate-generators.stderr index aea1e00d698a..554eeae8deca 100644 --- a/src/test/ui/feature-gates/feature-gate-generators.stderr +++ b/src/test/ui/feature-gates/feature-gate-generators.stderr @@ -1,7 +1,7 @@ error[E0658]: yield syntax is experimental (see issue #43122) --> $DIR/feature-gate-generators.rs:2:5 | -LL | yield true; //~ ERROR yield syntax is experimental +LL | yield true; | ^^^^^^^^^^ | = help: add #![feature(generators)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | yield true; //~ ERROR yield syntax is experimental error[E0627]: yield statement outside of generator literal --> $DIR/feature-gate-generators.rs:2:5 | -LL | yield true; //~ ERROR yield syntax is experimental +LL | yield true; | ^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/feature-gates/feature-gate-global_asm.stderr b/src/test/ui/feature-gates/feature-gate-global_asm.stderr index b698777f6234..fb9b47bd49c0 100644 --- a/src/test/ui/feature-gates/feature-gate-global_asm.stderr +++ b/src/test/ui/feature-gates/feature-gate-global_asm.stderr @@ -1,7 +1,7 @@ error[E0658]: `global_asm!` is not stable enough for use and is subject to change (see issue #35119) --> $DIR/feature-gate-global_asm.rs:1:1 | -LL | global_asm!(""); //~ ERROR `global_asm!` is not stable +LL | global_asm!(""); | ^^^^^^^^^^^^^^^^ | = help: add #![feature(global_asm)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.stderr b/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.stderr index 9f60a047cb47..689a3757343b 100644 --- a/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.stderr +++ b/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.stderr @@ -3,13 +3,13 @@ error[E0310]: the parameter type `U` may not live long enough | LL | struct Foo { | - help: consider adding an explicit lifetime bound `U: 'static`... -LL | bar: Bar //~ ERROR the parameter type `U` may not live long enough [E0310] +LL | bar: Bar | ^^^^^^^^^^^ | note: ...so that the type `U` will meet its required lifetime bounds --> $DIR/feature-gate-infer_static_outlives_requirements.rs:5:5 | -LL | bar: Bar //~ ERROR the parameter type `U` may not live long enough [E0310] +LL | bar: Bar | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/feature-gates/feature-gate-intrinsics.stderr b/src/test/ui/feature-gates/feature-gate-intrinsics.stderr index 092cb98a2f96..5b032c6f1ea3 100644 --- a/src/test/ui/feature-gates/feature-gate-intrinsics.stderr +++ b/src/test/ui/feature-gates/feature-gate-intrinsics.stderr @@ -1,8 +1,8 @@ error[E0658]: intrinsics are subject to change --> $DIR/feature-gate-intrinsics.rs:1:1 | -LL | / extern "rust-intrinsic" { //~ ERROR intrinsics are subject to change -LL | | fn bar(); //~ ERROR unrecognized intrinsic function: `bar` +LL | / extern "rust-intrinsic" { +LL | | fn bar(); LL | | } | |_^ | @@ -11,7 +11,7 @@ LL | | } error[E0658]: intrinsics are subject to change --> $DIR/feature-gate-intrinsics.rs:5:1 | -LL | extern "rust-intrinsic" fn baz() {} //~ ERROR intrinsics are subject to change +LL | extern "rust-intrinsic" fn baz() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(intrinsics)] to the crate attributes to enable @@ -19,7 +19,7 @@ LL | extern "rust-intrinsic" fn baz() {} //~ ERROR intrinsics are subject to cha error[E0093]: unrecognized intrinsic function: `bar` --> $DIR/feature-gate-intrinsics.rs:2:5 | -LL | fn bar(); //~ ERROR unrecognized intrinsic function: `bar` +LL | fn bar(); | ^^^^^^^^^ unrecognized intrinsic error: aborting due to 3 previous errors diff --git a/src/test/ui/feature-gates/feature-gate-label_break_value.stderr b/src/test/ui/feature-gates/feature-gate-label_break_value.stderr index 347b8a9710ee..b23db3c216d0 100644 --- a/src/test/ui/feature-gates/feature-gate-label_break_value.stderr +++ b/src/test/ui/feature-gates/feature-gate-label_break_value.stderr @@ -1,7 +1,7 @@ error[E0658]: labels on blocks are unstable (see issue #48594) --> $DIR/feature-gate-label_break_value.rs:2:5 | -LL | 'a: { //~ ERROR labels on blocks are unstable +LL | 'a: { | ^^ | = help: add #![feature(label_break_value)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-lang-items.stderr b/src/test/ui/feature-gates/feature-gate-lang-items.stderr index ccbb711fe6d4..f4c238d9f3ff 100644 --- a/src/test/ui/feature-gates/feature-gate-lang-items.stderr +++ b/src/test/ui/feature-gates/feature-gate-lang-items.stderr @@ -1,7 +1,7 @@ error[E0658]: language items are subject to change --> $DIR/feature-gate-lang-items.rs:1:1 | -LL | #[lang = "foo"] //~ ERROR language items are subject to change +LL | #[lang = "foo"] | ^^^^^^^^^^^^^^^ | = help: add #![feature(lang_items)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #[lang = "foo"] //~ ERROR language items are subject to change error[E0522]: definition of an unknown language item: `foo` --> $DIR/feature-gate-lang-items.rs:1:1 | -LL | #[lang = "foo"] //~ ERROR language items are subject to change +LL | #[lang = "foo"] | ^^^^^^^^^^^^^^^ definition of unknown language item `foo` error: aborting due to 2 previous errors diff --git a/src/test/ui/feature-gates/feature-gate-log_syntax.stderr b/src/test/ui/feature-gates/feature-gate-log_syntax.stderr index 33d1f07aa362..f29ee0b5a78c 100644 --- a/src/test/ui/feature-gates/feature-gate-log_syntax.stderr +++ b/src/test/ui/feature-gates/feature-gate-log_syntax.stderr @@ -1,7 +1,7 @@ error[E0658]: `log_syntax!` is not stable enough for use and is subject to change (see issue #29598) --> $DIR/feature-gate-log_syntax.rs:2:5 | -LL | log_syntax!() //~ ERROR `log_syntax!` is not stable enough +LL | log_syntax!() | ^^^^^^^^^^^^^ | = help: add #![feature(log_syntax)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-log_syntax2.stderr b/src/test/ui/feature-gates/feature-gate-log_syntax2.stderr index bdcd922c6e1e..c5a9b493728c 100644 --- a/src/test/ui/feature-gates/feature-gate-log_syntax2.stderr +++ b/src/test/ui/feature-gates/feature-gate-log_syntax2.stderr @@ -1,7 +1,7 @@ error[E0658]: `log_syntax!` is not stable enough for use and is subject to change (see issue #29598) --> $DIR/feature-gate-log_syntax2.rs:4:22 | -LL | println!("{:?}", log_syntax!()); //~ ERROR `log_syntax!` is not stable +LL | println!("{:?}", log_syntax!()); | ^^^^^^^^^^^^^ | = help: add #![feature(log_syntax)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-main.stderr b/src/test/ui/feature-gates/feature-gate-main.stderr index c92887eded64..870cf1aa2868 100644 --- a/src/test/ui/feature-gates/feature-gate-main.stderr +++ b/src/test/ui/feature-gates/feature-gate-main.stderr @@ -1,7 +1,7 @@ error[E0658]: declaration of a nonstandard #[main] function may change over time, for now a top-level `fn main()` is required (see issue #29634) --> $DIR/feature-gate-main.rs:2:1 | -LL | fn foo() {} //~ ERROR: declaration of a nonstandard #[main] function may change over time +LL | fn foo() {} | ^^^^^^^^^^^ | = help: add #![feature(main)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-min_const_fn.stderr b/src/test/ui/feature-gates/feature-gate-min_const_fn.stderr index 056e33111f0d..f6666b40f3e6 100644 --- a/src/test/ui/feature-gates/feature-gate-min_const_fn.stderr +++ b/src/test/ui/feature-gates/feature-gate-min_const_fn.stderr @@ -1,25 +1,25 @@ error[E0379]: trait fns cannot be declared const --> $DIR/feature-gate-min_const_fn.rs:6:5 | -LL | const fn foo() -> u32; //~ ERROR const fn is unstable +LL | const fn foo() -> u32; | ^^^^^ trait fns cannot be const error[E0379]: trait fns cannot be declared const --> $DIR/feature-gate-min_const_fn.rs:8:5 | -LL | const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable +LL | const fn bar() -> u32 { 0 } | ^^^^^ trait fns cannot be const error[E0379]: trait fns cannot be declared const --> $DIR/feature-gate-min_const_fn.rs:13:5 | -LL | const fn foo() -> u32 { 0 } //~ ERROR trait fns cannot be declared const +LL | const fn foo() -> u32 { 0 } | ^^^^^ trait fns cannot be const error[E0658]: const fn is unstable (see issue #57563) --> $DIR/feature-gate-min_const_fn.rs:6:5 | -LL | const fn foo() -> u32; //~ ERROR const fn is unstable +LL | const fn foo() -> u32; | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -27,7 +27,7 @@ LL | const fn foo() -> u32; //~ ERROR const fn is unstable error[E0658]: const fn is unstable (see issue #57563) --> $DIR/feature-gate-min_const_fn.rs:8:5 | -LL | const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable +LL | const fn bar() -> u32 { 0 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-needs-allocator.stderr b/src/test/ui/feature-gates/feature-gate-needs-allocator.stderr index 8897f393dbd5..012664e9b6bf 100644 --- a/src/test/ui/feature-gates/feature-gate-needs-allocator.stderr +++ b/src/test/ui/feature-gates/feature-gate-needs-allocator.stderr @@ -1,7 +1,7 @@ error[E0658]: the `#[needs_allocator]` attribute is an experimental feature --> $DIR/feature-gate-needs-allocator.rs:1:1 | -LL | #![needs_allocator] //~ ERROR the `#[needs_allocator]` attribute is +LL | #![needs_allocator] | ^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(allocator_internals)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-never_type.stderr b/src/test/ui/feature-gates/feature-gate-never_type.stderr index c4f8771171e8..13166db213e2 100644 --- a/src/test/ui/feature-gates/feature-gate-never_type.stderr +++ b/src/test/ui/feature-gates/feature-gate-never_type.stderr @@ -1,7 +1,7 @@ error[E0658]: The `!` type is experimental (see issue #35121) --> $DIR/feature-gate-never_type.rs:7:17 | -LL | type Ma = (u32, !, i32); //~ ERROR type is experimental +LL | type Ma = (u32, !, i32); | ^ | = help: add #![feature(never_type)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | type Ma = (u32, !, i32); //~ ERROR type is experimental error[E0658]: The `!` type is experimental (see issue #35121) --> $DIR/feature-gate-never_type.rs:8:20 | -LL | type Meeshka = Vec; //~ ERROR type is experimental +LL | type Meeshka = Vec; | ^ | = help: add #![feature(never_type)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | type Meeshka = Vec; //~ ERROR type is experimental error[E0658]: The `!` type is experimental (see issue #35121) --> $DIR/feature-gate-never_type.rs:9:24 | -LL | type Mow = &'static fn(!) -> !; //~ ERROR type is experimental +LL | type Mow = &'static fn(!) -> !; | ^ | = help: add #![feature(never_type)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | type Mow = &'static fn(!) -> !; //~ ERROR type is experimental error[E0658]: The `!` type is experimental (see issue #35121) --> $DIR/feature-gate-never_type.rs:10:27 | -LL | type Skwoz = &'static mut !; //~ ERROR type is experimental +LL | type Skwoz = &'static mut !; | ^ | = help: add #![feature(never_type)] to the crate attributes to enable @@ -33,7 +33,7 @@ LL | type Skwoz = &'static mut !; //~ ERROR type is experimental error[E0658]: The `!` type is experimental (see issue #35121) --> $DIR/feature-gate-never_type.rs:13:16 | -LL | type Wub = !; //~ ERROR type is experimental +LL | type Wub = !; | ^ | = help: add #![feature(never_type)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-nll.stderr b/src/test/ui/feature-gates/feature-gate-nll.stderr index f7b431d19be7..cc004e3a1da0 100644 --- a/src/test/ui/feature-gates/feature-gate-nll.stderr +++ b/src/test/ui/feature-gates/feature-gate-nll.stderr @@ -3,7 +3,7 @@ error[E0506]: cannot assign to `x` because it is borrowed | LL | let p = &x; | - borrow of `x` occurs here -LL | x = 22; //~ ERROR cannot assign to `x` because it is borrowed [E0506] +LL | x = 22; | ^^^^^^ assignment to borrowed `x` occurs here error: aborting due to previous error diff --git a/src/test/ui/feature-gates/feature-gate-no-debug-2.stderr b/src/test/ui/feature-gates/feature-gate-no-debug-2.stderr index 9299ac739ce3..1f8f114d7da5 100644 --- a/src/test/ui/feature-gates/feature-gate-no-debug-2.stderr +++ b/src/test/ui/feature-gates/feature-gate-no-debug-2.stderr @@ -1,7 +1,7 @@ error: use of deprecated attribute `no_debug`: the `#[no_debug]` attribute was an experimental feature that has been deprecated due to lack of demand. See https://github.com/rust-lang/rust/issues/29721 --> $DIR/feature-gate-no-debug-2.rs:4:1 | -LL | #[no_debug] //~ ERROR use of deprecated attribute `no_debug` +LL | #[no_debug] | ^^^^^^^^^^^ help: remove this attribute | note: lint level defined here diff --git a/src/test/ui/feature-gates/feature-gate-no-debug.stderr b/src/test/ui/feature-gates/feature-gate-no-debug.stderr index bdb732af7d2e..1ee2ec3c8818 100644 --- a/src/test/ui/feature-gates/feature-gate-no-debug.stderr +++ b/src/test/ui/feature-gates/feature-gate-no-debug.stderr @@ -1,7 +1,7 @@ error[E0658]: the `#[no_debug]` attribute was an experimental feature that has been deprecated due to lack of demand (see issue #29721) --> $DIR/feature-gate-no-debug.rs:3:1 | -LL | #[no_debug] //~ ERROR the `#[no_debug]` attribute was +LL | #[no_debug] | ^^^^^^^^^^^ | = help: add #![feature(no_debug)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-no_core.stderr b/src/test/ui/feature-gates/feature-gate-no_core.stderr index 7390051b95da..279f2198a808 100644 --- a/src/test/ui/feature-gates/feature-gate-no_core.stderr +++ b/src/test/ui/feature-gates/feature-gate-no_core.stderr @@ -1,7 +1,7 @@ error[E0658]: no_core is experimental (see issue #29639) --> $DIR/feature-gate-no_core.rs:3:1 | -LL | #![no_core] //~ ERROR no_core is experimental +LL | #![no_core] | ^^^^^^^^^^^ | = help: add #![feature(no_core)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-non_ascii_idents.stderr b/src/test/ui/feature-gates/feature-gate-non_ascii_idents.stderr index 5c441189ea7c..5e4c4649d012 100644 --- a/src/test/ui/feature-gates/feature-gate-non_ascii_idents.stderr +++ b/src/test/ui/feature-gates/feature-gate-non_ascii_idents.stderr @@ -1,7 +1,7 @@ error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:1:22 | -LL | extern crate core as bΓ€z; //~ ERROR non-ascii idents +LL | extern crate core as bΓ€z; | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | extern crate core as bΓ€z; //~ ERROR non-ascii idents error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:3:5 | -LL | use fΓΆΓΆ::bar; //~ ERROR non-ascii idents +LL | use fΓΆΓΆ::bar; | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | use fΓΆΓΆ::bar; //~ ERROR non-ascii idents error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:5:5 | -LL | mod fΓΆΓΆ { //~ ERROR non-ascii idents +LL | mod fΓΆΓΆ { | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | mod fΓΆΓΆ { //~ ERROR non-ascii idents error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:9:4 | -LL | fn bΓ€r( //~ ERROR non-ascii idents +LL | fn bΓ€r( | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -33,7 +33,7 @@ LL | fn bΓ€r( //~ ERROR non-ascii idents error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:10:5 | -LL | bΓ€z: isize //~ ERROR non-ascii idents +LL | bΓ€z: isize | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -41,7 +41,7 @@ LL | bΓ€z: isize //~ ERROR non-ascii idents error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:12:9 | -LL | let _ΓΆ: isize; //~ ERROR non-ascii idents +LL | let _ΓΆ: isize; | ^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -49,7 +49,7 @@ LL | let _ΓΆ: isize; //~ ERROR non-ascii idents error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:15:10 | -LL | (_Γ€, _) => {} //~ ERROR non-ascii idents +LL | (_Γ€, _) => {} | ^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -57,7 +57,7 @@ LL | (_Γ€, _) => {} //~ ERROR non-ascii idents error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:19:8 | -LL | struct FΓΆΓΆ { //~ ERROR non-ascii idents +LL | struct FΓΆΓΆ { | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -65,7 +65,7 @@ LL | struct FΓΆΓΆ { //~ ERROR non-ascii idents error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:20:5 | -LL | fΓΆΓΆ: isize //~ ERROR non-ascii idents +LL | fΓΆΓΆ: isize | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -73,7 +73,7 @@ LL | fΓΆΓΆ: isize //~ ERROR non-ascii idents error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:23:6 | -LL | enum BΓ€r { //~ ERROR non-ascii idents +LL | enum BΓ€r { | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -81,7 +81,7 @@ LL | enum BΓ€r { //~ ERROR non-ascii idents error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:24:5 | -LL | BΓ€z { //~ ERROR non-ascii idents +LL | BΓ€z { | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -89,7 +89,7 @@ LL | BΓ€z { //~ ERROR non-ascii idents error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:25:9 | -LL | qΓΌx: isize //~ ERROR non-ascii idents +LL | qΓΌx: isize | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -97,7 +97,7 @@ LL | qΓΌx: isize //~ ERROR non-ascii idents error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/feature-gate-non_ascii_idents.rs:30:8 | -LL | fn qΓΌx(); //~ ERROR non-ascii idents +LL | fn qΓΌx(); | ^^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-non_exhaustive.stderr b/src/test/ui/feature-gates/feature-gate-non_exhaustive.stderr index 9b45e19c3a3c..524f77902f68 100644 --- a/src/test/ui/feature-gates/feature-gate-non_exhaustive.stderr +++ b/src/test/ui/feature-gates/feature-gate-non_exhaustive.stderr @@ -1,7 +1,7 @@ error[E0658]: non exhaustive is an experimental feature (see issue #44109) --> $DIR/feature-gate-non_exhaustive.rs:3:1 | -LL | #[non_exhaustive] //~ERROR non exhaustive is an experimental feature (see issue #44109) +LL | #[non_exhaustive] | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(non_exhaustive)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.stderr b/src/test/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.stderr index de1f03cc170b..683424899a2d 100644 --- a/src/test/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.stderr +++ b/src/test/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.stderr @@ -1,7 +1,7 @@ error[E0658]: the `#[omit_gdb_pretty_printer_section]` attribute is just used for the Rust test suite --> $DIR/feature-gate-omit-gdb-pretty-printer-section.rs:1:1 | -LL | #[omit_gdb_pretty_printer_section] //~ ERROR the `#[omit_gdb_pretty_printer_section]` attribute is +LL | #[omit_gdb_pretty_printer_section] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(omit_gdb_pretty_printer_section)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr b/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr index 5806f6f03915..12b796d2e60a 100644 --- a/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr +++ b/src/test/ui/feature-gates/feature-gate-precise_pointer_size_matching.stderr @@ -1,14 +1,18 @@ error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/feature-gate-precise_pointer_size_matching.rs:6:11 | -LL | match 0usize { //~ERROR non-exhaustive patterns: `_` not covered +LL | match 0usize { | ^^^^^^ pattern `_` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/feature-gate-precise_pointer_size_matching.rs:10:11 | -LL | match 0isize { //~ERROR non-exhaustive patterns: `_` not covered +LL | match 0isize { | ^^^^^^ pattern `_` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to 2 previous errors diff --git a/src/test/ui/feature-gates/feature-gate-prelude_import.stderr b/src/test/ui/feature-gates/feature-gate-prelude_import.stderr index c0016d24f35e..7501954f904e 100644 --- a/src/test/ui/feature-gates/feature-gate-prelude_import.stderr +++ b/src/test/ui/feature-gates/feature-gate-prelude_import.stderr @@ -1,7 +1,7 @@ error[E0658]: `#[prelude_import]` is for use by rustc only --> $DIR/feature-gate-prelude_import.rs:1:1 | -LL | #[prelude_import] //~ ERROR `#[prelude_import]` is for use by rustc only +LL | #[prelude_import] | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(prelude_import)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-profiler-runtime.stderr b/src/test/ui/feature-gates/feature-gate-profiler-runtime.stderr index 2d6ef277572b..1f335401f996 100644 --- a/src/test/ui/feature-gates/feature-gate-profiler-runtime.stderr +++ b/src/test/ui/feature-gates/feature-gate-profiler-runtime.stderr @@ -1,7 +1,7 @@ error[E0658]: the `#[profiler_runtime]` attribute is used to identify the `profiler_builtins` crate which contains the profiler runtime and will never be stable --> $DIR/feature-gate-profiler-runtime.rs:1:1 | -LL | #![profiler_runtime] //~ ERROR the `#[profiler_runtime]` attribute is +LL | #![profiler_runtime] | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(profiler_runtime)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-repr-simd.stderr b/src/test/ui/feature-gates/feature-gate-repr-simd.stderr index 20cdbceeb689..c47ce70eaae7 100644 --- a/src/test/ui/feature-gates/feature-gate-repr-simd.stderr +++ b/src/test/ui/feature-gates/feature-gate-repr-simd.stderr @@ -1,7 +1,7 @@ error[E0658]: SIMD types are experimental and possibly buggy (see issue #27731) --> $DIR/feature-gate-repr-simd.rs:1:1 | -LL | #[repr(simd)] //~ error: SIMD types are experimental +LL | #[repr(simd)] | ^^^^^^^^^^^^^ | = help: add #![feature(repr_simd)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #[repr(simd)] //~ error: SIMD types are experimental error[E0658]: SIMD types are experimental and possibly buggy (see issue #27731) --> $DIR/feature-gate-repr-simd.rs:5:1 | -LL | #[repr(simd)] //~ error: SIMD types are experimental +LL | #[repr(simd)] | ^^^^^^^^^^^^^ | = help: add #![feature(repr_simd)] to the crate attributes to enable @@ -17,9 +17,9 @@ LL | #[repr(simd)] //~ error: SIMD types are experimental warning[E0566]: conflicting representation hints --> $DIR/feature-gate-repr-simd.rs:4:8 | -LL | #[repr(C)] //~ warn: conflicting representation hints +LL | #[repr(C)] | ^ -LL | #[repr(simd)] //~ error: SIMD types are experimental +LL | #[repr(simd)] | ^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/feature-gates/feature-gate-repr128.stderr b/src/test/ui/feature-gates/feature-gate-repr128.stderr index ddd11f6daab9..a2fd65935992 100644 --- a/src/test/ui/feature-gates/feature-gate-repr128.stderr +++ b/src/test/ui/feature-gates/feature-gate-repr128.stderr @@ -1,7 +1,7 @@ error[E0658]: repr with 128-bit type is unstable (see issue #35118) --> $DIR/feature-gate-repr128.rs:2:1 | -LL | / enum A { //~ ERROR repr with 128-bit type is unstable +LL | / enum A { LL | | A(u64) LL | | } | |_^ diff --git a/src/test/ui/feature-gates/feature-gate-repr_align_enum.stderr b/src/test/ui/feature-gates/feature-gate-repr_align_enum.stderr index 6def25f96511..ae4066ceb801 100644 --- a/src/test/ui/feature-gates/feature-gate-repr_align_enum.stderr +++ b/src/test/ui/feature-gates/feature-gate-repr_align_enum.stderr @@ -1,7 +1,7 @@ error[E0658]: `#[repr(align(x))]` on enums is experimental (see issue #57996) --> $DIR/feature-gate-repr_align_enum.rs:4:1 | -LL | #[repr(align(8))] //~ ERROR `#[repr(align(x))]` on enums is experimental (see issue #57996) +LL | #[repr(align(8))] | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(repr_align_enum)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.stderr b/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.stderr index 2b90699384b4..73cd28fe7498 100644 --- a/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.stderr +++ b/src/test/ui/feature-gates/feature-gate-rustc-attrs-1.stderr @@ -1,7 +1,7 @@ error[E0658]: the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable (see issue #29642) --> $DIR/feature-gate-rustc-attrs-1.rs:5:1 | -LL | #[rustc_variance] //~ ERROR the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable +LL | #[rustc_variance] | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(rustc_attrs)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #[rustc_variance] //~ ERROR the `#[rustc_variance]` attribute is just used error[E0658]: the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable (see issue #29642) --> $DIR/feature-gate-rustc-attrs-1.rs:6:1 | -LL | #[rustc_error] //~ ERROR the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable +LL | #[rustc_error] | ^^^^^^^^^^^^^^ | = help: add #![feature(rustc_attrs)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.stderr b/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.stderr index 52d9b8db2fbe..8f584c333ac7 100644 --- a/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.stderr +++ b/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.stderr @@ -1,7 +1,7 @@ error[E0658]: the `#[rustc_const_unstable]` attribute is an internal feature --> $DIR/feature-gate-rustc_const_unstable.rs:8:1 | -LL | #[rustc_const_unstable(feature="fzzzzzt")] //~ERROR internal feature +LL | #[rustc_const_unstable(feature="fzzzzzt")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(rustc_const_unstable)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-sanitizer-runtime.stderr b/src/test/ui/feature-gates/feature-gate-sanitizer-runtime.stderr index 37e9b35c0ba7..71d9890cb2c3 100644 --- a/src/test/ui/feature-gates/feature-gate-sanitizer-runtime.stderr +++ b/src/test/ui/feature-gates/feature-gate-sanitizer-runtime.stderr @@ -1,7 +1,7 @@ error[E0658]: the `#[sanitizer_runtime]` attribute is used to identify crates that contain the runtime of a sanitizer and will never be stable --> $DIR/feature-gate-sanitizer-runtime.rs:1:1 | -LL | #![sanitizer_runtime] //~ ERROR the `#[sanitizer_runtime]` attribute is +LL | #![sanitizer_runtime] | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(sanitizer_runtime)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-simd-ffi.stderr b/src/test/ui/feature-gates/feature-gate-simd-ffi.stderr index 01005138a607..11e095fef3da 100644 --- a/src/test/ui/feature-gates/feature-gate-simd-ffi.stderr +++ b/src/test/ui/feature-gates/feature-gate-simd-ffi.stderr @@ -1,7 +1,7 @@ error: use of SIMD type `LocalSimd` in FFI is highly experimental and may result in invalid code --> $DIR/feature-gate-simd-ffi.rs:9:17 | -LL | fn baz() -> LocalSimd; //~ ERROR use of SIMD type +LL | fn baz() -> LocalSimd; | ^^^^^^^^^ | = help: add #![feature(simd_ffi)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | fn baz() -> LocalSimd; //~ ERROR use of SIMD type error: use of SIMD type `LocalSimd` in FFI is highly experimental and may result in invalid code --> $DIR/feature-gate-simd-ffi.rs:10:15 | -LL | fn qux(x: LocalSimd); //~ ERROR use of SIMD type +LL | fn qux(x: LocalSimd); | ^^^^^^^^^ | = help: add #![feature(simd_ffi)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-simd.stderr b/src/test/ui/feature-gates/feature-gate-simd.stderr index ad5ffa5e7852..b37f138fbb5e 100644 --- a/src/test/ui/feature-gates/feature-gate-simd.stderr +++ b/src/test/ui/feature-gates/feature-gate-simd.stderr @@ -1,7 +1,7 @@ error[E0658]: SIMD types are experimental and possibly buggy (see issue #27731) --> $DIR/feature-gate-simd.rs:3:1 | -LL | #[repr(simd)] //~ ERROR SIMD types are experimental +LL | #[repr(simd)] | ^^^^^^^^^^^^^ | = help: add #![feature(repr_simd)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-slice-patterns.stderr b/src/test/ui/feature-gates/feature-gate-slice-patterns.stderr index 65dec6e10990..58eb57516eb0 100644 --- a/src/test/ui/feature-gates/feature-gate-slice-patterns.stderr +++ b/src/test/ui/feature-gates/feature-gate-slice-patterns.stderr @@ -1,7 +1,7 @@ error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121) --> $DIR/feature-gate-slice-patterns.rs:6:16 | -LL | [1, 2, ..] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized +LL | [1, 2, ..] => {} | ^^ | = help: add #![feature(slice_patterns)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | [1, 2, ..] => {} //~ ERROR syntax for subslices in slice patterns i error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121) --> $DIR/feature-gate-slice-patterns.rs:7:13 | -LL | [1, .., 5] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized +LL | [1, .., 5] => {} | ^^ | = help: add #![feature(slice_patterns)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | [1, .., 5] => {} //~ ERROR syntax for subslices in slice patterns i error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121) --> $DIR/feature-gate-slice-patterns.rs:8:10 | -LL | [.., 4, 5] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized +LL | [.., 4, 5] => {} | ^^ | = help: add #![feature(slice_patterns)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | [.., 4, 5] => {} //~ ERROR syntax for subslices in slice patterns i error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121) --> $DIR/feature-gate-slice-patterns.rs:13:11 | -LL | [ xs.., 4, 5 ] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized +LL | [ xs.., 4, 5 ] => {} | ^^ | = help: add #![feature(slice_patterns)] to the crate attributes to enable @@ -33,7 +33,7 @@ LL | [ xs.., 4, 5 ] => {} //~ ERROR syntax for subslices in slice patter error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121) --> $DIR/feature-gate-slice-patterns.rs:14:14 | -LL | [ 1, xs.., 5 ] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized +LL | [ 1, xs.., 5 ] => {} | ^^ | = help: add #![feature(slice_patterns)] to the crate attributes to enable @@ -41,7 +41,7 @@ LL | [ 1, xs.., 5 ] => {} //~ ERROR syntax for subslices in slice patter error[E0658]: syntax for subslices in slice patterns is not yet stabilized (see issue #23121) --> $DIR/feature-gate-slice-patterns.rs:15:17 | -LL | [ 1, 2, xs.. ] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized +LL | [ 1, 2, xs.. ] => {} | ^^ | = help: add #![feature(slice_patterns)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-thread_local.stderr b/src/test/ui/feature-gates/feature-gate-thread_local.stderr index dc7d67a20537..38064a6bc94b 100644 --- a/src/test/ui/feature-gates/feature-gate-thread_local.stderr +++ b/src/test/ui/feature-gates/feature-gate-thread_local.stderr @@ -1,7 +1,7 @@ error[E0658]: `#[thread_local]` is an experimental feature, and does not currently handle destructors. (see issue #29594) --> $DIR/feature-gate-thread_local.rs:8:1 | -LL | #[thread_local] //~ ERROR `#[thread_local]` is an experimental feature +LL | #[thread_local] | ^^^^^^^^^^^^^^^ | = help: add #![feature(thread_local)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-trace_macros.stderr b/src/test/ui/feature-gates/feature-gate-trace_macros.stderr index 9f4b01e45b6a..ee22bd25091a 100644 --- a/src/test/ui/feature-gates/feature-gate-trace_macros.stderr +++ b/src/test/ui/feature-gates/feature-gate-trace_macros.stderr @@ -1,7 +1,7 @@ error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598) --> $DIR/feature-gate-trace_macros.rs:2:5 | -LL | trace_macros!(true); //~ ERROR: `trace_macros` is not stable +LL | trace_macros!(true); | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(trace_macros)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr b/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr index 1f35efa59b69..b04a6e4d671b 100644 --- a/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr +++ b/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:10:1 | -LL | enum E where i32: Foo { V } //~ ERROR +LL | enum E where i32: Foo { V } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32` | = help: see issue #48214 @@ -10,7 +10,7 @@ LL | enum E where i32: Foo { V } //~ ERROR error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:12:1 | -LL | struct S where i32: Foo; //~ ERROR +LL | struct S where i32: Foo; | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32` | = help: see issue #48214 @@ -19,7 +19,7 @@ LL | struct S where i32: Foo; //~ ERROR error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:14:1 | -LL | trait T where i32: Foo {} //~ ERROR +LL | trait T where i32: Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32` | = help: see issue #48214 @@ -28,7 +28,7 @@ LL | trait T where i32: Foo {} //~ ERROR error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:16:1 | -LL | union U where i32: Foo { f: i32 } //~ ERROR +LL | union U where i32: Foo { f: i32 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32` | = help: see issue #48214 @@ -37,7 +37,7 @@ LL | union U where i32: Foo { f: i32 } //~ ERROR error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:20:1 | -LL | / impl Foo for () where i32: Foo { //~ ERROR +LL | / impl Foo for () where i32: Foo { LL | | fn test(&self) { LL | | 3i32.test(); LL | | Foo::test(&4i32); @@ -52,7 +52,7 @@ LL | | } error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:28:1 | -LL | / fn f() where i32: Foo //~ ERROR +LL | / fn f() where i32: Foo LL | | { LL | | let s = S; LL | | 3i32.test(); @@ -67,7 +67,7 @@ LL | | } error[E0277]: the trait bound `std::string::String: std::ops::Neg` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:36:1 | -LL | / fn use_op(s: String) -> String where String: ::std::ops::Neg { //~ ERROR +LL | / fn use_op(s: String) -> String where String: ::std::ops::Neg { LL | | -s LL | | } | |_^ the trait `std::ops::Neg` is not implemented for `std::string::String` @@ -78,7 +78,7 @@ LL | | } error[E0277]: `i32` is not an iterator --> $DIR/feature-gate-trivial_bounds.rs:40:1 | -LL | / fn use_for() where i32: Iterator { //~ ERROR +LL | / fn use_for() where i32: Iterator { LL | | for _ in 2i32 {} LL | | } | |_^ `i32` is not an iterator @@ -91,7 +91,7 @@ LL | | } error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/feature-gate-trivial_bounds.rs:52:1 | -LL | struct TwoStrs(str, str) where str: Sized; //~ ERROR +LL | struct TwoStrs(str, str) where str: Sized; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` @@ -102,7 +102,7 @@ LL | struct TwoStrs(str, str) where str: Sized; //~ ERROR error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time --> $DIR/feature-gate-trivial_bounds.rs:55:1 | -LL | / fn unsized_local() where Dst: Sized { //~ ERROR +LL | / fn unsized_local() where Dst: Sized { LL | | let x: Dst = *(Box::new(Dst { x: 1 }) as Box>); LL | | } | |_^ doesn't have a size known at compile-time @@ -116,7 +116,7 @@ LL | | } error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/feature-gate-trivial_bounds.rs:59:1 | -LL | / fn return_str() -> str where str: Sized { //~ ERROR +LL | / fn return_str() -> str where str: Sized { LL | | *"Sized".to_string().into_boxed_str() LL | | } | |_^ doesn't have a size known at compile-time diff --git a/src/test/ui/feature-gates/feature-gate-try_blocks.stderr b/src/test/ui/feature-gates/feature-gate-try_blocks.stderr index 209a445194da..74ad0e70c961 100644 --- a/src/test/ui/feature-gates/feature-gate-try_blocks.stderr +++ b/src/test/ui/feature-gates/feature-gate-try_blocks.stderr @@ -1,7 +1,7 @@ error[E0658]: `try` expression is experimental (see issue #31436) --> $DIR/feature-gate-try_blocks.rs:4:33 | -LL | let try_result: Option<_> = try { //~ ERROR `try` expression is experimental +LL | let try_result: Option<_> = try { | _________________________________^ LL | | let x = 5; LL | | x diff --git a/src/test/ui/feature-gates/feature-gate-try_reserve.stderr b/src/test/ui/feature-gates/feature-gate-try_reserve.stderr index 4ced5037f38b..61a3249c2ab9 100644 --- a/src/test/ui/feature-gates/feature-gate-try_reserve.stderr +++ b/src/test/ui/feature-gates/feature-gate-try_reserve.stderr @@ -1,7 +1,7 @@ error[E0658]: use of unstable library feature 'try_reserve': new API (see issue #48043) --> $DIR/feature-gate-try_reserve.rs:3:7 | -LL | v.try_reserve(10); //~ ERROR: use of unstable library feature 'try_reserve' +LL | v.try_reserve(10); | ^^^^^^^^^^^ | = help: add #![feature(try_reserve)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-type_ascription.stderr b/src/test/ui/feature-gates/feature-gate-type_ascription.stderr index 4cf1f29f1ab0..13dbb6029673 100644 --- a/src/test/ui/feature-gates/feature-gate-type_ascription.stderr +++ b/src/test/ui/feature-gates/feature-gate-type_ascription.stderr @@ -1,7 +1,7 @@ error[E0658]: type ascription is experimental (see issue #23416) --> $DIR/feature-gate-type_ascription.rs:4:13 | -LL | let a = 10: u8; //~ ERROR type ascription is experimental +LL | let a = 10: u8; | ^^^^^^ | = help: add #![feature(type_ascription)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-unboxed-closures-method-calls.stderr b/src/test/ui/feature-gates/feature-gate-unboxed-closures-method-calls.stderr index 8730bf678fd3..519f6528323f 100644 --- a/src/test/ui/feature-gates/feature-gate-unboxed-closures-method-calls.stderr +++ b/src/test/ui/feature-gates/feature-gate-unboxed-closures-method-calls.stderr @@ -1,7 +1,7 @@ error[E0658]: use of unstable library feature 'fn_traits' (see issue #29625) --> $DIR/feature-gate-unboxed-closures-method-calls.rs:4:7 | -LL | f.call(()); //~ ERROR use of unstable library feature 'fn_traits' +LL | f.call(()); | ^^^^ | = help: add #![feature(fn_traits)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | f.call(()); //~ ERROR use of unstable library feature 'fn_traits' error[E0658]: use of unstable library feature 'fn_traits' (see issue #29625) --> $DIR/feature-gate-unboxed-closures-method-calls.rs:5:7 | -LL | f.call_mut(()); //~ ERROR use of unstable library feature 'fn_traits' +LL | f.call_mut(()); | ^^^^^^^^ | = help: add #![feature(fn_traits)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | f.call_mut(()); //~ ERROR use of unstable library feature 'fn_traits' error[E0658]: use of unstable library feature 'fn_traits' (see issue #29625) --> $DIR/feature-gate-unboxed-closures-method-calls.rs:6:7 | -LL | f.call_once(()); //~ ERROR use of unstable library feature 'fn_traits' +LL | f.call_once(()); | ^^^^^^^^^ | = help: add #![feature(fn_traits)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.stderr b/src/test/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.stderr index 266775484a90..a49a8b4cdb2b 100644 --- a/src/test/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.stderr +++ b/src/test/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.stderr @@ -1,7 +1,7 @@ error[E0658]: use of unstable library feature 'fn_traits' (see issue #29625) --> $DIR/feature-gate-unboxed-closures-ufcs-calls.rs:4:5 | -LL | Fn::call(&f, ()); //~ ERROR use of unstable library feature 'fn_traits' +LL | Fn::call(&f, ()); | ^^^^^^^^ | = help: add #![feature(fn_traits)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | Fn::call(&f, ()); //~ ERROR use of unstable library feature 'fn_traits' error[E0658]: use of unstable library feature 'fn_traits' (see issue #29625) --> $DIR/feature-gate-unboxed-closures-ufcs-calls.rs:5:5 | -LL | FnMut::call_mut(&mut f, ()); //~ ERROR use of unstable library feature 'fn_traits' +LL | FnMut::call_mut(&mut f, ()); | ^^^^^^^^^^^^^^^ | = help: add #![feature(fn_traits)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | FnMut::call_mut(&mut f, ()); //~ ERROR use of unstable library feature error[E0658]: use of unstable library feature 'fn_traits' (see issue #29625) --> $DIR/feature-gate-unboxed-closures-ufcs-calls.rs:6:5 | -LL | FnOnce::call_once(f, ()); //~ ERROR use of unstable library feature 'fn_traits' +LL | FnOnce::call_once(f, ()); | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(fn_traits)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-underscore_const_names.stderr b/src/test/ui/feature-gates/feature-gate-underscore_const_names.stderr index d608f3d37cf2..ef93bb97ab44 100644 --- a/src/test/ui/feature-gates/feature-gate-underscore_const_names.stderr +++ b/src/test/ui/feature-gates/feature-gate-underscore_const_names.stderr @@ -2,7 +2,7 @@ error[E0658]: naming constants with `_` is unstable (see issue #54912) --> $DIR/feature-gate-underscore_const_names.rs:6:1 | LL | / const _ : () = { -LL | | //~^ ERROR is unstable +LL | | LL | | use std::marker::PhantomData; LL | | struct ImplementsTrait(PhantomData); LL | | let _ = ImplementsTrait::(PhantomData); diff --git a/src/test/ui/feature-gates/feature-gate-unrestricted-attribute-tokens.rs b/src/test/ui/feature-gates/feature-gate-unrestricted-attribute-tokens.rs deleted file mode 100644 index 181c8592c547..000000000000 --- a/src/test/ui/feature-gates/feature-gate-unrestricted-attribute-tokens.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![feature(custom_attribute)] - -#[my_attr(a b c d)] -//~^ ERROR expected one of `(`, `)`, `,`, `::`, or `=`, found `b` -//~| ERROR expected one of `(`, `)`, `,`, `::`, or `=`, found `c` -//~| ERROR expected one of `(`, `)`, `,`, `::`, or `=`, found `d` -fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-unrestricted-attribute-tokens.stderr b/src/test/ui/feature-gates/feature-gate-unrestricted-attribute-tokens.stderr deleted file mode 100644 index 1ddf2ff6d640..000000000000 --- a/src/test/ui/feature-gates/feature-gate-unrestricted-attribute-tokens.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: expected one of `(`, `)`, `,`, `::`, or `=`, found `b` - --> $DIR/feature-gate-unrestricted-attribute-tokens.rs:3:13 - | -LL | #[my_attr(a b c d)] - | ^ expected one of `(`, `)`, `,`, `::`, or `=` here - -error: expected one of `(`, `)`, `,`, `::`, or `=`, found `c` - --> $DIR/feature-gate-unrestricted-attribute-tokens.rs:3:15 - | -LL | #[my_attr(a b c d)] - | ^ expected one of `(`, `)`, `,`, `::`, or `=` here - -error: expected one of `(`, `)`, `,`, `::`, or `=`, found `d` - --> $DIR/feature-gate-unrestricted-attribute-tokens.rs:3:17 - | -LL | #[my_attr(a b c d)] - | ^ expected one of `(`, `)`, `,`, `::`, or `=` here - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/feature-gates/feature-gate-untagged_unions.stderr b/src/test/ui/feature-gates/feature-gate-untagged_unions.stderr index f9f8cfe9171a..6faa0528dc71 100644 --- a/src/test/ui/feature-gates/feature-gate-untagged_unions.stderr +++ b/src/test/ui/feature-gates/feature-gate-untagged_unions.stderr @@ -1,7 +1,7 @@ error[E0658]: unions with non-`Copy` fields are unstable (see issue #32836) --> $DIR/feature-gate-untagged_unions.rs:9:1 | -LL | / union U3 { //~ ERROR unions with non-`Copy` fields are unstable +LL | / union U3 { LL | | a: String, LL | | } | |_^ @@ -11,7 +11,7 @@ LL | | } error[E0658]: unions with non-`Copy` fields are unstable (see issue #32836) --> $DIR/feature-gate-untagged_unions.rs:13:1 | -LL | / union U4 { //~ ERROR unions with non-`Copy` fields are unstable +LL | / union U4 { LL | | a: T, LL | | } | |_^ @@ -21,7 +21,7 @@ LL | | } error[E0658]: unions with `Drop` implementations are unstable (see issue #32836) --> $DIR/feature-gate-untagged_unions.rs:17:1 | -LL | / union U5 { //~ ERROR unions with `Drop` implementations are unstable +LL | / union U5 { LL | | a: u8, LL | | } | |_^ diff --git a/src/test/ui/feature-gates/feature-gate-unwind-attributes.stderr b/src/test/ui/feature-gates/feature-gate-unwind-attributes.stderr index 918d40d681bb..149ce9e4f82a 100644 --- a/src/test/ui/feature-gates/feature-gate-unwind-attributes.stderr +++ b/src/test/ui/feature-gates/feature-gate-unwind-attributes.stderr @@ -1,7 +1,7 @@ -error[E0658]: #[unwind] is experimental +error[E0658]: #[unwind] is experimental (see issue #58760) --> $DIR/feature-gate-unwind-attributes.rs:11:5 | -LL | #[unwind(allowed)] //~ ERROR #[unwind] is experimental +LL | #[unwind(allowed)] | ^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unwind_attributes)] to the crate attributes to enable diff --git a/src/test/ui/feature-gates/underscore_const_names_feature_gate.stderr b/src/test/ui/feature-gates/underscore_const_names_feature_gate.stderr index a42b8e579c9b..83b3017a4cdf 100644 --- a/src/test/ui/feature-gates/underscore_const_names_feature_gate.stderr +++ b/src/test/ui/feature-gates/underscore_const_names_feature_gate.stderr @@ -1,7 +1,7 @@ error[E0658]: naming constants with `_` is unstable (see issue #54912) --> $DIR/underscore_const_names_feature_gate.rs:1:1 | -LL | const _: () = (); //~ ERROR is unstable +LL | const _: () = (); | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(underscore_const_names)] to the crate attributes to enable diff --git a/src/test/ui/ffi_returns_twice.stderr b/src/test/ui/ffi_returns_twice.stderr index c2105ae1dac7..e4137c79939a 100644 --- a/src/test/ui/ffi_returns_twice.stderr +++ b/src/test/ui/ffi_returns_twice.stderr @@ -1,7 +1,7 @@ error[E0724]: `#[ffi_returns_twice]` may only be used on foreign functions --> $DIR/ffi_returns_twice.rs:5:1 | -LL | #[ffi_returns_twice] //~ ERROR `#[ffi_returns_twice]` may only be used on foreign functions +LL | #[ffi_returns_twice] | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/float-literal-inference-restrictions.stderr b/src/test/ui/float-literal-inference-restrictions.stderr index a69c13507e6b..6ac49b7ccd13 100644 --- a/src/test/ui/float-literal-inference-restrictions.stderr +++ b/src/test/ui/float-literal-inference-restrictions.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/float-literal-inference-restrictions.rs:2:18 | -LL | let x: f32 = 1; //~ ERROR mismatched types +LL | let x: f32 = 1; | ^ | | | expected f32, found integer @@ -13,7 +13,7 @@ LL | let x: f32 = 1; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/float-literal-inference-restrictions.rs:3:18 | -LL | let y: f32 = 1f64; //~ ERROR mismatched types +LL | let y: f32 = 1f64; | ^^^^ expected f32, found f64 error: aborting due to 2 previous errors diff --git a/src/test/ui/fmt/send-sync.stderr b/src/test/ui/fmt/send-sync.stderr index 5abe0d0c50b4..1f698c90cb9a 100644 --- a/src/test/ui/fmt/send-sync.stderr +++ b/src/test/ui/fmt/send-sync.stderr @@ -1,7 +1,7 @@ error[E0277]: `*mut (dyn std::ops::Fn() + 'static)` cannot be shared between threads safely --> $DIR/send-sync.rs:8:5 | -LL | send(format_args!("{:?}", c)); //~ ERROR E0277 +LL | send(format_args!("{:?}", c)); | ^^^^ `*mut (dyn std::ops::Fn() + 'static)` cannot be shared between threads safely | = help: within `[std::fmt::ArgumentV1<'_>]`, the trait `std::marker::Sync` is not implemented for `*mut (dyn std::ops::Fn() + 'static)` @@ -21,7 +21,7 @@ LL | fn send(_: T) {} error[E0277]: `*mut (dyn std::ops::Fn() + 'static)` cannot be shared between threads safely --> $DIR/send-sync.rs:9:5 | -LL | sync(format_args!("{:?}", c)); //~ ERROR E0277 +LL | sync(format_args!("{:?}", c)); | ^^^^ `*mut (dyn std::ops::Fn() + 'static)` cannot be shared between threads safely | = help: within `std::fmt::Arguments<'_>`, the trait `std::marker::Sync` is not implemented for `*mut (dyn std::ops::Fn() + 'static)` diff --git a/src/test/ui/fn_must_use.stderr b/src/test/ui/fn_must_use.stderr index 4bba638c4e9b..5a1a4e36e06d 100644 --- a/src/test/ui/fn_must_use.stderr +++ b/src/test/ui/fn_must_use.stderr @@ -1,7 +1,7 @@ warning: unused return value of `need_to_use_this_value` that must be used --> $DIR/fn_must_use.rs:55:5 | -LL | need_to_use_this_value(); //~ WARN unused return value +LL | need_to_use_this_value(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -14,7 +14,7 @@ LL | #![warn(unused_must_use)] warning: unused return value of `MyStruct::need_to_use_this_method_value` that must be used --> $DIR/fn_must_use.rs:60:5 | -LL | m.need_to_use_this_method_value(); //~ WARN unused return value +LL | m.need_to_use_this_method_value(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused return value of `EvenNature::is_even` that must be used @@ -34,24 +34,24 @@ LL | MyStruct::need_to_use_this_associated_function_value(); warning: unused return value of `std::cmp::PartialEq::eq` that must be used --> $DIR/fn_must_use.rs:70:5 | -LL | 2.eq(&3); //~ WARN unused return value +LL | 2.eq(&3); | ^^^^^^^^^ warning: unused return value of `std::cmp::PartialEq::eq` that must be used --> $DIR/fn_must_use.rs:71:5 | -LL | m.eq(&n); //~ WARN unused return value +LL | m.eq(&n); | ^^^^^^^^^ warning: unused comparison that must be used --> $DIR/fn_must_use.rs:74:5 | -LL | 2 == 3; //~ WARN unused comparison +LL | 2 == 3; | ^^^^^^ warning: unused comparison that must be used --> $DIR/fn_must_use.rs:75:5 | -LL | m == n; //~ WARN unused comparison +LL | m == n; | ^^^^^^ diff --git a/src/test/ui/for/for-expn.stderr b/src/test/ui/for/for-expn.stderr index b598032e4c9b..cdb211555274 100644 --- a/src/test/ui/for/for-expn.stderr +++ b/src/test/ui/for/for-expn.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `foo` in this scope --> $DIR/for-expn.rs:6:7 | -LL | foo //~ ERROR cannot find value `foo` in this scope +LL | foo | ^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/for/for-loop-refutable-pattern-error-message.stderr b/src/test/ui/for/for-loop-refutable-pattern-error-message.stderr index 88d82187716d..da2b0dc234f4 100644 --- a/src/test/ui/for/for-loop-refutable-pattern-error-message.stderr +++ b/src/test/ui/for/for-loop-refutable-pattern-error-message.stderr @@ -1,7 +1,7 @@ error[E0005]: refutable pattern in `for` loop binding: `&-2147483648i32..=0i32` not covered --> $DIR/for-loop-refutable-pattern-error-message.rs:2:9 | -LL | for &1 in [1].iter() {} //~ ERROR refutable pattern in `for` loop binding +LL | for &1 in [1].iter() {} | ^^ pattern `&-2147483648i32..=0i32` not covered error: aborting due to previous error diff --git a/src/test/ui/for/for-loop-type-error.stderr b/src/test/ui/for/for-loop-type-error.stderr index b5a4a5240d9d..f1c1d0a53887 100644 --- a/src/test/ui/for/for-loop-type-error.stderr +++ b/src/test/ui/for/for-loop-type-error.stderr @@ -1,7 +1,7 @@ error[E0369]: binary operation `+` cannot be applied to type `()` --> $DIR/for-loop-type-error.rs:2:13 | -LL | let x = () + (); //~ ERROR binary operation +LL | let x = () + (); | ^^^^^^^ | = note: an implementation of `std::ops::Add` might be missing for `()` diff --git a/src/test/ui/for/for-loop-unconstrained-element-type.stderr b/src/test/ui/for/for-loop-unconstrained-element-type.stderr index aaaad658de7b..02fdb808da44 100644 --- a/src/test/ui/for/for-loop-unconstrained-element-type.stderr +++ b/src/test/ui/for/for-loop-unconstrained-element-type.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/for-loop-unconstrained-element-type.rs:8:14 | -LL | for i in Vec::new() { } //~ ERROR type annotations needed +LL | for i in Vec::new() { } | ^^^^^^^^^^ | | | cannot infer type diff --git a/src/test/ui/foreign-fn-return-lifetime.stderr b/src/test/ui/foreign-fn-return-lifetime.stderr index 00fda5dbd0c4..575da18f2404 100644 --- a/src/test/ui/foreign-fn-return-lifetime.stderr +++ b/src/test/ui/foreign-fn-return-lifetime.stderr @@ -1,7 +1,7 @@ error[E0106]: missing lifetime specifier --> $DIR/foreign-fn-return-lifetime.rs:5:19 | -LL | pub fn f() -> &u8; //~ ERROR missing lifetime specifier +LL | pub fn f() -> &u8; | ^ help: consider giving it a 'static lifetime: `&'static` | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from diff --git a/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.nll.stderr b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.nll.stderr index 67cca25ac0ca..e7b457534211 100644 --- a/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.nll.stderr +++ b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.nll.stderr @@ -1,7 +1,7 @@ error[E0509]: cannot move out of type `A`, which implements the `Drop` trait --> $DIR/functional-struct-update-noncopyable.rs:12:14 | -LL | let _b = A { y: Arc::new(3), ..a }; //~ ERROR cannot move out of type `A` +LL | let _b = A { y: Arc::new(3), ..a }; | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here error: aborting due to previous error diff --git a/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.stderr b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.stderr index a3497c59a52b..5549adc8d0e1 100644 --- a/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.stderr +++ b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.stderr @@ -1,7 +1,7 @@ error[E0509]: cannot move out of type `A`, which implements the `Drop` trait --> $DIR/functional-struct-update-noncopyable.rs:12:36 | -LL | let _b = A { y: Arc::new(3), ..a }; //~ ERROR cannot move out of type `A` +LL | let _b = A { y: Arc::new(3), ..a }; | ^ cannot move out of here error: aborting due to previous error diff --git a/src/test/ui/future-incompatible-lint-group.stderr b/src/test/ui/future-incompatible-lint-group.stderr index 79183fca9d3a..65c37e01eaa9 100644 --- a/src/test/ui/future-incompatible-lint-group.stderr +++ b/src/test/ui/future-incompatible-lint-group.stderr @@ -1,7 +1,7 @@ error: anonymous parameters are deprecated and will be removed in the next edition. --> $DIR/future-incompatible-lint-group.rs:4:10 | -LL | fn f(u8) {} //~ ERROR anonymous parameters are deprecated +LL | fn f(u8) {} | ^^ help: Try naming the parameter or explicitly ignoring it: `_: u8` | note: lint level defined here diff --git a/src/test/ui/gated-bad-feature.stderr b/src/test/ui/gated-bad-feature.stderr index 141c51609b7c..b208da3645d8 100644 --- a/src/test/ui/gated-bad-feature.stderr +++ b/src/test/ui/gated-bad-feature.stderr @@ -13,19 +13,19 @@ LL | foo = "baz" error[E0557]: feature has been removed --> $DIR/gated-bad-feature.rs:12:12 | -LL | #![feature(test_removed_feature)] //~ ERROR: feature has been removed +LL | #![feature(test_removed_feature)] | ^^^^^^^^^^^^^^^^^^^^ error: attribute must be of the form `#[feature(name1, name1, ...)]` --> $DIR/gated-bad-feature.rs:9:1 | -LL | #![feature] //~ ERROR: attribute must be of the form +LL | #![feature] | ^^^^^^^^^^^ error: attribute must be of the form `#[feature(name1, name1, ...)]` --> $DIR/gated-bad-feature.rs:10:1 | -LL | #![feature = "foo"] //~ ERROR: attribute must be of the form +LL | #![feature = "foo"] | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/generator/borrowing.nll.stderr b/src/test/ui/generator/borrowing.nll.stderr index 3c9221d28e74..3d58873f826d 100644 --- a/src/test/ui/generator/borrowing.nll.stderr +++ b/src/test/ui/generator/borrowing.nll.stderr @@ -7,7 +7,7 @@ LL | Pin::new(&mut || yield &a).resume() | | borrowed value does not live long enough | value captured here by generator | a temporary with access to the borrow is created here ... -LL | //~^ ERROR: `a` does not live long enough +LL | LL | }; | -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for generator | | diff --git a/src/test/ui/generator/borrowing.stderr b/src/test/ui/generator/borrowing.stderr index 169e4a8561c1..38502aa8e0b4 100644 --- a/src/test/ui/generator/borrowing.stderr +++ b/src/test/ui/generator/borrowing.stderr @@ -5,7 +5,7 @@ LL | Pin::new(&mut || yield &a).resume() | -- ^ borrowed value does not live long enough | | | capture occurs here -LL | //~^ ERROR: `a` does not live long enough +LL | LL | }; | - borrowed value only lives until here ... diff --git a/src/test/ui/generator/dropck.nll.stderr b/src/test/ui/generator/dropck.nll.stderr index a90a47fe9aa0..8bb860f288f1 100644 --- a/src/test/ui/generator/dropck.nll.stderr +++ b/src/test/ui/generator/dropck.nll.stderr @@ -18,7 +18,7 @@ error[E0597]: `ref_` does not live long enough LL | gen = || { | -- value captured here by generator LL | // but the generator can use it to drop a `Ref<'a, i32>`. -LL | let _d = ref_.take(); //~ ERROR `ref_` does not live long enough +LL | let _d = ref_.take(); | ^^^^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/generator/dropck.stderr b/src/test/ui/generator/dropck.stderr index fdaa5cfbae3e..977f388a626f 100644 --- a/src/test/ui/generator/dropck.stderr +++ b/src/test/ui/generator/dropck.stderr @@ -15,7 +15,7 @@ error[E0597]: `ref_` does not live long enough LL | gen = || { | -- capture occurs here LL | // but the generator can use it to drop a `Ref<'a, i32>`. -LL | let _d = ref_.take(); //~ ERROR `ref_` does not live long enough +LL | let _d = ref_.take(); | ^^^^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/generator/generator-with-nll.stderr b/src/test/ui/generator/generator-with-nll.stderr index c683ea1a3094..bd5abb202068 100644 --- a/src/test/ui/generator/generator-with-nll.stderr +++ b/src/test/ui/generator/generator-with-nll.stderr @@ -3,7 +3,7 @@ error[E0626]: borrow may still be in use when generator yields | LL | let b = &mut true; | ^^^^^^^^^ -LL | //~^ borrow may still be in use when generator yields +LL | LL | yield (); | -------- possible yield occurs here diff --git a/src/test/ui/generator/issue-48048.stderr b/src/test/ui/generator/issue-48048.stderr index aeea10225091..234235839164 100644 --- a/src/test/ui/generator/issue-48048.stderr +++ b/src/test/ui/generator/issue-48048.stderr @@ -1,7 +1,7 @@ error[E0626]: borrow may still be in use when generator yields --> $DIR/issue-48048.rs:9:9 | -LL | x.0({ //~ ERROR borrow may still be in use when generator yields +LL | x.0({ | ^^^ LL | yield; | ----- possible yield occurs here diff --git a/src/test/ui/generator/issue-53548-1.rs b/src/test/ui/generator/issue-53548-1.rs new file mode 100644 index 000000000000..df11800731c7 --- /dev/null +++ b/src/test/ui/generator/issue-53548-1.rs @@ -0,0 +1,20 @@ +// A variant of #53548 that does not actually require generators, +// but which encountered the same ICE/error. See `issue-53548.rs` +// for details. +// +// compile-pass + +use std::cell::RefCell; +use std::rc::Rc; + +trait Trait: 'static {} + +struct Store { + inner: Rc>>, +} + +fn main() { + let store = Store:: fn(&(dyn Trait + 'a))>> { + inner: Default::default(), + }; +} diff --git a/src/test/ui/generator/issue-53548.rs b/src/test/ui/generator/issue-53548.rs new file mode 100644 index 000000000000..00fdb91faab7 --- /dev/null +++ b/src/test/ui/generator/issue-53548.rs @@ -0,0 +1,39 @@ +// Regression test for #53548. The `Box` type below is +// expanded to `Box`, but the generator "witness" +// that results is `for<'r> { Box }`. The WF code was +// encountering an ICE (when debug-assertions were enabled) and an +// unexpected compilation error (without debug-asserions) when trying +// to process this `'r` region bound. In particular, to be WF, the +// region bound must meet the requirements of the trait, and hence we +// got `for<'r> { 'r: 'static }`. This would ICE because the `Binder` +// constructor we were using was assering that no higher-ranked +// regions were involved (because the WF code is supposed to skip +// those). The error (if debug-asserions were disabled) came because +// we obviously cannot prove that `'r: 'static` for any region `'r`. +// Pursuant with our "lazy WF" strategy for higher-ranked regions, the +// fix is not to require that `for<'r> { 'r: 'static }` holds (this is +// also analogous to what we would do for higher-ranked regions +// appearing within the trait in other positions). +// +// compile-pass + +#![feature(generators)] + +use std::cell::RefCell; +use std::rc::Rc; + +trait Trait: 'static {} + +struct Store { + inner: Rc>>, +} + +fn main() { + Box::new(static move || { + let store = Store::> { + inner: Default::default(), + }; + yield (); + }); +} + diff --git a/src/test/ui/generator/no-arguments-on-generators.stderr b/src/test/ui/generator/no-arguments-on-generators.stderr index 521001293afa..47a12bbacc02 100644 --- a/src/test/ui/generator/no-arguments-on-generators.stderr +++ b/src/test/ui/generator/no-arguments-on-generators.stderr @@ -1,7 +1,7 @@ error[E0628]: generators cannot have explicit arguments --> $DIR/no-arguments-on-generators.rs:4:15 | -LL | let gen = |start| { //~ ERROR generators cannot have explicit arguments +LL | let gen = |start| { | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/generator/pattern-borrow.stderr b/src/test/ui/generator/pattern-borrow.stderr index 50442828d8df..d78da5104915 100644 --- a/src/test/ui/generator/pattern-borrow.stderr +++ b/src/test/ui/generator/pattern-borrow.stderr @@ -1,7 +1,7 @@ error[E0626]: borrow may still be in use when generator yields --> $DIR/pattern-borrow.rs:9:24 | -LL | if let Test::A(ref _a) = test { //~ ERROR borrow may still be in use when generator yields +LL | if let Test::A(ref _a) = test { | ^^^^^^ LL | yield (); | -------- possible yield occurs here diff --git a/src/test/ui/generator/ref-escapes-but-not-over-yield.stderr b/src/test/ui/generator/ref-escapes-but-not-over-yield.stderr index 29299b2405a0..20a06abebd6a 100644 --- a/src/test/ui/generator/ref-escapes-but-not-over-yield.stderr +++ b/src/test/ui/generator/ref-escapes-but-not-over-yield.stderr @@ -3,7 +3,7 @@ error[E0597]: `b` does not live long enough | LL | a = &b; | ^ borrowed value does not live long enough -LL | //~^ ERROR `b` does not live long enough +LL | LL | }; | - `b` dropped here while still borrowed LL | } diff --git a/src/test/ui/generator/sized-yield.stderr b/src/test/ui/generator/sized-yield.stderr index c98f42e62168..c2caac7ebe2e 100644 --- a/src/test/ui/generator/sized-yield.stderr +++ b/src/test/ui/generator/sized-yield.stderr @@ -3,7 +3,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation t | LL | let mut gen = move || { | __________________________^ -LL | | //~^ ERROR the size for values of type +LL | | LL | | yield s[..]; LL | | }; | |____^ doesn't have a size known at compile-time diff --git a/src/test/ui/generator/static-not-unpin.stderr b/src/test/ui/generator/static-not-unpin.stderr index caf92f0ec693..404d3069f79f 100644 --- a/src/test/ui/generator/static-not-unpin.stderr +++ b/src/test/ui/generator/static-not-unpin.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `[static generator@$DIR/static-not-unpin.rs:11:25: 13:6 _]: std::marker::Unpin` is not satisfied --> $DIR/static-not-unpin.rs:14:5 | -LL | assert_unpin(generator); //~ ERROR std::marker::Unpin` is not satisfied +LL | assert_unpin(generator); | ^^^^^^^^^^^^ the trait `std::marker::Unpin` is not implemented for `[static generator@$DIR/static-not-unpin.rs:11:25: 13:6 _]` | note: required by `assert_unpin` diff --git a/src/test/ui/generator/yield-in-args.nll.stderr b/src/test/ui/generator/yield-in-args.nll.stderr index f753daafa974..ee6d22c27cde 100644 --- a/src/test/ui/generator/yield-in-args.nll.stderr +++ b/src/test/ui/generator/yield-in-args.nll.stderr @@ -1,7 +1,7 @@ error[E0626]: borrow may still be in use when generator yields --> $DIR/yield-in-args.rs:8:13 | -LL | foo(&b, yield); //~ ERROR +LL | foo(&b, yield); | ^^ ----- possible yield occurs here error: aborting due to previous error diff --git a/src/test/ui/generator/yield-in-args.stderr b/src/test/ui/generator/yield-in-args.stderr index f53677b5312e..2f22dea4e91f 100644 --- a/src/test/ui/generator/yield-in-args.stderr +++ b/src/test/ui/generator/yield-in-args.stderr @@ -1,7 +1,7 @@ error[E0626]: borrow may still be in use when generator yields --> $DIR/yield-in-args.rs:8:14 | -LL | foo(&b, yield); //~ ERROR +LL | foo(&b, yield); | ^ ----- possible yield occurs here error: aborting due to previous error diff --git a/src/test/ui/generator/yield-while-iterating.nll.stderr b/src/test/ui/generator/yield-while-iterating.nll.stderr index 2dc12f843b22..43e29ceb5e66 100644 --- a/src/test/ui/generator/yield-while-iterating.nll.stderr +++ b/src/test/ui/generator/yield-while-iterating.nll.stderr @@ -1,7 +1,7 @@ error[E0626]: borrow may still be in use when generator yields --> $DIR/yield-while-iterating.rs:13:18 | -LL | for p in &x { //~ ERROR +LL | for p in &x { | ^^ LL | yield(); | ------- possible yield occurs here @@ -14,7 +14,7 @@ LL | let mut b = || { LL | for p in &mut x { | - first borrow occurs due to use of `x` in generator ... -LL | println!("{}", x[0]); //~ ERROR +LL | println!("{}", x[0]); | ^ immutable borrow occurs here LL | Pin::new(&mut b).resume(); | ------ mutable borrow later used here diff --git a/src/test/ui/generator/yield-while-iterating.stderr b/src/test/ui/generator/yield-while-iterating.stderr index 1e3e31470e9d..bcfe4f64bc3d 100644 --- a/src/test/ui/generator/yield-while-iterating.stderr +++ b/src/test/ui/generator/yield-while-iterating.stderr @@ -1,7 +1,7 @@ error[E0626]: borrow may still be in use when generator yields --> $DIR/yield-while-iterating.rs:13:19 | -LL | for p in &x { //~ ERROR +LL | for p in &x { | ^ LL | yield(); | ------- possible yield occurs here @@ -14,7 +14,7 @@ LL | let mut b = || { LL | for p in &mut x { | - previous borrow occurs due to use of `x` in closure ... -LL | println!("{}", x[0]); //~ ERROR +LL | println!("{}", x[0]); | ^ immutable borrow occurs here LL | Pin::new(&mut b).resume(); LL | } diff --git a/src/test/ui/generator/yield-while-ref-reborrowed.nll.stderr b/src/test/ui/generator/yield-while-ref-reborrowed.nll.stderr index d0d6a98301e5..4c37cd351732 100644 --- a/src/test/ui/generator/yield-while-ref-reborrowed.nll.stderr +++ b/src/test/ui/generator/yield-while-ref-reborrowed.nll.stderr @@ -6,7 +6,7 @@ LL | let mut b = || { LL | let a = &mut *x; | - first borrow occurs due to use of `x` in generator ... -LL | println!("{}", x); //~ ERROR +LL | println!("{}", x); | ^ second borrow occurs here LL | Pin::new(&mut b).resume(); | ------ first borrow later used here diff --git a/src/test/ui/generator/yield-while-ref-reborrowed.stderr b/src/test/ui/generator/yield-while-ref-reborrowed.stderr index 5c9de279c02d..155f2770d3d5 100644 --- a/src/test/ui/generator/yield-while-ref-reborrowed.stderr +++ b/src/test/ui/generator/yield-while-ref-reborrowed.stderr @@ -6,7 +6,7 @@ LL | let mut b = || { LL | let a = &mut *x; | - previous borrow occurs due to use of `x` in closure ... -LL | println!("{}", x); //~ ERROR +LL | println!("{}", x); | ^ borrow occurs here LL | Pin::new(&mut b).resume(); LL | } diff --git a/src/test/ui/generic/generic-arg-mismatch-recover.stderr b/src/test/ui/generic/generic-arg-mismatch-recover.stderr index 37f6c61f06df..e16ad9120a65 100644 --- a/src/test/ui/generic/generic-arg-mismatch-recover.stderr +++ b/src/test/ui/generic/generic-arg-mismatch-recover.stderr @@ -1,13 +1,13 @@ error[E0107]: wrong number of lifetime arguments: expected 1, found 2 --> $DIR/generic-arg-mismatch-recover.rs:6:20 | -LL | Foo::<'static, 'static, ()>(&0); //~ ERROR wrong number of lifetime arguments +LL | Foo::<'static, 'static, ()>(&0); | ^^^^^^^ unexpected lifetime argument error[E0308]: mismatched types --> $DIR/generic-arg-mismatch-recover.rs:6:33 | -LL | Foo::<'static, 'static, ()>(&0); //~ ERROR wrong number of lifetime arguments +LL | Foo::<'static, 'static, ()>(&0); | ^^ expected (), found integer | = note: expected type `&'static ()` @@ -16,13 +16,13 @@ LL | Foo::<'static, 'static, ()>(&0); //~ ERROR wrong number of lifetime arg error[E0107]: wrong number of lifetime arguments: expected 1, found 2 --> $DIR/generic-arg-mismatch-recover.rs:9:20 | -LL | Bar::<'static, 'static, ()>(&()); //~ ERROR wrong number of lifetime arguments +LL | Bar::<'static, 'static, ()>(&()); | ^^^^^^^ unexpected lifetime argument error[E0107]: wrong number of type arguments: expected 0, found 1 --> $DIR/generic-arg-mismatch-recover.rs:9:29 | -LL | Bar::<'static, 'static, ()>(&()); //~ ERROR wrong number of lifetime arguments +LL | Bar::<'static, 'static, ()>(&()); | ^^ unexpected type argument error: aborting due to 4 previous errors diff --git a/src/test/ui/generic/generic-extern-lifetime.stderr b/src/test/ui/generic/generic-extern-lifetime.stderr index b31d2a88044c..39372c931583 100644 --- a/src/test/ui/generic/generic-extern-lifetime.stderr +++ b/src/test/ui/generic/generic-extern-lifetime.stderr @@ -1,19 +1,19 @@ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/generic-extern-lifetime.rs:6:24 | -LL | pub fn life2<'b>(x:&'a i32, y:&'b i32); //~ ERROR use of undeclared lifetime name `'a` +LL | pub fn life2<'b>(x:&'a i32, y:&'b i32); | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/generic-extern-lifetime.rs:8:36 | -LL | pub fn life4<'b>(x: for<'c> fn(&'a i32)); //~ ERROR use of undeclared lifetime name `'a` +LL | pub fn life4<'b>(x: for<'c> fn(&'a i32)); | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/generic-extern-lifetime.rs:11:38 | -LL | pub fn life7<'b>() -> for<'c> fn(&'a i32); //~ ERROR use of undeclared lifetime name `'a` +LL | pub fn life7<'b>() -> for<'c> fn(&'a i32); | ^^ undeclared lifetime error: aborting due to 3 previous errors diff --git a/src/test/ui/generic/generic-extern.stderr b/src/test/ui/generic/generic-extern.stderr index 1c978245f9c6..e7625abb1c83 100644 --- a/src/test/ui/generic/generic-extern.stderr +++ b/src/test/ui/generic/generic-extern.stderr @@ -1,7 +1,7 @@ error[E0044]: foreign items may not have type parameters --> $DIR/generic-extern.rs:2:5 | -LL | fn foo(); //~ ERROR foreign items may not have type parameters +LL | fn foo(); | ^^^^^^^^^^^^ can't have type parameters | = help: use specialization instead of type parameters by replacing them with concrete types like `u32` diff --git a/src/test/ui/generic/generic-lifetime-trait-impl.stderr b/src/test/ui/generic/generic-lifetime-trait-impl.stderr index 8f4a0f23670b..4ae5098a121f 100644 --- a/src/test/ui/generic/generic-lifetime-trait-impl.stderr +++ b/src/test/ui/generic/generic-lifetime-trait-impl.stderr @@ -4,7 +4,7 @@ error[E0195]: lifetime parameters or bounds on method `bar` do not match the tra LL | fn bar<'b, T: Bar<'b>>(self) -> &'b str; | ---------------- lifetimes in impl do not match this method in trait ... -LL | fn bar>(self) -> &'a str { panic!() } //~ ERROR lifetime +LL | fn bar>(self) -> &'a str { panic!() } | ^^^^^^^^^^^^ lifetimes do not match method in trait error: aborting due to previous error diff --git a/src/test/ui/generic/generic-no-mangle.stderr b/src/test/ui/generic/generic-no-mangle.stderr index 3da39f1dc17c..f055a3ab83f7 100644 --- a/src/test/ui/generic/generic-no-mangle.stderr +++ b/src/test/ui/generic/generic-no-mangle.stderr @@ -3,7 +3,7 @@ error: functions generic over types or consts must be mangled | LL | #[no_mangle] | ------------ help: remove this attribute -LL | pub fn foo() {} //~ ERROR functions generic over types or consts must be mangled +LL | pub fn foo() {} | ^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -17,7 +17,7 @@ error: functions generic over types or consts must be mangled | LL | #[no_mangle] | ------------ help: remove this attribute -LL | pub extern fn bar() {} //~ ERROR functions generic over types or consts must be mangled +LL | pub extern fn bar() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/glob-resolve1.stderr b/src/test/ui/glob-resolve1.stderr index 10a57aa6ca64..01730c4d6956 100644 --- a/src/test/ui/glob-resolve1.stderr +++ b/src/test/ui/glob-resolve1.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find function `fpriv` in this scope --> $DIR/glob-resolve1.rs:22:5 | -LL | fpriv(); //~ ERROR cannot find function `fpriv` in this scope +LL | fpriv(); | ^^^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -11,7 +11,7 @@ LL | use bar::fpriv; error[E0425]: cannot find function `epriv` in this scope --> $DIR/glob-resolve1.rs:23:5 | -LL | epriv(); //~ ERROR cannot find function `epriv` in this scope +LL | epriv(); | ^^^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -21,7 +21,7 @@ LL | use bar::epriv; error[E0423]: expected value, found enum `B` --> $DIR/glob-resolve1.rs:24:5 | -LL | B; //~ ERROR expected value, found enum `B` +LL | B; | ^ | = note: did you mean to use one of the following variants? @@ -30,7 +30,7 @@ LL | B; //~ ERROR expected value, found enum `B` error[E0425]: cannot find value `C` in this scope --> $DIR/glob-resolve1.rs:25:5 | -LL | C; //~ ERROR cannot find value `C` in this scope +LL | C; | ^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -40,17 +40,17 @@ LL | use bar::C; error[E0425]: cannot find function `import` in this scope --> $DIR/glob-resolve1.rs:26:5 | -LL | import(); //~ ERROR: cannot find function `import` in this scope +LL | import(); | ^^^^^^ not found in this scope error[E0412]: cannot find type `A` in this scope --> $DIR/glob-resolve1.rs:28:11 | -LL | foo::(); //~ ERROR: cannot find type `A` in this scope +LL | foo::(); | ^ help: an enum with a similar name exists | -LL | foo::(); //~ ERROR: cannot find type `A` in this scope +LL | foo::(); | ^ help: possible candidate is found in another module, you can import it into scope | @@ -60,11 +60,11 @@ LL | use bar::A; error[E0412]: cannot find type `C` in this scope --> $DIR/glob-resolve1.rs:29:11 | -LL | foo::(); //~ ERROR: cannot find type `C` in this scope +LL | foo::(); | ^ help: an enum with a similar name exists | -LL | foo::(); //~ ERROR: cannot find type `C` in this scope +LL | foo::(); | ^ help: possible candidate is found in another module, you can import it into scope | @@ -74,11 +74,11 @@ LL | use bar::C; error[E0412]: cannot find type `D` in this scope --> $DIR/glob-resolve1.rs:30:11 | -LL | foo::(); //~ ERROR: cannot find type `D` in this scope +LL | foo::(); | ^ help: an enum with a similar name exists | -LL | foo::(); //~ ERROR: cannot find type `D` in this scope +LL | foo::(); | ^ help: possible candidate is found in another module, you can import it into scope | diff --git a/src/test/ui/hashmap-iter-value-lifetime.nll.stderr b/src/test/ui/hashmap-iter-value-lifetime.nll.stderr index cff58af3775c..f7626b13bad3 100644 --- a/src/test/ui/hashmap-iter-value-lifetime.nll.stderr +++ b/src/test/ui/hashmap-iter-value-lifetime.nll.stderr @@ -4,7 +4,7 @@ error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as LL | let (_, thing) = my_stuff.iter().next().unwrap(); | -------- immutable borrow occurs here LL | -LL | my_stuff.clear(); //~ ERROR cannot borrow +LL | my_stuff.clear(); | ^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | LL | println!("{}", *thing); diff --git a/src/test/ui/hashmap-iter-value-lifetime.stderr b/src/test/ui/hashmap-iter-value-lifetime.stderr index 99761dd1cd7f..0f7e04dae0ce 100644 --- a/src/test/ui/hashmap-iter-value-lifetime.stderr +++ b/src/test/ui/hashmap-iter-value-lifetime.stderr @@ -4,7 +4,7 @@ error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as LL | let (_, thing) = my_stuff.iter().next().unwrap(); | -------- immutable borrow occurs here LL | -LL | my_stuff.clear(); //~ ERROR cannot borrow +LL | my_stuff.clear(); | ^^^^^^^^ mutable borrow occurs here ... LL | } diff --git a/src/test/ui/hashmap-lifetimes.nll.stderr b/src/test/ui/hashmap-lifetimes.nll.stderr index 08b8e3e443a9..497c7d1216cd 100644 --- a/src/test/ui/hashmap-lifetimes.nll.stderr +++ b/src/test/ui/hashmap-lifetimes.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as | LL | let mut it = my_stuff.iter(); | -------- immutable borrow occurs here -LL | my_stuff.insert(1, 43); //~ ERROR cannot borrow +LL | my_stuff.insert(1, 43); | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here LL | it; | -- immutable borrow later used here diff --git a/src/test/ui/hashmap-lifetimes.stderr b/src/test/ui/hashmap-lifetimes.stderr index 81b2304f3810..728946ca13a6 100644 --- a/src/test/ui/hashmap-lifetimes.stderr +++ b/src/test/ui/hashmap-lifetimes.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as | LL | let mut it = my_stuff.iter(); | -------- immutable borrow occurs here -LL | my_stuff.insert(1, 43); //~ ERROR cannot borrow +LL | my_stuff.insert(1, 43); | ^^^^^^^^ mutable borrow occurs here LL | it; LL | } diff --git a/src/test/ui/hidden-rt-injection.stderr b/src/test/ui/hidden-rt-injection.stderr index 6d63344882b2..3e288b72ec63 100644 --- a/src/test/ui/hidden-rt-injection.stderr +++ b/src/test/ui/hidden-rt-injection.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `native` --> $DIR/hidden-rt-injection.rs:5:9 | -LL | use native; //~ ERROR unresolved import +LL | use native; | ^^^^^^ no `native` in the root error: aborting due to previous error diff --git a/src/test/ui/hidden-rt-injection2.stderr b/src/test/ui/hidden-rt-injection2.stderr index bbb45552f2c1..73f89b5856da 100644 --- a/src/test/ui/hidden-rt-injection2.stderr +++ b/src/test/ui/hidden-rt-injection2.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `rt` --> $DIR/hidden-rt-injection2.rs:5:9 | -LL | use rt; //~ ERROR unresolved import +LL | use rt; | ^^ no `rt` in the root error: aborting due to previous error diff --git a/src/test/ui/hrtb/hrtb-cache-issue-54302.stderr b/src/test/ui/hrtb/hrtb-cache-issue-54302.stderr index 21d154eb2316..77a5491cb63a 100644 --- a/src/test/ui/hrtb/hrtb-cache-issue-54302.stderr +++ b/src/test/ui/hrtb/hrtb-cache-issue-54302.stderr @@ -1,7 +1,7 @@ error: implementation of `Deserialize` is not general enough --> $DIR/hrtb-cache-issue-54302.rs:19:5 | -LL | assert_deserialize_owned::<&'static str>(); //~ ERROR +LL | assert_deserialize_owned::<&'static str>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `&'static str` must implement `Deserialize<'0>`, for any lifetime `'0` diff --git a/src/test/ui/hrtb/hrtb-conflate-regions.stderr b/src/test/ui/hrtb/hrtb-conflate-regions.stderr index 50e1af8f1423..3fb6baa35e14 100644 --- a/src/test/ui/hrtb/hrtb-conflate-regions.stderr +++ b/src/test/ui/hrtb/hrtb-conflate-regions.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `for<'a, 'b> SomeStruct: Foo<(&'a isize, &'b isize)>` is not satisfied --> $DIR/hrtb-conflate-regions.rs:28:10 | -LL | fn b() { want_foo2::(); } //~ ERROR +LL | fn b() { want_foo2::(); } | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a, 'b> Foo<(&'a isize, &'b isize)>` is not implemented for `SomeStruct` | = help: the following implementations were found: diff --git a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.nll.stderr b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.nll.stderr index 80ecc4741a2e..70d5b3c2ec58 100644 --- a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.nll.stderr +++ b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time | LL | foo.insert(); | --- first mutable borrow occurs here -LL | foo.insert(); //~ ERROR cannot borrow +LL | foo.insert(); | ^^^ | | | second mutable borrow occurs here diff --git a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr index 85bff4ce7911..e498a9ad0222 100644 --- a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr +++ b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `foo` as mutable more than once at a time | LL | foo.insert(); | --- first mutable borrow occurs here -LL | foo.insert(); //~ ERROR cannot borrow +LL | foo.insert(); | ^^^ second mutable borrow occurs here LL | } | - first borrow ends here diff --git a/src/test/ui/hrtb/hrtb-exists-forall-fn.stderr b/src/test/ui/hrtb/hrtb-exists-forall-fn.stderr index 8e8892552b70..d893cd606f1e 100644 --- a/src/test/ui/hrtb/hrtb-exists-forall-fn.stderr +++ b/src/test/ui/hrtb/hrtb-exists-forall-fn.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/hrtb-exists-forall-fn.rs:17:34 | -LL | let _: for<'b> fn(&'b u32) = foo(); //~ ERROR mismatched types +LL | let _: for<'b> fn(&'b u32) = foo(); | ^^^^^ expected concrete lifetime, found bound lifetime parameter 'b | = note: expected type `for<'b> fn(&'b u32)` diff --git a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr index f56b81759fed..f10e427a545f 100644 --- a/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr +++ b/src/test/ui/hrtb/hrtb-exists-forall-trait-invariant.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `(): Trait fn(std::cell::Cell<&'b u32>)>` is not satisfied --> $DIR/hrtb-exists-forall-trait-invariant.rs:28:5 | -LL | foo::<()>(); //~ ERROR not satisfied +LL | foo::<()>(); | ^^^^^^^^^ the trait `Trait fn(std::cell::Cell<&'b u32>)>` is not implemented for `()` | = help: the following implementations were found: diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr index 77c1789852e5..b5d945fe15ca 100644 --- a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr +++ b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `for<'ccx> B: Bar<'ccx>` is not satisfied --> $DIR/hrtb-higher-ranker-supertraits-transitive.rs:47:5 | -LL | want_bar_for_any_ccx(b); //~ ERROR +LL | want_bar_for_any_ccx(b); | ^^^^^^^^^^^^^^^^^^^^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B` | = help: consider adding a `where for<'ccx> B: Bar<'ccx>` bound diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr index 5914cb3eaa49..20a8fd459fa4 100644 --- a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr +++ b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `for<'tcx> F: Foo<'tcx>` is not satisfied --> $DIR/hrtb-higher-ranker-supertraits.rs:18:5 | -LL | want_foo_for_any_tcx(f); //~ ERROR not satisfied +LL | want_foo_for_any_tcx(f); | ^^^^^^^^^^^^^^^^^^^^ the trait `for<'tcx> Foo<'tcx>` is not implemented for `F` | = help: consider adding a `where for<'tcx> F: Foo<'tcx>` bound @@ -19,7 +19,7 @@ LL | | } error[E0277]: the trait bound `for<'ccx> B: Bar<'ccx>` is not satisfied --> $DIR/hrtb-higher-ranker-supertraits.rs:35:5 | -LL | want_bar_for_any_ccx(b); //~ ERROR not satisfied +LL | want_bar_for_any_ccx(b); | ^^^^^^^^^^^^^^^^^^^^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B` | = help: consider adding a `where for<'ccx> B: Bar<'ccx>` bound diff --git a/src/test/ui/hrtb/hrtb-just-for-static.stderr b/src/test/ui/hrtb/hrtb-just-for-static.stderr index fe2bc1f22250..115851ddf938 100644 --- a/src/test/ui/hrtb/hrtb-just-for-static.stderr +++ b/src/test/ui/hrtb/hrtb-just-for-static.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `for<'a> StaticInt: Foo<&'a isize>` is not satisfied --> $DIR/hrtb-just-for-static.rs:24:5 | -LL | want_hrtb::() //~ ERROR +LL | want_hrtb::() | ^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Foo<&'a isize>` is not implemented for `StaticInt` | = help: the following implementations were found: @@ -18,7 +18,7 @@ LL | | } error[E0277]: the trait bound `for<'a> &'a u32: Foo<&'a isize>` is not satisfied --> $DIR/hrtb-just-for-static.rs:30:5 | -LL | want_hrtb::<&'a u32>() //~ ERROR +LL | want_hrtb::<&'a u32>() | ^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Foo<&'a isize>` is not implemented for `&'a u32` | = help: the following implementations were found: diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr b/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr index ea08af016406..9bc8cd67a82a 100644 --- a/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr +++ b/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/hrtb-perfect-forwarding.rs:46:5 | -LL | foo_hrtb_bar_not(&mut t); //~ ERROR mismatched types +LL | foo_hrtb_bar_not(&mut t); | ^^^^^^^^^^^^^^^^ one type is more general than the other | = note: expected type `Bar<&'a isize>` diff --git a/src/test/ui/hrtb/issue-58451.stderr b/src/test/ui/hrtb/issue-58451.stderr index 79c24855dc96..4648c0182b98 100644 --- a/src/test/ui/hrtb/issue-58451.stderr +++ b/src/test/ui/hrtb/issue-58451.stderr @@ -8,7 +8,7 @@ LL | | I::Item: for<'a> Into<&'a ()>, LL | | {} | |__- defined here ... -LL | f(&[f()]); //~ ERROR this function takes 1 parameter +LL | f(&[f()]); | ^^^ expected 1 parameter error: aborting due to previous error diff --git a/src/test/ui/hygiene/arguments.stderr b/src/test/ui/hygiene/arguments.stderr index 4cf35be22fad..d072086e086d 100644 --- a/src/test/ui/hygiene/arguments.stderr +++ b/src/test/ui/hygiene/arguments.stderr @@ -1,7 +1,7 @@ error[E0412]: cannot find type `S` in this scope --> $DIR/arguments.rs:16:8 | -LL | m!(S, S); //~ ERROR cannot find type `S` in this scope +LL | m!(S, S); | ^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/hygiene/assoc_item_ctxt.stderr b/src/test/ui/hygiene/assoc_item_ctxt.stderr index d89f395d8c17..ebe38b7c41a6 100644 --- a/src/test/ui/hygiene/assoc_item_ctxt.stderr +++ b/src/test/ui/hygiene/assoc_item_ctxt.stderr @@ -1,7 +1,7 @@ error[E0407]: method `method` is not a member of trait `Tr` --> $DIR/assoc_item_ctxt.rs:35:13 | -LL | fn method() {} //~ ERROR method `method` is not a member of trait `Tr` +LL | fn method() {} | ^^^^^^^^^^^^^^ not a member of trait `Tr` ... LL | mac_trait_impl!(); @@ -13,7 +13,7 @@ error[E0046]: not all trait items implemented, missing: `method` LL | fn method(); | ------------ `method` from trait ... -LL | impl Tr for u8 { //~ ERROR not all trait items implemented, missing: `method` +LL | impl Tr for u8 { | ^^^^^^^^^^^^^^ missing `method` in implementation ... LL | mac_trait_impl!(); diff --git a/src/test/ui/hygiene/fields-definition.stderr b/src/test/ui/hygiene/fields-definition.stderr index d6d25d7fa0c2..a30650d88e28 100644 --- a/src/test/ui/hygiene/fields-definition.stderr +++ b/src/test/ui/hygiene/fields-definition.stderr @@ -3,7 +3,7 @@ error[E0124]: field `a` is already declared | LL | a: u8, | ----- `a` first declared here -LL | $a: u8, //~ ERROR field `a` is already declared +LL | $a: u8, | ^^ field already declared ... LL | legacy!(a); diff --git a/src/test/ui/hygiene/fields-move.nll.stderr b/src/test/ui/hygiene/fields-move.nll.stderr index f72a52e2535d..562f60e31b5d 100644 --- a/src/test/ui/hygiene/fields-move.nll.stderr +++ b/src/test/ui/hygiene/fields-move.nll.stderr @@ -1,12 +1,12 @@ error[E0382]: use of moved value: `foo.x` --> $DIR/fields-move.rs:18:9 | -LL | $foo.x //~ ERROR use of moved value: `foo.x` +LL | $foo.x | ^^^^^^ value used here after move ... -LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved value: `foo.x` +LL | assert_two_copies(copy_modern!(foo), foo.x); | ----- value moved here -LL | assert_two_copies(copy_legacy!(foo), foo.x); //~ ERROR use of moved value: `foo.x` +LL | assert_two_copies(copy_legacy!(foo), foo.x); | ----------------- in this macro invocation | = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait @@ -17,7 +17,7 @@ error[E0382]: use of moved value: `foo.x` LL | $foo.x | ------ value moved here ... -LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved value: `foo.x` +LL | assert_two_copies(copy_modern!(foo), foo.x); | ^^^^^ value used here after move | = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait @@ -25,10 +25,10 @@ LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved val error[E0382]: use of moved value: `foo.x` --> $DIR/fields-move.rs:29:42 | -LL | $foo.x //~ ERROR use of moved value: `foo.x` +LL | $foo.x | ------ value moved here ... -LL | assert_two_copies(copy_legacy!(foo), foo.x); //~ ERROR use of moved value: `foo.x` +LL | assert_two_copies(copy_legacy!(foo), foo.x); | ^^^^^ value used here after move | = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait diff --git a/src/test/ui/hygiene/fields-move.stderr b/src/test/ui/hygiene/fields-move.stderr index a5eeadff4dc0..43d55fdc68fb 100644 --- a/src/test/ui/hygiene/fields-move.stderr +++ b/src/test/ui/hygiene/fields-move.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `foo.x` LL | $foo.x | ------ value moved here ... -LL | assert_two_copies(copy_modern!(foo), foo.x); //~ ERROR use of moved value: `foo.x` +LL | assert_two_copies(copy_modern!(foo), foo.x); | ^^^^^ value used here after move | = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait @@ -15,10 +15,10 @@ error[E0382]: use of moved value: `foo.x` LL | $foo.x | ------ value moved here ... -LL | $foo.x //~ ERROR use of moved value: `foo.x` +LL | $foo.x | ^^^^^^ value used here after move ... -LL | assert_two_copies(copy_legacy!(foo), foo.x); //~ ERROR use of moved value: `foo.x` +LL | assert_two_copies(copy_legacy!(foo), foo.x); | ----------------- in this macro invocation | = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait @@ -29,7 +29,7 @@ error[E0382]: use of moved value: `foo.x` LL | $foo.x | ------ value moved here ... -LL | assert_two_copies(copy_legacy!(foo), foo.x); //~ ERROR use of moved value: `foo.x` +LL | assert_two_copies(copy_legacy!(foo), foo.x); | ^^^^^ value used here after move | = note: move occurs because `foo.x` has type `NonCopy`, which does not implement the `Copy` trait diff --git a/src/test/ui/hygiene/fields.stderr b/src/test/ui/hygiene/fields.stderr index 6d5b60fcb5b7..20ea4e91067b 100644 --- a/src/test/ui/hygiene/fields.stderr +++ b/src/test/ui/hygiene/fields.stderr @@ -1,7 +1,7 @@ error: type `foo::S` is private --> $DIR/fields.rs:15:17 | -LL | let s = S { x: 0 }; //~ ERROR type `foo::S` is private +LL | let s = S { x: 0 }; | ^^^^^^^^^^ ... LL | let s = foo::m!(S, x); @@ -10,7 +10,7 @@ LL | let s = foo::m!(S, x); error: type `foo::S` is private --> $DIR/fields.rs:16:17 | -LL | let _ = s.x; //~ ERROR type `foo::S` is private +LL | let _ = s.x; | ^ ... LL | let s = foo::m!(S, x); @@ -19,7 +19,7 @@ LL | let s = foo::m!(S, x); error: type `foo::T` is private --> $DIR/fields.rs:18:17 | -LL | let t = T(0); //~ ERROR type `foo::T` is private +LL | let t = T(0); | ^^^^ ... LL | let s = foo::m!(S, x); @@ -28,7 +28,7 @@ LL | let s = foo::m!(S, x); error: type `foo::T` is private --> $DIR/fields.rs:19:17 | -LL | let _ = t.0; //~ ERROR type `foo::T` is private +LL | let _ = t.0; | ^ ... LL | let s = foo::m!(S, x); diff --git a/src/test/ui/hygiene/for-loop.stderr b/src/test/ui/hygiene/for-loop.stderr index 755bf3e55f71..932c951e7a54 100644 --- a/src/test/ui/hygiene/for-loop.stderr +++ b/src/test/ui/hygiene/for-loop.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `iter` in this scope --> $DIR/for-loop.rs:6:9 | -LL | iter.next(); //~ ERROR cannot find value `iter` in this scope +LL | iter.next(); | ^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/hygiene/generate-mod.stderr b/src/test/ui/hygiene/generate-mod.stderr index d9342d911592..5e2c56d4bf4d 100644 --- a/src/test/ui/hygiene/generate-mod.stderr +++ b/src/test/ui/hygiene/generate-mod.stderr @@ -1,19 +1,19 @@ error[E0412]: cannot find type `FromOutside` in this scope --> $DIR/generate-mod.rs:35:13 | -LL | genmod!(FromOutside, Outer); //~ ERROR cannot find type `FromOutside` in this scope +LL | genmod!(FromOutside, Outer); | ^^^^^^^^^^^ not found in this scope error[E0412]: cannot find type `Outer` in this scope --> $DIR/generate-mod.rs:35:26 | -LL | genmod!(FromOutside, Outer); //~ ERROR cannot find type `FromOutside` in this scope +LL | genmod!(FromOutside, Outer); | ^^^^^ not found in this scope error[E0412]: cannot find type `FromOutside` in this scope --> $DIR/generate-mod.rs:19:18 | -LL | type A = FromOutside; //~ ERROR cannot find type `FromOutside` in this scope +LL | type A = FromOutside; | ^^^^^^^^^^^ not found in this scope ... LL | genmod_transparent!(); @@ -22,7 +22,7 @@ LL | genmod_transparent!(); error[E0412]: cannot find type `Outer` in this scope --> $DIR/generate-mod.rs:20:22 | -LL | type Inner = Outer; //~ ERROR cannot find type `Outer` in this scope +LL | type Inner = Outer; | ^^^^^ not found in this scope ... LL | genmod_transparent!(); @@ -31,7 +31,7 @@ LL | genmod_transparent!(); error[E0412]: cannot find type `FromOutside` in this scope --> $DIR/generate-mod.rs:28:18 | -LL | type A = FromOutside; //~ ERROR cannot find type `FromOutside` in this scope +LL | type A = FromOutside; | ^^^^^^^^^^^ not found in this scope ... LL | genmod_legacy!(); @@ -40,7 +40,7 @@ LL | genmod_legacy!(); error[E0412]: cannot find type `Outer` in this scope --> $DIR/generate-mod.rs:29:22 | -LL | type Inner = Outer; //~ ERROR cannot find type `Outer` in this scope +LL | type Inner = Outer; | ^^^^^ not found in this scope ... LL | genmod_legacy!(); diff --git a/src/test/ui/hygiene/globs.stderr b/src/test/ui/hygiene/globs.stderr index ad62b976251f..7e0f4e4e0b8f 100644 --- a/src/test/ui/hygiene/globs.stderr +++ b/src/test/ui/hygiene/globs.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find function `f` in this scope --> $DIR/globs.rs:22:9 | -LL | f(); //~ ERROR cannot find function `f` in this scope +LL | f(); | ^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -15,13 +15,13 @@ LL | use foo::f; error[E0425]: cannot find function `g` in this scope --> $DIR/globs.rs:15:5 | -LL | g(); //~ ERROR cannot find function `g` in this scope +LL | g(); | ^ not found in this scope ... LL | / m! { LL | | use bar::*; LL | | g(); -LL | | f(); //~ ERROR cannot find function `f` in this scope +LL | | f(); LL | | } | |_____- in this macro invocation help: possible candidates are found in other modules, you can import them into scope @@ -42,7 +42,7 @@ error[E0425]: cannot find function `f` in this scope LL | n!(f); | ------ in this macro invocation ... -LL | n!(f); //~ ERROR cannot find function `f` in this scope +LL | n!(f); | ^ not found in this scope error[E0425]: cannot find function `f` in this scope @@ -51,7 +51,7 @@ error[E0425]: cannot find function `f` in this scope LL | n!(f); | ------ in this macro invocation ... -LL | f //~ ERROR cannot find function `f` in this scope +LL | f | ^ not found in this scope error: aborting due to 4 previous errors diff --git a/src/test/ui/hygiene/hygienic-label-1.stderr b/src/test/ui/hygiene/hygienic-label-1.stderr index 9a55965d85fe..80cd1547b45e 100644 --- a/src/test/ui/hygiene/hygienic-label-1.stderr +++ b/src/test/ui/hygiene/hygienic-label-1.stderr @@ -1,7 +1,7 @@ error[E0426]: use of undeclared label `'x` --> $DIR/hygienic-label-1.rs:2:19 | -LL | () => { break 'x; } //~ ERROR use of undeclared label `'x` +LL | () => { break 'x; } | ^^ did you mean `'x`? ... LL | 'x: loop { foo!() } diff --git a/src/test/ui/hygiene/hygienic-label-2.stderr b/src/test/ui/hygiene/hygienic-label-2.stderr index b7cb91d94f1b..c20cbd9f6879 100644 --- a/src/test/ui/hygiene/hygienic-label-2.stderr +++ b/src/test/ui/hygiene/hygienic-label-2.stderr @@ -1,7 +1,7 @@ error[E0426]: use of undeclared label `'x` --> $DIR/hygienic-label-2.rs:6:16 | -LL | foo!(break 'x); //~ ERROR use of undeclared label `'x` +LL | foo!(break 'x); | ^^ did you mean `'x`? error: aborting due to previous error diff --git a/src/test/ui/hygiene/hygienic-label-3.stderr b/src/test/ui/hygiene/hygienic-label-3.stderr index 227a39512b74..b5839fe5c3d2 100644 --- a/src/test/ui/hygiene/hygienic-label-3.stderr +++ b/src/test/ui/hygiene/hygienic-label-3.stderr @@ -1,7 +1,7 @@ error[E0426]: use of undeclared label `'x` --> $DIR/hygienic-label-3.rs:2:19 | -LL | () => { break 'x; } //~ ERROR use of undeclared label `'x` +LL | () => { break 'x; } | ^^ did you mean `'x`? ... LL | foo!() diff --git a/src/test/ui/hygiene/hygienic-label-4.stderr b/src/test/ui/hygiene/hygienic-label-4.stderr index 4f9a68ca8311..1dd748957462 100644 --- a/src/test/ui/hygiene/hygienic-label-4.stderr +++ b/src/test/ui/hygiene/hygienic-label-4.stderr @@ -1,7 +1,7 @@ error[E0426]: use of undeclared label `'x` --> $DIR/hygienic-label-4.rs:6:16 | -LL | foo!(break 'x); //~ ERROR use of undeclared label `'x` +LL | foo!(break 'x); | ^^ did you mean `'x`? error: aborting due to previous error diff --git a/src/test/ui/hygiene/impl_items.stderr b/src/test/ui/hygiene/impl_items.stderr index cb3705e5513c..418c2c73ba15 100644 --- a/src/test/ui/hygiene/impl_items.stderr +++ b/src/test/ui/hygiene/impl_items.stderr @@ -1,7 +1,7 @@ error: type `for<'r> fn(&'r foo::S) {foo::S::f}` is private --> $DIR/impl_items.rs:12:23 | -LL | let _: () = S.f(); //~ ERROR type `for<'r> fn(&'r foo::S) {foo::S::f}` is private +LL | let _: () = S.f(); | ^ ... LL | foo::m!(); diff --git a/src/test/ui/hygiene/nested_macro_privacy.stderr b/src/test/ui/hygiene/nested_macro_privacy.stderr index 4fca86d521ba..6e78cb86d80f 100644 --- a/src/test/ui/hygiene/nested_macro_privacy.stderr +++ b/src/test/ui/hygiene/nested_macro_privacy.stderr @@ -1,7 +1,7 @@ error[E0616]: field `i` of struct `foo::S` is private --> $DIR/nested_macro_privacy.rs:15:5 | -LL | S::default().i; //~ ERROR field `i` of struct `foo::S` is private +LL | S::default().i; | ^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/hygiene/no_implicit_prelude-2018.stderr b/src/test/ui/hygiene/no_implicit_prelude-2018.stderr index 370fc9784ad4..e7ae7afa02aa 100644 --- a/src/test/ui/hygiene/no_implicit_prelude-2018.stderr +++ b/src/test/ui/hygiene/no_implicit_prelude-2018.stderr @@ -1,7 +1,7 @@ error: cannot find macro `print!` in this scope --> $DIR/no_implicit_prelude-2018.rs:7:9 | -LL | print!(); //~ ERROR cannot find macro `print!` in this scope +LL | print!(); | ^^^^^ | = help: have you added the `#[macro_use]` on the module/import? diff --git a/src/test/ui/hygiene/no_implicit_prelude.rs b/src/test/ui/hygiene/no_implicit_prelude.rs index 20da78f08dd2..1cd05f4d44c5 100644 --- a/src/test/ui/hygiene/no_implicit_prelude.rs +++ b/src/test/ui/hygiene/no_implicit_prelude.rs @@ -13,7 +13,7 @@ mod bar { } fn f() { ::foo::m!(); - println!(); // OK on 2015 edition (at least for now) + println!(); //~ ERROR cannot find macro `print!` in this scope } } diff --git a/src/test/ui/hygiene/no_implicit_prelude.stderr b/src/test/ui/hygiene/no_implicit_prelude.stderr index 7c9404cee2b8..7948f1667d77 100644 --- a/src/test/ui/hygiene/no_implicit_prelude.stderr +++ b/src/test/ui/hygiene/no_implicit_prelude.stderr @@ -4,23 +4,32 @@ error[E0433]: failed to resolve: use of undeclared type or module `Vec` LL | fn f() { ::bar::m!(); } | ------------ in this macro invocation ... -LL | Vec::new(); //~ ERROR failed to resolve +LL | Vec::new(); | ^^^ use of undeclared type or module `Vec` +error: cannot find macro `print!` in this scope + --> $DIR/no_implicit_prelude.rs:16:9 + | +LL | println!(); + | ^^^^^^^^^^^ + | + = help: have you added the `#[macro_use]` on the module/import? + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + error[E0599]: no method named `clone` found for type `()` in the current scope --> $DIR/no_implicit_prelude.rs:12:12 | LL | fn f() { ::bar::m!(); } | ------------ in this macro invocation ... -LL | ().clone() //~ ERROR no method named `clone` found +LL | ().clone() | ^^^^^ | = help: items from traits can only be used if the trait is in scope = note: the following trait is implemented but not in scope, perhaps add a `use` for it: `use std::clone::Clone;` -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors Some errors occurred: E0433, E0599. For more information about an error, try `rustc --explain E0433`. diff --git a/src/test/ui/hygiene/pattern-macro.stderr b/src/test/ui/hygiene/pattern-macro.stderr index 8a170dccd5c4..edd05916ede2 100644 --- a/src/test/ui/hygiene/pattern-macro.stderr +++ b/src/test/ui/hygiene/pattern-macro.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `x` in this scope --> $DIR/pattern-macro.rs:5:5 | -LL | x + 1; //~ ERROR cannot find value `x` in this scope +LL | x + 1; | ^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/hygiene/privacy.stderr b/src/test/ui/hygiene/privacy.stderr index bc056c7cf3cb..80fb4dd0f314 100644 --- a/src/test/ui/hygiene/privacy.stderr +++ b/src/test/ui/hygiene/privacy.stderr @@ -1,7 +1,7 @@ error[E0603]: function `f` is private --> $DIR/privacy.rs:16:14 | -LL | foo::f() //~ ERROR `f` is private +LL | foo::f() | ^ error: aborting due to previous error diff --git a/src/test/ui/hygiene/trait_items.stderr b/src/test/ui/hygiene/trait_items.stderr index 677bd08b6af5..4192b97e7506 100644 --- a/src/test/ui/hygiene/trait_items.stderr +++ b/src/test/ui/hygiene/trait_items.stderr @@ -4,7 +4,7 @@ error[E0599]: no method named `f` found for type `()` in the current scope LL | fn f() { ::baz::m!(); } | ------------ in this macro invocation ... -LL | pub macro m() { ().f() } //~ ERROR no method named `f` found for type `()` in the current scope +LL | pub macro m() { ().f() } | ^ | = help: items from traits can only be used if the trait is in scope diff --git a/src/test/ui/if/if-let-arm-types.stderr b/src/test/ui/if/if-let-arm-types.stderr index 6401a62c06ba..b986973fe91f 100644 --- a/src/test/ui/if/if-let-arm-types.stderr +++ b/src/test/ui/if/if-let-arm-types.stderr @@ -2,7 +2,7 @@ error[E0308]: `if let` arms have incompatible types --> $DIR/if-let-arm-types.rs:6:9 | LL | / if let Some(b) = None { -LL | | //~^ NOTE if let` arms have incompatible types +LL | | LL | | () LL | | } else { LL | | 1 diff --git a/src/test/ui/if/if-let.stderr b/src/test/ui/if/if-let.stderr index b2a104bfacff..04bca1b76a09 100644 --- a/src/test/ui/if/if-let.stderr +++ b/src/test/ui/if/if-let.stderr @@ -4,7 +4,7 @@ warning: irrefutable if-let pattern LL | if let $p = $e $b | ^^ ... -LL | / foo!(a, 1, { //~ WARN irrefutable if-let +LL | / foo!(a, 1, { LL | | println!("irrefutable pattern"); LL | | }); | |_______- in this macro invocation @@ -17,7 +17,7 @@ warning: irrefutable if-let pattern LL | if let $p = $e $b | ^^ ... -LL | / bar!(a, 1, { //~ WARN irrefutable if-let +LL | / bar!(a, 1, { LL | | println!("irrefutable pattern"); LL | | }); | |_______- in this macro invocation @@ -25,7 +25,7 @@ LL | | }); warning: irrefutable if-let pattern --> $DIR/if-let.rs:24:5 | -LL | / if let a = 1 { //~ WARN irrefutable if-let +LL | / if let a = 1 { LL | | println!("irrefutable pattern"); LL | | } | |_____^ @@ -33,7 +33,7 @@ LL | | } warning: irrefutable if-let pattern --> $DIR/if-let.rs:28:5 | -LL | / if let a = 1 { //~ WARN irrefutable if-let +LL | / if let a = 1 { LL | | println!("irrefutable pattern"); LL | | } else if true { LL | | println!("else-if in irrefutable if-let"); @@ -45,7 +45,7 @@ LL | | } warning: irrefutable if-let pattern --> $DIR/if-let.rs:38:12 | -LL | } else if let a = 1 { //~ WARN irrefutable if-let +LL | } else if let a = 1 { | ____________^ LL | | println!("irrefutable pattern"); LL | | } @@ -54,7 +54,7 @@ LL | | } warning: irrefutable if-let pattern --> $DIR/if-let.rs:44:12 | -LL | } else if let a = 1 { //~ WARN irrefutable if-let +LL | } else if let a = 1 { | ____________^ LL | | println!("irrefutable pattern"); LL | | } diff --git a/src/test/ui/if/ifmt-bad-arg.stderr b/src/test/ui/if/ifmt-bad-arg.stderr index d4153ac94acd..65be86eaf257 100644 --- a/src/test/ui/if/ifmt-bad-arg.stderr +++ b/src/test/ui/if/ifmt-bad-arg.stderr @@ -73,13 +73,13 @@ LL | format!("{} {foo} {} {bar} {}", 1, 2, 3); error: there is no argument named `foo` --> $DIR/ifmt-bad-arg.rs:31:14 | -LL | format!("{foo}"); //~ ERROR: no argument named `foo` +LL | format!("{foo}"); | ^^^^^ error: multiple unused formatting arguments --> $DIR/ifmt-bad-arg.rs:32:17 | -LL | format!("", 1, 2); //~ ERROR: multiple unused formatting arguments +LL | format!("", 1, 2); | -- ^ ^ argument never used | | | | | argument never used @@ -88,7 +88,7 @@ LL | format!("", 1, 2); //~ ERROR: multiple unused formatting error: argument never used --> $DIR/ifmt-bad-arg.rs:33:22 | -LL | format!("{}", 1, 2); //~ ERROR: argument never used +LL | format!("{}", 1, 2); | ---- ^ argument never used | | | formatting specifier missing @@ -96,7 +96,7 @@ LL | format!("{}", 1, 2); //~ ERROR: argument never used error: argument never used --> $DIR/ifmt-bad-arg.rs:34:20 | -LL | format!("{1}", 1, 2); //~ ERROR: argument never used +LL | format!("{1}", 1, 2); | ----- ^ argument never used | | | formatting specifier missing @@ -104,7 +104,7 @@ LL | format!("{1}", 1, 2); //~ ERROR: argument never used error: named argument never used --> $DIR/ifmt-bad-arg.rs:35:26 | -LL | format!("{}", 1, foo=2); //~ ERROR: named argument never used +LL | format!("{}", 1, foo=2); | ---- ^ named argument never used | | | formatting specifier missing @@ -112,7 +112,7 @@ LL | format!("{}", 1, foo=2); //~ ERROR: named argument never used error: argument never used --> $DIR/ifmt-bad-arg.rs:36:22 | -LL | format!("{foo}", 1, foo=2); //~ ERROR: argument never used +LL | format!("{foo}", 1, foo=2); | ------- ^ argument never used | | | formatting specifier missing @@ -120,7 +120,7 @@ LL | format!("{foo}", 1, foo=2); //~ ERROR: argument never used error: named argument never used --> $DIR/ifmt-bad-arg.rs:37:21 | -LL | format!("", foo=2); //~ ERROR: named argument never used +LL | format!("", foo=2); | -- ^ named argument never used | | | formatting specifier missing @@ -128,7 +128,7 @@ LL | format!("", foo=2); //~ ERROR: named argument never used error: multiple unused formatting arguments --> $DIR/ifmt-bad-arg.rs:38:32 | -LL | format!("{} {}", 1, 2, foo=1, bar=2); //~ ERROR: multiple unused formatting arguments +LL | format!("{} {}", 1, 2, foo=1, bar=2); | ------- ^ ^ named argument never used | | | | | named argument never used @@ -137,19 +137,19 @@ LL | format!("{} {}", 1, 2, foo=1, bar=2); //~ ERROR: multiple unused forma error: duplicate argument named `foo` --> $DIR/ifmt-bad-arg.rs:40:33 | -LL | format!("{foo}", foo=1, foo=2); //~ ERROR: duplicate argument +LL | format!("{foo}", foo=1, foo=2); | ^ | note: previously here --> $DIR/ifmt-bad-arg.rs:40:26 | -LL | format!("{foo}", foo=1, foo=2); //~ ERROR: duplicate argument +LL | format!("{foo}", foo=1, foo=2); | ^ error: expected ident, positional arguments cannot follow named arguments --> $DIR/ifmt-bad-arg.rs:41:24 | -LL | format!("", foo=1, 2); //~ ERROR: positional arguments cannot follow +LL | format!("", foo=1, 2); | ^ error: there is no argument named `valueb` @@ -169,7 +169,7 @@ LL | format!("{valuea} {valueb}", valuea=5, valuec=7); error: invalid format string: expected `'}'` but string was terminated --> $DIR/ifmt-bad-arg.rs:51:15 | -LL | format!("{"); //~ ERROR: expected `'}'` but string was terminated +LL | format!("{"); | -^ expected `'}'` in format string | | | because of this opening brace @@ -179,7 +179,7 @@ LL | format!("{"); //~ ERROR: expected `'}'` but string was terminated error: invalid format string: unmatched `}` found --> $DIR/ifmt-bad-arg.rs:53:18 | -LL | format!("foo } bar"); //~ ERROR: unmatched `}` found +LL | format!("foo } bar"); | ^ unmatched `}` in format string | = note: if you intended to print `}`, you can escape it using `}}` @@ -187,7 +187,7 @@ LL | format!("foo } bar"); //~ ERROR: unmatched `}` found error: invalid format string: unmatched `}` found --> $DIR/ifmt-bad-arg.rs:54:18 | -LL | format!("foo }"); //~ ERROR: unmatched `}` found +LL | format!("foo }"); | ^ unmatched `}` in format string | = note: if you intended to print `}`, you can escape it using `}}` @@ -195,7 +195,7 @@ LL | format!("foo }"); //~ ERROR: unmatched `}` found error: argument never used --> $DIR/ifmt-bad-arg.rs:56:27 | -LL | format!("foo %s baz", "bar"); //~ ERROR: argument never used +LL | format!("foo %s baz", "bar"); | -- ^^^^^ argument never used | | | help: format specifiers use curly braces: `{}` diff --git a/src/test/ui/if/ifmt-bad-format-args.stderr b/src/test/ui/if/ifmt-bad-format-args.stderr index 966c8d916a3b..9dc2b8f9a739 100644 --- a/src/test/ui/if/ifmt-bad-format-args.stderr +++ b/src/test/ui/if/ifmt-bad-format-args.stderr @@ -1,17 +1,17 @@ error: requires at least a format string argument --> $DIR/ifmt-bad-format-args.rs:2:5 | -LL | format_args!(); //~ ERROR: requires at least a format string argument +LL | format_args!(); | ^^^^^^^^^^^^^^^ error: format argument must be a string literal --> $DIR/ifmt-bad-format-args.rs:3:18 | -LL | format_args!(|| {}); //~ ERROR: must be a string literal +LL | format_args!(|| {}); | ^^^^^ help: you might be missing a string literal to format with | -LL | format_args!("{}", || {}); //~ ERROR: must be a string literal +LL | format_args!("{}", || {}); | ^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/illegal-ufcs-drop.stderr b/src/test/ui/illegal-ufcs-drop.stderr index d8e2dc6e8700..d35d376962c1 100644 --- a/src/test/ui/illegal-ufcs-drop.stderr +++ b/src/test/ui/illegal-ufcs-drop.stderr @@ -1,7 +1,7 @@ error[E0040]: explicit use of destructor method --> $DIR/illegal-ufcs-drop.rs:8:5 | -LL | Drop::drop(&mut Foo) //~ ERROR explicit use of destructor method +LL | Drop::drop(&mut Foo) | ^^^^^^^^^^ explicit destructor calls not allowed error: aborting due to previous error diff --git a/src/test/ui/impl-bounds-checking.stderr b/src/test/ui/impl-bounds-checking.stderr index 618a9f94aa45..b52f3d6b839d 100644 --- a/src/test/ui/impl-bounds-checking.stderr +++ b/src/test/ui/impl-bounds-checking.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `isize: Clone2` is not satisfied --> $DIR/impl-bounds-checking.rs:10:6 | -LL | impl Getter for isize { //~ ERROR `isize: Clone2` is not satisfied +LL | impl Getter for isize { | ^^^^^^^^^^^^^ the trait `Clone2` is not implemented for `isize` error: aborting due to previous error diff --git a/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr b/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr index 53cd2b144118..af120fa977ca 100644 --- a/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr +++ b/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> $DIR/dyn-trait.rs:20:16 | -LL | static_val(x); //~ ERROR cannot infer +LL | static_val(x); | ^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 19:26... diff --git a/src/test/ui/impl-trait/extra-item.stderr b/src/test/ui/impl-trait/extra-item.stderr index de3c7ba5d311..728bcc0aa865 100644 --- a/src/test/ui/impl-trait/extra-item.stderr +++ b/src/test/ui/impl-trait/extra-item.stderr @@ -1,7 +1,7 @@ error[E0407]: method `extra` is not a member of trait `extra_item::MyTrait` --> $DIR/extra-item.rs:7:5 | -LL | fn extra() {} //~ ERROR method `extra` is not a member of trait `extra_item::MyTrait` +LL | fn extra() {} | ^^^^^^^^^^^^^ not a member of trait `extra_item::MyTrait` error: aborting due to previous error diff --git a/src/test/ui/impl-trait/infinite-impl-trait-issue-38064.stderr b/src/test/ui/impl-trait/infinite-impl-trait-issue-38064.stderr index 99c8fe35c66d..fb48ecd12b6d 100644 --- a/src/test/ui/impl-trait/infinite-impl-trait-issue-38064.stderr +++ b/src/test/ui/impl-trait/infinite-impl-trait-issue-38064.stderr @@ -1,7 +1,7 @@ error[E0720]: opaque type expands to a recursive type --> $DIR/infinite-impl-trait-issue-38064.rs:8:13 | -LL | fn foo() -> impl Quux { //~ opaque type expands to a recursive type +LL | fn foo() -> impl Quux { | ^^^^^^^^^ expands to self-referential type | = note: expanded type is `foo::Foo>` @@ -9,7 +9,7 @@ LL | fn foo() -> impl Quux { //~ opaque type expands to a recursive type error[E0720]: opaque type expands to a recursive type --> $DIR/infinite-impl-trait-issue-38064.rs:14:13 | -LL | fn bar() -> impl Quux { //~ opaque type expands to a recursive type +LL | fn bar() -> impl Quux { | ^^^^^^^^^ expands to self-referential type | = note: expanded type is `bar::Bar>` diff --git a/src/test/ui/impl-trait/issue-55608-captures-empty-region.stderr b/src/test/ui/impl-trait/issue-55608-captures-empty-region.stderr index d1f147834d2e..6311a7f00674 100644 --- a/src/test/ui/impl-trait/issue-55608-captures-empty-region.stderr +++ b/src/test/ui/impl-trait/issue-55608-captures-empty-region.stderr @@ -1,7 +1,7 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds --> $DIR/issue-55608-captures-empty-region.rs:6:16 | -LL | fn server() -> impl FilterBase2 { //~ ERROR [E0700] +LL | fn server() -> impl FilterBase2 { | ^^^^^^^^^^^^^^^^ | = note: hidden type `Map2<[closure@$DIR/issue-55608-captures-empty-region.rs:7:36: 7:41]>` captures an empty lifetime diff --git a/src/test/ui/impl-trait/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs b/src/test/ui/impl-trait/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs new file mode 100644 index 000000000000..5eef6a39325f --- /dev/null +++ b/src/test/ui/impl-trait/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs @@ -0,0 +1,42 @@ +// rust-lang/rust#57979 : the initial support for `impl Trait` didn't +// properly check syntax hidden behind an associated type projection, +// but it did catch *some cases*. This is checking that we continue to +// properly emit errors for those, even with the new +// future-incompatibility warnings. +// +// issue-57979-nested-impl-trait-in-assoc-proj.rs shows the main case +// that we were previously failing to catch. + +struct Deeper(T); + +mod allowed { + #![allow(nested_impl_trait)] + + pub trait Foo { } + pub trait Bar { } + pub trait Quux { type Assoc; } + pub fn demo(_: impl Quux>>) { } + //~^ ERROR nested `impl Trait` is not allowed +} + +mod warned { + #![warn(nested_impl_trait)] + + pub trait Foo { } + pub trait Bar { } + pub trait Quux { type Assoc; } + pub fn demo(_: impl Quux>>) { } + //~^ ERROR nested `impl Trait` is not allowed +} + +mod denied { + #![deny(nested_impl_trait)] + + pub trait Foo { } + pub trait Bar { } + pub trait Quux { type Assoc; } + pub fn demo(_: impl Quux>>) { } + //~^ ERROR nested `impl Trait` is not allowed +} + +fn main() { } diff --git a/src/test/ui/impl-trait/issue-57979-deeply-nested-impl-trait-in-assoc-proj.stderr b/src/test/ui/impl-trait/issue-57979-deeply-nested-impl-trait-in-assoc-proj.stderr new file mode 100644 index 000000000000..2b6f15e6d3eb --- /dev/null +++ b/src/test/ui/impl-trait/issue-57979-deeply-nested-impl-trait-in-assoc-proj.stderr @@ -0,0 +1,30 @@ +error[E0666]: nested `impl Trait` is not allowed + --> $DIR/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs:18:59 + | +LL | pub fn demo(_: impl Quux>>) { } + | ---------^^^^^^^^- + | | | + | | nested `impl Trait` here + | outer `impl Trait` + +error[E0666]: nested `impl Trait` is not allowed + --> $DIR/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs:28:59 + | +LL | pub fn demo(_: impl Quux>>) { } + | ---------^^^^^^^^- + | | | + | | nested `impl Trait` here + | outer `impl Trait` + +error[E0666]: nested `impl Trait` is not allowed + --> $DIR/issue-57979-deeply-nested-impl-trait-in-assoc-proj.rs:38:59 + | +LL | pub fn demo(_: impl Quux>>) { } + | ---------^^^^^^^^- + | | | + | | nested `impl Trait` here + | outer `impl Trait` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0666`. diff --git a/src/test/ui/impl-trait/issue-57979-impl-trait-in-path.rs b/src/test/ui/impl-trait/issue-57979-impl-trait-in-path.rs new file mode 100644 index 000000000000..84fcb5e2880a --- /dev/null +++ b/src/test/ui/impl-trait/issue-57979-impl-trait-in-path.rs @@ -0,0 +1,37 @@ +// rust-lang/rust#57979 : the initial support for `impl Trait` didn't +// properly check syntax hidden behind an associated type projection. +// Here we test behavior of occurrences of `impl Trait` within a path +// component in that context. + +mod allowed { + #![allow(nested_impl_trait)] + + pub trait Bar { } + pub trait Quux { type Assoc; } + pub fn demo(_: impl Quux<(), Assoc=<() as Quux>::Assoc>) { } + impl Quux for () { type Assoc = u32; } +} + +mod warned { + #![warn(nested_impl_trait)] + + pub trait Bar { } + pub trait Quux { type Assoc; } + pub fn demo(_: impl Quux<(), Assoc=<() as Quux>::Assoc>) { } + //~^ WARN `impl Trait` is not allowed in path parameters + //~| WARN will become a hard error in a future release! + impl Quux for () { type Assoc = u32; } +} + +mod denied { + #![deny(nested_impl_trait)] + + pub trait Bar { } + pub trait Quux { type Assoc; } + pub fn demo(_: impl Quux<(), Assoc=<() as Quux>::Assoc>) { } + //~^ ERROR `impl Trait` is not allowed in path parameters + //~| WARN will become a hard error in a future release! + impl Quux for () { type Assoc = u32; } +} + +fn main() { } diff --git a/src/test/ui/impl-trait/issue-57979-impl-trait-in-path.stderr b/src/test/ui/impl-trait/issue-57979-impl-trait-in-path.stderr new file mode 100644 index 000000000000..982ecba291f7 --- /dev/null +++ b/src/test/ui/impl-trait/issue-57979-impl-trait-in-path.stderr @@ -0,0 +1,30 @@ +warning: `impl Trait` is not allowed in path parameters + --> $DIR/issue-57979-impl-trait-in-path.rs:20:52 + | +LL | pub fn demo(_: impl Quux<(), Assoc=<() as Quux>::Assoc>) { } + | ^^^^^^^^ + | +note: lint level defined here + --> $DIR/issue-57979-impl-trait-in-path.rs:16:13 + | +LL | #![warn(nested_impl_trait)] + | ^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #59014 + +error: `impl Trait` is not allowed in path parameters + --> $DIR/issue-57979-impl-trait-in-path.rs:31:52 + | +LL | pub fn demo(_: impl Quux<(), Assoc=<() as Quux>::Assoc>) { } + | ^^^^^^^^ + | +note: lint level defined here + --> $DIR/issue-57979-impl-trait-in-path.rs:27:13 + | +LL | #![deny(nested_impl_trait)] + | ^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #59014 + +error: aborting due to previous error + diff --git a/src/test/ui/impl-trait/issue-57979-nested-impl-trait-in-assoc-proj.rs b/src/test/ui/impl-trait/issue-57979-nested-impl-trait-in-assoc-proj.rs new file mode 100644 index 000000000000..5c20ffc7c672 --- /dev/null +++ b/src/test/ui/impl-trait/issue-57979-nested-impl-trait-in-assoc-proj.rs @@ -0,0 +1,37 @@ +// rust-lang/rust#57979 : the initial support for `impl Trait` didn't +// properly check syntax hidden behind an associated type projection. +// Here we test behavior of occurrences of `impl Trait` within an +// `impl Trait` in that context. + +mod allowed { + #![allow(nested_impl_trait)] + + pub trait Foo { } + pub trait Bar { } + pub trait Quux { type Assoc; } + pub fn demo(_: impl Quux>) { } +} + +mod warned { + #![warn(nested_impl_trait)] + + pub trait Foo { } + pub trait Bar { } + pub trait Quux { type Assoc; } + pub fn demo(_: impl Quux>) { } + //~^ WARN nested `impl Trait` is not allowed + //~| WARN will become a hard error in a future release! +} + +mod denied { + #![deny(nested_impl_trait)] + + pub trait Foo { } + pub trait Bar { } + pub trait Quux { type Assoc; } + pub fn demo(_: impl Quux>) { } + //~^ ERROR nested `impl Trait` is not allowed + //~| WARN will become a hard error in a future release! +} + +fn main() { } diff --git a/src/test/ui/impl-trait/issue-57979-nested-impl-trait-in-assoc-proj.stderr b/src/test/ui/impl-trait/issue-57979-nested-impl-trait-in-assoc-proj.stderr new file mode 100644 index 000000000000..508aea243213 --- /dev/null +++ b/src/test/ui/impl-trait/issue-57979-nested-impl-trait-in-assoc-proj.stderr @@ -0,0 +1,36 @@ +warning: nested `impl Trait` is not allowed + --> $DIR/issue-57979-nested-impl-trait-in-assoc-proj.rs:21:45 + | +LL | pub fn demo(_: impl Quux>) { } + | ---------^^^^^^^^- + | | | + | | nested `impl Trait` here + | outer `impl Trait` + | +note: lint level defined here + --> $DIR/issue-57979-nested-impl-trait-in-assoc-proj.rs:16:13 + | +LL | #![warn(nested_impl_trait)] + | ^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #59014 + +error: nested `impl Trait` is not allowed + --> $DIR/issue-57979-nested-impl-trait-in-assoc-proj.rs:32:45 + | +LL | pub fn demo(_: impl Quux>) { } + | ---------^^^^^^^^- + | | | + | | nested `impl Trait` here + | outer `impl Trait` + | +note: lint level defined here + --> $DIR/issue-57979-nested-impl-trait-in-assoc-proj.rs:27:13 + | +LL | #![deny(nested_impl_trait)] + | ^^^^^^^^^^^^^^^^^ + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #59014 + +error: aborting due to previous error + diff --git a/src/test/ui/impl-trait/no-method-suggested-traits.stderr b/src/test/ui/impl-trait/no-method-suggested-traits.stderr index a3b118efa62c..d980d7cccadd 100644 --- a/src/test/ui/impl-trait/no-method-suggested-traits.stderr +++ b/src/test/ui/impl-trait/no-method-suggested-traits.stderr @@ -220,19 +220,19 @@ LL | std::rc::Rc::new(&mut Box::new(&Bar::X)).method3(); error[E0599]: no method named `method3` found for type `usize` in the current scope --> $DIR/no-method-suggested-traits.rs:69:13 | -LL | 1_usize.method3(); //~ ERROR no method named +LL | 1_usize.method3(); | ^^^^^^^ error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&usize>>` in the current scope --> $DIR/no-method-suggested-traits.rs:70:47 | -LL | std::rc::Rc::new(&mut Box::new(&1_usize)).method3(); //~ ERROR no method named +LL | std::rc::Rc::new(&mut Box::new(&1_usize)).method3(); | ^^^^^^^ error[E0599]: no method named `method3` found for type `no_method_suggested_traits::Foo` in the current scope --> $DIR/no-method-suggested-traits.rs:71:37 | -LL | no_method_suggested_traits::Foo.method3(); //~ ERROR no method named +LL | no_method_suggested_traits::Foo.method3(); | ^^^^^^^ error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Foo>>` in the current scope @@ -244,7 +244,7 @@ LL | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).metho error[E0599]: no method named `method3` found for type `no_method_suggested_traits::Bar` in the current scope --> $DIR/no-method-suggested-traits.rs:74:40 | -LL | no_method_suggested_traits::Bar::X.method3(); //~ ERROR no method named +LL | no_method_suggested_traits::Bar::X.method3(); | ^^^^^^^ error[E0599]: no method named `method3` found for type `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Bar>>` in the current scope diff --git a/src/test/ui/impl-trait/no-trait.stderr b/src/test/ui/impl-trait/no-trait.stderr index 84ac1bd5ca4a..3a636f2524ff 100644 --- a/src/test/ui/impl-trait/no-trait.stderr +++ b/src/test/ui/impl-trait/no-trait.stderr @@ -1,7 +1,7 @@ error: at least one trait must be specified --> $DIR/no-trait.rs:1:11 | -LL | fn f() -> impl 'static {} //~ ERROR at least one trait must be specified +LL | fn f() -> impl 'static {} | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/impl-trait/recursive-async-impl-trait-type.rs b/src/test/ui/impl-trait/recursive-async-impl-trait-type.rs new file mode 100644 index 000000000000..40642523be25 --- /dev/null +++ b/src/test/ui/impl-trait/recursive-async-impl-trait-type.rs @@ -0,0 +1,11 @@ +// edition:2018 +// Test that impl trait does not allow creating recursive types that are +// otherwise forbidden when using `async` and `await`. + +#![feature(await_macro, async_await, futures_api, generators)] + +async fn recursive_async_function() -> () { //~ ERROR + await!(recursive_async_function()); +} + +fn main() {} diff --git a/src/test/ui/impl-trait/recursive-async-impl-trait-type.stderr b/src/test/ui/impl-trait/recursive-async-impl-trait-type.stderr new file mode 100644 index 000000000000..abc9ff54bdee --- /dev/null +++ b/src/test/ui/impl-trait/recursive-async-impl-trait-type.stderr @@ -0,0 +1,11 @@ +error[E0720]: opaque type expands to a recursive type + --> $DIR/recursive-async-impl-trait-type.rs:7:40 + | +LL | async fn recursive_async_function() -> () { + | ^^ expands to self-referential type + | + = note: expanded type is `std::future::GenFuture<[static generator@$DIR/recursive-async-impl-trait-type.rs:7:43: 9:2 {impl std::future::Future, ()}]>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0720`. diff --git a/src/test/ui/impl-trait/recursive-impl-trait-type.rs b/src/test/ui/impl-trait/recursive-impl-trait-type.rs index facb191a3708..869876dc6a88 100644 --- a/src/test/ui/impl-trait/recursive-impl-trait-type.rs +++ b/src/test/ui/impl-trait/recursive-impl-trait-type.rs @@ -1,7 +1,7 @@ // Test that impl trait does not allow creating recursive types that are // otherwise forbidden. -#![feature(await_macro, async_await, futures_api, generators)] +#![feature(futures_api, generators)] fn option(i: i32) -> impl Sized { //~ ERROR if i < 0 { @@ -62,10 +62,6 @@ fn generator_hold() -> impl Sized { //~ ERROR } } -async fn recursive_async_function() -> () { //~ ERROR - await!(recursive_async_function()); -} - fn use_fn_ptr() -> impl Sized { // OK, error already reported fn_ptr() } diff --git a/src/test/ui/impl-trait/recursive-impl-trait-type.stderr b/src/test/ui/impl-trait/recursive-impl-trait-type.stderr index 8a8789120577..fce234eb87ce 100644 --- a/src/test/ui/impl-trait/recursive-impl-trait-type.stderr +++ b/src/test/ui/impl-trait/recursive-impl-trait-type.stderr @@ -1,7 +1,7 @@ error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:6:22 | -LL | fn option(i: i32) -> impl Sized { //~ ERROR +LL | fn option(i: i32) -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: expanded type is `std::option::Option<(impl Sized, i32)>` @@ -9,7 +9,7 @@ LL | fn option(i: i32) -> impl Sized { //~ ERROR error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:14:15 | -LL | fn tuple() -> impl Sized { //~ ERROR +LL | fn tuple() -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: expanded type is `(impl Sized,)` @@ -17,7 +17,7 @@ LL | fn tuple() -> impl Sized { //~ ERROR error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:18:15 | -LL | fn array() -> impl Sized { //~ ERROR +LL | fn array() -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: expanded type is `[impl Sized; 1]` @@ -25,7 +25,7 @@ LL | fn array() -> impl Sized { //~ ERROR error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:22:13 | -LL | fn ptr() -> impl Sized { //~ ERROR +LL | fn ptr() -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: expanded type is `*const impl Sized` @@ -33,7 +33,7 @@ LL | fn ptr() -> impl Sized { //~ ERROR error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:26:16 | -LL | fn fn_ptr() -> impl Sized { //~ ERROR +LL | fn fn_ptr() -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: expanded type is `fn() -> impl Sized` @@ -41,7 +41,7 @@ LL | fn fn_ptr() -> impl Sized { //~ ERROR error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:30:25 | -LL | fn closure_capture() -> impl Sized { //~ ERROR +LL | fn closure_capture() -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: expanded type is `[closure@$DIR/recursive-impl-trait-type.rs:32:5: 32:19 x:impl Sized]` @@ -49,7 +49,7 @@ LL | fn closure_capture() -> impl Sized { //~ ERROR error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:35:29 | -LL | fn closure_ref_capture() -> impl Sized { //~ ERROR +LL | fn closure_ref_capture() -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: expanded type is `[closure@$DIR/recursive-impl-trait-type.rs:37:5: 37:20 x:impl Sized]` @@ -57,7 +57,7 @@ LL | fn closure_ref_capture() -> impl Sized { //~ ERROR error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:40:21 | -LL | fn closure_sig() -> impl Sized { //~ ERROR +LL | fn closure_sig() -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: expanded type is `[closure@$DIR/recursive-impl-trait-type.rs:41:5: 41:21]` @@ -65,7 +65,7 @@ LL | fn closure_sig() -> impl Sized { //~ ERROR error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:44:23 | -LL | fn generator_sig() -> impl Sized { //~ ERROR +LL | fn generator_sig() -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: expanded type is `[closure@$DIR/recursive-impl-trait-type.rs:45:5: 45:23]` @@ -73,7 +73,7 @@ LL | fn generator_sig() -> impl Sized { //~ ERROR error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:48:27 | -LL | fn generator_capture() -> impl Sized { //~ ERROR +LL | fn generator_capture() -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: expanded type is `[generator@$DIR/recursive-impl-trait-type.rs:50:5: 50:26 x:impl Sized {()}]` @@ -81,7 +81,7 @@ LL | fn generator_capture() -> impl Sized { //~ ERROR error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:53:26 | -LL | fn substs_change() -> impl Sized { //~ ERROR +LL | fn substs_change() -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: expanded type is `(impl Sized,)` @@ -89,35 +89,27 @@ LL | fn substs_change() -> impl Sized { //~ ERROR error[E0720]: opaque type expands to a recursive type --> $DIR/recursive-impl-trait-type.rs:57:24 | -LL | fn generator_hold() -> impl Sized { //~ ERROR +LL | fn generator_hold() -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: expanded type is `[generator@$DIR/recursive-impl-trait-type.rs:58:5: 62:6 {impl Sized, ()}]` error[E0720]: opaque type expands to a recursive type - --> $DIR/recursive-impl-trait-type.rs:65:40 + --> $DIR/recursive-impl-trait-type.rs:69:26 | -LL | async fn recursive_async_function() -> () { //~ ERROR - | ^^ expands to self-referential type - | - = note: expanded type is `std::future::GenFuture<[static generator@$DIR/recursive-impl-trait-type.rs:65:43: 67:2 {impl std::future::Future, ()}]>` - -error[E0720]: opaque type expands to a recursive type - --> $DIR/recursive-impl-trait-type.rs:73:26 - | -LL | fn mutual_recursion() -> impl Sync { //~ ERROR +LL | fn mutual_recursion() -> impl Sync { | ^^^^^^^^^ expands to self-referential type | = note: type resolves to itself error[E0720]: opaque type expands to a recursive type - --> $DIR/recursive-impl-trait-type.rs:77:28 + --> $DIR/recursive-impl-trait-type.rs:73:28 | -LL | fn mutual_recursion_b() -> impl Sized { //~ ERROR +LL | fn mutual_recursion_b() -> impl Sized { | ^^^^^^^^^^ expands to self-referential type | = note: type resolves to itself -error: aborting due to 15 previous errors +error: aborting due to 14 previous errors For more information about this error, try `rustc --explain E0720`. diff --git a/src/test/ui/impl-trait/universal-issue-48703.stderr b/src/test/ui/impl-trait/universal-issue-48703.stderr index 920b44fc909a..26ed8dbb9c75 100644 --- a/src/test/ui/impl-trait/universal-issue-48703.stderr +++ b/src/test/ui/impl-trait/universal-issue-48703.stderr @@ -1,7 +1,7 @@ error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position. --> $DIR/universal-issue-48703.rs:8:5 | -LL | foo::('a'); //~ ERROR cannot provide explicit type parameters +LL | foo::('a'); | ^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/impl-trait/universal-mismatched-type.stderr b/src/test/ui/impl-trait/universal-mismatched-type.stderr index 55e1216d3a8a..d223b9672cfd 100644 --- a/src/test/ui/impl-trait/universal-mismatched-type.stderr +++ b/src/test/ui/impl-trait/universal-mismatched-type.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | fn foo(x: impl Debug) -> String { | ------ expected `std::string::String` because of return type -LL | x //~ ERROR mismatched types +LL | x | ^ expected struct `std::string::String`, found type parameter | = note: expected type `std::string::String` diff --git a/src/test/ui/impl-trait/universal-two-impl-traits.stderr b/src/test/ui/impl-trait/universal-two-impl-traits.stderr index 43bf2862feea..145d6a8431bf 100644 --- a/src/test/ui/impl-trait/universal-two-impl-traits.stderr +++ b/src/test/ui/impl-trait/universal-two-impl-traits.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/universal-two-impl-traits.rs:5:9 | -LL | a = y; //~ ERROR mismatched +LL | a = y; | ^ expected type parameter, found a different type parameter | = note: expected type `impl Debug` (type parameter) diff --git a/src/test/ui/impl-trait/universal_wrong_bounds.stderr b/src/test/ui/impl-trait/universal_wrong_bounds.stderr index f0b685bd5ee9..1fd3ebff62a8 100644 --- a/src/test/ui/impl-trait/universal_wrong_bounds.stderr +++ b/src/test/ui/impl-trait/universal_wrong_bounds.stderr @@ -1,7 +1,7 @@ error[E0405]: cannot find trait `Debug` in this scope --> $DIR/universal_wrong_bounds.rs:9:24 | -LL | fn wants_debug(g: impl Debug) { } //~ ERROR cannot find +LL | fn wants_debug(g: impl Debug) { } | ^^^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -11,7 +11,7 @@ LL | use std::fmt::Debug; error[E0405]: cannot find trait `Debug` in this scope --> $DIR/universal_wrong_bounds.rs:10:26 | -LL | fn wants_display(g: impl Debug) { } //~ ERROR cannot find +LL | fn wants_display(g: impl Debug) { } | ^^^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | diff --git a/src/test/ui/impl-unused-rps-in-assoc-type.stderr b/src/test/ui/impl-unused-rps-in-assoc-type.stderr index 80fc0504558f..c7ad1b4e608f 100644 --- a/src/test/ui/impl-unused-rps-in-assoc-type.stderr +++ b/src/test/ui/impl-unused-rps-in-assoc-type.stderr @@ -1,7 +1,7 @@ error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates --> $DIR/impl-unused-rps-in-assoc-type.rs:11:6 | -LL | impl<'a> Fun for Holder { //~ ERROR E0207 +LL | impl<'a> Fun for Holder { | ^^ unconstrained lifetime parameter error: aborting due to previous error diff --git a/src/test/ui/implicit-method-bind.stderr b/src/test/ui/implicit-method-bind.stderr index 7c70709c6b97..968272d4d2c1 100644 --- a/src/test/ui/implicit-method-bind.stderr +++ b/src/test/ui/implicit-method-bind.stderr @@ -1,7 +1,7 @@ error[E0615]: attempted to take value of method `abs` on type `i32` --> $DIR/implicit-method-bind.rs:2:20 | -LL | let _f = 10i32.abs; //~ ERROR attempted to take value of method +LL | let _f = 10i32.abs; | ^^^ help: use parentheses to call the method: `abs()` error: aborting due to previous error diff --git a/src/test/ui/import.rs b/src/test/ui/import.rs index 540258daaec8..3170dd2fae10 100644 --- a/src/test/ui/import.rs +++ b/src/test/ui/import.rs @@ -1,6 +1,8 @@ use zed::bar; use zed::baz; //~ ERROR unresolved import `zed::baz` [E0432] - //~^ no `baz` in `zed`. Did you mean to use `bar`? + //~| no `baz` in `zed` + //~| HELP a similar name exists in the module + //~| SUGGESTION bar mod zed { diff --git a/src/test/ui/import.stderr b/src/test/ui/import.stderr index 737d10cdecb2..685fff25a149 100644 --- a/src/test/ui/import.stderr +++ b/src/test/ui/import.stderr @@ -1,19 +1,22 @@ error[E0432]: unresolved import `zed::baz` --> $DIR/import.rs:2:5 | -LL | use zed::baz; //~ ERROR unresolved import `zed::baz` [E0432] - | ^^^^^^^^ no `baz` in `zed`. Did you mean to use `bar`? +LL | use zed::baz; + | ^^^^^--- + | | | + | | help: a similar name exists in the module: `bar` + | no `baz` in `zed` error[E0432]: unresolved import `foo` - --> $DIR/import.rs:8:9 + --> $DIR/import.rs:10:9 | -LL | use foo; //~ ERROR unresolved import `foo` [E0432] +LL | use foo; | ^^^ no `foo` in the root error[E0603]: unresolved item `foo` is private - --> $DIR/import.rs:13:10 + --> $DIR/import.rs:15:10 | -LL | zed::foo(); //~ ERROR `foo` is private +LL | zed::foo(); | ^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/import2.stderr b/src/test/ui/import2.stderr index f0509204f2ce..da888979c30f 100644 --- a/src/test/ui/import2.stderr +++ b/src/test/ui/import2.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `baz::zed` --> $DIR/import2.rs:1:10 | -LL | use baz::zed::bar; //~ ERROR unresolved import `baz::zed` [E0432] +LL | use baz::zed::bar; | ^^^ could not find `zed` in `baz` error: aborting due to previous error diff --git a/src/test/ui/imports/duplicate.stderr b/src/test/ui/imports/duplicate.stderr index 29660d908e48..7c43c642ec36 100644 --- a/src/test/ui/imports/duplicate.stderr +++ b/src/test/ui/imports/duplicate.stderr @@ -3,7 +3,7 @@ error[E0252]: the name `foo` is defined multiple times | LL | use a::foo; | ------ previous import of the value `foo` here -LL | use a::foo; //~ ERROR the name `foo` is defined multiple times +LL | use a::foo; | ----^^^^^^- | | | | | `foo` reimported here @@ -14,7 +14,7 @@ LL | use a::foo; //~ ERROR the name `foo` is defined multiple times error[E0659]: `foo` is ambiguous (glob import vs glob import in the same module) --> $DIR/duplicate.rs:46:15 | -LL | use self::foo::bar; //~ ERROR `foo` is ambiguous +LL | use self::foo::bar; | ^^^ ambiguous name | note: `foo` could refer to the module imported here @@ -33,7 +33,7 @@ LL | use self::m2::*; error[E0659]: `foo` is ambiguous (glob import vs glob import in the same module) --> $DIR/duplicate.rs:35:8 | -LL | f::foo(); //~ ERROR `foo` is ambiguous +LL | f::foo(); | ^^^ ambiguous name | note: `foo` could refer to the function imported here @@ -52,7 +52,7 @@ LL | pub use b::*; error[E0659]: `foo` is ambiguous (glob import vs glob import in the same module) --> $DIR/duplicate.rs:49:9 | -LL | foo::bar(); //~ ERROR `foo` is ambiguous +LL | foo::bar(); | ^^^ ambiguous name | note: `foo` could refer to the module imported here diff --git a/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr b/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr index b47d10343f68..f26bb2f5a0ec 100644 --- a/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr +++ b/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr @@ -1,13 +1,13 @@ error: `extern crate self;` requires renaming --> $DIR/extern-crate-self-fail.rs:1:1 | -LL | extern crate self; //~ ERROR `extern crate self;` requires renaming +LL | extern crate self; | ^^^^^^^^^^^^^^^^^^ help: try: `extern crate self as name;` error: `macro_use` is not supported on `extern crate self` --> $DIR/extern-crate-self-fail.rs:3:1 | -LL | #[macro_use] //~ ERROR `macro_use` is not supported on `extern crate self` +LL | #[macro_use] | ^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/imports/extern-crate-used.stderr b/src/test/ui/imports/extern-crate-used.stderr index 3f9aab9dc79c..c0783feb7947 100644 --- a/src/test/ui/imports/extern-crate-used.stderr +++ b/src/test/ui/imports/extern-crate-used.stderr @@ -1,7 +1,7 @@ error: `extern crate` is not idiomatic in the new edition --> $DIR/extern-crate-used.rs:8:1 | -LL | extern crate core as iso1; //~ ERROR `extern crate` is not idiomatic in the new edition +LL | extern crate core as iso1; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use` | note: lint level defined here @@ -13,25 +13,25 @@ LL | #![deny(unused_extern_crates)] error: `extern crate` is not idiomatic in the new edition --> $DIR/extern-crate-used.rs:9:1 | -LL | extern crate core as iso2; //~ ERROR `extern crate` is not idiomatic in the new edition +LL | extern crate core as iso2; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use` error: `extern crate` is not idiomatic in the new edition --> $DIR/extern-crate-used.rs:10:1 | -LL | extern crate core as iso3; //~ ERROR `extern crate` is not idiomatic in the new edition +LL | extern crate core as iso3; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use` error: `extern crate` is not idiomatic in the new edition --> $DIR/extern-crate-used.rs:11:1 | -LL | extern crate core as iso4; //~ ERROR `extern crate` is not idiomatic in the new edition +LL | extern crate core as iso4; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use` error: unused extern crate --> $DIR/extern-crate-used.rs:14:1 | -LL | extern crate core; //~ ERROR unused extern crate +LL | extern crate core; | ^^^^^^^^^^^^^^^^^^ help: remove it error: aborting due to 5 previous errors diff --git a/src/test/ui/imports/extern-prelude-extern-crate-fail.stderr b/src/test/ui/imports/extern-prelude-extern-crate-fail.stderr index baeed02517d1..e067432b3923 100644 --- a/src/test/ui/imports/extern-prelude-extern-crate-fail.stderr +++ b/src/test/ui/imports/extern-prelude-extern-crate-fail.stderr @@ -10,7 +10,7 @@ LL | define_std_as_non_existent!(); error[E0433]: failed to resolve: use of undeclared type or module `two_macros` --> $DIR/extern-prelude-extern-crate-fail.rs:10:9 | -LL | two_macros::m!(); //~ ERROR failed to resolve: use of undeclared type or module `two_macros` +LL | two_macros::m!(); | ^^^^^^^^^^ use of undeclared type or module `two_macros` error: aborting due to 2 previous errors diff --git a/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr b/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr index 795e1761ccdb..24b1b582d1ea 100644 --- a/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr +++ b/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr @@ -10,7 +10,7 @@ LL | define_other_core!(); error[E0659]: `Vec` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:13:9 | -LL | Vec::panic!(); //~ ERROR `Vec` is ambiguous +LL | Vec::panic!(); | ^^^ ambiguous name | = note: `Vec` could refer to a struct from prelude diff --git a/src/test/ui/imports/glob-conflict-cross-crate.stderr b/src/test/ui/imports/glob-conflict-cross-crate.stderr index f5a82ef1b3b0..ad70b7d5b91b 100644 --- a/src/test/ui/imports/glob-conflict-cross-crate.stderr +++ b/src/test/ui/imports/glob-conflict-cross-crate.stderr @@ -1,13 +1,13 @@ error[E0425]: cannot find function `f` in module `glob_conflict` --> $DIR/glob-conflict-cross-crate.rs:6:20 | -LL | glob_conflict::f(); //~ ERROR cannot find function `f` in module `glob_conflict` +LL | glob_conflict::f(); | ^ not found in `glob_conflict` error[E0425]: cannot find function `f` in module `glob_conflict::glob` --> $DIR/glob-conflict-cross-crate.rs:7:26 | -LL | glob_conflict::glob::f(); //~ ERROR cannot find function `f` in module `glob_conflict::glob` +LL | glob_conflict::glob::f(); | ^ not found in `glob_conflict::glob` error: aborting due to 2 previous errors diff --git a/src/test/ui/imports/glob-shadowing.stderr b/src/test/ui/imports/glob-shadowing.stderr index c43ab00e718a..7962fcb9aec1 100644 --- a/src/test/ui/imports/glob-shadowing.stderr +++ b/src/test/ui/imports/glob-shadowing.stderr @@ -1,7 +1,7 @@ error[E0659]: `env` is ambiguous (glob import vs any other name from outer scope during import/macro resolution) --> $DIR/glob-shadowing.rs:11:17 | -LL | let x = env!("PATH"); //~ ERROR `env` is ambiguous +LL | let x = env!("PATH"); | ^^^ ambiguous name | = note: `env` could refer to a built-in macro @@ -16,7 +16,7 @@ LL | use m::*; error[E0659]: `env` is ambiguous (glob import vs any other name from outer scope during import/macro resolution) --> $DIR/glob-shadowing.rs:19:21 | -LL | let x = env!("PATH"); //~ ERROR `env` is ambiguous +LL | let x = env!("PATH"); | ^^^ ambiguous name | = note: `env` could refer to a built-in macro @@ -30,7 +30,7 @@ LL | use m::*; error[E0659]: `fenv` is ambiguous (glob import vs any other name from outer scope during import/macro resolution) --> $DIR/glob-shadowing.rs:29:21 | -LL | let x = fenv!(); //~ ERROR `fenv` is ambiguous +LL | let x = fenv!(); | ^^^^ ambiguous name | note: `fenv` could refer to the macro imported here diff --git a/src/test/ui/imports/import-from-missing.stderr b/src/test/ui/imports/import-from-missing.stderr index 0524b1675645..4254bfb5efb5 100644 --- a/src/test/ui/imports/import-from-missing.stderr +++ b/src/test/ui/imports/import-from-missing.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `spam::eggs` --> $DIR/import-from-missing.rs:1:17 | -LL | use spam::{ham, eggs}; //~ ERROR unresolved import `spam::eggs` [E0432] +LL | use spam::{ham, eggs}; | ^^^^ no `eggs` in `spam` error: aborting due to previous error diff --git a/src/test/ui/imports/import-glob-0.stderr b/src/test/ui/imports/import-glob-0.stderr index 4fecf80bff22..820ff1bb536d 100644 --- a/src/test/ui/imports/import-glob-0.stderr +++ b/src/test/ui/imports/import-glob-0.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find function `f999` in this scope --> $DIR/import-glob-0.rs:14:5 | -LL | f999(); //~ ERROR cannot find function `f999` in this scope +LL | f999(); | ^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/imports/import-glob-circular.stderr b/src/test/ui/imports/import-glob-circular.stderr index 30586132c352..86bbea579ae2 100644 --- a/src/test/ui/imports/import-glob-circular.stderr +++ b/src/test/ui/imports/import-glob-circular.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find function `f1066` in this scope --> $DIR/import-glob-circular.rs:16:17 | -LL | fn test() { f1066(); } //~ ERROR cannot find function `f1066` in this scope +LL | fn test() { f1066(); } | ^^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/imports/import-prefix-macro-1.stderr b/src/test/ui/imports/import-prefix-macro-1.stderr index 76e543a9f271..577f12824716 100644 --- a/src/test/ui/imports/import-prefix-macro-1.stderr +++ b/src/test/ui/imports/import-prefix-macro-1.stderr @@ -1,7 +1,7 @@ error: expected one of `::`, `;`, or `as`, found `{` --> $DIR/import-prefix-macro-1.rs:11:27 | -LL | ($p: path) => (use $p {S, Z}); //~ERROR expected one of `::`, `;`, or `as`, found `{` +LL | ($p: path) => (use $p {S, Z}); | ^ expected one of `::`, `;`, or `as` here ... LL | import! { a::b::c } diff --git a/src/test/ui/imports/import-prefix-macro-2.stderr b/src/test/ui/imports/import-prefix-macro-2.stderr index fa3c90d9ed29..8428dce2728a 100644 --- a/src/test/ui/imports/import-prefix-macro-2.stderr +++ b/src/test/ui/imports/import-prefix-macro-2.stderr @@ -1,7 +1,7 @@ error: expected identifier, found `a::b::c` --> $DIR/import-prefix-macro-2.rs:11:26 | -LL | ($p: path) => (use ::$p {S, Z}); //~ERROR expected identifier, found `a::b::c` +LL | ($p: path) => (use ::$p {S, Z}); | ^^ expected identifier ... LL | import! { a::b::c } diff --git a/src/test/ui/imports/import-trait-method.stderr b/src/test/ui/imports/import-trait-method.stderr index 00cfb42ddd4f..3c26907d3d06 100644 --- a/src/test/ui/imports/import-trait-method.stderr +++ b/src/test/ui/imports/import-trait-method.stderr @@ -1,7 +1,7 @@ error[E0253]: `foo` is not directly importable --> $DIR/import-trait-method.rs:5:5 | -LL | use Foo::foo; //~ ERROR not directly importable +LL | use Foo::foo; | ^^^^^^^^ cannot be imported directly error: aborting due to previous error diff --git a/src/test/ui/imports/issue-53269.stderr b/src/test/ui/imports/issue-53269.stderr index 0163ee8bceb4..fc4ca3d0e53f 100644 --- a/src/test/ui/imports/issue-53269.stderr +++ b/src/test/ui/imports/issue-53269.stderr @@ -1,13 +1,13 @@ error[E0432]: unresolved import `nonexistent_module` --> $DIR/issue-53269.rs:6:9 | -LL | use nonexistent_module::mac; //~ ERROR unresolved import `nonexistent_module` +LL | use nonexistent_module::mac; | ^^^^^^^^^^^^^^^^^^ maybe a missing `extern crate nonexistent_module;`? error[E0659]: `mac` is ambiguous (`macro_rules` vs non-`macro_rules` from other module) --> $DIR/issue-53269.rs:8:5 | -LL | mac!(); //~ ERROR `mac` is ambiguous +LL | mac!(); | ^^^ ambiguous name | note: `mac` could refer to the macro defined here @@ -18,7 +18,7 @@ LL | macro_rules! mac { () => () } note: `mac` could also refer to the unresolved item imported here --> $DIR/issue-53269.rs:6:9 | -LL | use nonexistent_module::mac; //~ ERROR unresolved import `nonexistent_module` +LL | use nonexistent_module::mac; | ^^^^^^^^^^^^^^^^^^^^^^^ = help: use `self::mac` to refer to this unresolved item unambiguously diff --git a/src/test/ui/imports/issue-53512.stderr b/src/test/ui/imports/issue-53512.stderr index a733013be5f2..f902fc488882 100644 --- a/src/test/ui/imports/issue-53512.stderr +++ b/src/test/ui/imports/issue-53512.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `std::assert` --> $DIR/issue-53512.rs:3:5 | -LL | use std::assert; //~ ERROR unresolved import `std::assert` +LL | use std::assert; | ^^^^^^^^^^^ no `assert` in the root error: aborting due to previous error diff --git a/src/test/ui/imports/issue-55457.stderr b/src/test/ui/imports/issue-55457.stderr index 4ee0332d04bc..86a76c1d89c7 100644 --- a/src/test/ui/imports/issue-55457.stderr +++ b/src/test/ui/imports/issue-55457.stderr @@ -1,19 +1,22 @@ error[E0432]: unresolved import `NonExistent` --> $DIR/issue-55457.rs:1:5 | -LL | use NonExistent; //~ ERROR unresolved import `NonExistent` - | ^^^^^^^^^^^ no `NonExistent` in the root. Did you mean to use `non_existent`? +LL | use NonExistent; + | ^^^^^^^^^^^ + | | + | no `NonExistent` in the root + | help: a similar name exists in the module: `non_existent` error[E0432]: unresolved import `non_existent` --> $DIR/issue-55457.rs:2:5 | -LL | use non_existent::non_existent; //~ ERROR unresolved import `non_existent` +LL | use non_existent::non_existent; | ^^^^^^^^^^^^ maybe a missing `extern crate non_existent;`? error: cannot determine resolution for the derive macro `NonExistent` --> $DIR/issue-55457.rs:5:10 | -LL | #[derive(NonExistent)] //~ ERROR cannot determine resolution for the derive macro `NonExistent` +LL | #[derive(NonExistent)] | ^^^^^^^^^^^ | = note: import resolution is stuck, try simplifying macro imports @@ -21,7 +24,7 @@ LL | #[derive(NonExistent)] //~ ERROR cannot determine resolution for the derive error: cannot determine resolution for the attribute macro `non_existent` --> $DIR/issue-55457.rs:4:3 | -LL | #[non_existent] //~ ERROR cannot determine resolution for the attribute macro `non_existent` +LL | #[non_existent] | ^^^^^^^^^^^^ | = note: import resolution is stuck, try simplifying macro imports diff --git a/src/test/ui/imports/issue-55884-1.stderr b/src/test/ui/imports/issue-55884-1.stderr index 477e859d0815..a7a7cc8879e6 100644 --- a/src/test/ui/imports/issue-55884-1.stderr +++ b/src/test/ui/imports/issue-55884-1.stderr @@ -1,7 +1,7 @@ error[E0659]: `S` is ambiguous (glob import vs glob import in the same module) --> $DIR/issue-55884-1.rs:19:12 | -LL | use m::S; //~ ERROR `S` is ambiguous +LL | use m::S; | ^ ambiguous name | note: `S` could refer to the struct imported here diff --git a/src/test/ui/imports/issue-55884-2.stderr b/src/test/ui/imports/issue-55884-2.stderr index f8a6cb4a5809..d3b43783ee9c 100644 --- a/src/test/ui/imports/issue-55884-2.stderr +++ b/src/test/ui/imports/issue-55884-2.stderr @@ -1,7 +1,7 @@ error[E0603]: struct `ParseOptions` is private --> $DIR/issue-55884-2.rs:12:17 | -LL | pub use parser::ParseOptions; //~ ERROR struct `ParseOptions` is private +LL | pub use parser::ParseOptions; | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/imports/issue-56125.stderr b/src/test/ui/imports/issue-56125.stderr index 844962b910a6..26d2fa06dd27 100644 --- a/src/test/ui/imports/issue-56125.stderr +++ b/src/test/ui/imports/issue-56125.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `empty::issue_56125` --> $DIR/issue-56125.rs:17:9 | -LL | use empty::issue_56125; //~ ERROR unresolved import `empty::issue_56125` +LL | use empty::issue_56125; | ^^^^^^^^^^^^^^^^^^ no `issue_56125` in `m3::empty` error[E0659]: `issue_56125` is ambiguous (name vs any other name during import resolution) @@ -37,7 +37,7 @@ LL | use issue_56125::non_last_segment::non_last_segment::*; error[E0659]: `issue_56125` is ambiguous (name vs any other name during import resolution) --> $DIR/issue-56125.rs:18:9 | -LL | use issue_56125::*; //~ ERROR `issue_56125` is ambiguous +LL | use issue_56125::*; | ^^^^^^^^^^^ ambiguous name | = note: `issue_56125` could refer to an extern crate passed with `--extern` @@ -45,7 +45,7 @@ LL | use issue_56125::*; //~ ERROR `issue_56125` is ambiguous note: `issue_56125` could also refer to the module imported here --> $DIR/issue-56125.rs:18:9 | -LL | use issue_56125::*; //~ ERROR `issue_56125` is ambiguous +LL | use issue_56125::*; | ^^^^^^^^^^^^^^ = help: use `self::issue_56125` to refer to this module unambiguously diff --git a/src/test/ui/imports/issue-57015.stderr b/src/test/ui/imports/issue-57015.stderr index b0fcf5bec6a7..d200d23ab28e 100644 --- a/src/test/ui/imports/issue-57015.stderr +++ b/src/test/ui/imports/issue-57015.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `single_err::something` --> $DIR/issue-57015.rs:10:5 | -LL | use single_err::something; //~ ERROR unresolved import `single_err::something` +LL | use single_err::something; | ^^^^^^^^^^^^^^^^^^^^^ no `something` in `single_err` error: aborting due to previous error diff --git a/src/test/ui/imports/issue-57539.stderr b/src/test/ui/imports/issue-57539.stderr index 3f745fd8204b..ebf27ca54bc4 100644 --- a/src/test/ui/imports/issue-57539.stderr +++ b/src/test/ui/imports/issue-57539.stderr @@ -1,7 +1,7 @@ error[E0659]: `core` is ambiguous (name vs any other name during import resolution) --> $DIR/issue-57539.rs:4:9 | -LL | use core; //~ ERROR `core` is ambiguous +LL | use core; | ^^^^ ambiguous name | = note: `core` could refer to a built-in extern crate diff --git a/src/test/ui/imports/local-modularized-tricky-fail-1.stderr b/src/test/ui/imports/local-modularized-tricky-fail-1.stderr index 21f75afb3f74..d7ae8e6d505d 100644 --- a/src/test/ui/imports/local-modularized-tricky-fail-1.stderr +++ b/src/test/ui/imports/local-modularized-tricky-fail-1.stderr @@ -1,7 +1,7 @@ error[E0659]: `exported` is ambiguous (glob import vs macro-expanded name in the same module during import/macro resolution) --> $DIR/local-modularized-tricky-fail-1.rs:28:1 | -LL | exported!(); //~ ERROR `exported` is ambiguous +LL | exported!(); | ^^^^^^^^ ambiguous name | note: `exported` could refer to the macro defined here @@ -24,7 +24,7 @@ LL | use inner1::*; error[E0659]: `include` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/local-modularized-tricky-fail-1.rs:47:1 | -LL | include!(); //~ ERROR `include` is ambiguous +LL | include!(); | ^^^^^^^ ambiguous name | = note: `include` could refer to a built-in macro @@ -43,7 +43,7 @@ LL | define_include!(); error[E0659]: `panic` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/local-modularized-tricky-fail-1.rs:35:5 | -LL | panic!(); //~ ERROR `panic` is ambiguous +LL | panic!(); | ^^^^^ ambiguous name | = note: `panic` could refer to a macro from prelude @@ -62,7 +62,7 @@ LL | define_panic!(); error[E0659]: `panic` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/local-modularized-tricky-fail-1.rs:35:5 | -LL | panic!(); //~ ERROR `panic` is ambiguous +LL | panic!(); | ^^^^^^^^^ ambiguous name | = note: `panic` could refer to a macro from prelude diff --git a/src/test/ui/imports/local-modularized-tricky-fail-2.stderr b/src/test/ui/imports/local-modularized-tricky-fail-2.stderr index 40cb10ced16f..a26f0cbec724 100644 --- a/src/test/ui/imports/local-modularized-tricky-fail-2.stderr +++ b/src/test/ui/imports/local-modularized-tricky-fail-2.stderr @@ -4,7 +4,7 @@ error[E0658]: non-ascii idents are not fully supported. (see issue #55467) LL | exported!(); | ------------ in this macro invocation ... -LL | () => ( struct Π‘; ) //~ ERROR non-ascii idents are not fully supported +LL | () => ( struct Π‘; ) | ^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -15,7 +15,7 @@ error[E0658]: non-ascii idents are not fully supported. (see issue #55467) LL | panic!(); | --------- in this macro invocation ... -LL | () => ( struct Π“; ) //~ ERROR non-ascii idents are not fully supported +LL | () => ( struct Π“; ) | ^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -26,7 +26,7 @@ error[E0658]: non-ascii idents are not fully supported. (see issue #55467) LL | include!(); | ----------- in this macro invocation ... -LL | () => ( struct Π”; ) //~ ERROR non-ascii idents are not fully supported +LL | () => ( struct Π”; ) | ^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable diff --git a/src/test/ui/imports/macro-paths.stderr b/src/test/ui/imports/macro-paths.stderr index 36290b2d93e6..a5b90008272c 100644 --- a/src/test/ui/imports/macro-paths.stderr +++ b/src/test/ui/imports/macro-paths.stderr @@ -1,7 +1,7 @@ error[E0659]: `bar` is ambiguous (glob import vs macro-expanded name in the same module during import/macro resolution) --> $DIR/macro-paths.rs:13:5 | -LL | bar::m! { //~ ERROR ambiguous +LL | bar::m! { | ^^^ ambiguous name | note: `bar` could refer to the module defined here @@ -19,7 +19,7 @@ LL | use foo::*; error[E0659]: `baz` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/macro-paths.rs:23:5 | -LL | baz::m! { //~ ERROR ambiguous +LL | baz::m! { | ^^^ ambiguous name | note: `baz` could refer to the module defined here diff --git a/src/test/ui/imports/macros.stderr b/src/test/ui/imports/macros.stderr index 5a15bf0ae71c..3b9e6feebd7e 100644 --- a/src/test/ui/imports/macros.stderr +++ b/src/test/ui/imports/macros.stderr @@ -1,7 +1,7 @@ error[E0659]: `m` is ambiguous (glob import vs macro-expanded name in the same module during import/macro resolution) --> $DIR/macros.rs:16:5 | -LL | m! { //~ ERROR ambiguous +LL | m! { | ^ ambiguous name | note: `m` could refer to the macro imported here @@ -19,7 +19,7 @@ LL | use two_macros::*; error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/macros.rs:29:9 | -LL | m! { //~ ERROR ambiguous +LL | m! { | ^ ambiguous name | note: `m` could refer to the macro imported here diff --git a/src/test/ui/imports/reexports.stderr b/src/test/ui/imports/reexports.stderr index 964e847392af..7726343ba6e3 100644 --- a/src/test/ui/imports/reexports.stderr +++ b/src/test/ui/imports/reexports.stderr @@ -1,31 +1,31 @@ error[E0364]: `foo` is private, and cannot be re-exported --> $DIR/reexports.rs:6:17 | -LL | pub use super::foo; //~ ERROR cannot be re-exported +LL | pub use super::foo; | ^^^^^^^^^^ | note: consider marking `foo` as `pub` in the imported module --> $DIR/reexports.rs:6:17 | -LL | pub use super::foo; //~ ERROR cannot be re-exported +LL | pub use super::foo; | ^^^^^^^^^^ error: A non-empty glob must import something with the glob's visibility --> $DIR/reexports.rs:7:17 | -LL | pub use super::*; //~ ERROR must import something with the glob's visibility +LL | pub use super::*; | ^^^^^^^^ error[E0603]: module `foo` is private --> $DIR/reexports.rs:28:15 | -LL | use b::a::foo::S; //~ ERROR `foo` +LL | use b::a::foo::S; | ^^^ error[E0603]: module `foo` is private --> $DIR/reexports.rs:29:15 | -LL | use b::b::foo::S as T; //~ ERROR `foo` +LL | use b::b::foo::S as T; | ^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/imports/rfc-1560-warning-cycle.stderr b/src/test/ui/imports/rfc-1560-warning-cycle.stderr index 16caf68e14fd..d79c719d8264 100644 --- a/src/test/ui/imports/rfc-1560-warning-cycle.stderr +++ b/src/test/ui/imports/rfc-1560-warning-cycle.stderr @@ -1,7 +1,7 @@ error[E0659]: `Foo` is ambiguous (glob import vs glob import in the same module) --> $DIR/rfc-1560-warning-cycle.rs:9:17 | -LL | fn f(_: Foo) {} //~ ERROR `Foo` is ambiguous +LL | fn f(_: Foo) {} | ^^^ ambiguous name | note: `Foo` could refer to the struct imported here diff --git a/src/test/ui/imports/shadow_builtin_macros.stderr b/src/test/ui/imports/shadow_builtin_macros.stderr index db4ee1128f42..c84226ef313c 100644 --- a/src/test/ui/imports/shadow_builtin_macros.stderr +++ b/src/test/ui/imports/shadow_builtin_macros.stderr @@ -1,7 +1,7 @@ error[E0659]: `panic` is ambiguous (glob import vs any other name from outer scope during import/macro resolution) --> $DIR/shadow_builtin_macros.rs:15:14 | -LL | fn f() { panic!(); } //~ ERROR ambiguous +LL | fn f() { panic!(); } | ^^^^^ ambiguous name | = note: `panic` could refer to a macro from prelude @@ -16,7 +16,7 @@ LL | use foo::*; error[E0659]: `panic` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/shadow_builtin_macros.rs:20:14 | -LL | fn f() { panic!(); } //~ ERROR ambiguous +LL | fn f() { panic!(); } | ^^^^^ ambiguous name | = note: `panic` could refer to a macro from prelude @@ -30,7 +30,7 @@ LL | ::two_macros::m!(use foo::panic;); error[E0659]: `panic` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/shadow_builtin_macros.rs:33:5 | -LL | panic!(); //~ ERROR `panic` is ambiguous +LL | panic!(); | ^^^^^ ambiguous name | = note: `panic` could refer to a macro from prelude @@ -46,7 +46,7 @@ LL | m!(); error[E0659]: `n` is ambiguous (glob import vs any other name from outer scope during import/macro resolution) --> $DIR/shadow_builtin_macros.rs:49:5 | -LL | n!(); //~ ERROR ambiguous +LL | n!(); | ^ ambiguous name | note: `n` could refer to the macro imported here diff --git a/src/test/ui/imports/unused-macro-use.stderr b/src/test/ui/imports/unused-macro-use.stderr index 2d20b3114426..78683147f7ba 100644 --- a/src/test/ui/imports/unused-macro-use.stderr +++ b/src/test/ui/imports/unused-macro-use.stderr @@ -1,7 +1,7 @@ error: unused `#[macro_use]` import --> $DIR/unused-macro-use.rs:3:1 | -LL | #[macro_use] //~ ERROR unused `#[macro_use]` import +LL | #[macro_use] | ^^^^^^^^^^^^ | note: lint level defined here @@ -14,7 +14,7 @@ LL | #![deny(unused)] error: unused `#[macro_use]` import --> $DIR/unused-macro-use.rs:7:5 | -LL | panic //~ ERROR unused `#[macro_use]` import +LL | panic | ^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/imports/unused.stderr b/src/test/ui/imports/unused.stderr index b56e930158cc..259ed9586962 100644 --- a/src/test/ui/imports/unused.stderr +++ b/src/test/ui/imports/unused.stderr @@ -1,7 +1,7 @@ error: unused import: `super::f` --> $DIR/unused.rs:7:24 | -LL | pub(super) use super::f; //~ ERROR unused +LL | pub(super) use super::f; | ^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/impossible_range.stderr b/src/test/ui/impossible_range.stderr index 1d26030625fc..091fe37c7a1f 100644 --- a/src/test/ui/impossible_range.stderr +++ b/src/test/ui/impossible_range.stderr @@ -1,7 +1,7 @@ error[E0586]: inclusive range with no end --> $DIR/impossible_range.rs:8:8 | -LL | ..=; //~ERROR inclusive range with no end +LL | ..=; | ^ | = help: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) @@ -9,7 +9,7 @@ LL | ..=; //~ERROR inclusive range with no end error[E0586]: inclusive range with no end --> $DIR/impossible_range.rs:15:9 | -LL | 0..=; //~ERROR inclusive range with no end +LL | 0..=; | ^ | = help: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) diff --git a/src/test/ui/in-band-lifetimes/E0687.stderr b/src/test/ui/in-band-lifetimes/E0687.stderr index 74245e16e7f2..7aea2f220466 100644 --- a/src/test/ui/in-band-lifetimes/E0687.stderr +++ b/src/test/ui/in-band-lifetimes/E0687.stderr @@ -1,25 +1,25 @@ error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders --> $DIR/E0687.rs:4:15 | -LL | fn foo(x: fn(&'a u32)) {} //~ ERROR must be explicitly +LL | fn foo(x: fn(&'a u32)) {} | ^^ in-band lifetime definition error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders --> $DIR/E0687.rs:6:16 | -LL | fn bar(x: &Fn(&'a u32)) {} //~ ERROR must be explicitly +LL | fn bar(x: &Fn(&'a u32)) {} | ^^ in-band lifetime definition error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders --> $DIR/E0687.rs:8:15 | -LL | fn baz(x: fn(&'a u32), y: &'a u32) {} //~ ERROR must be explicitly +LL | fn baz(x: fn(&'a u32), y: &'a u32) {} | ^^ in-band lifetime definition error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders --> $DIR/E0687.rs:13:26 | -LL | fn bar(&self, x: fn(&'a u32)) {} //~ ERROR must be explicitly +LL | fn bar(&self, x: fn(&'a u32)) {} | ^^ in-band lifetime definition error: aborting due to 4 previous errors diff --git a/src/test/ui/in-band-lifetimes/E0687_where.stderr b/src/test/ui/in-band-lifetimes/E0687_where.stderr index 4533c3b10f79..af0f9665f5d0 100644 --- a/src/test/ui/in-band-lifetimes/E0687_where.stderr +++ b/src/test/ui/in-band-lifetimes/E0687_where.stderr @@ -1,13 +1,13 @@ error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders --> $DIR/E0687_where.rs:4:31 | -LL | fn bar(x: &F) where F: Fn(&'a u32) {} //~ ERROR must be explicitly +LL | fn bar(x: &F) where F: Fn(&'a u32) {} | ^^ in-band lifetime definition error[E0687]: lifetimes used in `fn` or `Fn` syntax must be explicitly declared using `<...>` binders --> $DIR/E0687_where.rs:6:21 | -LL | fn baz(x: &impl Fn(&'a u32)) {} //~ ERROR must be explicitly +LL | fn baz(x: &impl Fn(&'a u32)) {} | ^^ in-band lifetime definition error: aborting due to 2 previous errors diff --git a/src/test/ui/in-band-lifetimes/E0688.stderr b/src/test/ui/in-band-lifetimes/E0688.stderr index f02b8db4669e..afefcd9fc2c6 100644 --- a/src/test/ui/in-band-lifetimes/E0688.stderr +++ b/src/test/ui/in-band-lifetimes/E0688.stderr @@ -1,7 +1,7 @@ error[E0688]: cannot mix in-band and explicit lifetime definitions --> $DIR/E0688.rs:4:28 | -LL | fn foo<'a>(x: &'a u32, y: &'b u32) {} //~ ERROR cannot mix +LL | fn foo<'a>(x: &'a u32, y: &'b u32) {} | -- ^^ in-band lifetime definition here | | | explicit lifetime definition here @@ -9,7 +9,7 @@ LL | fn foo<'a>(x: &'a u32, y: &'b u32) {} //~ ERROR cannot mix error[E0688]: cannot mix in-band and explicit lifetime definitions --> $DIR/E0688.rs:9:44 | -LL | fn bar<'b>(x: &'a u32, y: &'b u32, z: &'c u32) {} //~ ERROR cannot mix +LL | fn bar<'b>(x: &'a u32, y: &'b u32, z: &'c u32) {} | -- ^^ in-band lifetime definition here | | | explicit lifetime definition here @@ -17,7 +17,7 @@ LL | fn bar<'b>(x: &'a u32, y: &'b u32, z: &'c u32) {} //~ ERROR cannot mix error[E0688]: cannot mix in-band and explicit lifetime definitions --> $DIR/E0688.rs:12:14 | -LL | impl<'b> Foo<'a> { //~ ERROR cannot mix +LL | impl<'b> Foo<'a> { | -- ^^ in-band lifetime definition here | | | explicit lifetime definition here diff --git a/src/test/ui/in-band-lifetimes/mismatched.stderr b/src/test/ui/in-band-lifetimes/mismatched.stderr index abc6d42910fb..9d33aaf4c36f 100644 --- a/src/test/ui/in-band-lifetimes/mismatched.stderr +++ b/src/test/ui/in-band-lifetimes/mismatched.stderr @@ -1,7 +1,7 @@ error[E0621]: explicit lifetime required in the type of `y` --> $DIR/mismatched.rs:4:42 | -LL | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y } //~ ERROR explicit lifetime required +LL | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y } | ---- ^ lifetime `'a` required | | | help: add explicit lifetime `'a` to the type of `y`: `&'a u32` @@ -9,7 +9,7 @@ LL | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y } //~ ERROR explicit lifetime re error[E0623]: lifetime mismatch --> $DIR/mismatched.rs:6:46 | -LL | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y } //~ ERROR lifetime mismatch +LL | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y } | ------- ------- ^ ...but data from `y` is returned here | | | this parameter and the return type are declared with different lifetimes... diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait.stderr index dd28aa226b7f..ac66daa21c7a 100644 --- a/src/test/ui/in-band-lifetimes/mismatched_trait.stderr +++ b/src/test/ui/in-band-lifetimes/mismatched_trait.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `y` | LL | fn baz(&self, x: &'a u32, y: &u32) -> &'a u32 { | ---- help: add explicit lifetime `'a` to the type of `y`: `&'a u32` -LL | y //~ ERROR explicit lifetime required +LL | y | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait_impl.stderr index 4af991cede43..a80ebaf8dd29 100644 --- a/src/test/ui/in-band-lifetimes/mismatched_trait_impl.stderr +++ b/src/test/ui/in-band-lifetimes/mismatched_trait_impl.stderr @@ -1,20 +1,20 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'a in generic type due to conflicting requirements --> $DIR/mismatched_trait_impl.rs:9:5 | -LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR cannot infer +LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the method body at 9:5... --> $DIR/mismatched_trait_impl.rs:9:5 | -LL | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR cannot infer +LL | / fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { LL | | x LL | | } | |_____^ note: ...but the lifetime must also be valid for the lifetime 'a as defined on the method body at 9:32... --> $DIR/mismatched_trait_impl.rs:9:32 | -LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { //~ ERROR cannot infer +LL | fn foo(&self, x: &u32, y: &'a u32) -> &'a u32 { | ^^ = note: ...so that the method type is compatible with trait: expected fn(&i32, &'a u32, &u32) -> &'a u32 diff --git a/src/test/ui/in-band-lifetimes/mut_while_borrow.nll.stderr b/src/test/ui/in-band-lifetimes/mut_while_borrow.nll.stderr index 3f5dbb850cc7..f96ff9dd4e67 100644 --- a/src/test/ui/in-band-lifetimes/mut_while_borrow.nll.stderr +++ b/src/test/ui/in-band-lifetimes/mut_while_borrow.nll.stderr @@ -3,7 +3,7 @@ error[E0506]: cannot assign to `p` because it is borrowed | LL | let r = foo(&p); | -- borrow of `p` occurs here -LL | p += 1; //~ ERROR cannot assign to `p` because it is borrowed +LL | p += 1; | ^^^^^^ assignment to borrowed `p` occurs here LL | println!("{}", r); | - borrow later used here diff --git a/src/test/ui/in-band-lifetimes/mut_while_borrow.stderr b/src/test/ui/in-band-lifetimes/mut_while_borrow.stderr index e710986c7217..556c15d0edbb 100644 --- a/src/test/ui/in-band-lifetimes/mut_while_borrow.stderr +++ b/src/test/ui/in-band-lifetimes/mut_while_borrow.stderr @@ -3,7 +3,7 @@ error[E0506]: cannot assign to `p` because it is borrowed | LL | let r = foo(&p); | - borrow of `p` occurs here -LL | p += 1; //~ ERROR cannot assign to `p` because it is borrowed +LL | p += 1; | ^^^^^^ assignment to borrowed `p` occurs here error: aborting due to previous error diff --git a/src/test/ui/in-band-lifetimes/no_in_band_in_struct.stderr b/src/test/ui/in-band-lifetimes/no_in_band_in_struct.stderr index 9076bdc946a3..a270dd03926d 100644 --- a/src/test/ui/in-band-lifetimes/no_in_band_in_struct.stderr +++ b/src/test/ui/in-band-lifetimes/no_in_band_in_struct.stderr @@ -1,13 +1,13 @@ error[E0261]: use of undeclared lifetime name `'test` --> $DIR/no_in_band_in_struct.rs:5:9 | -LL | x: &'test u32, //~ ERROR undeclared lifetime +LL | x: &'test u32, | ^^^^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'test` --> $DIR/no_in_band_in_struct.rs:9:10 | -LL | Baz(&'test u32), //~ ERROR undeclared lifetime +LL | Baz(&'test u32), | ^^^^^ undeclared lifetime error: aborting due to 2 previous errors diff --git a/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr b/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr index 932dea5b2a95..c307066be6b4 100644 --- a/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr +++ b/src/test/ui/in-band-lifetimes/no_introducing_in_band_in_locals.stderr @@ -1,13 +1,13 @@ error[E0261]: use of undeclared lifetime name `'test` --> $DIR/no_introducing_in_band_in_locals.rs:5:13 | -LL | let y: &'test u32 = x; //~ ERROR use of undeclared lifetime +LL | let y: &'test u32 = x; | ^^^^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'test` --> $DIR/no_introducing_in_band_in_locals.rs:10:16 | -LL | let y: fn(&'test u32) = foo2; //~ ERROR use of undeclared lifetime +LL | let y: fn(&'test u32) = foo2; | ^^^^^ undeclared lifetime error: aborting due to 2 previous errors diff --git a/src/test/ui/in-band-lifetimes/shadow.stderr b/src/test/ui/in-band-lifetimes/shadow.stderr index ac5bd5b5a332..a0a15d3aa888 100644 --- a/src/test/ui/in-band-lifetimes/shadow.stderr +++ b/src/test/ui/in-band-lifetimes/shadow.stderr @@ -3,7 +3,7 @@ error[E0496]: lifetime name `'s` shadows a lifetime name that is already in scop | LL | impl Foo<&'s u8> { | -- first declared here -LL | fn bar<'s>(&self, x: &'s u8) {} //~ ERROR shadows a lifetime name +LL | fn bar<'s>(&self, x: &'s u8) {} | ^^ lifetime 's already in scope error[E0496]: lifetime name `'s` shadows a lifetime name that is already in scope @@ -11,8 +11,8 @@ error[E0496]: lifetime name `'s` shadows a lifetime name that is already in scop | LL | impl Foo<&'s u8> { | -- first declared here -LL | fn bar<'s>(&self, x: &'s u8) {} //~ ERROR shadows a lifetime name -LL | fn baz(x: for<'s> fn(&'s u32)) {} //~ ERROR shadows a lifetime name +LL | fn bar<'s>(&self, x: &'s u8) {} +LL | fn baz(x: for<'s> fn(&'s u32)) {} | ^^ lifetime 's already in scope error: aborting due to 2 previous errors diff --git a/src/test/ui/inaccessible-test-modules.stderr b/src/test/ui/inaccessible-test-modules.stderr index 636ef8187059..b6a817e6b1d3 100644 --- a/src/test/ui/inaccessible-test-modules.stderr +++ b/src/test/ui/inaccessible-test-modules.stderr @@ -1,14 +1,20 @@ error[E0432]: unresolved import `__test` --> $DIR/inaccessible-test-modules.rs:5:5 | -LL | use __test as x; //~ ERROR unresolved import `__test` - | ^^^^^^^^^^^ no `__test` in the root. Did you mean to use `test`? +LL | use __test as x; + | ------^^^^^ + | | + | no `__test` in the root + | help: a similar name exists in the module: `test` error[E0432]: unresolved import `__test_reexports` --> $DIR/inaccessible-test-modules.rs:6:5 | -LL | use __test_reexports as y; //~ ERROR unresolved import `__test_reexports` - | ^^^^^^^^^^^^^^^^^^^^^ no `__test_reexports` in the root. Did you mean to use `__test_reexports`? +LL | use __test_reexports as y; + | ----------------^^^^^ + | | + | no `__test_reexports` in the root + | help: a similar name exists in the module: `__test_reexports` error: aborting due to 2 previous errors diff --git a/src/test/ui/include-macros/mismatched-types.stderr b/src/test/ui/include-macros/mismatched-types.stderr index 1ee223b23f05..33204f1cfce9 100644 --- a/src/test/ui/include-macros/mismatched-types.stderr +++ b/src/test/ui/include-macros/mismatched-types.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/mismatched-types.rs:2:20 | -LL | let b: &[u8] = include_str!("file.txt"); //~ ERROR mismatched types +LL | let b: &[u8] = include_str!("file.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found str | = note: expected type `&[u8]` @@ -10,7 +10,7 @@ LL | let b: &[u8] = include_str!("file.txt"); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/mismatched-types.rs:3:19 | -LL | let s: &str = include_bytes!("file.txt"); //~ ERROR mismatched types +LL | let s: &str = include_bytes!("file.txt"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected str, found array of 0 elements | = note: expected type `&str` diff --git a/src/test/ui/index-bot.stderr b/src/test/ui/index-bot.stderr index 2e2a98d1d80a..b5d78297505d 100644 --- a/src/test/ui/index-bot.stderr +++ b/src/test/ui/index-bot.stderr @@ -1,7 +1,7 @@ error[E0608]: cannot index into a value of type `!` --> $DIR/index-bot.rs:2:5 | -LL | (return)[0]; //~ ERROR cannot index into a value of type `!` +LL | (return)[0]; | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/index-help.stderr b/src/test/ui/index-help.stderr index 4c585a958c14..cd4d8356749a 100644 --- a/src/test/ui/index-help.stderr +++ b/src/test/ui/index-help.stderr @@ -1,7 +1,7 @@ error[E0277]: the type `[{integer}]` cannot be indexed by `i32` --> $DIR/index-help.rs:3:5 | -LL | x[0i32]; //~ ERROR E0277 +LL | x[0i32]; | ^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[{integer}]>` is not implemented for `i32` diff --git a/src/test/ui/index_message.stderr b/src/test/ui/index_message.stderr index 62a14523fe9a..6c2b126734b0 100644 --- a/src/test/ui/index_message.stderr +++ b/src/test/ui/index_message.stderr @@ -1,7 +1,7 @@ error[E0608]: cannot index into a value of type `()` --> $DIR/index_message.rs:3:13 | -LL | let _ = z[0]; //~ ERROR cannot index into a value of type `()` +LL | let _ = z[0]; | ^^^^ help: to access tuple elements, use: `z.0` error: aborting due to previous error diff --git a/src/test/ui/indexing-requires-a-uint.stderr b/src/test/ui/indexing-requires-a-uint.stderr index 363c3d0d4585..0b879581ec69 100644 --- a/src/test/ui/indexing-requires-a-uint.stderr +++ b/src/test/ui/indexing-requires-a-uint.stderr @@ -1,7 +1,7 @@ error[E0277]: the type `[{integer}]` cannot be indexed by `u8` --> $DIR/indexing-requires-a-uint.rs:6:5 | -LL | [0][0u8]; //~ ERROR: the type `[{integer}]` cannot be indexed by `u8` +LL | [0][0u8]; | ^^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[{integer}]>` is not implemented for `u8` diff --git a/src/test/ui/inference/inference_unstable_featured.stderr b/src/test/ui/inference/inference_unstable_featured.stderr index 5f0257851271..08cdb8cc6883 100644 --- a/src/test/ui/inference/inference_unstable_featured.stderr +++ b/src/test/ui/inference/inference_unstable_featured.stderr @@ -1,7 +1,7 @@ error[E0034]: multiple applicable items in scope --> $DIR/inference_unstable_featured.rs:16:20 | -LL | assert_eq!('x'.ipu_flatten(), 0); //~ ERROR E0034 +LL | assert_eq!('x'.ipu_flatten(), 0); | ^^^^^^^^^^^ multiple `ipu_flatten` found | = note: candidate #1 is defined in an impl of the trait `inference_unstable_iterator::IpuIterator` for the type `char` diff --git a/src/test/ui/inference/inference_unstable_forced.stderr b/src/test/ui/inference/inference_unstable_forced.stderr index 3c07085a648f..067bf44bda8e 100644 --- a/src/test/ui/inference/inference_unstable_forced.stderr +++ b/src/test/ui/inference/inference_unstable_forced.stderr @@ -1,7 +1,7 @@ error[E0658]: use of unstable library feature 'ipu_flatten' (see issue #99999) --> $DIR/inference_unstable_forced.rs:11:20 | -LL | assert_eq!('x'.ipu_flatten(), 0); //~ ERROR E0658 +LL | assert_eq!('x'.ipu_flatten(), 0); | ^^^^^^^^^^^ | = help: add #![feature(ipu_flatten)] to the crate attributes to enable diff --git a/src/test/ui/infinite/infinite-instantiation.stderr b/src/test/ui/infinite/infinite-instantiation.stderr index 42be1411b686..976b9e36cf8c 100644 --- a/src/test/ui/infinite/infinite-instantiation.stderr +++ b/src/test/ui/infinite/infinite-instantiation.stderr @@ -2,7 +2,7 @@ error: reached the recursion limit while instantiating `function:: $DIR/infinite-instantiation.rs:23:1 | LL | / fn function(counter: usize, t: T) { -LL | | //~^ ERROR reached the recursion limit while instantiating `function:: 0 { LL | | function(counter - 1, t.to_option()); ... | diff --git a/src/test/ui/infinite/infinite-macro-expansion.stderr b/src/test/ui/infinite/infinite-macro-expansion.stderr index 9b64fba8b94d..0faf29f0b3eb 100644 --- a/src/test/ui/infinite/infinite-macro-expansion.stderr +++ b/src/test/ui/infinite/infinite-macro-expansion.stderr @@ -1,7 +1,7 @@ error: recursion limit reached while expanding the macro `recursive` --> $DIR/infinite-macro-expansion.rs:2:12 | -LL | () => (recursive!()) //~ ERROR recursion limit reached while expanding the macro `recursive` +LL | () => (recursive!()) | ^^^^^^^^^^^^ ... LL | recursive!() diff --git a/src/test/ui/infinite/infinite-recursion-const-fn.stderr b/src/test/ui/infinite/infinite-recursion-const-fn.stderr index 3ed7957d14d9..9e0530de425f 100644 --- a/src/test/ui/infinite/infinite-recursion-const-fn.stderr +++ b/src/test/ui/infinite/infinite-recursion-const-fn.stderr @@ -1,7 +1,7 @@ error[E0080]: evaluation of constant value failed --> $DIR/infinite-recursion-const-fn.rs:3:25 | -LL | const fn a() -> usize { b() } //~ ERROR evaluation of constant value failed +LL | const fn a() -> usize { b() } | ^^^ | | | reached the configured maximum number of stack frames diff --git a/src/test/ui/infinite/infinite-vec-type-recursion.stderr b/src/test/ui/infinite/infinite-vec-type-recursion.stderr index daa18a7e9b1c..be0db56f0344 100644 --- a/src/test/ui/infinite/infinite-vec-type-recursion.stderr +++ b/src/test/ui/infinite/infinite-vec-type-recursion.stderr @@ -9,7 +9,7 @@ note: cycle used when collecting item types in top-level module --> $DIR/infinite-vec-type-recursion.rs:1:1 | LL | / type X = Vec; -LL | | //~^ ERROR cycle detected +LL | | LL | | LL | | fn main() { let b: X = Vec::new(); } | |____________________________________^ diff --git a/src/test/ui/init-unsafe.stderr b/src/test/ui/init-unsafe.stderr index dba8cc43ff22..857142dff64b 100644 --- a/src/test/ui/init-unsafe.stderr +++ b/src/test/ui/init-unsafe.stderr @@ -1,7 +1,7 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block --> $DIR/init-unsafe.rs:7:17 | -LL | let stuff = init::(); //~ ERROR call to unsafe function is unsafe +LL | let stuff = init::(); | ^^^^^^^^^^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior diff --git a/src/test/ui/inline-asm-bad-constraint.stderr b/src/test/ui/inline-asm-bad-constraint.stderr index 1f63d4c2a48c..59066e5e7fc7 100644 --- a/src/test/ui/inline-asm-bad-constraint.stderr +++ b/src/test/ui/inline-asm-bad-constraint.stderr @@ -1,19 +1,19 @@ error[E0668]: malformed inline assembly --> $DIR/inline-asm-bad-constraint.rs:21:9 | -LL | asm!("" :"={rax"(rax)) //~ ERROR E0668 +LL | asm!("" :"={rax"(rax)) | ^^^^^^^^^^^^^^^^^^^^^^ error[E0668]: malformed inline assembly --> $DIR/inline-asm-bad-constraint.rs:29:9 | -LL | asm!("callq $0" : : "0"(foo)) //~ ERROR E0668 +LL | asm!("callq $0" : : "0"(foo)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0668]: malformed inline assembly --> $DIR/inline-asm-bad-constraint.rs:36:9 | -LL | asm!("addb $1, $0" : "={rax}"((0i32, rax))); //~ ERROR E0668 +LL | asm!("addb $1, $0" : "={rax}"((0i32, rax))); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/inline-asm-bad-operand.stderr b/src/test/ui/inline-asm-bad-operand.stderr index f1de38efc036..3bb1cdda2497 100644 --- a/src/test/ui/inline-asm-bad-operand.stderr +++ b/src/test/ui/inline-asm-bad-operand.stderr @@ -1,43 +1,43 @@ error[E0669]: invalid value for constraint in inline assembly --> $DIR/inline-asm-bad-operand.rs:21:24 | -LL | asm!("" :: "r"("")); //~ ERROR E0669 +LL | asm!("" :: "r"("")); | ^^ error[E0669]: invalid value for constraint in inline assembly --> $DIR/inline-asm-bad-operand.rs:26:32 | -LL | asm!("ret" : : "{rdi}"(target)); //~ ERROR E0669 +LL | asm!("ret" : : "{rdi}"(target)); | ^^^^^^ error[E0669]: invalid value for constraint in inline assembly --> $DIR/inline-asm-bad-operand.rs:33:29 | -LL | unsafe { asm!("" :: "i"(hello)) }; //~ ERROR E0669 +LL | unsafe { asm!("" :: "i"(hello)) }; | ^^^^^ error[E0669]: invalid value for constraint in inline assembly --> $DIR/inline-asm-bad-operand.rs:41:38 | -LL | asm!("movups $1, %xmm0"::"m"(arr)); //~ ERROR E0669 +LL | asm!("movups $1, %xmm0"::"m"(arr)); | ^^^ error[E0669]: invalid value for constraint in inline assembly --> $DIR/inline-asm-bad-operand.rs:48:32 | -LL | asm!("mov sp, $0"::"r"(addr)); //~ ERROR E0669 +LL | asm!("mov sp, $0"::"r"(addr)); | ^^^^ error[E0669]: invalid value for constraint in inline assembly --> $DIR/inline-asm-bad-operand.rs:55:32 | -LL | asm!("mov sp, $0"::"r"(addr), //~ ERROR E0669 +LL | asm!("mov sp, $0"::"r"(addr), | ^^^^ error[E0669]: invalid value for constraint in inline assembly --> $DIR/inline-asm-bad-operand.rs:56:32 | -LL | "r"("hello e0669")); //~ ERROR E0669 +LL | "r"("hello e0669")); | ^^^^^^^^^^^^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/inner-static-type-parameter.stderr b/src/test/ui/inner-static-type-parameter.stderr index 87fb364954d9..3c14e217aeb8 100644 --- a/src/test/ui/inner-static-type-parameter.stderr +++ b/src/test/ui/inner-static-type-parameter.stderr @@ -11,7 +11,7 @@ LL | static a: Bar = Bar::What; error[E0392]: parameter `T` is never used --> $DIR/inner-static-type-parameter.rs:3:10 | -LL | enum Bar { What } //~ ERROR parameter `T` is never used +LL | enum Bar { What } | ^ unused type parameter | = help: consider removing `T` or using a marker such as `std::marker::PhantomData` diff --git a/src/test/ui/integral-indexing.stderr b/src/test/ui/integral-indexing.stderr index efbad86c4d31..28ef5937eaa4 100644 --- a/src/test/ui/integral-indexing.stderr +++ b/src/test/ui/integral-indexing.stderr @@ -1,7 +1,7 @@ error[E0277]: the type `[isize]` cannot be indexed by `u8` --> $DIR/integral-indexing.rs:6:5 | -LL | v[3u8]; //~ERROR : the type `[isize]` cannot be indexed by `u8` +LL | v[3u8]; | ^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[isize]>` is not implemented for `u8` @@ -10,7 +10,7 @@ LL | v[3u8]; //~ERROR : the type `[isize]` cannot be indexed by `u8` error[E0277]: the type `[isize]` cannot be indexed by `i8` --> $DIR/integral-indexing.rs:7:5 | -LL | v[3i8]; //~ERROR : the type `[isize]` cannot be indexed by `i8` +LL | v[3i8]; | ^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[isize]>` is not implemented for `i8` @@ -19,7 +19,7 @@ LL | v[3i8]; //~ERROR : the type `[isize]` cannot be indexed by `i8` error[E0277]: the type `[isize]` cannot be indexed by `u32` --> $DIR/integral-indexing.rs:8:5 | -LL | v[3u32]; //~ERROR : the type `[isize]` cannot be indexed by `u32` +LL | v[3u32]; | ^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[isize]>` is not implemented for `u32` @@ -28,7 +28,7 @@ LL | v[3u32]; //~ERROR : the type `[isize]` cannot be indexed by `u32` error[E0277]: the type `[isize]` cannot be indexed by `i32` --> $DIR/integral-indexing.rs:9:5 | -LL | v[3i32]; //~ERROR : the type `[isize]` cannot be indexed by `i32` +LL | v[3i32]; | ^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[isize]>` is not implemented for `i32` @@ -37,7 +37,7 @@ LL | v[3i32]; //~ERROR : the type `[isize]` cannot be indexed by `i32` error[E0277]: the type `[u8]` cannot be indexed by `u8` --> $DIR/integral-indexing.rs:12:5 | -LL | s.as_bytes()[3u8]; //~ERROR : the type `[u8]` cannot be indexed by `u8` +LL | s.as_bytes()[3u8]; | ^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[u8]>` is not implemented for `u8` @@ -46,7 +46,7 @@ LL | s.as_bytes()[3u8]; //~ERROR : the type `[u8]` cannot be indexed by `u8 error[E0277]: the type `[u8]` cannot be indexed by `i8` --> $DIR/integral-indexing.rs:13:5 | -LL | s.as_bytes()[3i8]; //~ERROR : the type `[u8]` cannot be indexed by `i8` +LL | s.as_bytes()[3i8]; | ^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[u8]>` is not implemented for `i8` @@ -55,7 +55,7 @@ LL | s.as_bytes()[3i8]; //~ERROR : the type `[u8]` cannot be indexed by `i8 error[E0277]: the type `[u8]` cannot be indexed by `u32` --> $DIR/integral-indexing.rs:14:5 | -LL | s.as_bytes()[3u32]; //~ERROR : the type `[u8]` cannot be indexed by `u32` +LL | s.as_bytes()[3u32]; | ^^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[u8]>` is not implemented for `u32` @@ -64,7 +64,7 @@ LL | s.as_bytes()[3u32]; //~ERROR : the type `[u8]` cannot be indexed by `u3 error[E0277]: the type `[u8]` cannot be indexed by `i32` --> $DIR/integral-indexing.rs:15:5 | -LL | s.as_bytes()[3i32]; //~ERROR : the type `[u8]` cannot be indexed by `i32` +LL | s.as_bytes()[3i32]; | ^^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[u8]>` is not implemented for `i32` diff --git a/src/test/ui/internal/internal-unstable-thread-local.stderr b/src/test/ui/internal/internal-unstable-thread-local.stderr index 0e25592b103c..603bdc39bdd0 100644 --- a/src/test/ui/internal/internal-unstable-thread-local.stderr +++ b/src/test/ui/internal/internal-unstable-thread-local.stderr @@ -1,7 +1,7 @@ error[E0658]: use of unstable library feature 'function' --> $DIR/internal-unstable-thread-local.rs:9:32 | -LL | thread_local!(static BAR: () = internal_unstable::unstable()); //~ ERROR use of unstable +LL | thread_local!(static BAR: () = internal_unstable::unstable()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(function)] to the crate attributes to enable diff --git a/src/test/ui/internal/internal-unstable.stderr b/src/test/ui/internal/internal-unstable.stderr index 3e1a44f082ee..5c14fed568f2 100644 --- a/src/test/ui/internal/internal-unstable.stderr +++ b/src/test/ui/internal/internal-unstable.stderr @@ -1,7 +1,7 @@ error[E0658]: use of unstable library feature 'function' --> $DIR/internal-unstable.rs:33:25 | -LL | pass_through_allow!(internal_unstable::unstable()); //~ ERROR use of unstable +LL | pass_through_allow!(internal_unstable::unstable()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(function)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | pass_through_allow!(internal_unstable::unstable()); //~ ERROR use of un error[E0658]: use of unstable library feature 'function' --> $DIR/internal-unstable.rs:35:27 | -LL | pass_through_noallow!(internal_unstable::unstable()); //~ ERROR use of unstable +LL | pass_through_noallow!(internal_unstable::unstable()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(function)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | pass_through_noallow!(internal_unstable::unstable()); //~ ERROR use of error[E0658]: use of unstable library feature 'function' --> $DIR/internal-unstable.rs:39:22 | -LL | println!("{:?}", internal_unstable::unstable()); //~ ERROR use of unstable +LL | println!("{:?}", internal_unstable::unstable()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(function)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | println!("{:?}", internal_unstable::unstable()); //~ ERROR use of unsta error[E0658]: use of unstable library feature 'function' --> $DIR/internal-unstable.rs:41:10 | -LL | bar!(internal_unstable::unstable()); //~ ERROR use of unstable +LL | bar!(internal_unstable::unstable()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(function)] to the crate attributes to enable @@ -33,10 +33,10 @@ LL | bar!(internal_unstable::unstable()); //~ ERROR use of unstable error[E0658]: use of unstable library feature 'function' --> $DIR/internal-unstable.rs:12:9 | -LL | internal_unstable::unstable(); //~ ERROR use of unstable +LL | internal_unstable::unstable(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... -LL | bar!(internal_unstable::unstable()); //~ ERROR use of unstable +LL | bar!(internal_unstable::unstable()); | ------------------------------------ in this macro invocation | = help: add #![feature(function)] to the crate attributes to enable diff --git a/src/test/ui/invalid/invalid-crate-type.stderr b/src/test/ui/invalid/invalid-crate-type.stderr index 63edd04650b2..030dc96c6d64 100644 --- a/src/test/ui/invalid/invalid-crate-type.stderr +++ b/src/test/ui/invalid/invalid-crate-type.stderr @@ -1,7 +1,7 @@ error: invalid `crate_type` value --> $DIR/invalid-crate-type.rs:2:15 | -LL | #![crate_type="foo"] //~ ERROR invalid `crate_type` value +LL | #![crate_type="foo"] | ^^^^^ | = note: #[deny(unknown_crate_types)] on by default diff --git a/src/test/ui/invalid/invalid-inline.stderr b/src/test/ui/invalid/invalid-inline.stderr index fdbd25070f7f..ce29951822fd 100644 --- a/src/test/ui/invalid/invalid-inline.stderr +++ b/src/test/ui/invalid/invalid-inline.stderr @@ -1,19 +1,19 @@ error[E0535]: invalid argument --> $DIR/invalid-inline.rs:3:10 | -LL | #[inline(please_no)] //~ ERROR invalid argument +LL | #[inline(please_no)] | ^^^^^^^^^ error[E0534]: expected one argument --> $DIR/invalid-inline.rs:7:1 | -LL | #[inline(please,no)] //~ ERROR expected one argument +LL | #[inline(please,no)] | ^^^^^^^^^^^^^^^^^^^^ error[E0534]: expected one argument --> $DIR/invalid-inline.rs:11:1 | -LL | #[inline()] //~ ERROR expected one argument +LL | #[inline()] | ^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/invalid/invalid-macro-matcher.stderr b/src/test/ui/invalid/invalid-macro-matcher.stderr index 5d6c70fa30b8..dbe025b7330b 100644 --- a/src/test/ui/invalid/invalid-macro-matcher.stderr +++ b/src/test/ui/invalid/invalid-macro-matcher.stderr @@ -1,7 +1,7 @@ error: invalid macro matcher; matchers must be contained in balanced delimiters --> $DIR/invalid-macro-matcher.rs:4:5 | -LL | _ => (); //~ ERROR invalid macro matcher +LL | _ => (); | ^ error: aborting due to previous error diff --git a/src/test/ui/invalid/invalid-plugin-attr.stderr b/src/test/ui/invalid/invalid-plugin-attr.stderr index 2d7ae1f5cfed..c7b2ce47489a 100644 --- a/src/test/ui/invalid/invalid-plugin-attr.stderr +++ b/src/test/ui/invalid/invalid-plugin-attr.stderr @@ -1,7 +1,7 @@ error: unused attribute --> $DIR/invalid-plugin-attr.rs:4:1 | -LL | #[plugin(bla)] //~ ERROR unused attribute +LL | #[plugin(bla)] | ^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unused_attributes)] error: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] --> $DIR/invalid-plugin-attr.rs:4:1 | -LL | #[plugin(bla)] //~ ERROR unused attribute +LL | #[plugin(bla)] | ^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/invalid/invalid-variadic-function.rs b/src/test/ui/invalid/invalid-variadic-function.rs index aea630e7c26a..8d23f0e47707 100644 --- a/src/test/ui/invalid/invalid-variadic-function.rs +++ b/src/test/ui/invalid/invalid-variadic-function.rs @@ -1,3 +1,3 @@ extern "C" fn foo(x: u8, ...); -//~^ ERROR only foreign functions are allowed to be variadic +//~^ ERROR only foreign functions are allowed to be C-variadic //~| ERROR expected one of `->`, `where`, or `{`, found `;` diff --git a/src/test/ui/invalid/invalid-variadic-function.stderr b/src/test/ui/invalid/invalid-variadic-function.stderr index 7a0b8066fd52..b2dbf8b91908 100644 --- a/src/test/ui/invalid/invalid-variadic-function.stderr +++ b/src/test/ui/invalid/invalid-variadic-function.stderr @@ -1,4 +1,4 @@ -error: only foreign functions are allowed to be variadic +error: only foreign functions are allowed to be C-variadic --> $DIR/invalid-variadic-function.rs:1:26 | LL | extern "C" fn foo(x: u8, ...); diff --git a/src/test/ui/invalid_crate_type_syntax.stderr b/src/test/ui/invalid_crate_type_syntax.stderr index 8d6948b583c5..cb3faedfedb8 100644 --- a/src/test/ui/invalid_crate_type_syntax.stderr +++ b/src/test/ui/invalid_crate_type_syntax.stderr @@ -1,7 +1,7 @@ error: attribute must be of the form `#[crate_type = "bin|lib|..."]` --> $DIR/invalid_crate_type_syntax.rs:2:1 | -LL | #![crate_type(lib)] //~ ERROR attribute must be of the form +LL | #![crate_type(lib)] | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/invalid_dispatch_from_dyn_impls.stderr b/src/test/ui/invalid_dispatch_from_dyn_impls.stderr index 8ee0a40a529c..bd016466300d 100644 --- a/src/test/ui/invalid_dispatch_from_dyn_impls.stderr +++ b/src/test/ui/invalid_dispatch_from_dyn_impls.stderr @@ -4,7 +4,7 @@ error[E0378]: the trait `DispatchFromDyn` may only be implemented for structs co LL | / impl DispatchFromDyn> for WrapperWithExtraField LL | | where LL | | T: DispatchFromDyn, -LL | | {} //~^^^ ERROR [E0378] +LL | | {} | |__^ | = note: extra field `1` of type `i32` is not allowed @@ -15,7 +15,7 @@ error[E0378]: implementing the `DispatchFromDyn` trait requires multiple coercio LL | / impl DispatchFromDyn> for MultiplePointers LL | | where LL | | T: Unsize, -LL | | {} //~^^^ ERROR [E0378] +LL | | {} | |__^ | = note: the trait `DispatchFromDyn` may only be implemented for a coercion between structures with a single field being coerced @@ -33,7 +33,7 @@ error[E0378]: structs implementing `DispatchFromDyn` may not have `#[repr(packed LL | / impl DispatchFromDyn> for HasReprC LL | | where LL | | T: Unsize, -LL | | {} //~^^^ ERROR [E0378] +LL | | {} | |__^ error: aborting due to 4 previous errors diff --git a/src/test/ui/issue-18986.stderr b/src/test/ui/issue-18986.stderr index 440782b0b1f2..6c23178c7001 100644 --- a/src/test/ui/issue-18986.stderr +++ b/src/test/ui/issue-18986.stderr @@ -1,7 +1,7 @@ error[E0574]: expected struct, variant or union type, found trait `Trait` --> $DIR/issue-18986.rs:8:9 | -LL | Trait { x: 42 } => () //~ ERROR expected struct, variant or union type, found trait `Trait` +LL | Trait { x: 42 } => () | ^^^^^ not a struct, variant or union type error: aborting due to previous error diff --git a/src/test/ui/issue-42944.stderr b/src/test/ui/issue-42944.stderr index 43fd0ffb7243..0613be0b3d0f 100644 --- a/src/test/ui/issue-42944.stderr +++ b/src/test/ui/issue-42944.stderr @@ -1,13 +1,13 @@ error[E0423]: expected function, found struct `B` --> $DIR/issue-42944.rs:9:9 | -LL | B(()); //~ ERROR expected function, found struct `B` [E0423] +LL | B(()); | ^ constructor is not visible here due to private fields error[E0425]: cannot find function `B` in this scope --> $DIR/issue-42944.rs:15:9 | -LL | B(()); //~ ERROR cannot find function `B` in this scope [E0425] +LL | B(()); | ^ not found in this scope help: possible candidate is found in another module, you can import it into scope | diff --git a/src/test/ui/issue-53787-inline-assembler-macro.stderr b/src/test/ui/issue-53787-inline-assembler-macro.stderr index 69f380bdc9c0..047ba341cfc7 100644 --- a/src/test/ui/issue-53787-inline-assembler-macro.stderr +++ b/src/test/ui/issue-53787-inline-assembler-macro.stderr @@ -1,7 +1,7 @@ error[E0669]: invalid value for constraint in inline assembly --> $DIR/issue-53787-inline-assembler-macro.rs:21:16 | -LL | fake_jump!("FirstFunc"); //~ ERROR invalid value for constraint in inline assembly +LL | fake_jump!("FirstFunc"); | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-10200.stderr b/src/test/ui/issues/issue-10200.stderr index ac1ad118a715..544716e89b39 100644 --- a/src/test/ui/issues/issue-10200.stderr +++ b/src/test/ui/issues/issue-10200.stderr @@ -1,7 +1,7 @@ error[E0532]: expected tuple struct/variant, found function `foo` --> $DIR/issue-10200.rs:6:9 | -LL | foo(x) //~ ERROR expected tuple struct/variant, found function `foo` +LL | foo(x) | ^^^ help: a tuple struct with a similar name exists: `Foo` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-10291.stderr b/src/test/ui/issues/issue-10291.stderr index 9bd428950179..89ffd4537a27 100644 --- a/src/test/ui/issues/issue-10291.stderr +++ b/src/test/ui/issues/issue-10291.stderr @@ -1,7 +1,7 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... --> $DIR/issue-10291.rs:3:9 | -LL | x //~ ERROR E0312 +LL | x | ^ | note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 2:65... @@ -9,7 +9,7 @@ note: ...the reference is valid for the anonymous lifetime #2 defined on the bod | LL | drop:: FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { | _________________________________________________________________^ -LL | | x //~ ERROR E0312 +LL | | x LL | | })); | |_____^ note: ...but the borrowed content is only valid for the lifetime 'x as defined on the function body at 1:9 diff --git a/src/test/ui/issues/issue-10412.stderr b/src/test/ui/issues/issue-10412.stderr index 8128ba22fdeb..48920813ae10 100644 --- a/src/test/ui/issues/issue-10412.stderr +++ b/src/test/ui/issues/issue-10412.stderr @@ -1,49 +1,49 @@ error: lifetimes cannot use keyword names --> $DIR/issue-10412.rs:1:20 | -LL | trait Serializable<'self, T> { //~ ERROR lifetimes cannot use keyword names +LL | trait Serializable<'self, T> { | ^^^^^ error: lifetimes cannot use keyword names --> $DIR/issue-10412.rs:2:25 | -LL | fn serialize(val : &'self T) -> Vec; //~ ERROR lifetimes cannot use keyword names +LL | fn serialize(val : &'self T) -> Vec; | ^^^^^ error: lifetimes cannot use keyword names --> $DIR/issue-10412.rs:3:38 | -LL | fn deserialize(repr : &[u8]) -> &'self T; //~ ERROR lifetimes cannot use keyword names +LL | fn deserialize(repr : &[u8]) -> &'self T; | ^^^^^ error: lifetimes cannot use keyword names --> $DIR/issue-10412.rs:6:6 | -LL | impl<'self> Serializable for &'self str { //~ ERROR lifetimes cannot use keyword names +LL | impl<'self> Serializable for &'self str { | ^^^^^ error: lifetimes cannot use keyword names --> $DIR/issue-10412.rs:6:36 | -LL | impl<'self> Serializable for &'self str { //~ ERROR lifetimes cannot use keyword names +LL | impl<'self> Serializable for &'self str { | ^^^^^ error: lifetimes cannot use keyword names --> $DIR/issue-10412.rs:9:25 | -LL | fn serialize(val : &'self str) -> Vec { //~ ERROR lifetimes cannot use keyword names +LL | fn serialize(val : &'self str) -> Vec { | ^^^^^ error: lifetimes cannot use keyword names --> $DIR/issue-10412.rs:12:37 | -LL | fn deserialize(repr: &[u8]) -> &'self str { //~ ERROR lifetimes cannot use keyword names +LL | fn deserialize(repr: &[u8]) -> &'self str { | ^^^^^ error[E0106]: missing lifetime specifier --> $DIR/issue-10412.rs:6:13 | -LL | impl<'self> Serializable for &'self str { //~ ERROR lifetimes cannot use keyword names +LL | impl<'self> Serializable for &'self str { | ^^^^^^^^^^^^^^^^^ expected lifetime parameter error: aborting due to 8 previous errors diff --git a/src/test/ui/issues/issue-10465.stderr b/src/test/ui/issues/issue-10465.stderr index 41613cfa0105..6efbd8e40ef6 100644 --- a/src/test/ui/issues/issue-10465.stderr +++ b/src/test/ui/issues/issue-10465.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `foo` found for type `&b::B` in the current scope --> $DIR/issue-10465.rs:17:15 | -LL | b.foo(); //~ ERROR: no method named `foo` found +LL | b.foo(); | ^^^ | = help: items from traits can only be used if the trait is in scope diff --git a/src/test/ui/issues/issue-10545.stderr b/src/test/ui/issues/issue-10545.stderr index e486a17bda94..59d4fedcd2b4 100644 --- a/src/test/ui/issues/issue-10545.stderr +++ b/src/test/ui/issues/issue-10545.stderr @@ -1,7 +1,7 @@ error[E0603]: struct `S` is private --> $DIR/issue-10545.rs:6:14 | -LL | fn foo(_: a::S) { //~ ERROR: struct `S` is private +LL | fn foo(_: a::S) { | ^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-10969.stderr b/src/test/ui/issues/issue-10969.stderr index 0eaed9464b41..9e28a665e30f 100644 --- a/src/test/ui/issues/issue-10969.stderr +++ b/src/test/ui/issues/issue-10969.stderr @@ -3,7 +3,7 @@ error[E0618]: expected function, found `i32` | LL | fn func(i: i32) { | - `i32` defined here -LL | i(); //~ERROR expected function, found `i32` +LL | i(); | ^-- | | | call expression requires function @@ -13,7 +13,7 @@ error[E0618]: expected function, found `i32` | LL | let i = 0i32; | - `i32` defined here -LL | i(); //~ERROR expected function, found `i32` +LL | i(); | ^-- | | | call expression requires function diff --git a/src/test/ui/issues/issue-10991.stderr b/src/test/ui/issues/issue-10991.stderr index c91b15cb3fb3..f12539b47cf4 100644 --- a/src/test/ui/issues/issue-10991.stderr +++ b/src/test/ui/issues/issue-10991.stderr @@ -1,7 +1,7 @@ error[E0605]: non-primitive cast: `()` as `usize` --> $DIR/issue-10991.rs:3:14 | -LL | let _t = nil as usize; //~ ERROR: non-primitive cast: `()` as `usize` +LL | let _t = nil as usize; | ^^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait diff --git a/src/test/ui/issues/issue-11004.stderr b/src/test/ui/issues/issue-11004.stderr index a5c63e9c31d4..b5831e42e399 100644 --- a/src/test/ui/issues/issue-11004.stderr +++ b/src/test/ui/issues/issue-11004.stderr @@ -1,7 +1,7 @@ error[E0609]: no field `x` on type `*mut A` --> $DIR/issue-11004.rs:7:21 | -LL | let x : i32 = n.x; //~ no field `x` on type `*mut A` +LL | let x : i32 = n.x; | --^ | | | help: `n` is a raw pointer; try dereferencing it: `(*n).x` @@ -9,7 +9,7 @@ LL | let x : i32 = n.x; //~ no field `x` on type `*mut A` error[E0609]: no field `y` on type `*mut A` --> $DIR/issue-11004.rs:8:21 | -LL | let y : f64 = n.y; //~ no field `y` on type `*mut A` +LL | let y : f64 = n.y; | --^ | | | help: `n` is a raw pointer; try dereferencing it: `(*n).y` diff --git a/src/test/ui/issues/issue-11192.stderr b/src/test/ui/issues/issue-11192.stderr index 37ae73685b4f..ce90b16207f0 100644 --- a/src/test/ui/issues/issue-11192.stderr +++ b/src/test/ui/issues/issue-11192.stderr @@ -9,7 +9,7 @@ LL | ptr = box Foo { x: ptr.x + 1 }; ... LL | test(&*ptr); | ^^^^ immutable borrow occurs here -LL | //~^ ERROR: cannot borrow `*ptr` as immutable +LL | LL | } | - mutable borrow ends here diff --git a/src/test/ui/issues/issue-11319.stderr b/src/test/ui/issues/issue-11319.stderr index 10db477b8ca7..6179f9d3fe00 100644 --- a/src/test/ui/issues/issue-11319.stderr +++ b/src/test/ui/issues/issue-11319.stderr @@ -2,13 +2,13 @@ error[E0308]: match arms have incompatible types --> $DIR/issue-11319.rs:8:20 | LL | / match Some(10) { -LL | | //~^ NOTE `match` arms have incompatible types +LL | | LL | | Some(5) => false, | | ----- this is found to be of type `bool` -LL | | //~^ NOTE this is found to be of type `bool` +LL | | LL | | Some(2) => true, | | ---- this is found to be of type `bool` -LL | | //~^ NOTE this is found to be of type `bool` +LL | | LL | | None => (), | | ^^ expected bool, found () ... | diff --git a/src/test/ui/issues/issue-11374.stderr b/src/test/ui/issues/issue-11374.stderr index 6cd552f86e15..8d7e6c81f4fc 100644 --- a/src/test/ui/issues/issue-11374.stderr +++ b/src/test/ui/issues/issue-11374.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-11374.rs:26:15 | -LL | c.read_to(v); //~ ERROR E0308 +LL | c.read_to(v); | ^ | | | expected &mut [u8], found struct `std::vec::Vec` diff --git a/src/test/ui/issues/issue-11515.stderr b/src/test/ui/issues/issue-11515.stderr index d7d51a32414c..0ab0c7dba0b7 100644 --- a/src/test/ui/issues/issue-11515.stderr +++ b/src/test/ui/issues/issue-11515.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-11515.rs:9:33 | -LL | let test = box Test { func: closure }; //~ ERROR mismatched types +LL | let test = box Test { func: closure }; | ^^^^^^^ expected trait `std::ops::FnMut`, found trait `std::ops::Fn` | = note: expected type `std::boxed::Box<(dyn std::ops::FnMut() + 'static)>` diff --git a/src/test/ui/issues/issue-11681.nll.stderr b/src/test/ui/issues/issue-11681.nll.stderr index a3c71ffe95a8..f2f930766719 100644 --- a/src/test/ui/issues/issue-11681.nll.stderr +++ b/src/test/ui/issues/issue-11681.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing temporary value --> $DIR/issue-11681.rs:13:10 | -LL | let testValue = &Test; //~ ERROR borrowed value does not live long enough +LL | let testValue = &Test; | ---- temporary value created here LL | return testValue; | ^^^^^^^^^ returns a value referencing data owned by the current function diff --git a/src/test/ui/issues/issue-11681.stderr b/src/test/ui/issues/issue-11681.stderr index 210c6dc5a00b..f59ddb076420 100644 --- a/src/test/ui/issues/issue-11681.stderr +++ b/src/test/ui/issues/issue-11681.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/issue-11681.rs:12:20 | -LL | let testValue = &Test; //~ ERROR borrowed value does not live long enough +LL | let testValue = &Test; | ^^^^ temporary value does not live long enough LL | return testValue; LL | } diff --git a/src/test/ui/issues/issue-11692-1.stderr b/src/test/ui/issues/issue-11692-1.stderr index 57a6a999544c..bfd1647e8bee 100644 --- a/src/test/ui/issues/issue-11692-1.stderr +++ b/src/test/ui/issues/issue-11692-1.stderr @@ -1,7 +1,7 @@ error: cannot find macro `testo!` in this scope --> $DIR/issue-11692-1.rs:2:12 | -LL | print!(testo!()); //~ ERROR cannot find macro `testo!` in this scope +LL | print!(testo!()); | ^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-11692-2.stderr b/src/test/ui/issues/issue-11692-2.stderr index 5d4467080f14..740c3555e52f 100644 --- a/src/test/ui/issues/issue-11692-2.stderr +++ b/src/test/ui/issues/issue-11692-2.stderr @@ -1,7 +1,7 @@ error: cannot find macro `test!` in this scope --> $DIR/issue-11692-2.rs:2:13 | -LL | concat!(test!()); //~ ERROR cannot find macro `test!` in this scope +LL | concat!(test!()); | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-11844.stderr b/src/test/ui/issues/issue-11844.stderr index 683ad48ff52c..1c4321f1b4ab 100644 --- a/src/test/ui/issues/issue-11844.stderr +++ b/src/test/ui/issues/issue-11844.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | match a { | - this match expression has type `std::option::Option>` -LL | Ok(a) => //~ ERROR: mismatched types +LL | Ok(a) => | ^^^^^ expected enum `std::option::Option`, found enum `std::result::Result` | = note: expected type `std::option::Option>` diff --git a/src/test/ui/issues/issue-11873.nll.stderr b/src/test/ui/issues/issue-11873.nll.stderr index e5abf0742023..4475bdf14740 100644 --- a/src/test/ui/issues/issue-11873.nll.stderr +++ b/src/test/ui/issues/issue-11873.nll.stderr @@ -5,7 +5,7 @@ LL | let mut f = || v.push(2); | -- - borrow occurs due to use in closure | | | borrow of `v` occurs here -LL | let _w = v; //~ ERROR: cannot move out of `v` +LL | let _w = v; | ^ move out of `v` occurs here LL | LL | f(); diff --git a/src/test/ui/issues/issue-11873.stderr b/src/test/ui/issues/issue-11873.stderr index 1e44754c707d..63bb4e7bd042 100644 --- a/src/test/ui/issues/issue-11873.stderr +++ b/src/test/ui/issues/issue-11873.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `v` because it is borrowed | LL | let mut f = || v.push(2); | -- borrow of `v` occurs here -LL | let _w = v; //~ ERROR: cannot move out of `v` +LL | let _w = v; | ^^ move out of `v` occurs here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-12028.stderr b/src/test/ui/issues/issue-12028.stderr index 7b0850581cec..64694c7a8d0b 100644 --- a/src/test/ui/issues/issue-12028.stderr +++ b/src/test/ui/issues/issue-12028.stderr @@ -1,7 +1,7 @@ error[E0284]: type annotations required: cannot resolve `<_ as StreamHasher>::S == ::S` --> $DIR/issue-12028.rs:29:14 | -LL | self.input_stream(&mut stream); //~ ERROR type annotations required +LL | self.input_stream(&mut stream); | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-12369.stderr b/src/test/ui/issues/issue-12369.stderr index 6906c7b7920c..fec9078dc409 100644 --- a/src/test/ui/issues/issue-12369.stderr +++ b/src/test/ui/issues/issue-12369.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/issue-12369.rs:10:9 | -LL | &[10,a, ref rest..] => 10 //~ ERROR: unreachable pattern +LL | &[10,a, ref rest..] => 10 | ^^^^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/issues/issue-12470.nll.stderr b/src/test/ui/issues/issue-12470.nll.stderr index 27878e7718be..c97e59195ed0 100644 --- a/src/test/ui/issues/issue-12470.nll.stderr +++ b/src/test/ui/issues/issue-12470.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local data `*b` --> $DIR/issue-12470.rs:29:5 | -LL | let bb: &B = &*b; //~ ERROR does not live long enough +LL | let bb: &B = &*b; | --- `*b` is borrowed here LL | make_a(bb) | ^^^^^^^^^^ returns a value referencing data owned by the current function diff --git a/src/test/ui/issues/issue-12470.stderr b/src/test/ui/issues/issue-12470.stderr index 59056aaca902..fadfb75cde64 100644 --- a/src/test/ui/issues/issue-12470.stderr +++ b/src/test/ui/issues/issue-12470.stderr @@ -1,7 +1,7 @@ error[E0597]: `*b` does not live long enough --> $DIR/issue-12470.rs:28:19 | -LL | let bb: &B = &*b; //~ ERROR does not live long enough +LL | let bb: &B = &*b; | ^^ borrowed value does not live long enough LL | make_a(bb) LL | } diff --git a/src/test/ui/issues/issue-12552.stderr b/src/test/ui/issues/issue-12552.stderr index 768d11bf899a..6eaac1b35776 100644 --- a/src/test/ui/issues/issue-12552.stderr +++ b/src/test/ui/issues/issue-12552.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | match t { | - this match expression has type `std::result::Result<_, {integer}>` -LL | Some(k) => match k { //~ ERROR mismatched types +LL | Some(k) => match k { | ^^^^^^^ expected enum `std::result::Result`, found enum `std::option::Option` | = note: expected type `std::result::Result<_, {integer}>` @@ -12,7 +12,7 @@ LL | Some(k) => match k { //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/issue-12552.rs:9:5 | -LL | None => () //~ ERROR mismatched types +LL | None => () | ^^^^ expected enum `std::result::Result`, found enum `std::option::Option` | = note: expected type `std::result::Result<_, {integer}>` diff --git a/src/test/ui/issues/issue-12863.stderr b/src/test/ui/issues/issue-12863.stderr index 3f1a6bf598de..bec70a5fb95a 100644 --- a/src/test/ui/issues/issue-12863.stderr +++ b/src/test/ui/issues/issue-12863.stderr @@ -1,7 +1,7 @@ error[E0532]: expected unit struct/variant or constant, found function `foo::bar` --> $DIR/issue-12863.rs:5:9 | -LL | foo::bar => {} //~ ERROR expected unit struct/variant or constant, found function `foo::bar` +LL | foo::bar => {} | ^^^^^^^^ not a unit struct/variant or constant error: aborting due to previous error diff --git a/src/test/ui/issues/issue-12997-1.stderr b/src/test/ui/issues/issue-12997-1.stderr index 050e753dd1a4..e036896812ec 100644 --- a/src/test/ui/issues/issue-12997-1.stderr +++ b/src/test/ui/issues/issue-12997-1.stderr @@ -1,13 +1,13 @@ error: functions used as benches must have signature `fn(&mut Bencher) -> impl Termination` --> $DIR/issue-12997-1.rs:6:1 | -LL | fn foo() { } //~ ERROR functions used as benches +LL | fn foo() { } | ^^^^^^^^^^^^ error: functions used as benches must have signature `fn(&mut Bencher) -> impl Termination` --> $DIR/issue-12997-1.rs:9:1 | -LL | fn bar(x: isize, y: isize) { } //~ ERROR functions used as benches +LL | fn bar(x: isize, y: isize) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-13404.stderr b/src/test/ui/issues/issue-13404.stderr index 45cddffef710..1f50debb07b1 100644 --- a/src/test/ui/issues/issue-13404.stderr +++ b/src/test/ui/issues/issue-13404.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `b::f` --> $DIR/issue-13404.rs:2:5 | -LL | use b::f; //~ ERROR: unresolved import `b::f` [E0432] +LL | use b::f; | ^^^^ no `f` in `b` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-13482-2.stderr b/src/test/ui/issues/issue-13482-2.stderr index 0c036f1d0e68..ccab95878b52 100644 --- a/src/test/ui/issues/issue-13482-2.stderr +++ b/src/test/ui/issues/issue-13482-2.stderr @@ -1,7 +1,7 @@ error[E0527]: pattern requires 0 elements but array has 2 --> $DIR/issue-13482-2.rs:6:9 | -LL | [] => None, //~ ERROR pattern requires 0 elements but array has 2 +LL | [] => None, | ^^ expected 2 elements error: aborting due to previous error diff --git a/src/test/ui/issues/issue-13482.stderr b/src/test/ui/issues/issue-13482.stderr index 5776dedf0a2c..3eb05f504c23 100644 --- a/src/test/ui/issues/issue-13482.stderr +++ b/src/test/ui/issues/issue-13482.stderr @@ -1,7 +1,7 @@ error[E0527]: pattern requires 0 elements but array has 2 --> $DIR/issue-13482.rs:4:5 | -LL | [] => None, //~ ERROR pattern requires 0 elements but array has 2 +LL | [] => None, | ^^ expected 2 elements error: aborting due to previous error diff --git a/src/test/ui/issues/issue-13483.stderr b/src/test/ui/issues/issue-13483.stderr index 1ab67d285c0d..739f06123669 100644 --- a/src/test/ui/issues/issue-13483.stderr +++ b/src/test/ui/issues/issue-13483.stderr @@ -1,13 +1,13 @@ error: missing condition for `if` statemement --> $DIR/issue-13483.rs:3:14 | -LL | } else if { //~ ERROR missing condition +LL | } else if { | ^ expected if condition here error: missing condition for `if` statemement --> $DIR/issue-13483.rs:10:14 | -LL | } else if { //~ ERROR missing condition +LL | } else if { | ^ expected if condition here error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-13497-2.nll.stderr b/src/test/ui/issues/issue-13497-2.nll.stderr index fb0d606690d0..8ad921027e2e 100644 --- a/src/test/ui/issues/issue-13497-2.nll.stderr +++ b/src/test/ui/issues/issue-13497-2.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local variable `rawLines` --> $DIR/issue-13497-2.rs:3:5 | -LL | rawLines //~ ERROR `rawLines` does not live long enough +LL | rawLines | ^------- | | | _____`rawLines` is borrowed here diff --git a/src/test/ui/issues/issue-13497-2.stderr b/src/test/ui/issues/issue-13497-2.stderr index c91ab789fe8a..5fde55cce005 100644 --- a/src/test/ui/issues/issue-13497-2.stderr +++ b/src/test/ui/issues/issue-13497-2.stderr @@ -1,7 +1,7 @@ error[E0597]: `rawLines` does not live long enough --> $DIR/issue-13497-2.rs:3:5 | -LL | rawLines //~ ERROR `rawLines` does not live long enough +LL | rawLines | ^^^^^^^^ borrowed value does not live long enough LL | .iter().map(|l| l.trim()).collect() LL | } diff --git a/src/test/ui/issues/issue-13497.stderr b/src/test/ui/issues/issue-13497.stderr index eb053c1003e3..b72f0277052b 100644 --- a/src/test/ui/issues/issue-13497.stderr +++ b/src/test/ui/issues/issue-13497.stderr @@ -1,7 +1,7 @@ error[E0106]: missing lifetime specifier --> $DIR/issue-13497.rs:2:5 | -LL | &str //~ ERROR missing lifetime specifier +LL | &str | ^ help: consider giving it a 'static lifetime: `&'static` | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from diff --git a/src/test/ui/issues/issue-1362.stderr b/src/test/ui/issues/issue-1362.stderr index dd97e0cf04a9..5fef8497cde5 100644 --- a/src/test/ui/issues/issue-1362.stderr +++ b/src/test/ui/issues/issue-1362.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-1362.rs:4:16 | -LL | let x: u32 = 20i32; //~ ERROR mismatched types +LL | let x: u32 = 20i32; | ^^^^^ expected u32, found i32 error: aborting due to previous error diff --git a/src/test/ui/issues/issue-13847.stderr b/src/test/ui/issues/issue-13847.stderr index 9199199d7305..52b8dc049702 100644 --- a/src/test/ui/issues/issue-13847.stderr +++ b/src/test/ui/issues/issue-13847.stderr @@ -1,7 +1,7 @@ error[E0609]: no field `is_failure` on type `!` --> $DIR/issue-13847.rs:2:12 | -LL | return.is_failure //~ ERROR no field `is_failure` on type `!` +LL | return.is_failure | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-13853-2.stderr b/src/test/ui/issues/issue-13853-2.stderr index 3e711243b4e1..0853f5cffb76 100644 --- a/src/test/ui/issues/issue-13853-2.stderr +++ b/src/test/ui/issues/issue-13853-2.stderr @@ -1,7 +1,7 @@ error[E0615]: attempted to take value of method `get` on type `std::boxed::Box<(dyn ResponseHook + 'static)>` --> $DIR/issue-13853-2.rs:5:39 | -LL | fn foo(res : Box) { res.get } //~ ERROR attempted to take value of method +LL | fn foo(res : Box) { res.get } | ^^^ help: use parentheses to call the method: `get()` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-13853.stderr b/src/test/ui/issues/issue-13853.stderr index 6da5da04fb16..b4efd5511c35 100644 --- a/src/test/ui/issues/issue-13853.stderr +++ b/src/test/ui/issues/issue-13853.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn nodes<'a, I: Iterator>(&self) -> I | - expected `I` because of return type ... -LL | self.iter() //~ ERROR mismatched types +LL | self.iter() | ^^^^^^^^^^^ expected type parameter, found struct `std::slice::Iter` | = note: expected type `I` @@ -13,13 +13,13 @@ LL | self.iter() //~ ERROR mismatched types error[E0599]: no method named `iter` found for type `&G` in the current scope --> $DIR/issue-13853.rs:27:23 | -LL | for node in graph.iter() { //~ ERROR no method named `iter` found +LL | for node in graph.iter() { | ^^^^ error[E0308]: mismatched types --> $DIR/issue-13853.rs:37:13 | -LL | iterate(graph); //~ ERROR mismatched types +LL | iterate(graph); | ^^^^^ | | | expected reference, found struct `std::vec::Vec` diff --git a/src/test/ui/issues/issue-14221.stderr b/src/test/ui/issues/issue-14221.stderr index bf12480a5d37..3e5e25a9f6d1 100644 --- a/src/test/ui/issues/issue-14221.stderr +++ b/src/test/ui/issues/issue-14221.stderr @@ -7,7 +7,7 @@ LL | A => "A", warning[E0170]: pattern binding `B` is named the same as one of the variants of the type `E` --> $DIR/issue-14221.rs:15:13 | -LL | B => "B", //~ ERROR: unreachable pattern +LL | B => "B", | ^ help: to match on the variant, qualify the path: `E::B` error: unreachable pattern @@ -15,8 +15,8 @@ error: unreachable pattern | LL | A => "A", | - matches any value -LL | //~^ WARN pattern binding `A` is named the same as one of the variants of the type `E` -LL | B => "B", //~ ERROR: unreachable pattern +LL | +LL | B => "B", | ^ unreachable pattern | note: lint level defined here diff --git a/src/test/ui/issues/issue-14285.stderr b/src/test/ui/issues/issue-14285.stderr index e5d0ab0684a0..c180ed03e540 100644 --- a/src/test/ui/issues/issue-14285.stderr +++ b/src/test/ui/issues/issue-14285.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `a` | LL | fn foo<'a>(a: &Foo) -> B<'a> { | ---- help: add explicit lifetime `'a` to the type of `a`: `&'a (dyn Foo + 'a)` -LL | B(a) //~ ERROR explicit lifetime required in the type of `a` [E0621] +LL | B(a) | ^^^^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/issues/issue-14309.stderr b/src/test/ui/issues/issue-14309.stderr index b8d82aadd482..4376876ecd69 100644 --- a/src/test/ui/issues/issue-14309.stderr +++ b/src/test/ui/issues/issue-14309.stderr @@ -1,7 +1,7 @@ error: `extern` block uses type `A` which is not FFI-safe: this struct has unspecified layout --> $DIR/issue-14309.rs:30:15 | -LL | fn foo(x: A); //~ ERROR type `A` which is not FFI-safe +LL | fn foo(x: A); | ^ | note: lint level defined here @@ -21,7 +21,7 @@ LL | | } error: `extern` block uses type `A` which is not FFI-safe: this struct has unspecified layout --> $DIR/issue-14309.rs:31:15 | -LL | fn bar(x: B); //~ ERROR type `A` +LL | fn bar(x: B); | ^ | = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct @@ -36,7 +36,7 @@ LL | | } error: `extern` block uses type `A` which is not FFI-safe: this struct has unspecified layout --> $DIR/issue-14309.rs:33:15 | -LL | fn qux(x: A2); //~ ERROR type `A` +LL | fn qux(x: A2); | ^^ | = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct @@ -51,7 +51,7 @@ LL | | } error: `extern` block uses type `A` which is not FFI-safe: this struct has unspecified layout --> $DIR/issue-14309.rs:34:16 | -LL | fn quux(x: B2); //~ ERROR type `A` +LL | fn quux(x: B2); | ^^ | = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct @@ -66,7 +66,7 @@ LL | | } error: `extern` block uses type `A` which is not FFI-safe: this struct has unspecified layout --> $DIR/issue-14309.rs:36:16 | -LL | fn fred(x: D); //~ ERROR type `A` +LL | fn fred(x: D); | ^ | = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct diff --git a/src/test/ui/issues/issue-1448-2.stderr b/src/test/ui/issues/issue-1448-2.stderr index b06a6162712f..487b061eba13 100644 --- a/src/test/ui/issues/issue-1448-2.stderr +++ b/src/test/ui/issues/issue-1448-2.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-1448-2.rs:6:24 | -LL | println!("{}", foo(10i32)); //~ ERROR mismatched types +LL | println!("{}", foo(10i32)); | ^^^^^ expected u32, found i32 error: aborting due to previous error diff --git a/src/test/ui/issues/issue-14721.stderr b/src/test/ui/issues/issue-14721.stderr index 8029318419a6..49ebb2976e8a 100644 --- a/src/test/ui/issues/issue-14721.stderr +++ b/src/test/ui/issues/issue-14721.stderr @@ -1,7 +1,7 @@ error[E0609]: no field `desc` on type `&str` --> $DIR/issue-14721.rs:3:24 | -LL | println!("{}", foo.desc); //~ no field `desc` on type `&str` +LL | println!("{}", foo.desc); | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-1476.stderr b/src/test/ui/issues/issue-1476.stderr index a0c0a8fb1f29..670bd546335f 100644 --- a/src/test/ui/issues/issue-1476.stderr +++ b/src/test/ui/issues/issue-1476.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `x` in this scope --> $DIR/issue-1476.rs:2:20 | -LL | println!("{}", x); //~ ERROR cannot find value `x` in this scope +LL | println!("{}", x); | ^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/issues/issue-14772.stderr b/src/test/ui/issues/issue-14772.stderr index a7448ad5b88d..253fec5e5783 100644 --- a/src/test/ui/issues/issue-14772.stderr +++ b/src/test/ui/issues/issue-14772.stderr @@ -1,7 +1,7 @@ error: only functions may be used as tests --> $DIR/issue-14772.rs:4:1 | -LL | mod foo {} //~ ERROR only functions may be used as tests +LL | mod foo {} | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-14845.stderr b/src/test/ui/issues/issue-14845.stderr index 94e7ac74ff0c..2fa9fbaa887b 100644 --- a/src/test/ui/issues/issue-14845.stderr +++ b/src/test/ui/issues/issue-14845.stderr @@ -1,13 +1,13 @@ error[E0606]: casting `&[u8; 1]` as `*mut u8` is invalid --> $DIR/issue-14845.rs:7:14 | -LL | let _f = &x.a as *mut u8; //~ ERROR casting +LL | let _f = &x.a as *mut u8; | ^^^^^^^^^^^^^^^ error[E0606]: casting `&[u8; 1]` as `*mut u8` is invalid --> $DIR/issue-14845.rs:10:14 | -LL | let _v = &local as *mut u8; //~ ERROR casting +LL | let _v = &local as *mut u8; | ^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-15129.stderr b/src/test/ui/issues/issue-15129.stderr index 7ee369085202..b93fa14db038 100644 --- a/src/test/ui/issues/issue-15129.stderr +++ b/src/test/ui/issues/issue-15129.stderr @@ -3,6 +3,8 @@ error[E0004]: non-exhaustive patterns: `(T1(()), V2(_))` not covered | LL | match (T::T1(()), V::V2(true)) { | ^^^^^^^^^^^^^^^^^^^^^^^^ pattern `(T1(()), V2(_))` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/issues/issue-15207.stderr b/src/test/ui/issues/issue-15207.stderr index 7149444b5668..2d90eb80fc54 100644 --- a/src/test/ui/issues/issue-15207.stderr +++ b/src/test/ui/issues/issue-15207.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `push` found for type `!` in the current scope --> $DIR/issue-15207.rs:3:15 | -LL | break.push(1) //~ ERROR no method named `push` found for type `!` +LL | break.push(1) | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-15965.stderr b/src/test/ui/issues/issue-15965.stderr index 904656cb3b1c..90377c19dee0 100644 --- a/src/test/ui/issues/issue-15965.stderr +++ b/src/test/ui/issues/issue-15965.stderr @@ -2,7 +2,7 @@ error[E0282]: type annotations needed --> $DIR/issue-15965.rs:3:9 | LL | / { return () } -LL | | //~^ ERROR type annotations needed [E0282] +LL | | LL | | () | |______^ cannot infer type | diff --git a/src/test/ui/issues/issue-16098.stderr b/src/test/ui/issues/issue-16098.stderr index 4a62cea20b8a..cdab76ca70ba 100644 --- a/src/test/ui/issues/issue-16098.stderr +++ b/src/test/ui/issues/issue-16098.stderr @@ -1,7 +1,7 @@ error: recursion limit reached while expanding the macro `prob1` --> $DIR/issue-16098.rs:7:18 | -LL | $n + prob1!($n - 1); //~ ERROR recursion limit reached while expanding the macro `prob1` +LL | $n + prob1!($n - 1); | ^^^^^^^^^^^^^^ ... LL | println!("Problem 1: {}", prob1!(1000)); diff --git a/src/test/ui/issues/issue-16250.stderr b/src/test/ui/issues/issue-16250.stderr index fc6f26f04399..a8ff2548b73d 100644 --- a/src/test/ui/issues/issue-16250.stderr +++ b/src/test/ui/issues/issue-16250.stderr @@ -1,7 +1,7 @@ error: `extern` block uses type `Foo` which is not FFI-safe: this struct has unspecified layout --> $DIR/issue-16250.rs:6:20 | -LL | pub fn foo(x: (Foo)); //~ ERROR unspecified layout +LL | pub fn foo(x: (Foo)); | ^^^ | note: lint level defined here diff --git a/src/test/ui/issues/issue-16683.stderr b/src/test/ui/issues/issue-16683.stderr index 23e67bb2de9b..a047893a168a 100644 --- a/src/test/ui/issues/issue-16683.stderr +++ b/src/test/ui/issues/issue-16683.stderr @@ -1,20 +1,20 @@ error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements --> $DIR/issue-16683.rs:4:14 | -LL | self.a(); //~ ERROR cannot infer +LL | self.a(); | ^ | note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 3:5... --> $DIR/issue-16683.rs:3:5 | LL | / fn b(&self) { -LL | | self.a(); //~ ERROR cannot infer +LL | | self.a(); LL | | } | |_____^ note: ...so that reference does not outlive borrowed content --> $DIR/issue-16683.rs:4:9 | -LL | self.a(); //~ ERROR cannot infer +LL | self.a(); | ^^^^ note: but, the lifetime must be valid for the lifetime 'a as defined on the trait at 1:9... --> $DIR/issue-16683.rs:1:9 diff --git a/src/test/ui/issues/issue-16939.stderr b/src/test/ui/issues/issue-16939.stderr index 7281f6a73556..5df2119c1412 100644 --- a/src/test/ui/issues/issue-16939.stderr +++ b/src/test/ui/issues/issue-16939.stderr @@ -1,7 +1,7 @@ error[E0057]: this function takes 0 parameters but 1 parameter was supplied --> $DIR/issue-16939.rs:5:9 | -LL | |t| f(t); //~ ERROR E0057 +LL | |t| f(t); | ^^^^ expected 0 parameters error: aborting due to previous error diff --git a/src/test/ui/issues/issue-1697.stderr b/src/test/ui/issues/issue-1697.stderr index 00e136cb1ce8..6ae5bd1fc264 100644 --- a/src/test/ui/issues/issue-1697.stderr +++ b/src/test/ui/issues/issue-1697.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `unresolved` --> $DIR/issue-1697.rs:3:5 | -LL | use unresolved::*; //~ ERROR unresolved import `unresolved` [E0432] +LL | use unresolved::*; | ^^^^^^^^^^ maybe a missing `extern crate unresolved;`? error: aborting due to previous error diff --git a/src/test/ui/issues/issue-17001.stderr b/src/test/ui/issues/issue-17001.stderr index bdd082496380..d7e6069977b4 100644 --- a/src/test/ui/issues/issue-17001.stderr +++ b/src/test/ui/issues/issue-17001.stderr @@ -1,7 +1,7 @@ error[E0574]: expected struct, variant or union type, found module `foo` --> $DIR/issue-17001.rs:4:13 | -LL | let p = foo { x: () }; //~ ERROR expected struct, variant or union type, found module `foo` +LL | let p = foo { x: () }; | ^^^ not a struct, variant or union type error: aborting due to previous error diff --git a/src/test/ui/issues/issue-17033.stderr b/src/test/ui/issues/issue-17033.stderr index 181a9992c6d8..ba78aa2bc6a5 100644 --- a/src/test/ui/issues/issue-17033.stderr +++ b/src/test/ui/issues/issue-17033.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-17033.rs:2:10 | -LL | (*p)(()) //~ ERROR mismatched types +LL | (*p)(()) | ^^ | | | expected &mut (), found () diff --git a/src/test/ui/issues/issue-17252.stderr b/src/test/ui/issues/issue-17252.stderr index e333e1506511..c993588f5531 100644 --- a/src/test/ui/issues/issue-17252.stderr +++ b/src/test/ui/issues/issue-17252.stderr @@ -1,7 +1,7 @@ error[E0391]: cycle detected when processing `FOO` --> $DIR/issue-17252.rs:1:20 | -LL | const FOO: usize = FOO; //~ ERROR E0391 +LL | const FOO: usize = FOO; | ^^^ | = note: ...which again requires processing `FOO`, completing the cycle diff --git a/src/test/ui/issues/issue-17337.stderr b/src/test/ui/issues/issue-17337.stderr index 4c3ffe92cccd..8973afb80681 100644 --- a/src/test/ui/issues/issue-17337.stderr +++ b/src/test/ui/issues/issue-17337.stderr @@ -1,7 +1,7 @@ error: use of deprecated item 'Foo::foo': text --> $DIR/issue-17337.rs:16:6 | -LL | .foo(); //~ ERROR use of deprecated item +LL | .foo(); | ^^^ | note: lint level defined here diff --git a/src/test/ui/issues/issue-17373.stderr b/src/test/ui/issues/issue-17373.stderr index e1a9f097b226..5c429d1113df 100644 --- a/src/test/ui/issues/issue-17373.stderr +++ b/src/test/ui/issues/issue-17373.stderr @@ -1,7 +1,7 @@ error[E0614]: type `!` cannot be dereferenced --> $DIR/issue-17373.rs:2:5 | -LL | *return //~ ERROR type `!` cannot be dereferenced +LL | *return | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-17385.nll.stderr b/src/test/ui/issues/issue-17385.nll.stderr index 20198f19dd5f..28c22260c388 100644 --- a/src/test/ui/issues/issue-17385.nll.stderr +++ b/src/test/ui/issues/issue-17385.nll.stderr @@ -5,7 +5,7 @@ LL | let foo = X(1); | --- move occurs because `foo` has type `X`, which does not implement the `Copy` trait LL | drop(foo); | --- value moved here -LL | match foo { //~ ERROR use of moved value +LL | match foo { LL | X(1) => (), | ^ value used here after move @@ -16,7 +16,7 @@ LL | let e = Enum::Variant2; | - move occurs because `e` has type `Enum`, which does not implement the `Copy` trait LL | drop(e); | - value moved here -LL | match e { //~ ERROR use of moved value +LL | match e { | ^ value used here after move error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-17385.stderr b/src/test/ui/issues/issue-17385.stderr index 5f28a3c2c278..ee55d862e13d 100644 --- a/src/test/ui/issues/issue-17385.stderr +++ b/src/test/ui/issues/issue-17385.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `foo` | LL | drop(foo); | --- value moved here -LL | match foo { //~ ERROR use of moved value +LL | match foo { | ^^^ value used here after move | = note: move occurs because `foo` has type `X`, which does not implement the `Copy` trait @@ -13,7 +13,7 @@ error[E0382]: use of moved value: `e` | LL | drop(e); | - value moved here -LL | match e { //~ ERROR use of moved value +LL | match e { | ^ value used here after move | = note: move occurs because `e` has type `Enum`, which does not implement the `Copy` trait diff --git a/src/test/ui/issues/issue-17405.stderr b/src/test/ui/issues/issue-17405.stderr index 2bfc85cc7de8..37274e239ba0 100644 --- a/src/test/ui/issues/issue-17405.stderr +++ b/src/test/ui/issues/issue-17405.stderr @@ -1,7 +1,7 @@ error[E0574]: expected struct, variant or union type, found enum `Foo` --> $DIR/issue-17405.rs:7:9 | -LL | Foo { i } => () //~ ERROR expected struct, variant or union type, found enum `Foo` +LL | Foo { i } => () | ^^^ not a struct, variant or union type error: aborting due to previous error diff --git a/src/test/ui/issues/issue-17545.nll.stderr b/src/test/ui/issues/issue-17545.nll.stderr index 527f8df9ccbb..79a1e09bd7cc 100644 --- a/src/test/ui/issues/issue-17545.nll.stderr +++ b/src/test/ui/issues/issue-17545.nll.stderr @@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed LL | pub fn foo<'a, F: Fn(&'a ())>(bar: F) { | -- lifetime `'a` defined here LL | / bar.call(( -LL | | &id(()), //~ ERROR borrowed value does not live long enough +LL | | &id(()), | | ^^^^^^ creates a temporary which is freed while still in use LL | | )); | | -- temporary value is freed at the end of this statement diff --git a/src/test/ui/issues/issue-17545.stderr b/src/test/ui/issues/issue-17545.stderr index 62ec25e1d1a4..c4acaf2278e6 100644 --- a/src/test/ui/issues/issue-17545.stderr +++ b/src/test/ui/issues/issue-17545.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/issue-17545.rs:7:10 | -LL | &id(()), //~ ERROR borrowed value does not live long enough +LL | &id(()), | ^^^^^^ temporary value does not live long enough LL | )); | - temporary value only lives until here diff --git a/src/test/ui/issues/issue-17551.stderr b/src/test/ui/issues/issue-17551.stderr index df693591e7c2..40e7727752b7 100644 --- a/src/test/ui/issues/issue-17551.stderr +++ b/src/test/ui/issues/issue-17551.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/issue-17551.rs:6:15 | -LL | let foo = B(marker::PhantomData); //~ ERROR type annotations needed +LL | let foo = B(marker::PhantomData); | --- ^ cannot infer type for `T` | | | consider giving `foo` a type diff --git a/src/test/ui/issues/issue-17718-const-privacy.stderr b/src/test/ui/issues/issue-17718-const-privacy.stderr index 5025aaca777d..0b0de8a52590 100644 --- a/src/test/ui/issues/issue-17718-const-privacy.stderr +++ b/src/test/ui/issues/issue-17718-const-privacy.stderr @@ -1,13 +1,13 @@ error[E0603]: constant `B` is private --> $DIR/issue-17718-const-privacy.rs:5:8 | -LL | use a::B; //~ ERROR: constant `B` is private +LL | use a::B; | ^ error[E0603]: constant `BAR` is private --> $DIR/issue-17718-const-privacy.rs:8:5 | -LL | BAR, //~ ERROR: constant `BAR` is private +LL | BAR, | ^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-17718-patterns.stderr b/src/test/ui/issues/issue-17718-patterns.stderr index 698bd857a580..109091c2af0c 100644 --- a/src/test/ui/issues/issue-17718-patterns.stderr +++ b/src/test/ui/issues/issue-17718-patterns.stderr @@ -4,7 +4,7 @@ error[E0530]: match bindings cannot shadow statics LL | static A1: usize = 1; | --------------------- the static `A1` is defined here ... -LL | A1 => {} //~ ERROR: match bindings cannot shadow statics +LL | A1 => {} | ^^ cannot be named the same as a static error[E0530]: match bindings cannot shadow statics @@ -13,7 +13,7 @@ error[E0530]: match bindings cannot shadow statics LL | static mut A2: usize = 1; | ------------------------- the static `A2` is defined here ... -LL | A2 => {} //~ ERROR: match bindings cannot shadow statics +LL | A2 => {} | ^^ cannot be named the same as a static error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-17718-references.stderr b/src/test/ui/issues/issue-17718-references.stderr index ef49dcfeef9f..15c3e67f7a1a 100644 --- a/src/test/ui/issues/issue-17718-references.stderr +++ b/src/test/ui/issues/issue-17718-references.stderr @@ -1,13 +1,13 @@ error[E0013]: constants cannot refer to statics, use a constant instead --> $DIR/issue-17718-references.rs:9:28 | -LL | const T2: &'static usize = &S; //~ ERROR: constants cannot refer to statics +LL | const T2: &'static usize = &S; | ^^ error[E0013]: constants cannot refer to statics, use a constant instead --> $DIR/issue-17718-references.rs:14:19 | -LL | const T6: usize = S; //~ ERROR: constants cannot refer to statics +LL | const T6: usize = S; | ^ error[E0013]: constants cannot refer to statics, use a constant instead diff --git a/src/test/ui/issues/issue-17718-static-move.nll.stderr b/src/test/ui/issues/issue-17718-static-move.nll.stderr index 86e7a1849104..c3e6267d30ff 100644 --- a/src/test/ui/issues/issue-17718-static-move.nll.stderr +++ b/src/test/ui/issues/issue-17718-static-move.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of static item --> $DIR/issue-17718-static-move.rs:6:14 | -LL | let _a = FOO; //~ ERROR: cannot move out of static item +LL | let _a = FOO; | ^^^ | | | cannot move out of static item diff --git a/src/test/ui/issues/issue-17718-static-move.stderr b/src/test/ui/issues/issue-17718-static-move.stderr index dd473f0a4c45..064a991e4a3d 100644 --- a/src/test/ui/issues/issue-17718-static-move.stderr +++ b/src/test/ui/issues/issue-17718-static-move.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of static item --> $DIR/issue-17718-static-move.rs:6:14 | -LL | let _a = FOO; //~ ERROR: cannot move out of static item +LL | let _a = FOO; | ^^^ | | | cannot move out of static item diff --git a/src/test/ui/issues/issue-17740.stderr b/src/test/ui/issues/issue-17740.stderr index c7a76c558ee8..7ab0fa4d818b 100644 --- a/src/test/ui/issues/issue-17740.stderr +++ b/src/test/ui/issues/issue-17740.stderr @@ -10,11 +10,11 @@ note: the anonymous lifetime #2 defined on the method body at 6:5... --> $DIR/issue-17740.rs:6:5 | LL | / fn bar(self: &mut Foo) { -LL | | //~^ mismatched method receiver -LL | | //~| expected type `Foo<'a>` -LL | | //~| found type `Foo<'_>` +LL | | +LL | | +LL | | ... | -LL | | //~| lifetime mismatch +LL | | LL | | } | |_____^ note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 5:7 @@ -40,11 +40,11 @@ note: ...does not necessarily outlive the anonymous lifetime #2 defined on the m --> $DIR/issue-17740.rs:6:5 | LL | / fn bar(self: &mut Foo) { -LL | | //~^ mismatched method receiver -LL | | //~| expected type `Foo<'a>` -LL | | //~| found type `Foo<'_>` +LL | | +LL | | +LL | | ... | -LL | | //~| lifetime mismatch +LL | | LL | | } | |_____^ diff --git a/src/test/ui/issues/issue-17758.stderr b/src/test/ui/issues/issue-17758.stderr index b376757091dd..28a1be59840a 100644 --- a/src/test/ui/issues/issue-17758.stderr +++ b/src/test/ui/issues/issue-17758.stderr @@ -9,7 +9,7 @@ note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on th | LL | / fn bar(&self) { LL | | self.foo(); -LL | | //~^ ERROR cannot infer +LL | | LL | | } | |_____^ note: ...so that reference does not outlive borrowed content diff --git a/src/test/ui/issues/issue-17904-2.stderr b/src/test/ui/issues/issue-17904-2.stderr index b4f974525749..b8fabd3b13f4 100644 --- a/src/test/ui/issues/issue-17904-2.stderr +++ b/src/test/ui/issues/issue-17904-2.stderr @@ -1,7 +1,7 @@ error[E0392]: parameter `T` is never used --> $DIR/issue-17904-2.rs:4:12 | -LL | struct Foo where T: Copy; //~ ERROR parameter `T` is never used +LL | struct Foo where T: Copy; | ^ unused type parameter | = help: consider removing `T` or using a marker such as `std::marker::PhantomData` diff --git a/src/test/ui/issues/issue-17905-2.stderr b/src/test/ui/issues/issue-17905-2.stderr index 39e5f8ffc9f9..f185f49b9b92 100644 --- a/src/test/ui/issues/issue-17905-2.stderr +++ b/src/test/ui/issues/issue-17905-2.stderr @@ -10,8 +10,8 @@ note: the anonymous lifetime #2 defined on the method body at 8:5... --> $DIR/issue-17905-2.rs:8:5 | LL | / fn say(self: &Pair<&str, isize>) { -LL | | //~^ ERROR mismatched method receiver -LL | | //~| ERROR mismatched method receiver +LL | | +LL | | LL | | println!("{:?}", self); LL | | } | |_____^ @@ -38,8 +38,8 @@ note: ...does not necessarily outlive the anonymous lifetime #2 defined on the m --> $DIR/issue-17905-2.rs:8:5 | LL | / fn say(self: &Pair<&str, isize>) { -LL | | //~^ ERROR mismatched method receiver -LL | | //~| ERROR mismatched method receiver +LL | | +LL | | LL | | println!("{:?}", self); LL | | } | |_____^ diff --git a/src/test/ui/issues/issue-17959.stderr b/src/test/ui/issues/issue-17959.stderr index 790e8f7c7982..de742e48aea9 100644 --- a/src/test/ui/issues/issue-17959.stderr +++ b/src/test/ui/issues/issue-17959.stderr @@ -2,7 +2,7 @@ error[E0367]: The requirement `T: std::marker::Sized` is added only by the Drop --> $DIR/issue-17959.rs:11:1 | LL | / impl Drop for G { -LL | | //~^ ERROR: The requirement `T: std::marker::Sized` is added only by the Drop impl. [E0367] +LL | | LL | | fn drop(&mut self) { LL | | if !self._ptr.is_null() { LL | | } diff --git a/src/test/ui/issues/issue-17994.stderr b/src/test/ui/issues/issue-17994.stderr index e22b2c071973..61e1e496f795 100644 --- a/src/test/ui/issues/issue-17994.stderr +++ b/src/test/ui/issues/issue-17994.stderr @@ -1,7 +1,7 @@ error[E0091]: type parameter `T` is unused --> $DIR/issue-17994.rs:2:10 | -LL | type Huh where T: Tr = isize; //~ ERROR type parameter `T` is unused +LL | type Huh where T: Tr = isize; | ^ unused type parameter error: aborting due to previous error diff --git a/src/test/ui/issues/issue-17999.stderr b/src/test/ui/issues/issue-17999.stderr index 51c0c757a80c..b9ae03356e9b 100644 --- a/src/test/ui/issues/issue-17999.stderr +++ b/src/test/ui/issues/issue-17999.stderr @@ -1,7 +1,7 @@ error: unused variable: `x` --> $DIR/issue-17999.rs:5:13 | -LL | let x = (); //~ ERROR: unused variable: `x` +LL | let x = (); | ^ help: consider prefixing with an underscore: `_x` | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unused_variables)] error: unused variable: `a` --> $DIR/issue-17999.rs:7:13 | -LL | a => {} //~ ERROR: unused variable: `a` +LL | a => {} | ^ help: consider prefixing with an underscore: `_a` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-18118.nll.stderr b/src/test/ui/issues/issue-18118.nll.stderr index 1920e1637d14..49798a148dee 100644 --- a/src/test/ui/issues/issue-18118.nll.stderr +++ b/src/test/ui/issues/issue-18118.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `p` does not live long enough --> $DIR/issue-18118.rs:4:9 | -LL | &p //~ ERROR `p` does not live long enough +LL | &p | ^^ | | | borrowed value does not live long enough diff --git a/src/test/ui/issues/issue-18118.stderr b/src/test/ui/issues/issue-18118.stderr index 9b21ece341a9..07fa1f60e063 100644 --- a/src/test/ui/issues/issue-18118.stderr +++ b/src/test/ui/issues/issue-18118.stderr @@ -1,7 +1,7 @@ error[E0597]: `p` does not live long enough --> $DIR/issue-18118.rs:4:10 | -LL | &p //~ ERROR `p` does not live long enough +LL | &p | ^ borrowed value does not live long enough LL | }; | - borrowed value only lives until here diff --git a/src/test/ui/issues/issue-18159.stderr b/src/test/ui/issues/issue-18159.stderr index 25b7051a8800..6048344125c5 100644 --- a/src/test/ui/issues/issue-18159.stderr +++ b/src/test/ui/issues/issue-18159.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/issue-18159.rs:2:9 | -LL | let x; //~ ERROR type annotations needed +LL | let x; | ^ | | | cannot infer type diff --git a/src/test/ui/issues/issue-18183.stderr b/src/test/ui/issues/issue-18183.stderr index cf33124bc950..c8f8ac9296dc 100644 --- a/src/test/ui/issues/issue-18183.stderr +++ b/src/test/ui/issues/issue-18183.stderr @@ -1,7 +1,7 @@ error[E0128]: type parameters with a default cannot use forward declared identifiers --> $DIR/issue-18183.rs:1:20 | -LL | pub struct Foo(Bar); //~ ERROR E0128 +LL | pub struct Foo(Bar); | ^^^ defaulted type parameters cannot be forward declared error: aborting due to previous error diff --git a/src/test/ui/issues/issue-18294.stderr b/src/test/ui/issues/issue-18294.stderr index f3e8ab1a3130..a7d0392f7f08 100644 --- a/src/test/ui/issues/issue-18294.stderr +++ b/src/test/ui/issues/issue-18294.stderr @@ -1,7 +1,7 @@ error[E0658]: casting pointers to integers in constants is unstable (see issue #51910) --> $DIR/issue-18294.rs:3:31 | -LL | const Y: usize = unsafe { &X as *const u32 as usize }; //~ ERROR is unstable +LL | const Y: usize = unsafe { &X as *const u32 as usize }; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable diff --git a/src/test/ui/issues/issue-18389.stderr b/src/test/ui/issues/issue-18389.stderr index 02ff6b6d5bff..090487ee8fdb 100644 --- a/src/test/ui/issues/issue-18389.stderr +++ b/src/test/ui/issues/issue-18389.stderr @@ -5,7 +5,7 @@ LL | trait Private { | - `Private<::P, ::R>` declared as private ... LL | / pub trait Public: Private< -LL | | //~^ ERROR private trait `Private<::P, ::R>` in public interface +LL | | LL | | ::P, LL | | ::R ... | diff --git a/src/test/ui/issues/issue-18423.stderr b/src/test/ui/issues/issue-18423.stderr index 96652767a05c..141fd27be364 100644 --- a/src/test/ui/issues/issue-18423.stderr +++ b/src/test/ui/issues/issue-18423.stderr @@ -1,7 +1,7 @@ error[E0107]: wrong number of lifetime arguments: expected 0, found 1 --> $DIR/issue-18423.rs:4:12 | -LL | x: Box<'a, isize> //~ ERROR wrong number of lifetime arguments +LL | x: Box<'a, isize> | ^^ unexpected lifetime argument error: aborting due to previous error diff --git a/src/test/ui/issues/issue-18446.stderr b/src/test/ui/issues/issue-18446.stderr index 8aff0309aa77..e6afc4c13a91 100644 --- a/src/test/ui/issues/issue-18446.stderr +++ b/src/test/ui/issues/issue-18446.stderr @@ -1,7 +1,7 @@ error[E0034]: multiple applicable items in scope --> $DIR/issue-18446.rs:18:7 | -LL | x.foo(); //~ ERROR multiple applicable items in scope [E0034] +LL | x.foo(); | ^^^ multiple `foo` found | note: candidate #1 is defined in an impl for the type `dyn T` diff --git a/src/test/ui/issues/issue-18532.stderr b/src/test/ui/issues/issue-18532.stderr index 400890348a12..4c224eb2d243 100644 --- a/src/test/ui/issues/issue-18532.stderr +++ b/src/test/ui/issues/issue-18532.stderr @@ -1,7 +1,7 @@ error[E0618]: expected function, found `!` --> $DIR/issue-18532.rs:6:5 | -LL | (return)((),()); //~ ERROR expected function, found `!` +LL | (return)((),()); | ^^^^^^^^------- | | | call expression requires function diff --git a/src/test/ui/issues/issue-18611.stderr b/src/test/ui/issues/issue-18611.stderr index 8fa7694dc6c3..22c3470b61ed 100644 --- a/src/test/ui/issues/issue-18611.stderr +++ b/src/test/ui/issues/issue-18611.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `isize: HasState` is not satisfied --> $DIR/issue-18611.rs:1:1 | LL | / fn add_state(op: ::State) { -LL | | //~^ ERROR `isize: HasState` is not satisfied +LL | | LL | | } | |_^ the trait `HasState` is not implemented for `isize` diff --git a/src/test/ui/issues/issue-1871.stderr b/src/test/ui/issues/issue-1871.stderr index 10b0825c34e1..fecd689251b3 100644 --- a/src/test/ui/issues/issue-1871.stderr +++ b/src/test/ui/issues/issue-1871.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `honk` found for type `{integer}` in the current scope --> $DIR/issue-1871.rs:7:9 | -LL | f.honk() //~ ERROR no method named `honk` found +LL | f.honk() | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-18783.nll.stderr b/src/test/ui/issues/issue-18783.nll.stderr index f49a2d7a2b2f..047b42578a22 100644 --- a/src/test/ui/issues/issue-18783.nll.stderr +++ b/src/test/ui/issues/issue-18783.nll.stderr @@ -9,7 +9,7 @@ LL | c.push(Box::new(|| y = 0)); | ^^ - second borrow occurs due to use of `y` in closure | | | second mutable borrow occurs here -LL | //~^ ERROR cannot borrow `y` as mutable more than once at a time +LL | LL | } | - first borrow might be used here, when `c` is dropped and runs the destructor for type `std::cell::RefCell>>` @@ -24,7 +24,7 @@ LL | Push::push(&c, Box::new(|| y = 0)); | ^^ - second borrow occurs due to use of `y` in closure | | | second mutable borrow occurs here -LL | //~^ ERROR cannot borrow `y` as mutable more than once at a time +LL | LL | } | - first borrow might be used here, when `c` is dropped and runs the destructor for type `std::cell::RefCell>>` diff --git a/src/test/ui/issues/issue-18783.stderr b/src/test/ui/issues/issue-18783.stderr index 68eb5167ecbd..f88c42552e33 100644 --- a/src/test/ui/issues/issue-18783.stderr +++ b/src/test/ui/issues/issue-18783.stderr @@ -9,7 +9,7 @@ LL | c.push(Box::new(|| y = 0)); | ^^ - borrow occurs due to use of `y` in closure | | | second mutable borrow occurs here -LL | //~^ ERROR cannot borrow `y` as mutable more than once at a time +LL | LL | } | - first borrow ends here @@ -24,7 +24,7 @@ LL | Push::push(&c, Box::new(|| y = 0)); | ^^ - borrow occurs due to use of `y` in closure | | | second mutable borrow occurs here -LL | //~^ ERROR cannot borrow `y` as mutable more than once at a time +LL | LL | } | - first borrow ends here diff --git a/src/test/ui/issues/issue-18919.stderr b/src/test/ui/issues/issue-18919.stderr index ca717a3c49b8..87528652bd48 100644 --- a/src/test/ui/issues/issue-18919.stderr +++ b/src/test/ui/issues/issue-18919.stderr @@ -2,7 +2,7 @@ error[E0277]: the size for values of type `dyn for<'r> std::ops::Fn(&'r isize) - --> $DIR/issue-18919.rs:3:1 | LL | / fn ho_func(f: Option) { -LL | | //~^ ERROR the size for values of type +LL | | LL | | } | |_^ doesn't have a size known at compile-time | diff --git a/src/test/ui/issues/issue-18937.stderr b/src/test/ui/issues/issue-18937.stderr index 91182224ad0a..ac302caecc33 100644 --- a/src/test/ui/issues/issue-18937.stderr +++ b/src/test/ui/issues/issue-18937.stderr @@ -6,7 +6,7 @@ LL | | where F: fmt::Debug + 'a, LL | | Self: Sized; | |__________________________- definition of `foo` from trait ... -LL | / fn foo(&mut self, f: F) //~ ERROR impl has stricter +LL | / fn foo(&mut self, f: F) LL | | where F: fmt::Debug + 'static, LL | | { LL | | self.list.push(Box::new(f)); diff --git a/src/test/ui/issues/issue-19498.stderr b/src/test/ui/issues/issue-19498.stderr index fd5e48bde160..cc1d649d6109 100644 --- a/src/test/ui/issues/issue-19498.stderr +++ b/src/test/ui/issues/issue-19498.stderr @@ -4,7 +4,7 @@ error[E0255]: the name `A` is defined multiple times LL | use self::A; | ------- previous import of the module `A` here LL | use self::B; -LL | mod A {} //~ ERROR the name `A` is defined multiple times +LL | mod A {} | ^^^^^ `A` redefined here | = note: `A` must be defined only once in the type namespace of this module @@ -19,7 +19,7 @@ error[E0255]: the name `B` is defined multiple times LL | use self::B; | ------- previous import of the module `B` here ... -LL | pub mod B {} //~ ERROR the name `B` is defined multiple times +LL | pub mod B {} | ^^^^^^^^^ `B` redefined here | = note: `B` must be defined only once in the type namespace of this module @@ -33,7 +33,7 @@ error[E0255]: the name `D` is defined multiple times | LL | use C::D; | ---- previous import of the module `D` here -LL | mod D {} //~ ERROR the name `D` is defined multiple times +LL | mod D {} | ^^^^^ `D` redefined here | = note: `D` must be defined only once in the type namespace of this module diff --git a/src/test/ui/issues/issue-19521.stderr b/src/test/ui/issues/issue-19521.stderr index 9005317736a9..a43368be5833 100644 --- a/src/test/ui/issues/issue-19521.stderr +++ b/src/test/ui/issues/issue-19521.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `homura` found for type `&'static str` in the current scope --> $DIR/issue-19521.rs:2:8 | -LL | "".homura()(); //~ ERROR no method named `homura` found +LL | "".homura()(); | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-1962.stderr b/src/test/ui/issues/issue-1962.stderr index f2c540b74515..afef59c52642 100644 --- a/src/test/ui/issues/issue-1962.stderr +++ b/src/test/ui/issues/issue-1962.stderr @@ -1,7 +1,7 @@ error: denote infinite loops with `loop { ... }` --> $DIR/issue-1962.rs:4:3 | -LL | while true { //~ ERROR denote infinite loops with `loop +LL | while true { | ^^^^^^^^^^ help: use `loop` | = note: requested on the command line with `-D while-true` diff --git a/src/test/ui/issues/issue-19692.stderr b/src/test/ui/issues/issue-19692.stderr index 1ed196766744..5e576f11583e 100644 --- a/src/test/ui/issues/issue-19692.stderr +++ b/src/test/ui/issues/issue-19692.stderr @@ -4,7 +4,7 @@ error[E0599]: no method named `kaname` found for type `Homura` in the current sc LL | struct Homura; | -------------- method `kaname` not found for this ... -LL | let Some(ref madoka) = Some(homura.kaname()); //~ ERROR no method named `kaname` found +LL | let Some(ref madoka) = Some(homura.kaname()); | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-19707.stderr b/src/test/ui/issues/issue-19707.stderr index 7ba683a6891b..c85ce0eb3a75 100644 --- a/src/test/ui/issues/issue-19707.stderr +++ b/src/test/ui/issues/issue-19707.stderr @@ -1,7 +1,7 @@ error[E0106]: missing lifetime specifier --> $DIR/issue-19707.rs:3:28 | -LL | type Foo = fn(&u8, &u8) -> &u8; //~ ERROR missing lifetime specifier +LL | type Foo = fn(&u8, &u8) -> &u8; | ^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2 @@ -9,7 +9,7 @@ LL | type Foo = fn(&u8, &u8) -> &u8; //~ ERROR missing lifetime specifier error[E0106]: missing lifetime specifier --> $DIR/issue-19707.rs:5:27 | -LL | fn bar &u8>(f: &F) {} //~ ERROR missing lifetime specifier +LL | fn bar &u8>(f: &F) {} | ^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2 diff --git a/src/test/ui/issues/issue-19991.stderr b/src/test/ui/issues/issue-19991.stderr index ee5d363c4bd2..4c6d150229a3 100644 --- a/src/test/ui/issues/issue-19991.stderr +++ b/src/test/ui/issues/issue-19991.stderr @@ -1,10 +1,10 @@ error[E0317]: if may be missing an else clause --> $DIR/issue-19991.rs:5:5 | -LL | / if let Some(homura) = Some("madoka") { //~ ERROR missing an else clause -LL | | //~| expected type `()` -LL | | //~| found type `{integer}` -LL | | //~| expected (), found integer +LL | / if let Some(homura) = Some("madoka") { +LL | | +LL | | +LL | | LL | | 765 LL | | }; | |_____^ expected (), found integer diff --git a/src/test/ui/issues/issue-20005.stderr b/src/test/ui/issues/issue-20005.stderr index 672d78f65e9f..e271005e74d1 100644 --- a/src/test/ui/issues/issue-20005.stderr +++ b/src/test/ui/issues/issue-20005.stderr @@ -1,7 +1,7 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation time --> $DIR/issue-20005.rs:8:5 | -LL | / fn to( //~ ERROR the size for values of type +LL | / fn to( LL | | self LL | | ) -> >::Result where Dst: From { LL | | From::from(self) diff --git a/src/test/ui/issues/issue-20313.stderr b/src/test/ui/issues/issue-20313.stderr index 01673630cf18..87e2e899d3f8 100644 --- a/src/test/ui/issues/issue-20313.stderr +++ b/src/test/ui/issues/issue-20313.stderr @@ -1,7 +1,7 @@ error[E0658]: linking to LLVM intrinsics is experimental (see issue #29602) --> $DIR/issue-20313.rs:3:5 | -LL | fn sqrt(x: f32) -> f32; //~ ERROR linking to LLVM intrinsics is experimental +LL | fn sqrt(x: f32) -> f32; | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(link_llvm_intrinsics)] to the crate attributes to enable diff --git a/src/test/ui/issues/issue-20413.rs b/src/test/ui/issues/issue-20413.rs index 34094fe6a44e..7eb6d5c0ecba 100644 --- a/src/test/ui/issues/issue-20413.rs +++ b/src/test/ui/issues/issue-20413.rs @@ -8,6 +8,7 @@ struct NoData; impl Foo for T where NoData: Foo { //~^ ERROR: overflow evaluating the requirement fn answer(self) { + //~^ ERROR: overflow evaluating the requirement let val: NoData = NoData; } } diff --git a/src/test/ui/issues/issue-20413.stderr b/src/test/ui/issues/issue-20413.stderr index 1c353fec8aab..893f4faab0d5 100644 --- a/src/test/ui/issues/issue-20413.stderr +++ b/src/test/ui/issues/issue-20413.stderr @@ -10,8 +10,9 @@ error[E0275]: overflow evaluating the requirement `NoData $DIR/issue-20413.rs:8:1 | LL | / impl Foo for T where NoData: Foo { -LL | | //~^ ERROR: overflow evaluating the requirement +LL | | LL | | fn answer(self) { +LL | | LL | | let val: NoData = NoData; LL | | } LL | | } @@ -87,7 +88,86 @@ note: required by `Foo` LL | trait Foo { | ^^^^^^^^^ -error: aborting due to 2 previous errors +error[E0275]: overflow evaluating the requirement `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>: Foo` + --> $DIR/issue-20413.rs:10:3 + | +LL | / fn answer(self) { +LL | | +LL | | let val: NoData = NoData; +LL | | } + | |___^ + | + = help: consider adding a `#![recursion_limit="128"]` attribute to your crate + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>>` + = note: required because of the requirements on the impl of `Foo` for `NoData>` + = note: required because of the requirements on the impl of `Foo` for `NoData` +note: required by `Foo` + --> $DIR/issue-20413.rs:1:1 + | +LL | trait Foo { + | ^^^^^^^^^ + +error: aborting due to 3 previous errors Some errors occurred: E0275, E0392. For more information about an error, try `rustc --explain E0275`. diff --git a/src/test/ui/issues/issue-20616-1.stderr b/src/test/ui/issues/issue-20616-1.stderr index 522db4124122..143486c8f5ad 100644 --- a/src/test/ui/issues/issue-20616-1.stderr +++ b/src/test/ui/issues/issue-20616-1.stderr @@ -1,7 +1,7 @@ error: expected one of `,`, `:`, or `>`, found `T` --> $DIR/issue-20616-1.rs:9:16 | -LL | type Type_1<'a T> = &'a T; //~ error: expected one of `,`, `:`, or `>`, found `T` +LL | type Type_1<'a T> = &'a T; | ^ expected one of `,`, `:`, or `>` here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20616-2.stderr b/src/test/ui/issues/issue-20616-2.stderr index 544219eb6cfa..1152dec8bad1 100644 --- a/src/test/ui/issues/issue-20616-2.stderr +++ b/src/test/ui/issues/issue-20616-2.stderr @@ -1,7 +1,7 @@ error: expected one of `,` or `>`, found `(` --> $DIR/issue-20616-2.rs:12:31 | -LL | type Type_2 = Type_1_<'static ()>; //~ error: expected one of `,` or `>`, found `(` +LL | type Type_2 = Type_1_<'static ()>; | ^ expected one of `,` or `>` here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-20714.stderr b/src/test/ui/issues/issue-20714.stderr index 9cd6a27c12a2..456aff05750d 100644 --- a/src/test/ui/issues/issue-20714.stderr +++ b/src/test/ui/issues/issue-20714.stderr @@ -4,7 +4,7 @@ error[E0618]: expected function, found `G` LL | struct G; | --------- `G` defined here ... -LL | let g = G(); //~ ERROR: expected function, found `G` +LL | let g = G(); | ^-- | | | call expression requires function diff --git a/src/test/ui/issues/issue-20772.stderr b/src/test/ui/issues/issue-20772.stderr index 7dc4e43fd573..e67fedc5a9eb 100644 --- a/src/test/ui/issues/issue-20772.stderr +++ b/src/test/ui/issues/issue-20772.stderr @@ -2,8 +2,8 @@ error[E0391]: cycle detected when computing the supertraits of `T` --> $DIR/issue-20772.rs:1:1 | LL | / trait T : Iterator -LL | | //~^ ERROR cycle detected -LL | | //~| ERROR associated type `Item` not found for `Self` +LL | | +LL | | LL | | {} | |__^ | @@ -12,8 +12,8 @@ note: cycle used when collecting item types in top-level module --> $DIR/issue-20772.rs:1:1 | LL | / trait T : Iterator -LL | | //~^ ERROR cycle detected -LL | | //~| ERROR associated type `Item` not found for `Self` +LL | | +LL | | LL | | {} | |__^ diff --git a/src/test/ui/issues/issue-20831-debruijn.stderr b/src/test/ui/issues/issue-20831-debruijn.stderr index fa7704cf17e3..b2a05551837c 100644 --- a/src/test/ui/issues/issue-20831-debruijn.stderr +++ b/src/test/ui/issues/issue-20831-debruijn.stderr @@ -3,8 +3,8 @@ error[E0308]: mismatched types | LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ -LL | | //~^^ ERROR cannot infer -LL | | //~| ERROR mismatched types +LL | | +LL | | ... | LL | | self.sub = t; LL | | } @@ -17,8 +17,8 @@ note: the anonymous lifetime #2 defined on the method body at 28:5... | LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ -LL | | //~^^ ERROR cannot infer -LL | | //~| ERROR mismatched types +LL | | +LL | | ... | LL | | self.sub = t; LL | | } @@ -34,8 +34,8 @@ error[E0308]: mismatched types | LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ -LL | | //~^^ ERROR cannot infer -LL | | //~| ERROR mismatched types +LL | | +LL | | ... | LL | | self.sub = t; LL | | } @@ -53,8 +53,8 @@ note: ...does not necessarily outlive the anonymous lifetime #2 defined on the m | LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ -LL | | //~^^ ERROR cannot infer -LL | | //~| ERROR mismatched types +LL | | +LL | | ... | LL | | self.sub = t; LL | | } @@ -65,8 +65,8 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` d | LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ -LL | | //~^^ ERROR cannot infer -LL | | //~| ERROR mismatched types +LL | | +LL | | ... | LL | | self.sub = t; LL | | } @@ -77,8 +77,8 @@ note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on th | LL | / fn subscribe(&mut self, t : Box::Output> + 'a>) { LL | | // Not obvious, but there is an implicit lifetime here -------^ -LL | | //~^^ ERROR cannot infer -LL | | //~| ERROR mismatched types +LL | | +LL | | ... | LL | | self.sub = t; LL | | } diff --git a/src/test/ui/issues/issue-2111.stderr b/src/test/ui/issues/issue-2111.stderr index 348ad153c809..90fdb48ea625 100644 --- a/src/test/ui/issues/issue-2111.stderr +++ b/src/test/ui/issues/issue-2111.stderr @@ -3,6 +3,8 @@ error[E0004]: non-exhaustive patterns: `(None, None)` not covered | LL | match (a,b) { | ^^^^^ pattern `(None, None)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/issues/issue-2151.stderr b/src/test/ui/issues/issue-2151.stderr index 23f3c58653e5..a2bcc8a8ceaf 100644 --- a/src/test/ui/issues/issue-2151.stderr +++ b/src/test/ui/issues/issue-2151.stderr @@ -3,7 +3,7 @@ error[E0282]: type annotations needed | LL | let x = panic!(); | - consider giving `x` a type -LL | x.clone(); //~ ERROR type annotations needed +LL | x.clone(); | ^ cannot infer type | = note: type must be known at this point diff --git a/src/test/ui/issues/issue-21600.nll.stderr b/src/test/ui/issues/issue-21600.nll.stderr index 05837e92cdbc..21f3774c0564 100644 --- a/src/test/ui/issues/issue-21600.nll.stderr +++ b/src/test/ui/issues/issue-21600.nll.stderr @@ -1,19 +1,19 @@ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/issue-21600.rs:14:20 | -LL | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer +LL | call_it(|| x.gen_mut()); | ^ cannot borrow as mutable | help: consider changing this to accept closures that implement `FnMut` --> $DIR/issue-21600.rs:14:17 | -LL | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer +LL | call_it(|| x.gen_mut()); | ^^^^^^^^^^^^^^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/issue-21600.rs:14:17 | -LL | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer +LL | call_it(|| x.gen_mut()); | ^^ - mutable borrow occurs due to use of `x` in closure | | | cannot borrow as mutable @@ -24,8 +24,8 @@ help: consider changing this to accept closures that implement `FnMut` LL | call_it(|| { | _____________^ LL | | call_it(|| x.gen()); -LL | | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer -LL | | //~^ ERROR cannot borrow data mutably in a captured outer +LL | | call_it(|| x.gen_mut()); +LL | | LL | | }); | |_____^ diff --git a/src/test/ui/issues/issue-21600.stderr b/src/test/ui/issues/issue-21600.stderr index ccb75f4cc005..a20838c6c9b3 100644 --- a/src/test/ui/issues/issue-21600.stderr +++ b/src/test/ui/issues/issue-21600.stderr @@ -1,7 +1,7 @@ error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure --> $DIR/issue-21600.rs:14:17 | -LL | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer +LL | call_it(|| x.gen_mut()); | ^^ | help: consider changing this to accept closures that implement `FnMut` @@ -10,21 +10,21 @@ help: consider changing this to accept closures that implement `FnMut` LL | call_it(|| { | _____________^ LL | | call_it(|| x.gen()); -LL | | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer -LL | | //~^ ERROR cannot borrow data mutably in a captured outer +LL | | call_it(|| x.gen_mut()); +LL | | LL | | }); | |_____^ error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure --> $DIR/issue-21600.rs:14:20 | -LL | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer +LL | call_it(|| x.gen_mut()); | ^ | help: consider changing this closure to take self by mutable reference --> $DIR/issue-21600.rs:14:17 | -LL | call_it(|| x.gen_mut()); //~ ERROR cannot borrow data mutably in a captured outer +LL | call_it(|| x.gen_mut()); | ^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-21837.stderr b/src/test/ui/issues/issue-21837.stderr index 464a65fa695a..3111d3a47414 100644 --- a/src/test/ui/issues/issue-21837.stderr +++ b/src/test/ui/issues/issue-21837.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: Bound` is not satisfied --> $DIR/issue-21837.rs:8:9 | -LL | impl Trait2 for Foo {} //~ ERROR the trait bound `T: Bound` is not satisfied +LL | impl Trait2 for Foo {} | ^^^^^^ the trait `Bound` is not implemented for `T` | = help: consider adding a `where T: Bound` bound diff --git a/src/test/ui/issues/issue-21946.rs b/src/test/ui/issues/issue-21946.rs index d7a6c656df98..2d99769cfa31 100644 --- a/src/test/ui/issues/issue-21946.rs +++ b/src/test/ui/issues/issue-21946.rs @@ -7,6 +7,7 @@ struct FooStruct; impl Foo for FooStruct { //~^ ERROR overflow evaluating the requirement `::A` type A = ::A; + //~^ ERROR overflow evaluating the requirement `::A` } fn main() {} diff --git a/src/test/ui/issues/issue-21946.stderr b/src/test/ui/issues/issue-21946.stderr index 7a178bee6ae0..5ac49f61543e 100644 --- a/src/test/ui/issues/issue-21946.stderr +++ b/src/test/ui/issues/issue-21946.stderr @@ -4,6 +4,12 @@ error[E0275]: overflow evaluating the requirement `::A` LL | impl Foo for FooStruct { | ^^^ -error: aborting due to previous error +error[E0275]: overflow evaluating the requirement `::A` + --> $DIR/issue-21946.rs:9:5 + | +LL | type A = ::A; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/src/test/ui/issues/issue-21974.stderr b/src/test/ui/issues/issue-21974.stderr index d5c48db4500e..85e59d7bede5 100644 --- a/src/test/ui/issues/issue-21974.stderr +++ b/src/test/ui/issues/issue-21974.stderr @@ -1,7 +1,7 @@ error[E0283]: type annotations required: cannot resolve `&'a T: Foo` --> $DIR/issue-21974.rs:10:1 | -LL | / fn foo<'a,'b,T>(x: &'a T, y: &'b T) //~ ERROR type annotations required +LL | / fn foo<'a,'b,T>(x: &'a T, y: &'b T) LL | | where &'a T : Foo, LL | | &'b T : Foo LL | | { diff --git a/src/test/ui/issues/issue-22289.stderr b/src/test/ui/issues/issue-22289.stderr index 5214ec1ad163..e9846b848f43 100644 --- a/src/test/ui/issues/issue-22289.stderr +++ b/src/test/ui/issues/issue-22289.stderr @@ -1,7 +1,7 @@ error[E0605]: non-primitive cast: `i32` as `&(dyn std::any::Any + 'static)` --> $DIR/issue-22289.rs:2:5 | -LL | 0 as &std::any::Any; //~ ERROR non-primitive cast +LL | 0 as &std::any::Any; | ^^^^^^^^^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait diff --git a/src/test/ui/issues/issue-22560.stderr b/src/test/ui/issues/issue-22560.stderr index c6de479aac04..be4f3dda0cbc 100644 --- a/src/test/ui/issues/issue-22560.stderr +++ b/src/test/ui/issues/issue-22560.stderr @@ -25,8 +25,8 @@ error[E0191]: the value of the associated type `Output` (from the trait `std::op | LL | type Test = Add + | _____________^ -LL | | //~^ ERROR E0393 -LL | | //~| ERROR E0191 +LL | | +LL | | LL | | Sub; | |_______________^ associated type `Output` must be specified diff --git a/src/test/ui/issues/issue-22599.stderr b/src/test/ui/issues/issue-22599.stderr index bc4949da6f78..12234293ac99 100644 --- a/src/test/ui/issues/issue-22599.stderr +++ b/src/test/ui/issues/issue-22599.stderr @@ -1,7 +1,7 @@ error: unused variable: `a` --> $DIR/issue-22599.rs:8:19 | -LL | v = match 0 { a => 0 }; //~ ERROR: unused variable: `a` +LL | v = match 0 { a => 0 }; | ^ help: consider prefixing with an underscore: `_a` | note: lint level defined here diff --git a/src/test/ui/issues/issue-22638.stderr b/src/test/ui/issues/issue-22638.stderr index ba7d5f070170..aff968f3618c 100644 --- a/src/test/ui/issues/issue-22638.stderr +++ b/src/test/ui/issues/issue-22638.stderr @@ -2,7 +2,7 @@ error: reached the type-length limit while instantiating `D::matches::$CLOSURE` --> $DIR/issue-22638.rs:52:5 | LL | / pub fn matches(&self, f: &F) { -LL | | //~^ ERROR reached the type-length limit while instantiating `D::matches::<[closure +LL | | LL | | let &D(ref a) = self; LL | | a.matches(f) LL | | } diff --git a/src/test/ui/issues/issue-22644.stderr b/src/test/ui/issues/issue-22644.stderr index de97b2271b10..cbff5575ed20 100644 --- a/src/test/ui/issues/issue-22644.stderr +++ b/src/test/ui/issues/issue-22644.stderr @@ -1,7 +1,7 @@ error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison --> $DIR/issue-22644.rs:8:31 | -LL | println!("{}", a as usize < long_name); //~ ERROR `<` is interpreted as a start of generic +LL | println!("{}", a as usize < long_name); | ---------- ^ --------- interpreted as generic arguments | | | | | not interpreted as comparison @@ -19,7 +19,7 @@ LL | println!("{}{}", a as usize < long_name, long_name); error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison --> $DIR/issue-22644.rs:11:31 | -LL | println!("{}", a as usize < 4); //~ ERROR `<` is interpreted as a start of generic +LL | println!("{}", a as usize < 4); | ---------- ^ - interpreted as generic arguments | | | | | not interpreted as comparison @@ -37,7 +37,7 @@ LL | println!("{}{}", a: usize < long_name, long_name); error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison --> $DIR/issue-22644.rs:15:29 | -LL | println!("{}", a: usize < 4); //~ ERROR `<` is interpreted as a start of generic +LL | println!("{}", a: usize < 4); | -------- ^ - interpreted as generic arguments | | | | | not interpreted as comparison @@ -46,7 +46,7 @@ LL | println!("{}", a: usize < 4); //~ ERROR `<` is interpreted as a start o error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison --> $DIR/issue-22644.rs:20:20 | -LL | < //~ ERROR `<` is interpreted as a start of generic +LL | < | ^ not interpreted as comparison LL | 4); | - interpreted as generic arguments @@ -60,7 +60,7 @@ LL | usize) error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison --> $DIR/issue-22644.rs:29:20 | -LL | < //~ ERROR `<` is interpreted as a start of generic +LL | < | ^ not interpreted as comparison LL | 5); | - interpreted as generic arguments @@ -77,7 +77,7 @@ LL | error: `<` is interpreted as a start of generic arguments for `usize`, not a shift --> $DIR/issue-22644.rs:32:31 | -LL | println!("{}", a as usize << long_name); //~ ERROR `<` is interpreted as a start of generic +LL | println!("{}", a as usize << long_name); | ---------- ^^ --------- interpreted as generic arguments | | | | | not interpreted as shift @@ -86,7 +86,7 @@ LL | println!("{}", a as usize << long_name); //~ ERROR `<` is interpreted a error: expected type, found `4` --> $DIR/issue-22644.rs:34:28 | -LL | println!("{}", a: &mut 4); //~ ERROR expected type, found `4` +LL | println!("{}", a: &mut 4); | ^ expecting a type here because of type ascription error: aborting due to 9 previous errors diff --git a/src/test/ui/issues/issue-22684.stderr b/src/test/ui/issues/issue-22684.stderr index 6e2b2357a05d..738123ec4d41 100644 --- a/src/test/ui/issues/issue-22684.stderr +++ b/src/test/ui/issues/issue-22684.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-22684.rs:17:17 | -LL | let _: () = foo::Foo.bar(); //~ ERROR mismatched types +LL | let _: () = foo::Foo.bar(); | ^^^^^^^^^^^^^^ expected (), found bool | = note: expected type `()` diff --git a/src/test/ui/issues/issue-2281-part1.stderr b/src/test/ui/issues/issue-2281-part1.stderr index faf31c7bd4af..c2391a7c0911 100644 --- a/src/test/ui/issues/issue-2281-part1.stderr +++ b/src/test/ui/issues/issue-2281-part1.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `foobar` in this scope --> $DIR/issue-2281-part1.rs:1:28 | -LL | fn main() { println!("{}", foobar); } //~ ERROR cannot find value `foobar` in this scope +LL | fn main() { println!("{}", foobar); } | ^^^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/issues/issue-22886.stderr b/src/test/ui/issues/issue-22886.stderr index ff206e8113e1..c4b396559241 100644 --- a/src/test/ui/issues/issue-22886.stderr +++ b/src/test/ui/issues/issue-22886.stderr @@ -1,7 +1,7 @@ error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates --> $DIR/issue-22886.rs:13:6 | -LL | impl<'a> Iterator for Newtype { //~ ERROR E0207 +LL | impl<'a> Iterator for Newtype { | ^^ unconstrained lifetime parameter error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23041.stderr b/src/test/ui/issues/issue-23041.stderr index aa6ffdd2570f..401086b20443 100644 --- a/src/test/ui/issues/issue-23041.stderr +++ b/src/test/ui/issues/issue-23041.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/issue-23041.rs:6:22 | -LL | b.downcast_ref::_>(); //~ ERROR E0282 +LL | b.downcast_ref::_>(); | ^^^^^^^^ cannot infer type error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23046.stderr b/src/test/ui/issues/issue-23046.stderr index 9b7599e1e35d..aab90a9d4403 100644 --- a/src/test/ui/issues/issue-23046.stderr +++ b/src/test/ui/issues/issue-23046.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/issue-23046.rs:17:15 | -LL | let ex = |x| { //~ ERROR type annotations needed +LL | let ex = |x| { | ^ consider giving this closure parameter a type error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23073.stderr b/src/test/ui/issues/issue-23073.stderr index e3ddd190d4f8..3a10a1ab11ac 100644 --- a/src/test/ui/issues/issue-23073.stderr +++ b/src/test/ui/issues/issue-23073.stderr @@ -1,7 +1,7 @@ error[E0223]: ambiguous associated type --> $DIR/issue-23073.rs:6:17 | -LL | type FooT = <::Foo>::T; //~ ERROR ambiguous associated type +LL | type FooT = <::Foo>::T; | ^^^^^^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<::Foo as Trait>::T` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23080-2.stderr b/src/test/ui/issues/issue-23080-2.stderr index db9a6488851a..38998469e42d 100644 --- a/src/test/ui/issues/issue-23080-2.stderr +++ b/src/test/ui/issues/issue-23080-2.stderr @@ -2,7 +2,7 @@ error[E0380]: auto traits cannot have methods or associated items --> $DIR/issue-23080-2.rs:7:1 | LL | / unsafe auto trait Trait { -LL | | //~^ ERROR E0380 +LL | | LL | | type Output; LL | | } | |_^ diff --git a/src/test/ui/issues/issue-23080.stderr b/src/test/ui/issues/issue-23080.stderr index cace9a57507f..ed843e793bee 100644 --- a/src/test/ui/issues/issue-23080.stderr +++ b/src/test/ui/issues/issue-23080.stderr @@ -2,7 +2,7 @@ error[E0380]: auto traits cannot have methods or associated items --> $DIR/issue-23080.rs:5:1 | LL | / unsafe auto trait Trait { -LL | | //~^ ERROR E0380 +LL | | LL | | fn method(&self) { LL | | println!("Hello"); LL | | } diff --git a/src/test/ui/issues/issue-23122-1.rs b/src/test/ui/issues/issue-23122-1.rs index a882aa36af75..d6f64650f36b 100644 --- a/src/test/ui/issues/issue-23122-1.rs +++ b/src/test/ui/issues/issue-23122-1.rs @@ -7,6 +7,7 @@ struct GetNext { t: T } impl Next for GetNext { //~^ ERROR overflow evaluating the requirement type Next = as Next>::Next; + //~^ ERROR overflow evaluating the requirement } fn main() {} diff --git a/src/test/ui/issues/issue-23122-1.stderr b/src/test/ui/issues/issue-23122-1.stderr index 39dd424a86ca..1b752b7afe2e 100644 --- a/src/test/ui/issues/issue-23122-1.stderr +++ b/src/test/ui/issues/issue-23122-1.stderr @@ -4,6 +4,12 @@ error[E0275]: overflow evaluating the requirement ` as Next>::Next` LL | impl Next for GetNext { | ^^^^ -error: aborting due to previous error +error[E0275]: overflow evaluating the requirement ` as Next>::Next` + --> $DIR/issue-23122-1.rs:9:5 + | +LL | type Next = as Next>::Next; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/src/test/ui/issues/issue-23122-2.rs b/src/test/ui/issues/issue-23122-2.rs index b84112003430..695712d2cc92 100644 --- a/src/test/ui/issues/issue-23122-2.rs +++ b/src/test/ui/issues/issue-23122-2.rs @@ -7,6 +7,7 @@ struct GetNext { t: T } impl Next for GetNext { //~^ ERROR overflow evaluating the requirement type Next = as Next>::Next; + //~^ ERROR overflow evaluating the requirement } fn main() {} diff --git a/src/test/ui/issues/issue-23122-2.stderr b/src/test/ui/issues/issue-23122-2.stderr index 859287758110..b122dd42373c 100644 --- a/src/test/ui/issues/issue-23122-2.stderr +++ b/src/test/ui/issues/issue-23122-2.stderr @@ -7,6 +7,15 @@ LL | impl Next for GetNext { = help: consider adding a `#![recursion_limit="128"]` attribute to your crate = note: required because of the requirements on the impl of `Next` for `GetNext<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next>` -error: aborting due to previous error +error[E0275]: overflow evaluating the requirement `<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next: std::marker::Sized` + --> $DIR/issue-23122-2.rs:9:5 + | +LL | type Next = as Next>::Next; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: consider adding a `#![recursion_limit="128"]` attribute to your crate + = note: required because of the requirements on the impl of `Next` for `GetNext<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next as Next>::Next>` + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0275`. diff --git a/src/test/ui/issues/issue-23189.stderr b/src/test/ui/issues/issue-23189.stderr index 82c6ed9c062b..ed065212c560 100644 --- a/src/test/ui/issues/issue-23189.stderr +++ b/src/test/ui/issues/issue-23189.stderr @@ -1,7 +1,7 @@ error[E0574]: expected struct, variant or union type, found module `module` --> $DIR/issue-23189.rs:4:13 | -LL | let _ = module { x: 0 }; //~ERROR expected struct +LL | let _ = module { x: 0 }; | ^^^^^^ not a struct, variant or union type error: aborting due to previous error diff --git a/src/test/ui/issues/issue-2330.stderr b/src/test/ui/issues/issue-2330.stderr index 472ad199a639..877cf68b5866 100644 --- a/src/test/ui/issues/issue-2330.stderr +++ b/src/test/ui/issues/issue-2330.stderr @@ -1,7 +1,7 @@ error[E0404]: expected trait, found enum `Chan` --> $DIR/issue-2330.rs:8:6 | -LL | impl Chan for isize { //~ ERROR expected trait, found enum `Chan` +LL | impl Chan for isize { | ^^^^ not a trait error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23302-1.stderr b/src/test/ui/issues/issue-23302-1.stderr index ed422e10c985..5fa82f8b7863 100644 --- a/src/test/ui/issues/issue-23302-1.stderr +++ b/src/test/ui/issues/issue-23302-1.stderr @@ -1,14 +1,14 @@ error[E0391]: cycle detected when processing `X::A::{{constant}}` --> $DIR/issue-23302-1.rs:4:9 | -LL | A = X::A as isize, //~ ERROR E0391 +LL | A = X::A as isize, | ^^^^^^^^^^^^^ | = note: ...which again requires processing `X::A::{{constant}}`, completing the cycle note: cycle used when const-evaluating `X::A::{{constant}}` --> $DIR/issue-23302-1.rs:4:9 | -LL | A = X::A as isize, //~ ERROR E0391 +LL | A = X::A as isize, | ^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23302-2.stderr b/src/test/ui/issues/issue-23302-2.stderr index b6d44ceec9d7..5b77baed73c3 100644 --- a/src/test/ui/issues/issue-23302-2.stderr +++ b/src/test/ui/issues/issue-23302-2.stderr @@ -1,14 +1,14 @@ error[E0391]: cycle detected when processing `Y::A::{{constant}}` --> $DIR/issue-23302-2.rs:4:9 | -LL | A = Y::B as isize, //~ ERROR E0391 +LL | A = Y::B as isize, | ^^^^^^^^^^^^^ | = note: ...which again requires processing `Y::A::{{constant}}`, completing the cycle note: cycle used when const-evaluating `Y::A::{{constant}}` --> $DIR/issue-23302-2.rs:4:9 | -LL | A = Y::B as isize, //~ ERROR E0391 +LL | A = Y::B as isize, | ^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23302-3.stderr b/src/test/ui/issues/issue-23302-3.stderr index 392769b4c565..a7d643987f71 100644 --- a/src/test/ui/issues/issue-23302-3.stderr +++ b/src/test/ui/issues/issue-23302-3.stderr @@ -1,13 +1,13 @@ error[E0391]: cycle detected when const checking if rvalue is promotable to static `A` --> $DIR/issue-23302-3.rs:1:1 | -LL | const A: i32 = B; //~ ERROR cycle detected +LL | const A: i32 = B; | ^^^^^^^^^^^^^^^^^ | note: ...which requires checking which parts of `A` are promotable to static... --> $DIR/issue-23302-3.rs:1:16 | -LL | const A: i32 = B; //~ ERROR cycle detected +LL | const A: i32 = B; | ^ note: ...which requires const checking if rvalue is promotable to static `B`... --> $DIR/issue-23302-3.rs:3:1 @@ -20,6 +20,7 @@ note: ...which requires checking which parts of `B` are promotable to static... LL | const B: i32 = A; | ^ = note: ...which again requires const checking if rvalue is promotable to static `A`, completing the cycle + = note: cycle used when running analysis passes on this crate error: aborting due to previous error diff --git a/src/test/ui/issues/issue-24081.stderr b/src/test/ui/issues/issue-24081.stderr index 999ac0d5570e..647048c7c201 100644 --- a/src/test/ui/issues/issue-24081.stderr +++ b/src/test/ui/issues/issue-24081.stderr @@ -4,7 +4,7 @@ error[E0255]: the name `Add` is defined multiple times LL | use std::ops::Add; | ------------- previous import of the trait `Add` here ... -LL | type Add = bool; //~ ERROR the name `Add` is defined multiple times +LL | type Add = bool; | ^^^^^^^^^^^^^^^^ `Add` redefined here | = note: `Add` must be defined only once in the type namespace of this module @@ -19,7 +19,7 @@ error[E0255]: the name `Sub` is defined multiple times LL | use std::ops::Sub; | ------------- previous import of the trait `Sub` here ... -LL | struct Sub { x: f32 } //~ ERROR the name `Sub` is defined multiple times +LL | struct Sub { x: f32 } | ^^^^^^^^^^ `Sub` redefined here | = note: `Sub` must be defined only once in the type namespace of this module @@ -34,7 +34,7 @@ error[E0255]: the name `Mul` is defined multiple times LL | use std::ops::Mul; | ------------- previous import of the trait `Mul` here ... -LL | enum Mul { A, B } //~ ERROR the name `Mul` is defined multiple times +LL | enum Mul { A, B } | ^^^^^^^^ `Mul` redefined here | = note: `Mul` must be defined only once in the type namespace of this module @@ -49,7 +49,7 @@ error[E0255]: the name `Div` is defined multiple times LL | use std::ops::Div; | ------------- previous import of the trait `Div` here ... -LL | mod Div { } //~ ERROR the name `Div` is defined multiple times +LL | mod Div { } | ^^^^^^^ `Div` redefined here | = note: `Div` must be defined only once in the type namespace of this module @@ -64,7 +64,7 @@ error[E0255]: the name `Rem` is defined multiple times LL | use std::ops::Rem; | ------------- previous import of the trait `Rem` here ... -LL | trait Rem { } //~ ERROR the name `Rem` is defined multiple times +LL | trait Rem { } | ^^^^^^^^^ `Rem` redefined here | = note: `Rem` must be defined only once in the type namespace of this module diff --git a/src/test/ui/issues/issue-24267-flow-exit.nll.stderr b/src/test/ui/issues/issue-24267-flow-exit.nll.stderr index 52e637a3f0b0..3b4f27621f69 100644 --- a/src/test/ui/issues/issue-24267-flow-exit.nll.stderr +++ b/src/test/ui/issues/issue-24267-flow-exit.nll.stderr @@ -1,13 +1,13 @@ error[E0381]: borrow of possibly uninitialized variable: `x` --> $DIR/issue-24267-flow-exit.rs:12:20 | -LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` +LL | println!("{}", x); | ^ use of possibly uninitialized `x` error[E0381]: borrow of possibly uninitialized variable: `x` --> $DIR/issue-24267-flow-exit.rs:18:20 | -LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` +LL | println!("{}", x); | ^ use of possibly uninitialized `x` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-24267-flow-exit.stderr b/src/test/ui/issues/issue-24267-flow-exit.stderr index 0d226e01809b..2b9e2ee9011e 100644 --- a/src/test/ui/issues/issue-24267-flow-exit.stderr +++ b/src/test/ui/issues/issue-24267-flow-exit.stderr @@ -1,13 +1,13 @@ error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/issue-24267-flow-exit.rs:12:20 | -LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` +LL | println!("{}", x); | ^ use of possibly uninitialized `x` error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/issue-24267-flow-exit.rs:18:20 | -LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x` +LL | println!("{}", x); | ^ use of possibly uninitialized `x` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-24322.stderr b/src/test/ui/issues/issue-24322.stderr index b42854387518..def373cf2c0a 100644 --- a/src/test/ui/issues/issue-24322.stderr +++ b/src/test/ui/issues/issue-24322.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-24322.rs:8:29 | -LL | let x: &fn(&B) -> u32 = &B::func; //~ ERROR mismatched types +LL | let x: &fn(&B) -> u32 = &B::func; | ^^^^^^^^ expected fn pointer, found fn item | = note: expected type `&for<'r> fn(&'r B) -> u32` diff --git a/src/test/ui/issues/issue-24352.stderr b/src/test/ui/issues/issue-24352.stderr index 835706d015b5..a315ca8b08f5 100644 --- a/src/test/ui/issues/issue-24352.stderr +++ b/src/test/ui/issues/issue-24352.stderr @@ -1,7 +1,7 @@ error[E0277]: cannot subtract `{integer}` from `f64` --> $DIR/issue-24352.rs:3:12 | -LL | 1.0f64 - 1 //~ ERROR E0277 +LL | 1.0f64 - 1 | ^ no implementation for `f64 - {integer}` | = help: the trait `std::ops::Sub<{integer}>` is not implemented for `f64` diff --git a/src/test/ui/issues/issue-24357.nll.stderr b/src/test/ui/issues/issue-24357.nll.stderr index 310535434cd0..a9c43a8f0d91 100644 --- a/src/test/ui/issues/issue-24357.nll.stderr +++ b/src/test/ui/issues/issue-24357.nll.stderr @@ -7,7 +7,7 @@ LL | let f = move || { let y = x; }; | ------- - variable moved due to use in closure | | | value moved into closure here -LL | //~^ NOTE value moved (into closure) here +LL | LL | let z = x; | ^ value used here after move diff --git a/src/test/ui/issues/issue-24357.stderr b/src/test/ui/issues/issue-24357.stderr index 3bc84cba0f53..ced24ffc5edd 100644 --- a/src/test/ui/issues/issue-24357.stderr +++ b/src/test/ui/issues/issue-24357.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x` | LL | let f = move || { let y = x; }; | ------- value moved (into closure) here -LL | //~^ NOTE value moved (into closure) here +LL | LL | let z = x; | ^ value used here after move | diff --git a/src/test/ui/issues/issue-24363.stderr b/src/test/ui/issues/issue-24363.stderr index ff02887a1539..3399856d3f9a 100644 --- a/src/test/ui/issues/issue-24363.stderr +++ b/src/test/ui/issues/issue-24363.stderr @@ -1,13 +1,13 @@ error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/issue-24363.rs:2:7 | -LL | 1.create_a_type_error[ //~ `{integer}` is a primitive type and therefore doesn't have fields +LL | 1.create_a_type_error[ | ^^^^^^^^^^^^^^^^^^^ error[E0369]: binary operation `+` cannot be applied to type `()` --> $DIR/issue-24363.rs:3:9 | -LL | ()+() //~ ERROR binary operation `+` cannot be applied +LL | ()+() | ^^^^^ | = note: an implementation of `std::ops::Add` might be missing for `()` diff --git a/src/test/ui/issues/issue-24365.stderr b/src/test/ui/issues/issue-24365.stderr index 7d02f117f9f5..f9eead8a4f21 100644 --- a/src/test/ui/issues/issue-24365.stderr +++ b/src/test/ui/issues/issue-24365.stderr @@ -1,19 +1,19 @@ error[E0609]: no field `b` on type `Foo` --> $DIR/issue-24365.rs:10:22 | -LL | println!("{}", a.b); //~ no field `b` on type `Foo` +LL | println!("{}", a.b); | ^ error[E0609]: no field `attr_name_idx` on type `&Attribute` --> $DIR/issue-24365.rs:17:18 | -LL | let z = (&x).attr_name_idx; //~ no field `attr_name_idx` on type `&Attribute` +LL | let z = (&x).attr_name_idx; | ^^^^^^^^^^^^^ error[E0609]: no field `attr_name_idx` on type `Attribute` --> $DIR/issue-24365.rs:18:15 | -LL | let y = x.attr_name_idx; //~ no field `attr_name_idx` on type `Attribute` +LL | let y = x.attr_name_idx; | ^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-24682.stderr b/src/test/ui/issues/issue-24682.stderr index f6d03f6c18fd..e1943bf4d683 100644 --- a/src/test/ui/issues/issue-24682.stderr +++ b/src/test/ui/issues/issue-24682.stderr @@ -1,20 +1,20 @@ error[E0229]: associated type bindings are not allowed here --> $DIR/issue-24682.rs:5:11 | -LL | / N= //~ ERROR associated type bindings are not allowed here +LL | / N= LL | | Self::N> { | |_________________^ associated type not allowed here error[E0229]: associated type bindings are not allowed here --> $DIR/issue-24682.rs:11:13 | -LL | //~ ERROR associated type bindings are not allowed here +LL | | ^^^^ associated type not allowed here error[E0229]: associated type bindings are not allowed here --> $DIR/issue-24682.rs:15:13 | -LL | u32 //~ ERROR associated type bindings are not allowed here +LL | u32 | ^^^^ associated type not allowed here error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-25076.stderr b/src/test/ui/issues/issue-25076.stderr index 8793475e6d4e..435ab13edada 100644 --- a/src/test/ui/issues/issue-25076.stderr +++ b/src/test/ui/issues/issue-25076.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `(): InOut<_>` is not satisfied --> $DIR/issue-25076.rs:10:5 | -LL | do_fold(bot(), ()); //~ ERROR `(): InOut<_>` is not satisfied +LL | do_fold(bot(), ()); | ^^^^^^^ the trait `InOut<_>` is not implemented for `()` | note: required by `do_fold` diff --git a/src/test/ui/issues/issue-25368.stderr b/src/test/ui/issues/issue-25368.stderr index 2e6a02e7389a..3ad6a2569be4 100644 --- a/src/test/ui/issues/issue-25368.stderr +++ b/src/test/ui/issues/issue-25368.stderr @@ -4,7 +4,7 @@ error[E0282]: type annotations needed LL | let (tx, rx) = channel(); | -------- consider giving the pattern a type ... -LL | tx.send(Foo{ foo: PhantomData }); //~ ERROR E0282 +LL | tx.send(Foo{ foo: PhantomData }); | ^^^ cannot infer type for `T` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-25396.stderr b/src/test/ui/issues/issue-25396.stderr index aae62b688d4a..38dc9ef10351 100644 --- a/src/test/ui/issues/issue-25396.stderr +++ b/src/test/ui/issues/issue-25396.stderr @@ -3,13 +3,13 @@ error[E0252]: the name `baz` is defined multiple times | LL | use foo::baz; | -------- previous import of the module `baz` here -LL | use bar::baz; //~ ERROR the name `baz` is defined multiple times +LL | use bar::baz; | ^^^^^^^^ `baz` reimported here | = note: `baz` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use bar::baz as other_baz; //~ ERROR the name `baz` is defined multiple times +LL | use bar::baz as other_baz; | ^^^^^^^^^^^^^^^^^^^^^ error[E0252]: the name `Quux` is defined multiple times @@ -17,13 +17,13 @@ error[E0252]: the name `Quux` is defined multiple times | LL | use foo::Quux; | --------- previous import of the trait `Quux` here -LL | use bar::Quux; //~ ERROR the name `Quux` is defined multiple times +LL | use bar::Quux; | ^^^^^^^^^ `Quux` reimported here | = note: `Quux` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use bar::Quux as OtherQuux; //~ ERROR the name `Quux` is defined multiple times +LL | use bar::Quux as OtherQuux; | ^^^^^^^^^^^^^^^^^^^^^^ error[E0252]: the name `blah` is defined multiple times @@ -31,13 +31,13 @@ error[E0252]: the name `blah` is defined multiple times | LL | use foo::blah; | --------- previous import of the type `blah` here -LL | use bar::blah; //~ ERROR the name `blah` is defined multiple times +LL | use bar::blah; | ^^^^^^^^^ `blah` reimported here | = note: `blah` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use bar::blah as other_blah; //~ ERROR the name `blah` is defined multiple times +LL | use bar::blah as other_blah; | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0252]: the name `WOMP` is defined multiple times @@ -45,13 +45,13 @@ error[E0252]: the name `WOMP` is defined multiple times | LL | use foo::WOMP; | --------- previous import of the value `WOMP` here -LL | use bar::WOMP; //~ ERROR the name `WOMP` is defined multiple times +LL | use bar::WOMP; | ^^^^^^^^^ `WOMP` reimported here | = note: `WOMP` must be defined only once in the value namespace of this module help: you can use `as` to change the binding name of the import | -LL | use bar::WOMP as OtherWOMP; //~ ERROR the name `WOMP` is defined multiple times +LL | use bar::WOMP as OtherWOMP; | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/issues/issue-25439.stderr b/src/test/ui/issues/issue-25439.stderr index 9e9ab4e39d34..9b0414831325 100644 --- a/src/test/ui/issues/issue-25439.stderr +++ b/src/test/ui/issues/issue-25439.stderr @@ -1,7 +1,7 @@ error[E0644]: closure/generator type that references itself --> $DIR/issue-25439.rs:8:9 | -LL | fix(|_, x| x); //~ ERROR closure/generator type that references itself [E0644] +LL | fix(|_, x| x); | ^^^^^^^^ cyclic type of infinite size | = note: closures cannot capture themselves or take themselves as argument; diff --git a/src/test/ui/issues/issue-25700.nll.stderr b/src/test/ui/issues/issue-25700.nll.stderr index ba5403cca4d0..fa309a55c3c2 100644 --- a/src/test/ui/issues/issue-25700.nll.stderr +++ b/src/test/ui/issues/issue-25700.nll.stderr @@ -5,7 +5,7 @@ LL | let t = S::<()>(None); | - move occurs because `t` has type `S<()>`, which does not implement the `Copy` trait LL | drop(t); | - value moved here -LL | drop(t); //~ ERROR use of moved value +LL | drop(t); | ^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/issues/issue-25700.stderr b/src/test/ui/issues/issue-25700.stderr index d4cf89d0abd5..4a203c7c2578 100644 --- a/src/test/ui/issues/issue-25700.stderr +++ b/src/test/ui/issues/issue-25700.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `t` | LL | drop(t); | - value moved here -LL | drop(t); //~ ERROR use of moved value +LL | drop(t); | ^ value used here after move | = note: move occurs because `t` has type `S<()>`, which does not implement the `Copy` trait diff --git a/src/test/ui/issues/issue-2590.nll.stderr b/src/test/ui/issues/issue-2590.nll.stderr index 1252578419a8..e19e83dc747e 100644 --- a/src/test/ui/issues/issue-2590.nll.stderr +++ b/src/test/ui/issues/issue-2590.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/issue-2590.rs:11:9 | -LL | self.tokens //~ ERROR cannot move out of borrowed content +LL | self.tokens | ^^^^^^^^^^^ cannot move out of borrowed content error: aborting due to previous error diff --git a/src/test/ui/issues/issue-2590.stderr b/src/test/ui/issues/issue-2590.stderr index f93b5db3adfb..c50652d32841 100644 --- a/src/test/ui/issues/issue-2590.stderr +++ b/src/test/ui/issues/issue-2590.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/issue-2590.rs:11:9 | -LL | self.tokens //~ ERROR cannot move out of borrowed content +LL | self.tokens | ^^^^ cannot move out of borrowed content error: aborting due to previous error diff --git a/src/test/ui/issues/issue-26158.stderr b/src/test/ui/issues/issue-26158.stderr index 868ffd191cba..3a4dd79e8105 100644 --- a/src/test/ui/issues/issue-26158.stderr +++ b/src/test/ui/issues/issue-26158.stderr @@ -1,7 +1,7 @@ error[E0005]: refutable pattern in local binding: `&[]` not covered --> $DIR/issue-26158.rs:5:9 | -LL | let &[[ref _a, ref _b..]..] = x; //~ ERROR refutable pattern +LL | let &[[ref _a, ref _b..]..] = x; | ^^^^^^^^^^^^^^^^^^^^^^^ pattern `&[]` not covered error: aborting due to previous error diff --git a/src/test/ui/issues/issue-26448-1.rs b/src/test/ui/issues/issue-26448-1.rs new file mode 100644 index 000000000000..7d2d75bf2e87 --- /dev/null +++ b/src/test/ui/issues/issue-26448-1.rs @@ -0,0 +1,13 @@ +// run-pass + +pub trait Foo { + fn foo(self) -> T; +} + +impl<'a, T> Foo for &'a str where &'a str: Into { + fn foo(self) -> T { + panic!(); + } +} + +fn main() {} diff --git a/src/test/ui/issues/issue-26448-2.rs b/src/test/ui/issues/issue-26448-2.rs new file mode 100644 index 000000000000..17e7c1f977a6 --- /dev/null +++ b/src/test/ui/issues/issue-26448-2.rs @@ -0,0 +1,21 @@ +// run-pass + +pub struct Bar { + items: Vec<&'static str>, + inner: T, +} + +pub trait IntoBar { + fn into_bar(self) -> Bar; +} + +impl<'a, T> IntoBar for &'a str where &'a str: Into { + fn into_bar(self) -> Bar { + Bar { + items: Vec::new(), + inner: self.into(), + } + } +} + +fn main() {} diff --git a/src/test/ui/issues/issue-26448-3.rs b/src/test/ui/issues/issue-26448-3.rs new file mode 100644 index 000000000000..e57352e57f4f --- /dev/null +++ b/src/test/ui/issues/issue-26448-3.rs @@ -0,0 +1,25 @@ +// run-pass + +pub struct Item { + _inner: &'static str, +} + +pub struct Bar { + items: Vec, + inner: T, +} + +pub trait IntoBar { + fn into_bar(self) -> Bar; +} + +impl<'a, T> IntoBar for &'a str where &'a str: Into { + fn into_bar(self) -> Bar { + Bar { + items: Vec::new(), + inner: self.into(), + } + } +} + +fn main() {} diff --git a/src/test/ui/issues/issue-26472.stderr b/src/test/ui/issues/issue-26472.stderr index 8c261d2a3f3e..245ebeaf972e 100644 --- a/src/test/ui/issues/issue-26472.stderr +++ b/src/test/ui/issues/issue-26472.stderr @@ -1,7 +1,7 @@ error[E0616]: field `len` of struct `sub::S` is private --> $DIR/issue-26472.rs:11:13 | -LL | let v = s.len; //~ ERROR field `len` of struct `sub::S` is private +LL | let v = s.len; | ^^--- | | | help: a method `len` also exists, call it with parentheses: `len()` @@ -9,7 +9,7 @@ LL | let v = s.len; //~ ERROR field `len` of struct `sub::S` is private error[E0616]: field `len` of struct `sub::S` is private --> $DIR/issue-26472.rs:12:5 | -LL | s.len = v; //~ ERROR field `len` of struct `sub::S` is private +LL | s.len = v; | ^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-26548.stderr b/src/test/ui/issues/issue-26548.stderr index ff197eeeb0fe..7c1789cc1e99 100644 --- a/src/test/ui/issues/issue-26548.stderr +++ b/src/test/ui/issues/issue-26548.stderr @@ -5,7 +5,7 @@ error[E0391]: cycle detected when computing layout of `std::option::Option` note: cycle used when processing `main` --> $DIR/issue-26548.rs:9:1 | -LL | fn main() { //~ NOTE cycle used when processing `main` +LL | fn main() { | ^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-26619.nll.stderr b/src/test/ui/issues/issue-26619.nll.stderr new file mode 100644 index 000000000000..d1157cda92bf --- /dev/null +++ b/src/test/ui/issues/issue-26619.nll.stderr @@ -0,0 +1,11 @@ +error[E0515]: cannot return value referencing function parameter + --> $DIR/issue-26619.rs:7:76 + | +LL | for s in vec!["1|2".to_string()].into_iter().filter_map(|ref line| self.make_entry(line)) { + | -------- ^^^^^^^^^^^^^^^^^^^^^ returns a value referencing data owned by the current function + | | + | function parameter borrowed here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0515`. diff --git a/src/test/ui/issues/issue-26619.rs b/src/test/ui/issues/issue-26619.rs new file mode 100644 index 000000000000..cd89c674e499 --- /dev/null +++ b/src/test/ui/issues/issue-26619.rs @@ -0,0 +1,24 @@ +#![feature(slice_patterns)] + +pub struct History<'a> { pub _s: &'a str } + +impl<'a> History<'a> { + pub fn get_page(&self) { + for s in vec!["1|2".to_string()].into_iter().filter_map(|ref line| self.make_entry(line)) { + //~^ ERROR borrowed value does not live long enough + println!("{:?}", s); + } + } + + fn make_entry(&self, s: &'a String) -> Option<&str> { + let parts: Vec<_> = s.split('|').collect(); + println!("{:?} -> {:?}", s, parts); + + if let [commit, ..] = &parts[..] { Some(commit) } else { None } + } +} + +fn main() { + let h = History{ _s: "" }; + h.get_page(); +} diff --git a/src/test/ui/issues/issue-26619.stderr b/src/test/ui/issues/issue-26619.stderr new file mode 100644 index 000000000000..3ac6c4e308d2 --- /dev/null +++ b/src/test/ui/issues/issue-26619.stderr @@ -0,0 +1,12 @@ +error[E0597]: borrowed value does not live long enough + --> $DIR/issue-26619.rs:7:66 + | +LL | for s in vec!["1|2".to_string()].into_iter().filter_map(|ref line| self.make_entry(line)) { + | ^^^^^^^^ -- temporary value needs to live until here + | | | + | | temporary value dropped here while still borrowed + | temporary value does not live long enough + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/issues/issue-26886.stderr b/src/test/ui/issues/issue-26886.stderr index 70dacb353fe0..fa7f922707ab 100644 --- a/src/test/ui/issues/issue-26886.stderr +++ b/src/test/ui/issues/issue-26886.stderr @@ -3,7 +3,7 @@ error[E0252]: the name `Arc` is defined multiple times | LL | use std::sync::{self, Arc}; | --- previous import of the type `Arc` here -LL | use std::sync::Arc; //~ ERROR the name `Arc` is defined multiple times +LL | use std::sync::Arc; | ----^^^^^^^^^^^^^^- | | | | | `Arc` reimported here @@ -17,7 +17,7 @@ error[E0252]: the name `sync` is defined multiple times LL | use std::sync::{self, Arc}; | ---- previous import of the module `sync` here ... -LL | use std::sync; //~ ERROR the name `sync` is defined multiple times +LL | use std::sync; | ----^^^^^^^^^- | | | | | `sync` reimported here diff --git a/src/test/ui/issues/issue-26905.stderr b/src/test/ui/issues/issue-26905.stderr index 93b4d7e36e81..10dbb7325859 100644 --- a/src/test/ui/issues/issue-26905.stderr +++ b/src/test/ui/issues/issue-26905.stderr @@ -1,7 +1,7 @@ error[E0375]: implementing the trait `CoerceUnsized` requires multiple coercions --> $DIR/issue-26905.rs:16:40 | -LL | impl, U: ?Sized> CoerceUnsized> for MyRc{ } //~ERROR +LL | impl, U: ?Sized> CoerceUnsized> for MyRc{ } | ^^^^^^^^^^^^^^^^^^^^^^ requires multiple coercions | = note: `CoerceUnsized` may only be implemented for a coercion between structures with one field being coerced diff --git a/src/test/ui/issues/issue-27033.stderr b/src/test/ui/issues/issue-27033.stderr index b343924bb024..ab9543322803 100644 --- a/src/test/ui/issues/issue-27033.stderr +++ b/src/test/ui/issues/issue-27033.stderr @@ -1,7 +1,7 @@ error[E0530]: match bindings cannot shadow unit variants --> $DIR/issue-27033.rs:3:9 | -LL | None @ _ => {} //~ ERROR match bindings cannot shadow unit variants +LL | None @ _ => {} | ^^^^ cannot be named the same as a unit variant error[E0530]: match bindings cannot shadow constants @@ -10,7 +10,7 @@ error[E0530]: match bindings cannot shadow constants LL | const C: u8 = 1; | ---------------- the constant `C` is defined here LL | match 1 { -LL | C @ 2 => { //~ ERROR match bindings cannot shadow constant +LL | C @ 2 => { | ^ cannot be named the same as a constant error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-27042.stderr b/src/test/ui/issues/issue-27042.stderr index bcefb29c18b0..cce7d24a5f60 100644 --- a/src/test/ui/issues/issue-27042.stderr +++ b/src/test/ui/issues/issue-27042.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-27042.rs:6:16 | -LL | loop { break }; //~ ERROR mismatched types +LL | loop { break }; | ^^^^^ expected (), found i32 | = note: expected type `()` @@ -10,7 +10,7 @@ LL | loop { break }; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/issue-27042.rs:8:9 | -LL | / 'b: //~ ERROR mismatched types +LL | / 'b: LL | | while true { break }; // but here we cite the whole loop | |____________________________^ expected i32, found () | @@ -20,7 +20,7 @@ LL | | while true { break }; // but here we cite the whole loop error[E0308]: mismatched types --> $DIR/issue-27042.rs:11:9 | -LL | / 'c: //~ ERROR mismatched types +LL | / 'c: LL | | for _ in None { break }; // but here we cite the whole loop | |_______________________________^ expected i32, found () | @@ -30,7 +30,7 @@ LL | | for _ in None { break }; // but here we cite the whole loop error[E0308]: mismatched types --> $DIR/issue-27042.rs:14:9 | -LL | / 'd: //~ ERROR mismatched types +LL | / 'd: LL | | while let Some(_) = None { break }; | |__________________________________________^ expected i32, found () | diff --git a/src/test/ui/issues/issue-27060-2.stderr b/src/test/ui/issues/issue-27060-2.stderr index b95c298b6e67..f7227c341014 100644 --- a/src/test/ui/issues/issue-27060-2.stderr +++ b/src/test/ui/issues/issue-27060-2.stderr @@ -1,7 +1,7 @@ error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/issue-27060-2.rs:3:5 | -LL | data: T, //~ ERROR the size for values of type +LL | data: T, | ^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `T` diff --git a/src/test/ui/issues/issue-27060.stderr b/src/test/ui/issues/issue-27060.stderr index 023f90eb9fea..bc44c1a4ac57 100644 --- a/src/test/ui/issues/issue-27060.stderr +++ b/src/test/ui/issues/issue-27060.stderr @@ -1,7 +1,7 @@ error: borrow of packed field is unsafe and requires unsafe function or block (error E0133) --> $DIR/issue-27060.rs:26:13 | -LL | let _ = &good.data; //~ ERROR borrow of packed field is unsafe +LL | let _ = &good.data; | ^^^^^^^^^^ | note: lint level defined here @@ -16,7 +16,7 @@ LL | #[deny(safe_packed_borrows)] error: borrow of packed field is unsafe and requires unsafe function or block (error E0133) --> $DIR/issue-27060.rs:28:13 | -LL | let _ = &good.data2[0]; //~ ERROR borrow of packed field is unsafe +LL | let _ = &good.data2[0]; | ^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/issues/issue-27340.stderr b/src/test/ui/issues/issue-27340.stderr index 634a31a89d55..05b213b293cb 100644 --- a/src/test/ui/issues/issue-27340.stderr +++ b/src/test/ui/issues/issue-27340.stderr @@ -3,7 +3,7 @@ error[E0204]: the trait `Copy` may not be implemented for this type | LL | #[derive(Copy, Clone)] | ^^^^ -LL | //~^ ERROR the trait `Copy` may not be implemented for this type +LL | LL | struct Bar(Foo); | --- this field does not implement `Copy` diff --git a/src/test/ui/issues/issue-27815.stderr b/src/test/ui/issues/issue-27815.stderr index fbddd3be9dce..43f78ccf6395 100644 --- a/src/test/ui/issues/issue-27815.stderr +++ b/src/test/ui/issues/issue-27815.stderr @@ -1,13 +1,13 @@ error[E0574]: expected struct, variant or union type, found module `A` --> $DIR/issue-27815.rs:4:13 | -LL | let u = A { x: 1 }; //~ ERROR expected struct, variant or union type, found module `A` +LL | let u = A { x: 1 }; | ^ not a struct, variant or union type error[E0574]: expected struct, variant or union type, found builtin type `u32` --> $DIR/issue-27815.rs:5:13 | -LL | let v = u32 { x: 1 }; //~ ERROR expected struct, variant or union type, found builtin type `u32` +LL | let v = u32 { x: 1 }; | ^^^ not a struct, variant or union type error[E0574]: expected struct, variant or union type, found module `A` diff --git a/src/test/ui/issues/issue-28105.stderr b/src/test/ui/issues/issue-28105.stderr index 900bc43bfc8a..0e1b90e65209 100644 --- a/src/test/ui/issues/issue-28105.stderr +++ b/src/test/ui/issues/issue-28105.stderr @@ -1,13 +1,13 @@ error[E0268]: `continue` outside of loop --> $DIR/issue-28105.rs:4:5 | -LL | continue //~ ERROR `continue` outside of loop +LL | continue | ^^^^^^^^ cannot break outside of a loop error[E0268]: `break` outside of loop --> $DIR/issue-28105.rs:6:5 | -LL | break //~ ERROR `break` outside of loop +LL | break | ^^^^^ cannot break outside of a loop error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-28109.stderr b/src/test/ui/issues/issue-28109.stderr index 91a829725643..0f918d3b6f70 100644 --- a/src/test/ui/issues/issue-28109.stderr +++ b/src/test/ui/issues/issue-28109.stderr @@ -1,13 +1,13 @@ error[E0426]: use of undeclared label `'b` --> $DIR/issue-28109.rs:6:9 | -LL | 'b //~ ERROR use of undeclared label +LL | 'b | ^^ undeclared label `'b` error[E0426]: use of undeclared label `'c` --> $DIR/issue-28109.rs:9:9 | -LL | 'c //~ ERROR use of undeclared label +LL | 'c | ^^ undeclared label `'c` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-28134.stderr b/src/test/ui/issues/issue-28134.stderr index 5b967b31c29e..b9189480048d 100644 --- a/src/test/ui/issues/issue-28134.stderr +++ b/src/test/ui/issues/issue-28134.stderr @@ -1,7 +1,7 @@ error: only functions may be used as tests --> $DIR/issue-28134.rs:3:1 | -LL | #![test] //~ ERROR only functions may be used as tests +LL | #![test] | ^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-2823.stderr b/src/test/ui/issues/issue-2823.stderr index b51ff611dbd7..4c1dfb8501a9 100644 --- a/src/test/ui/issues/issue-2823.stderr +++ b/src/test/ui/issues/issue-2823.stderr @@ -4,7 +4,7 @@ error[E0599]: no method named `clone` found for type `C` in the current scope LL | struct C { | -------- method `clone` not found for this ... -LL | let _d = c.clone(); //~ ERROR no method named `clone` found +LL | let _d = c.clone(); | ^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope diff --git a/src/test/ui/issues/issue-28388-1.stderr b/src/test/ui/issues/issue-28388-1.stderr index 6aabf6535120..7f5e47aa84fb 100644 --- a/src/test/ui/issues/issue-28388-1.stderr +++ b/src/test/ui/issues/issue-28388-1.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `foo` --> $DIR/issue-28388-1.rs:3:5 | -LL | use foo::{}; //~ ERROR unresolved import `foo` +LL | use foo::{}; | ^^^^^^^ no `foo` in the root error: aborting due to previous error diff --git a/src/test/ui/issues/issue-28472.stderr b/src/test/ui/issues/issue-28472.stderr index 8288a1d9bb78..92b598252bf7 100644 --- a/src/test/ui/issues/issue-28472.stderr +++ b/src/test/ui/issues/issue-28472.stderr @@ -4,7 +4,7 @@ error[E0428]: the name `foo` is defined multiple times LL | fn foo(); | --------- previous definition of the value `foo` here LL | -LL | / pub //~ ERROR the name `foo` is defined multiple times +LL | / pub LL | | fn foo(); | |___________^ `foo` redefined here | @@ -16,7 +16,7 @@ error[E0428]: the name `foo` is defined multiple times LL | fn foo(); | --------- previous definition of the value `foo` here ... -LL | / pub //~ ERROR the name `foo` is defined multiple times +LL | / pub LL | | static mut foo: u32; | |______________________^ `foo` redefined here | diff --git a/src/test/ui/issues/issue-2848.stderr b/src/test/ui/issues/issue-2848.stderr index d9466405dd2a..71ed7d70b5b8 100644 --- a/src/test/ui/issues/issue-2848.stderr +++ b/src/test/ui/issues/issue-2848.stderr @@ -1,7 +1,7 @@ error[E0408]: variable `beta` is not bound in all patterns --> $DIR/issue-2848.rs:14:7 | -LL | alpha | beta => {} //~ ERROR variable `beta` is not bound in all patterns +LL | alpha | beta => {} | ^^^^^ ---- variable not in all patterns | | | pattern doesn't bind `beta` diff --git a/src/test/ui/issues/issue-28576.stderr b/src/test/ui/issues/issue-28576.stderr index b04715f23f49..cf6174ba857b 100644 --- a/src/test/ui/issues/issue-28576.stderr +++ b/src/test/ui/issues/issue-28576.stderr @@ -1,7 +1,7 @@ error[E0038]: the trait `Bar` cannot be made into an object --> $DIR/issue-28576.rs:7:12 | -LL | / Bar //~ ERROR the trait `Bar` cannot be made into an object +LL | / Bar LL | | | |________________________^ the trait `Bar` cannot be made into an object | diff --git a/src/test/ui/issues/issue-28625.stderr b/src/test/ui/issues/issue-28625.stderr index 36cb47944f23..7ee0cd486707 100644 --- a/src/test/ui/issues/issue-28625.stderr +++ b/src/test/ui/issues/issue-28625.stderr @@ -1,7 +1,7 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/issue-28625.rs:12:14 | -LL | unsafe { std::mem::transmute(a) } //~ ERROR cannot transmute between types of different sizes +LL | unsafe { std::mem::transmute(a) } | ^^^^^^^^^^^^^^^^^^^ | = note: source type: `&ArrayPeano` (N bits) diff --git a/src/test/ui/issues/issue-28837.stderr b/src/test/ui/issues/issue-28837.stderr index 833493e5cda5..aeb25ce12867 100644 --- a/src/test/ui/issues/issue-28837.stderr +++ b/src/test/ui/issues/issue-28837.stderr @@ -1,7 +1,7 @@ error[E0369]: binary operation `+` cannot be applied to type `A` --> $DIR/issue-28837.rs:6:5 | -LL | a + a; //~ ERROR binary operation `+` cannot be applied to type `A` +LL | a + a; | ^^^^^ | = note: an implementation of `std::ops::Add` might be missing for `A` @@ -9,7 +9,7 @@ LL | a + a; //~ ERROR binary operation `+` cannot be applied to type `A` error[E0369]: binary operation `-` cannot be applied to type `A` --> $DIR/issue-28837.rs:8:5 | -LL | a - a; //~ ERROR binary operation `-` cannot be applied to type `A` +LL | a - a; | ^^^^^ | = note: an implementation of `std::ops::Sub` might be missing for `A` @@ -17,7 +17,7 @@ LL | a - a; //~ ERROR binary operation `-` cannot be applied to type `A` error[E0369]: binary operation `*` cannot be applied to type `A` --> $DIR/issue-28837.rs:10:5 | -LL | a * a; //~ ERROR binary operation `*` cannot be applied to type `A` +LL | a * a; | ^^^^^ | = note: an implementation of `std::ops::Mul` might be missing for `A` @@ -25,7 +25,7 @@ LL | a * a; //~ ERROR binary operation `*` cannot be applied to type `A` error[E0369]: binary operation `/` cannot be applied to type `A` --> $DIR/issue-28837.rs:12:5 | -LL | a / a; //~ ERROR binary operation `/` cannot be applied to type `A` +LL | a / a; | ^^^^^ | = note: an implementation of `std::ops::Div` might be missing for `A` @@ -33,7 +33,7 @@ LL | a / a; //~ ERROR binary operation `/` cannot be applied to type `A` error[E0369]: binary operation `%` cannot be applied to type `A` --> $DIR/issue-28837.rs:14:5 | -LL | a % a; //~ ERROR binary operation `%` cannot be applied to type `A` +LL | a % a; | ^^^^^ | = note: an implementation of `std::ops::Rem` might be missing for `A` @@ -41,7 +41,7 @@ LL | a % a; //~ ERROR binary operation `%` cannot be applied to type `A` error[E0369]: binary operation `&` cannot be applied to type `A` --> $DIR/issue-28837.rs:16:5 | -LL | a & a; //~ ERROR binary operation `&` cannot be applied to type `A` +LL | a & a; | ^^^^^ | = note: an implementation of `std::ops::BitAnd` might be missing for `A` @@ -49,7 +49,7 @@ LL | a & a; //~ ERROR binary operation `&` cannot be applied to type `A` error[E0369]: binary operation `|` cannot be applied to type `A` --> $DIR/issue-28837.rs:18:5 | -LL | a | a; //~ ERROR binary operation `|` cannot be applied to type `A` +LL | a | a; | ^^^^^ | = note: an implementation of `std::ops::BitOr` might be missing for `A` @@ -57,7 +57,7 @@ LL | a | a; //~ ERROR binary operation `|` cannot be applied to type `A` error[E0369]: binary operation `<<` cannot be applied to type `A` --> $DIR/issue-28837.rs:20:5 | -LL | a << a; //~ ERROR binary operation `<<` cannot be applied to type `A` +LL | a << a; | ^^^^^^ | = note: an implementation of `std::ops::Shl` might be missing for `A` @@ -65,7 +65,7 @@ LL | a << a; //~ ERROR binary operation `<<` cannot be applied to type `A` error[E0369]: binary operation `>>` cannot be applied to type `A` --> $DIR/issue-28837.rs:22:5 | -LL | a >> a; //~ ERROR binary operation `>>` cannot be applied to type `A` +LL | a >> a; | ^^^^^^ | = note: an implementation of `std::ops::Shr` might be missing for `A` @@ -73,7 +73,7 @@ LL | a >> a; //~ ERROR binary operation `>>` cannot be applied to type `A` error[E0369]: binary operation `==` cannot be applied to type `A` --> $DIR/issue-28837.rs:24:5 | -LL | a == a; //~ ERROR binary operation `==` cannot be applied to type `A` +LL | a == a; | ^^^^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `A` @@ -81,7 +81,7 @@ LL | a == a; //~ ERROR binary operation `==` cannot be applied to type `A` error[E0369]: binary operation `!=` cannot be applied to type `A` --> $DIR/issue-28837.rs:26:5 | -LL | a != a; //~ ERROR binary operation `!=` cannot be applied to type `A` +LL | a != a; | ^^^^^^ | = note: an implementation of `std::cmp::PartialEq` might be missing for `A` @@ -89,7 +89,7 @@ LL | a != a; //~ ERROR binary operation `!=` cannot be applied to type `A` error[E0369]: binary operation `<` cannot be applied to type `A` --> $DIR/issue-28837.rs:28:5 | -LL | a < a; //~ ERROR binary operation `<` cannot be applied to type `A` +LL | a < a; | ^^^^^ | = note: an implementation of `std::cmp::PartialOrd` might be missing for `A` @@ -97,7 +97,7 @@ LL | a < a; //~ ERROR binary operation `<` cannot be applied to type `A` error[E0369]: binary operation `<=` cannot be applied to type `A` --> $DIR/issue-28837.rs:30:5 | -LL | a <= a; //~ ERROR binary operation `<=` cannot be applied to type `A` +LL | a <= a; | ^^^^^^ | = note: an implementation of `std::cmp::PartialOrd` might be missing for `A` @@ -105,7 +105,7 @@ LL | a <= a; //~ ERROR binary operation `<=` cannot be applied to type `A` error[E0369]: binary operation `>` cannot be applied to type `A` --> $DIR/issue-28837.rs:32:5 | -LL | a > a; //~ ERROR binary operation `>` cannot be applied to type `A` +LL | a > a; | ^^^^^ | = note: an implementation of `std::cmp::PartialOrd` might be missing for `A` @@ -113,7 +113,7 @@ LL | a > a; //~ ERROR binary operation `>` cannot be applied to type `A` error[E0369]: binary operation `>=` cannot be applied to type `A` --> $DIR/issue-28837.rs:34:5 | -LL | a >= a; //~ ERROR binary operation `>=` cannot be applied to type `A` +LL | a >= a; | ^^^^^^ | = note: an implementation of `std::cmp::PartialOrd` might be missing for `A` diff --git a/src/test/ui/issues/issue-28848.stderr b/src/test/ui/issues/issue-28848.stderr index d9cdccac9fca..5f0f202c0b27 100644 --- a/src/test/ui/issues/issue-28848.stderr +++ b/src/test/ui/issues/issue-28848.stderr @@ -1,7 +1,7 @@ error[E0478]: lifetime bound not satisfied --> $DIR/issue-28848.rs:10:5 | -LL | Foo::<'a, 'b>::xmute(u) //~ ERROR lifetime bound not satisfied +LL | Foo::<'a, 'b>::xmute(u) | ^^^^^^^^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime 'b as defined on the function body at 9:16 diff --git a/src/test/ui/issues/issue-28992-empty.stderr b/src/test/ui/issues/issue-28992-empty.stderr index 1eb1c67d106c..68be37252cb5 100644 --- a/src/test/ui/issues/issue-28992-empty.stderr +++ b/src/test/ui/issues/issue-28992-empty.stderr @@ -1,7 +1,7 @@ error[E0532]: expected tuple struct/variant, found constant `C1` --> $DIR/issue-28992-empty.rs:13:12 | -LL | if let C1(..) = 0 {} //~ ERROR expected tuple struct/variant, found constant `C1` +LL | if let C1(..) = 0 {} | ^^ not a tuple struct/variant error[E0164]: expected tuple struct/variant, found associated constant `::C2` diff --git a/src/test/ui/issues/issue-29147.stderr b/src/test/ui/issues/issue-29147.stderr index c6d850925ec6..3b42186b2513 100644 --- a/src/test/ui/issues/issue-29147.stderr +++ b/src/test/ui/issues/issue-29147.stderr @@ -1,7 +1,7 @@ error[E0283]: type annotations required: cannot resolve `S5<_>: Foo` --> $DIR/issue-29147.rs:21:13 | -LL | let _ = >::xxx; //~ ERROR cannot resolve `S5<_>: Foo` +LL | let _ = >::xxx; | ^^^^^^^^^^^^ | note: required by `Foo::xxx` diff --git a/src/test/ui/issues/issue-29161.stderr b/src/test/ui/issues/issue-29161.stderr index e0215157b369..50c257ad6f17 100644 --- a/src/test/ui/issues/issue-29161.stderr +++ b/src/test/ui/issues/issue-29161.stderr @@ -1,7 +1,7 @@ error[E0449]: unnecessary visibility qualifier --> $DIR/issue-29161.rs:5:9 | -LL | pub fn default() -> A { //~ ERROR unnecessary visibility qualifier +LL | pub fn default() -> A { | ^^^ `pub` not permitted here because it's implied error[E0603]: struct `A` is private diff --git a/src/test/ui/issues/issue-29181.stderr b/src/test/ui/issues/issue-29181.stderr index b277753608a1..092014281546 100644 --- a/src/test/ui/issues/issue-29181.stderr +++ b/src/test/ui/issues/issue-29181.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `homura` found for type `{integer}` in the current scope --> $DIR/issue-29181.rs:6:7 | -LL | 0.homura(); //~ ERROR no method named `homura` found +LL | 0.homura(); | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-29184.stderr b/src/test/ui/issues/issue-29184.stderr index 6c1eeb9c0dc8..87d3632ee42e 100644 --- a/src/test/ui/issues/issue-29184.stderr +++ b/src/test/ui/issues/issue-29184.stderr @@ -1,7 +1,7 @@ error[E0516]: `typeof` is a reserved keyword but unimplemented --> $DIR/issue-29184.rs:2:12 | -LL | let x: typeof(92) = 92; //~ ERROR `typeof` is a reserved keyword +LL | let x: typeof(92) = 92; | ^^^^^^^^^^ reserved keyword error: aborting due to previous error diff --git a/src/test/ui/issues/issue-2937.stderr b/src/test/ui/issues/issue-2937.stderr index e63ee42d99c0..428634828f9b 100644 --- a/src/test/ui/issues/issue-2937.stderr +++ b/src/test/ui/issues/issue-2937.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `m::f` --> $DIR/issue-2937.rs:1:5 | -LL | use m::f as x; //~ ERROR unresolved import `m::f` [E0432] +LL | use m::f as x; | ^^^^^^^^^ no `f` in `m` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-2995.stderr b/src/test/ui/issues/issue-2995.stderr index 68cb283e453d..c316780d5f6a 100644 --- a/src/test/ui/issues/issue-2995.stderr +++ b/src/test/ui/issues/issue-2995.stderr @@ -1,7 +1,7 @@ error[E0605]: non-primitive cast: `*const isize` as `&isize` --> $DIR/issue-2995.rs:2:22 | -LL | let _q: &isize = p as &isize; //~ ERROR non-primitive cast +LL | let _q: &isize = p as &isize; | ^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait diff --git a/src/test/ui/issues/issue-30007.stderr b/src/test/ui/issues/issue-30007.stderr index fb069e8ff989..87e770e1543d 100644 --- a/src/test/ui/issues/issue-30007.stderr +++ b/src/test/ui/issues/issue-30007.stderr @@ -1,7 +1,7 @@ error: macro expansion ignores token `;` and any following --> $DIR/issue-30007.rs:2:20 | -LL | () => ( String ; ); //~ ERROR macro expansion ignores token `;` +LL | () => ( String ; ); | ^ ... LL | let i: Vec; diff --git a/src/test/ui/issues/issue-30079.stderr b/src/test/ui/issues/issue-30079.stderr index b62482add304..57ca57215448 100644 --- a/src/test/ui/issues/issue-30079.stderr +++ b/src/test/ui/issues/issue-30079.stderr @@ -1,7 +1,7 @@ warning: private type `m1::Priv` in public interface (error E0446) --> $DIR/issue-30079.rs:6:9 | -LL | pub fn f(_: Priv) {} //~ WARN private type `m1::Priv` in public interface +LL | pub fn f(_: Priv) {} | ^^^^^^^^^^^^^^^^^^^^ | = note: #[warn(private_in_public)] on by default @@ -14,7 +14,7 @@ error[E0446]: private type `m2::Priv` in public interface LL | struct Priv; | - `m2::Priv` declared as private LL | impl ::std::ops::Deref for ::SemiPriv { -LL | type Target = Priv; //~ ERROR private type `m2::Priv` in public interface +LL | type Target = Priv; | ^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `m3::Priv` in public interface @@ -23,7 +23,7 @@ error[E0446]: private type `m3::Priv` in public interface LL | struct Priv; | - `m3::Priv` declared as private LL | impl ::SemiPrivTrait for () { -LL | type Assoc = Priv; //~ ERROR private type `m3::Priv` in public interface +LL | type Assoc = Priv; | ^^^^^^^^^^^^^^^^^^ can't leak private type error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-3021-b.stderr b/src/test/ui/issues/issue-3021-b.stderr index 375da43c1973..72289c5f9c34 100644 --- a/src/test/ui/issues/issue-3021-b.stderr +++ b/src/test/ui/issues/issue-3021-b.stderr @@ -1,7 +1,7 @@ error[E0434]: can't capture dynamic environment in a fn item --> $DIR/issue-3021-b.rs:9:22 | -LL | self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment +LL | self.v0 = k0 ^ 0x736f6d6570736575; | ^^ | = help: use the `|| { ... }` closure form instead diff --git a/src/test/ui/issues/issue-3021-c.stderr b/src/test/ui/issues/issue-3021-c.stderr index 5eadf7837c7d..cef30acd6023 100644 --- a/src/test/ui/issues/issue-3021-c.stderr +++ b/src/test/ui/issues/issue-3021-c.stderr @@ -4,7 +4,7 @@ error[E0401]: can't use generic parameters from outer function LL | fn siphash() { | - type variable from outer function ... -LL | fn g(&self, x: T) -> T; //~ ERROR can't use generic parameters from outer function +LL | fn g(&self, x: T) -> T; | - ^ use of generic parameter from outer function | | | help: try using a local generic parameter instead: `g` @@ -15,7 +15,7 @@ error[E0401]: can't use generic parameters from outer function LL | fn siphash() { | - type variable from outer function ... -LL | fn g(&self, x: T) -> T; //~ ERROR can't use generic parameters from outer function +LL | fn g(&self, x: T) -> T; | - ^ use of generic parameter from outer function | | | help: try using a local generic parameter instead: `g` diff --git a/src/test/ui/issues/issue-3021-d.stderr b/src/test/ui/issues/issue-3021-d.stderr index ffefab19725f..39e6e8c43e94 100644 --- a/src/test/ui/issues/issue-3021-d.stderr +++ b/src/test/ui/issues/issue-3021-d.stderr @@ -1,7 +1,7 @@ error[E0434]: can't capture dynamic environment in a fn item --> $DIR/issue-3021-d.rs:21:23 | -LL | self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment +LL | self.v0 = k0 ^ 0x736f6d6570736575; | ^^ | = help: use the `|| { ... }` closure form instead @@ -9,7 +9,7 @@ LL | self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dyna error[E0434]: can't capture dynamic environment in a fn item --> $DIR/issue-3021-d.rs:22:23 | -LL | self.v1 = k1 ^ 0x646f72616e646f6d; //~ ERROR can't capture dynamic environment +LL | self.v1 = k1 ^ 0x646f72616e646f6d; | ^^ | = help: use the `|| { ... }` closure form instead diff --git a/src/test/ui/issues/issue-3021.stderr b/src/test/ui/issues/issue-3021.stderr index 38c5bd2b94af..d5b015eec350 100644 --- a/src/test/ui/issues/issue-3021.stderr +++ b/src/test/ui/issues/issue-3021.stderr @@ -1,7 +1,7 @@ error[E0434]: can't capture dynamic environment in a fn item --> $DIR/issue-3021.rs:12:22 | -LL | self.v0 = k0 ^ 0x736f6d6570736575; //~ ERROR can't capture dynamic environment +LL | self.v0 = k0 ^ 0x736f6d6570736575; | ^^ | = help: use the `|| { ... }` closure form instead diff --git a/src/test/ui/issues/issue-30236.stderr b/src/test/ui/issues/issue-30236.stderr index e60babd9559e..64cbd58d6954 100644 --- a/src/test/ui/issues/issue-30236.stderr +++ b/src/test/ui/issues/issue-30236.stderr @@ -1,7 +1,7 @@ error[E0091]: type parameter `Unused` is unused --> $DIR/issue-30236.rs:2:5 | -LL | Unused //~ ERROR type parameter `Unused` is unused +LL | Unused | ^^^^^^ unused type parameter error: aborting due to previous error diff --git a/src/test/ui/issues/issue-30240-b.stderr b/src/test/ui/issues/issue-30240-b.stderr index 5613a18f404a..e0dd4794db59 100644 --- a/src/test/ui/issues/issue-30240-b.stderr +++ b/src/test/ui/issues/issue-30240-b.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/issue-30240-b.rs:12:9 | -LL | "hello" => {} //~ ERROR unreachable pattern +LL | "hello" => {} | ^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/issues/issue-30240.stderr b/src/test/ui/issues/issue-30240.stderr index 973c59c58526..8b683b4af65c 100644 --- a/src/test/ui/issues/issue-30240.stderr +++ b/src/test/ui/issues/issue-30240.stderr @@ -1,14 +1,18 @@ error[E0004]: non-exhaustive patterns: `&_` not covered --> $DIR/issue-30240.rs:2:11 | -LL | match "world" { //~ ERROR non-exhaustive patterns: `&_` +LL | match "world" { | ^^^^^^^ pattern `&_` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `&_` not covered --> $DIR/issue-30240.rs:6:11 | -LL | match "world" { //~ ERROR non-exhaustive patterns: `&_` +LL | match "world" { | ^^^^^^^ pattern `&_` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-30302.stderr b/src/test/ui/issues/issue-30302.stderr index 193a8c4916c6..d762d6f2b3d5 100644 --- a/src/test/ui/issues/issue-30302.stderr +++ b/src/test/ui/issues/issue-30302.stderr @@ -9,7 +9,7 @@ error: unreachable pattern | LL | Nil => true, | --- matches any value -LL | //~^ WARN pattern binding `Nil` is named the same as one of the variants of the type `Stack` +LL | LL | _ => false | ^ unreachable pattern | diff --git a/src/test/ui/issues/issue-3038.stderr b/src/test/ui/issues/issue-3038.stderr index 8638c1965240..210da2ceff9b 100644 --- a/src/test/ui/issues/issue-3038.stderr +++ b/src/test/ui/issues/issue-3038.stderr @@ -13,7 +13,7 @@ LL | H::I(J::L(x, _), K::M(_, x)) error[E0416]: identifier `x` is bound more than once in the same pattern --> $DIR/issue-3038.rs:23:13 | -LL | (x, x) => { x } //~ ERROR identifier `x` is bound more than once in the same pattern +LL | (x, x) => { x } | ^ used in a pattern more than once error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-30438-a.stderr b/src/test/ui/issues/issue-30438-a.stderr index 94aca7f03199..89f8e623dc47 100644 --- a/src/test/ui/issues/issue-30438-a.stderr +++ b/src/test/ui/issues/issue-30438-a.stderr @@ -11,7 +11,7 @@ note: borrowed value must be valid for the anonymous lifetime #1 defined on the | LL | / fn index(&self, _: usize) -> &Self::Output { LL | | return &Test { s: &self.s}; -LL | | //~^ ERROR: borrowed value does not live long enough +LL | | LL | | } | |_____^ = note: consider using a `let` binding to increase its lifetime diff --git a/src/test/ui/issues/issue-30438-b.stderr b/src/test/ui/issues/issue-30438-b.stderr index b99801dad81d..49208ed696ae 100644 --- a/src/test/ui/issues/issue-30438-b.stderr +++ b/src/test/ui/issues/issue-30438-b.stderr @@ -3,7 +3,7 @@ error[E0597]: borrowed value does not live long enough | LL | &Test { s: &self.s} | ^^^^^^^^^^^^^^^^^^ temporary value does not live long enough -LL | //~^ ERROR: borrowed value does not live long enough +LL | LL | } | - temporary value only lives until here | @@ -12,7 +12,7 @@ note: borrowed value must be valid for the anonymous lifetime #1 defined on the | LL | / fn index(&self, _: usize) -> &Self::Output { LL | | &Test { s: &self.s} -LL | | //~^ ERROR: borrowed value does not live long enough +LL | | LL | | } | |_____^ diff --git a/src/test/ui/issues/issue-30438-c.stderr b/src/test/ui/issues/issue-30438-c.stderr index 71c2ed9dfc93..a003e27f055e 100644 --- a/src/test/ui/issues/issue-30438-c.stderr +++ b/src/test/ui/issues/issue-30438-c.stderr @@ -3,7 +3,7 @@ error[E0597]: `x` does not live long enough | LL | &x | ^ borrowed value does not live long enough -LL | //~^ ERROR: `x` does not live long enough +LL | LL | } | - borrowed value only lives until here | diff --git a/src/test/ui/issues/issue-30535.stderr b/src/test/ui/issues/issue-30535.stderr index b93ed8d9c2aa..e3692934b62a 100644 --- a/src/test/ui/issues/issue-30535.stderr +++ b/src/test/ui/issues/issue-30535.stderr @@ -1,7 +1,7 @@ error[E0573]: expected type, found variant `foo::Foo::FooV` --> $DIR/issue-30535.rs:6:8 | -LL | _: foo::Foo::FooV //~ ERROR expected type, found variant `foo::Foo::FooV` +LL | _: foo::Foo::FooV | ^^^^^^^^^^^^^^ | | | not a type diff --git a/src/test/ui/issues/issue-30560.stderr b/src/test/ui/issues/issue-30560.stderr index 27fa9e16bf24..5225f190f9ed 100644 --- a/src/test/ui/issues/issue-30560.stderr +++ b/src/test/ui/issues/issue-30560.stderr @@ -1,7 +1,7 @@ error: items in traits are not importable. --> $DIR/issue-30560.rs:10:5 | -LL | use T::*; //~ ERROR items in traits are not importable +LL | use T::*; | ^^^^ error[E0432]: unresolved import `Alias` diff --git a/src/test/ui/issues/issue-30589.stderr b/src/test/ui/issues/issue-30589.stderr index 17ba4051fb4e..4b88547a1aff 100644 --- a/src/test/ui/issues/issue-30589.stderr +++ b/src/test/ui/issues/issue-30589.stderr @@ -1,7 +1,7 @@ error[E0412]: cannot find type `DecoderError` in this scope --> $DIR/issue-30589.rs:3:23 | -LL | impl fmt::Display for DecoderError { //~ ERROR cannot find type `DecoderError` in this scope +LL | impl fmt::Display for DecoderError { | ^^^^^^^^^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/issues/issue-3080.stderr b/src/test/ui/issues/issue-3080.stderr index 44f16c708e0f..138d6df679fc 100644 --- a/src/test/ui/issues/issue-3080.stderr +++ b/src/test/ui/issues/issue-3080.stderr @@ -1,7 +1,7 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block --> $DIR/issue-3080.rs:7:5 | -LL | X(()).with(); //~ ERROR requires unsafe function or block +LL | X(()).with(); | ^^^^^^^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior diff --git a/src/test/ui/issues/issue-3096-1.stderr b/src/test/ui/issues/issue-3096-1.stderr index 7ced0d36805d..c5a7fa7e0eb8 100644 --- a/src/test/ui/issues/issue-3096-1.stderr +++ b/src/test/ui/issues/issue-3096-1.stderr @@ -1,14 +1,10 @@ error[E0004]: non-exhaustive patterns: type `()` is non-empty --> $DIR/issue-3096-1.rs:2:11 | -LL | match () { } //~ ERROR non-exhaustive +LL | match () { } | ^^ | -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - --> $DIR/issue-3096-1.rs:2:11 - | -LL | match () { } //~ ERROR non-exhaustive - | ^^ + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/issues/issue-3096-2.stderr b/src/test/ui/issues/issue-3096-2.stderr index df8767944895..6f2e0e760d7f 100644 --- a/src/test/ui/issues/issue-3096-2.stderr +++ b/src/test/ui/issues/issue-3096-2.stderr @@ -1,14 +1,10 @@ error[E0004]: non-exhaustive patterns: type `*const Bottom` is non-empty --> $DIR/issue-3096-2.rs:5:11 | -LL | match x { } //~ ERROR non-exhaustive patterns +LL | match x { } | ^ | -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - --> $DIR/issue-3096-2.rs:5:11 - | -LL | match x { } //~ ERROR non-exhaustive patterns - | ^ + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/issues/issue-3099-a.stderr b/src/test/ui/issues/issue-3099-a.stderr index d3da944cb533..d6e0a799921f 100644 --- a/src/test/ui/issues/issue-3099-a.stderr +++ b/src/test/ui/issues/issue-3099-a.stderr @@ -4,7 +4,7 @@ error[E0428]: the name `A` is defined multiple times LL | enum A { B, C } | ------ previous definition of the type `A` here LL | -LL | enum A { D, E } //~ ERROR the name `A` is defined multiple times +LL | enum A { D, E } | ^^^^^^ `A` redefined here | = note: `A` must be defined only once in the type namespace of this module diff --git a/src/test/ui/issues/issue-3099-b.stderr b/src/test/ui/issues/issue-3099-b.stderr index cc49325805e3..3ba8b189da67 100644 --- a/src/test/ui/issues/issue-3099-b.stderr +++ b/src/test/ui/issues/issue-3099-b.stderr @@ -4,7 +4,7 @@ error[E0428]: the name `a` is defined multiple times LL | pub mod a {} | --------- previous definition of the module `a` here LL | -LL | pub mod a {} //~ ERROR the name `a` is defined multiple times +LL | pub mod a {} | ^^^^^^^^^ `a` redefined here | = note: `a` must be defined only once in the type namespace of this module diff --git a/src/test/ui/issues/issue-3099.stderr b/src/test/ui/issues/issue-3099.stderr index a650d3caa640..32ee2e1d2073 100644 --- a/src/test/ui/issues/issue-3099.stderr +++ b/src/test/ui/issues/issue-3099.stderr @@ -4,7 +4,7 @@ error[E0428]: the name `a` is defined multiple times LL | fn a(x: String) -> String { | ------------------------- previous definition of the value `a` here ... -LL | fn a(x: String, y: String) -> String { //~ ERROR the name `a` is defined multiple times +LL | fn a(x: String, y: String) -> String { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `a` redefined here | = note: `a` must be defined only once in the value namespace of this module diff --git a/src/test/ui/issues/issue-31173.stderr b/src/test/ui/issues/issue-31173.stderr index 76f245a22cf8..d5f8cc8f8390 100644 --- a/src/test/ui/issues/issue-31173.stderr +++ b/src/test/ui/issues/issue-31173.stderr @@ -10,7 +10,7 @@ LL | .cloned() error[E0599]: no method named `collect` found for type `std::iter::Cloned, [closure@$DIR/issue-31173.rs:6:39: 9:6 found_e:_]>>` in the current scope --> $DIR/issue-31173.rs:14:10 | -LL | .collect(); //~ ERROR no method named `collect` +LL | .collect(); | ^^^^^^^ | = note: the method `collect` exists but the following trait bounds were not satisfied: diff --git a/src/test/ui/issues/issue-31212.stderr b/src/test/ui/issues/issue-31212.stderr index d964b702f221..5daf900c31ff 100644 --- a/src/test/ui/issues/issue-31212.stderr +++ b/src/test/ui/issues/issue-31212.stderr @@ -1,13 +1,13 @@ error[E0432]: unresolved import `self::*` --> $DIR/issue-31212.rs:5:13 | -LL | pub use self::*; //~ ERROR unresolved - | ^^^^^^^ Cannot glob-import a module into itself. +LL | pub use self::*; + | ^^^^^^^ cannot glob-import a module into itself error[E0425]: cannot find function `f` in module `foo` --> $DIR/issue-31212.rs:9:10 | -LL | foo::f(); //~ ERROR cannot find function `f` in module `foo` +LL | foo::f(); | ^ not found in `foo` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-3154.stderr b/src/test/ui/issues/issue-3154.stderr index 6f3b37a8a3fa..da2af83ff03c 100644 --- a/src/test/ui/issues/issue-3154.stderr +++ b/src/test/ui/issues/issue-3154.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `x` | LL | fn thing<'a,Q>(x: &Q) -> Thing<'a,Q> { | -- help: add explicit lifetime `'a` to the type of `x`: `&'a Q` -LL | Thing { x: x } //~ ERROR explicit lifetime required in the type of `x` [E0621] +LL | Thing { x: x } | ^^^^^^^^^^^^^^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/issues/issue-31561.stderr b/src/test/ui/issues/issue-31561.stderr index c95fc36cea6e..246137aeee05 100644 --- a/src/test/ui/issues/issue-31561.stderr +++ b/src/test/ui/issues/issue-31561.stderr @@ -1,8 +1,15 @@ error[E0005]: refutable pattern in local binding: `Bar` not covered --> $DIR/issue-31561.rs:8:9 | -LL | let Thing::Foo(y) = Thing::Foo(1); - | ^^^^^^^^^^^^^ pattern `Bar` not covered +LL | / enum Thing { +LL | | Foo(u8), +LL | | Bar, +LL | | Baz +LL | | } + | |_- `Thing` defined here +... +LL | let Thing::Foo(y) = Thing::Foo(1); + | ^^^^^^^^^^^^^ pattern `Bar` not covered error: aborting due to previous error diff --git a/src/test/ui/issues/issue-31769.stderr b/src/test/ui/issues/issue-31769.stderr index 7e5e5673bafc..29fcefc08037 100644 --- a/src/test/ui/issues/issue-31769.stderr +++ b/src/test/ui/issues/issue-31769.stderr @@ -1,13 +1,13 @@ error[E0518]: attribute should be applied to function or closure --> $DIR/issue-31769.rs:2:5 | -LL | #[inline] struct Foo; //~ ERROR attribute should be applied to function or closure +LL | #[inline] struct Foo; | ^^^^^^^^^ ----------- not a function or closure error[E0517]: attribute should be applied to struct, enum or union --> $DIR/issue-31769.rs:3:12 | -LL | #[repr(C)] fn foo() {} //~ ERROR attribute should be applied to struct, enum or union +LL | #[repr(C)] fn foo() {} | ^ ----------- not a struct, enum or union error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-31804.stderr b/src/test/ui/issues/issue-31804.stderr index 67e2f2bf2ecf..76e68b0b3524 100644 --- a/src/test/ui/issues/issue-31804.stderr +++ b/src/test/ui/issues/issue-31804.stderr @@ -1,7 +1,7 @@ error: expected pattern, found `}` --> $DIR/issue-31804.rs:6:1 | -LL | } //~ ERROR expected pattern, found `}` +LL | } | ^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/issues/issue-31845.stderr b/src/test/ui/issues/issue-31845.stderr index 7ee1a41a3870..10cb398cb24f 100644 --- a/src/test/ui/issues/issue-31845.stderr +++ b/src/test/ui/issues/issue-31845.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find function `g` in this scope --> $DIR/issue-31845.rs:7:12 | -LL | g(); //~ ERROR cannot find function `g` in this scope +LL | g(); | ^ help: a function with a similar name exists: `h` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-32086.stderr b/src/test/ui/issues/issue-32086.stderr index bb2cc7c101b7..b5a120c4b9ce 100644 --- a/src/test/ui/issues/issue-32086.stderr +++ b/src/test/ui/issues/issue-32086.stderr @@ -1,13 +1,13 @@ error[E0532]: expected tuple struct/variant, found constant `C` --> $DIR/issue-32086.rs:5:9 | -LL | let C(a) = S(11); //~ ERROR expected tuple struct/variant, found constant `C` +LL | let C(a) = S(11); | ^ help: a tuple struct with a similar name exists: `S` error[E0532]: expected tuple struct/variant, found constant `C` --> $DIR/issue-32086.rs:6:9 | -LL | let C(..) = S(11); //~ ERROR expected tuple struct/variant, found constant `C` +LL | let C(..) = S(11); | ^ help: a tuple struct with a similar name exists: `S` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-3214.stderr b/src/test/ui/issues/issue-3214.stderr index e6526bad3e0d..9c2585688e96 100644 --- a/src/test/ui/issues/issue-3214.stderr +++ b/src/test/ui/issues/issue-3214.stderr @@ -6,7 +6,7 @@ LL | fn foo() { | | | try adding a local generic parameter in this method instead LL | struct Foo { -LL | x: T, //~ ERROR can't use generic parameters from outer function +LL | x: T, | ^ use of generic parameter from outer function error[E0107]: wrong number of type arguments: expected 0, found 1 diff --git a/src/test/ui/issues/issue-32326.stderr b/src/test/ui/issues/issue-32326.stderr index 0f56e94bd196..5967627e51a4 100644 --- a/src/test/ui/issues/issue-32326.stderr +++ b/src/test/ui/issues/issue-32326.stderr @@ -1,7 +1,7 @@ error[E0072]: recursive type `Expr` has infinite size --> $DIR/issue-32326.rs:5:1 | -LL | enum Expr { //~ ERROR E0072 +LL | enum Expr { | ^^^^^^^^^ recursive type has infinite size LL | Plus(Expr, Expr), | ---- ---- recursive without indirection diff --git a/src/test/ui/issues/issue-32354-suggest-import-rename.stderr b/src/test/ui/issues/issue-32354-suggest-import-rename.stderr index 9e115143fbd2..96684309a008 100644 --- a/src/test/ui/issues/issue-32354-suggest-import-rename.stderr +++ b/src/test/ui/issues/issue-32354-suggest-import-rename.stderr @@ -3,13 +3,13 @@ error[E0252]: the name `ConstructorExtension` is defined multiple times | LL | use extension1::ConstructorExtension; | -------------------------------- previous import of the trait `ConstructorExtension` here -LL | use extension2::ConstructorExtension; //~ ERROR is defined multiple times +LL | use extension2::ConstructorExtension; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ConstructorExtension` reimported here | = note: `ConstructorExtension` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use extension2::ConstructorExtension as OtherConstructorExtension; //~ ERROR is defined multiple times +LL | use extension2::ConstructorExtension as OtherConstructorExtension; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-32655.stderr b/src/test/ui/issues/issue-32655.stderr index ae0cf49a7911..7b3c8e75beb2 100644 --- a/src/test/ui/issues/issue-32655.stderr +++ b/src/test/ui/issues/issue-32655.stderr @@ -1,7 +1,7 @@ error[E0658]: The attribute `derive_Clone` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/issue-32655.rs:6:11 | -LL | #[derive_Clone] //~ ERROR attribute `derive_Clone` is currently unknown +LL | #[derive_Clone] | ^^^^^^^^^^^^ ... LL | foo!(); @@ -12,7 +12,7 @@ LL | foo!(); error[E0658]: The attribute `derive_Clone` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/issue-32655.rs:18:7 | -LL | #[derive_Clone] //~ ERROR attribute `derive_Clone` is currently unknown +LL | #[derive_Clone] | ^^^^^^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable diff --git a/src/test/ui/issues/issue-32709.stderr b/src/test/ui/issues/issue-32709.stderr index 9161e64ef0a8..9127c7546582 100644 --- a/src/test/ui/issues/issue-32709.stderr +++ b/src/test/ui/issues/issue-32709.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `(): std::convert::From<{integer}>` is not satisfied --> $DIR/issue-32709.rs:4:5 | -LL | Err(5)?; //~ ERROR +LL | Err(5)?; | ^^^^^^^ the trait `std::convert::From<{integer}>` is not implemented for `()` | = note: required by `std::convert::From::from` diff --git a/src/test/ui/issues/issue-32782.stderr b/src/test/ui/issues/issue-32782.stderr index 5d583ee843f6..886f5297156f 100644 --- a/src/test/ui/issues/issue-32782.stderr +++ b/src/test/ui/issues/issue-32782.stderr @@ -1,7 +1,7 @@ error[E0658]: allow_internal_unstable side-steps feature gating and stability checks --> $DIR/issue-32782.rs:7:9 | -LL | #[allow_internal_unstable] //~ ERROR allow_internal_unstable side-steps +LL | #[allow_internal_unstable] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | foo!(); diff --git a/src/test/ui/issues/issue-32833.stderr b/src/test/ui/issues/issue-32833.stderr index c7f0eb1a4329..430cc0fda26d 100644 --- a/src/test/ui/issues/issue-32833.stderr +++ b/src/test/ui/issues/issue-32833.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `bar::Foo` --> $DIR/issue-32833.rs:1:5 | -LL | use bar::Foo; //~ ERROR unresolved import `bar::Foo` [E0432] +LL | use bar::Foo; | ^^^^^^^^ no `Foo` in `bar` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-32950.stderr b/src/test/ui/issues/issue-32950.stderr index 13aed4a1756b..3cdf35af1d86 100644 --- a/src/test/ui/issues/issue-32950.stderr +++ b/src/test/ui/issues/issue-32950.stderr @@ -1,13 +1,13 @@ error: `derive` cannot be used on items with type macros --> $DIR/issue-32950.rs:5:5 | -LL | concat_idents!(Foo, Bar) //~ ERROR `derive` cannot be used on items with type macros +LL | concat_idents!(Foo, Bar) | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0412]: cannot find type `FooBar` in this scope --> $DIR/issue-32950.rs:5:5 | -LL | concat_idents!(Foo, Bar) //~ ERROR `derive` cannot be used on items with type macros +LL | concat_idents!(Foo, Bar) | ^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-33140.stderr b/src/test/ui/issues/issue-33140.stderr index e2631e971c51..43065a2e2d48 100644 --- a/src/test/ui/issues/issue-33140.stderr +++ b/src/test/ui/issues/issue-33140.stderr @@ -19,7 +19,7 @@ LL | impl Trait2 for dyn Sync + Send + Sync { error[E0592]: duplicate definitions with name `abc` --> $DIR/issue-33140.rs:29:5 | -LL | / fn abc() -> bool { //~ ERROR duplicate definitions with name `abc` +LL | / fn abc() -> bool { LL | | false LL | | } | |_____^ duplicate definitions for `abc` diff --git a/src/test/ui/issues/issue-3344.stderr b/src/test/ui/issues/issue-3344.stderr index 8e4a14fb4fae..6593e07b1897 100644 --- a/src/test/ui/issues/issue-3344.stderr +++ b/src/test/ui/issues/issue-3344.stderr @@ -1,7 +1,7 @@ error[E0046]: not all trait items implemented, missing: `partial_cmp` --> $DIR/issue-3344.rs:3:1 | -LL | impl PartialOrd for Thing { //~ ERROR not all trait items implemented, missing: `partial_cmp` +LL | impl PartialOrd for Thing { | ^^^^^^^^^^^^^^^^^^^^^^^^^ missing `partial_cmp` in implementation | = note: `partial_cmp` from trait: `fn(&Self, &Rhs) -> std::option::Option` diff --git a/src/test/ui/issues/issue-33504.stderr b/src/test/ui/issues/issue-33504.stderr index 716aa8a86329..7af555eaa2ce 100644 --- a/src/test/ui/issues/issue-33504.stderr +++ b/src/test/ui/issues/issue-33504.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-33504.rs:7:13 | -LL | let Test = 1; //~ ERROR mismatched types +LL | let Test = 1; | ^^^^ expected integer, found struct `Test` | = note: expected type `{integer}` diff --git a/src/test/ui/issues/issue-33525.stderr b/src/test/ui/issues/issue-33525.stderr index 2c97a39a183f..584b903c2efc 100644 --- a/src/test/ui/issues/issue-33525.stderr +++ b/src/test/ui/issues/issue-33525.stderr @@ -1,19 +1,19 @@ error[E0425]: cannot find value `a` in this scope --> $DIR/issue-33525.rs:2:5 | -LL | a; //~ ERROR cannot find value `a` +LL | a; | ^ not found in this scope error[E0609]: no field `lorem` on type `&'static str` --> $DIR/issue-33525.rs:3:8 | -LL | "".lorem; //~ ERROR no field +LL | "".lorem; | ^^^^^ error[E0609]: no field `ipsum` on type `&'static str` --> $DIR/issue-33525.rs:4:8 | -LL | "".ipsum; //~ ERROR no field +LL | "".ipsum; | ^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-33571.stderr b/src/test/ui/issues/issue-33571.stderr index 2fae447c5e8c..5d83a08e9075 100644 --- a/src/test/ui/issues/issue-33571.stderr +++ b/src/test/ui/issues/issue-33571.stderr @@ -1,7 +1,7 @@ error: this unsafe trait should be implemented explicitly --> $DIR/issue-33571.rs:2:10 | -LL | Sync, //~ ERROR this unsafe trait should be implemented explicitly +LL | Sync, | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-33941.stderr b/src/test/ui/issues/issue-33941.stderr index 43cd7af81d98..596921e526d9 100644 --- a/src/test/ui/issues/issue-33941.stderr +++ b/src/test/ui/issues/issue-33941.stderr @@ -1,7 +1,7 @@ error[E0271]: type mismatch resolving ` as std::iter::Iterator>::Item == &_` --> $DIR/issue-33941.rs:4:36 | -LL | for _ in HashMap::new().iter().cloned() {} //~ ERROR type mismatch +LL | for _ in HashMap::new().iter().cloned() {} | ^^^^^^ expected tuple, found reference | = note: expected type `(&_, &_)` @@ -10,7 +10,7 @@ LL | for _ in HashMap::new().iter().cloned() {} //~ ERROR type mismatch error[E0271]: type mismatch resolving ` as std::iter::Iterator>::Item == &_` --> $DIR/issue-33941.rs:4:14 | -LL | for _ in HashMap::new().iter().cloned() {} //~ ERROR type mismatch +LL | for _ in HashMap::new().iter().cloned() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tuple, found reference | = note: expected type `(&_, &_)` diff --git a/src/test/ui/issues/issue-34047.stderr b/src/test/ui/issues/issue-34047.stderr index 8d552f24cd67..f770ded50d0f 100644 --- a/src/test/ui/issues/issue-34047.stderr +++ b/src/test/ui/issues/issue-34047.stderr @@ -4,7 +4,7 @@ error[E0530]: match bindings cannot shadow constants LL | const C: u8 = 0; | ---------------- the constant `C` is defined here ... -LL | mut C => {} //~ ERROR match bindings cannot shadow constants +LL | mut C => {} | ^ cannot be named the same as a constant error: aborting due to previous error diff --git a/src/test/ui/issues/issue-34222-1.stderr b/src/test/ui/issues/issue-34222-1.stderr index beb6b589766b..0799656b06bd 100644 --- a/src/test/ui/issues/issue-34222-1.stderr +++ b/src/test/ui/issues/issue-34222-1.stderr @@ -1,7 +1,7 @@ error[E0585]: found a documentation comment that doesn't document anything --> $DIR/issue-34222-1.rs:2:5 | -LL | /// comment //~ ERROR found a documentation comment that doesn't document anything +LL | /// comment | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: doc comments must come before what they document, maybe a comment was intended with `//`? diff --git a/src/test/ui/issues/issue-34334.stderr b/src/test/ui/issues/issue-34334.stderr index 9571d0436351..1b0babf93904 100644 --- a/src/test/ui/issues/issue-34334.stderr +++ b/src/test/ui/issues/issue-34334.stderr @@ -1,7 +1,7 @@ error: expected one of `,` or `>`, found `=` --> $DIR/issue-34334.rs:2:29 | -LL | let sr: Vec<(u32, _, _) = vec![]; //~ ERROR expected one of `,` or `>`, found `=` +LL | let sr: Vec<(u32, _, _) = vec![]; | -- ^ expected one of `,` or `>` here | | | while parsing the type for `sr` diff --git a/src/test/ui/issues/issue-34349.stderr b/src/test/ui/issues/issue-34349.stderr index f0cd8f948815..d0b51961b44a 100644 --- a/src/test/ui/issues/issue-34349.stderr +++ b/src/test/ui/issues/issue-34349.stderr @@ -1,7 +1,7 @@ error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnMut` --> $DIR/issue-34349.rs:16:17 | -LL | let diary = || { //~ ERROR E0525 +LL | let diary = || { | ^^ this closure implements `FnMut`, not `Fn` LL | farewell.push_str("!!!"); | -------- closure is `FnMut` because it mutates the variable `farewell` here diff --git a/src/test/ui/issues/issue-34373.stderr b/src/test/ui/issues/issue-34373.stderr index 07ac421455cf..f260a8477431 100644 --- a/src/test/ui/issues/issue-34373.stderr +++ b/src/test/ui/issues/issue-34373.stderr @@ -1,7 +1,7 @@ error[E0391]: cycle detected when processing `Foo::T` --> $DIR/issue-34373.rs:7:30 | -LL | pub struct Foo>>; //~ ERROR cycle detected +LL | pub struct Foo>>; | ^^^^^^^^^^ | note: ...which requires processing `DefaultFoo`... diff --git a/src/test/ui/issues/issue-35075.stderr b/src/test/ui/issues/issue-35075.stderr index 5372996d1cbb..2aeb6b152242 100644 --- a/src/test/ui/issues/issue-35075.stderr +++ b/src/test/ui/issues/issue-35075.stderr @@ -1,21 +1,21 @@ error[E0412]: cannot find type `Foo` in this scope --> $DIR/issue-35075.rs:2:12 | -LL | inner: Foo //~ ERROR cannot find type `Foo` in this scope +LL | inner: Foo | ^^^ not found in this scope help: there is an enum variant `Baz::Foo`; try using the variant's enum | -LL | inner: Baz //~ ERROR cannot find type `Foo` in this scope +LL | inner: Baz | ^^^ error[E0412]: cannot find type `Foo` in this scope --> $DIR/issue-35075.rs:6:9 | -LL | Foo(Foo) //~ ERROR cannot find type `Foo` in this scope +LL | Foo(Foo) | ^^^ not found in this scope help: there is an enum variant `Baz::Foo`; try using the variant's enum | -LL | Foo(Baz) //~ ERROR cannot find type `Foo` in this scope +LL | Foo(Baz) | ^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-35139.stderr b/src/test/ui/issues/issue-35139.stderr index 1e3d24fa514c..79e889b7e599 100644 --- a/src/test/ui/issues/issue-35139.stderr +++ b/src/test/ui/issues/issue-35139.stderr @@ -1,7 +1,7 @@ error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates --> $DIR/issue-35139.rs:9:6 | -LL | impl<'a> MethodType for MTFn { //~ ERROR E0207 +LL | impl<'a> MethodType for MTFn { | ^^ unconstrained lifetime parameter error: aborting due to previous error diff --git a/src/test/ui/issues/issue-35241.stderr b/src/test/ui/issues/issue-35241.stderr index 022bc7baa34c..8fda58abadb6 100644 --- a/src/test/ui/issues/issue-35241.stderr +++ b/src/test/ui/issues/issue-35241.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-35241.rs:3:20 | -LL | fn test() -> Foo { Foo } //~ ERROR mismatched types +LL | fn test() -> Foo { Foo } | --- ^^^ | | | | | expected struct `Foo`, found fn item diff --git a/src/test/ui/issues/issue-35450.stderr b/src/test/ui/issues/issue-35450.stderr index 7edee5c41e62..f2065689f444 100644 --- a/src/test/ui/issues/issue-35450.stderr +++ b/src/test/ui/issues/issue-35450.stderr @@ -1,7 +1,7 @@ error: expected expression, found `$` --> $DIR/issue-35450.rs:4:8 | -LL | m!($t); //~ ERROR expected expression +LL | m!($t); | ^ expected expression error: aborting due to previous error diff --git a/src/test/ui/issues/issue-3601.stderr b/src/test/ui/issues/issue-3601.stderr index 0b5242ee528d..fa0fa3345f5e 100644 --- a/src/test/ui/issues/issue-3601.stderr +++ b/src/test/ui/issues/issue-3601.stderr @@ -1,8 +1,10 @@ error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/issue-3601.rs:30:44 | -LL | box NodeKind::Element(ed) => match ed.kind { //~ ERROR non-exhaustive patterns +LL | box NodeKind::Element(ed) => match ed.kind { | ^^^^^^^ pattern `_` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/issues/issue-36116.stderr b/src/test/ui/issues/issue-36116.stderr index e8f9a472b07b..5236db29ae4a 100644 --- a/src/test/ui/issues/issue-36116.stderr +++ b/src/test/ui/issues/issue-36116.stderr @@ -1,12 +1,12 @@ warning: unnecessary path disambiguator --> $DIR/issue-36116.rs:20:50 | -LL | let f = Some(Foo { _a: 42 }).map(|a| a as Foo::); //~ WARN unnecessary path disambiguator +LL | let f = Some(Foo { _a: 42 }).map(|a| a as Foo::); | ^^ try removing `::` warning: unnecessary path disambiguator --> $DIR/issue-36116.rs:21:15 | -LL | let g: Foo:: = Foo { _a: 42 }; //~ WARN unnecessary path disambiguator +LL | let g: Foo:: = Foo { _a: 42 }; | ^^ try removing `::` diff --git a/src/test/ui/issues/issue-36163.stderr b/src/test/ui/issues/issue-36163.stderr index c114e58e4d94..94de4c76927a 100644 --- a/src/test/ui/issues/issue-36163.stderr +++ b/src/test/ui/issues/issue-36163.stderr @@ -1,7 +1,7 @@ error[E0391]: cycle detected when processing `Foo::B::{{constant}}` --> $DIR/issue-36163.rs:4:9 | -LL | B = A, //~ ERROR E0391 +LL | B = A, | ^ | note: ...which requires processing `A`... @@ -13,7 +13,7 @@ LL | const A: isize = Foo::B as isize; note: cycle used when const-evaluating `Foo::B::{{constant}}` --> $DIR/issue-36163.rs:4:9 | -LL | B = A, //~ ERROR E0391 +LL | B = A, | ^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-36400.nll.stderr b/src/test/ui/issues/issue-36400.nll.stderr index e260fab77911..3b37578f3c45 100644 --- a/src/test/ui/issues/issue-36400.nll.stderr +++ b/src/test/ui/issues/issue-36400.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable | LL | let x = Box::new(3); | - help: consider changing this to be mutable: `mut x` -LL | f(&mut *x); //~ ERROR cannot borrow immutable +LL | f(&mut *x); | ^^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/issues/issue-36400.stderr b/src/test/ui/issues/issue-36400.stderr index d9394277050d..1494324eea30 100644 --- a/src/test/ui/issues/issue-36400.stderr +++ b/src/test/ui/issues/issue-36400.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable `Box` content `*x` as mutable | LL | let x = Box::new(3); | - help: make this binding mutable: `mut x` -LL | f(&mut *x); //~ ERROR cannot borrow immutable +LL | f(&mut *x); | ^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/issues/issue-36617.stderr b/src/test/ui/issues/issue-36617.stderr index 7685b84bea7b..296fec46d80a 100644 --- a/src/test/ui/issues/issue-36617.stderr +++ b/src/test/ui/issues/issue-36617.stderr @@ -1,7 +1,7 @@ error: `derive` may only be applied to structs, enums and unions --> $DIR/issue-36617.rs:1:1 | -LL | #![derive(Copy)] //~ ERROR `derive` may only be applied to structs, enums and unions +LL | #![derive(Copy)] | ^^^^^^^^^^^^^^^^ help: try an outer attribute: `#[derive(Copy)]` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-36881.stderr b/src/test/ui/issues/issue-36881.stderr index b08b229384d0..2ec636fde60b 100644 --- a/src/test/ui/issues/issue-36881.stderr +++ b/src/test/ui/issues/issue-36881.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `issue_36881_aux` --> $DIR/issue-36881.rs:6:9 | -LL | use issue_36881_aux::Foo; //~ ERROR unresolved import +LL | use issue_36881_aux::Foo; | ^^^^^^^^^^^^^^^ maybe a missing `extern crate issue_36881_aux;`? error: aborting due to previous error diff --git a/src/test/ui/issues/issue-3702-2.stderr b/src/test/ui/issues/issue-3702-2.stderr index 11d24b38061e..347a19b687fb 100644 --- a/src/test/ui/issues/issue-3702-2.stderr +++ b/src/test/ui/issues/issue-3702-2.stderr @@ -1,7 +1,7 @@ error[E0034]: multiple applicable items in scope --> $DIR/issue-3702-2.rs:16:14 | -LL | self.to_int() + other.to_int() //~ ERROR multiple applicable items in scope +LL | self.to_int() + other.to_int() | ^^^^^^ multiple `to_int` found | note: candidate #1 is defined in an impl of the trait `ToPrimitive` for the type `isize` diff --git a/src/test/ui/issues/issue-37026.stderr b/src/test/ui/issues/issue-37026.stderr index 39a500cf5653..1f81264ffdb4 100644 --- a/src/test/ui/issues/issue-37026.stderr +++ b/src/test/ui/issues/issue-37026.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-37026.rs:6:9 | -LL | let empty_struct::XEmpty2 = (); //~ ERROR mismatched types +LL | let empty_struct::XEmpty2 = (); | ^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `empty_struct::XEmpty2` | = note: expected type `()` @@ -10,7 +10,7 @@ LL | let empty_struct::XEmpty2 = (); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/issue-37026.rs:7:9 | -LL | let empty_struct::XEmpty6(..) = (); //~ ERROR mismatched types +LL | let empty_struct::XEmpty6(..) = (); | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `empty_struct::XEmpty6` | = note: expected type `()` diff --git a/src/test/ui/issues/issue-3707.stderr b/src/test/ui/issues/issue-3707.stderr index 436dcbee862a..05c8ce4c3f11 100644 --- a/src/test/ui/issues/issue-3707.stderr +++ b/src/test/ui/issues/issue-3707.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `boom` found for type `&Obj` in the current scope --> $DIR/issue-3707.rs:10:14 | -LL | self.boom(); //~ ERROR no method named `boom` found for type `&Obj` in the current scope +LL | self.boom(); | -----^^^^ | | | | | this is an associated function, not a method diff --git a/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr b/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr index fa1ee227f0bf..24b31f43a85a 100644 --- a/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr +++ b/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr @@ -1,7 +1,7 @@ error: reached the type-length limit while instantiating `<(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(), &()), &(&()...` --> $DIR/issue-37311.rs:13:5 | -LL | / fn recurse(&self) { //~ ERROR reached the type-length limit +LL | / fn recurse(&self) { LL | | (self, self).recurse(); LL | | } | |_____^ diff --git a/src/test/ui/issues/issue-37550.stderr b/src/test/ui/issues/issue-37550.stderr index 97160af43bee..41f33a38fbd0 100644 --- a/src/test/ui/issues/issue-37550.stderr +++ b/src/test/ui/issues/issue-37550.stderr @@ -1,7 +1,7 @@ error[E0723]: function pointers in const fn are unstable (see issue #57563) --> $DIR/issue-37550.rs:3:9 | -LL | let x = || t; //~ ERROR function pointers in const fn are unstable +LL | let x = || t; | ^ | = help: add #![feature(const_fn)] to the crate attributes to enable diff --git a/src/test/ui/issues/issue-3763.stderr b/src/test/ui/issues/issue-3763.stderr index f37b923d5dcf..cc95d221c511 100644 --- a/src/test/ui/issues/issue-3763.stderr +++ b/src/test/ui/issues/issue-3763.stderr @@ -13,13 +13,13 @@ LL | let _woohoo = (Box::new(my_struct)).priv_field; error[E0624]: method `happyfun` is private --> $DIR/issue-3763.rs:21:18 | -LL | (&my_struct).happyfun(); //~ ERROR method `happyfun` is private +LL | (&my_struct).happyfun(); | ^^^^^^^^ error[E0624]: method `happyfun` is private --> $DIR/issue-3763.rs:23:27 | -LL | (Box::new(my_struct)).happyfun(); //~ ERROR method `happyfun` is private +LL | (Box::new(my_struct)).happyfun(); | ^^^^^^^^ error[E0616]: field `priv_field` of struct `my_mod::MyStruct` is private diff --git a/src/test/ui/issues/issue-37665.stderr b/src/test/ui/issues/issue-37665.stderr index c3599fab6850..c27494699515 100644 --- a/src/test/ui/issues/issue-37665.stderr +++ b/src/test/ui/issues/issue-37665.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-37665.rs:10:17 | -LL | let x: () = 0; //~ ERROR: mismatched types +LL | let x: () = 0; | ^ expected (), found integer | = note: expected type `()` diff --git a/src/test/ui/issues/issue-3779.stderr b/src/test/ui/issues/issue-3779.stderr index 3538cb199c3e..ba1e842c610b 100644 --- a/src/test/ui/issues/issue-3779.stderr +++ b/src/test/ui/issues/issue-3779.stderr @@ -3,7 +3,7 @@ error[E0072]: recursive type `S` has infinite size | LL | struct S { | ^^^^^^^^ recursive type has infinite size -LL | //~^ ERROR E0072 +LL | LL | element: Option | ------------------ recursive without indirection | diff --git a/src/test/ui/issues/issue-37884.stderr b/src/test/ui/issues/issue-37884.stderr index f791c6df72f2..9a5f659da160 100644 --- a/src/test/ui/issues/issue-37884.stderr +++ b/src/test/ui/issues/issue-37884.stderr @@ -2,8 +2,8 @@ error[E0308]: method not compatible with trait --> $DIR/issue-37884.rs:6:5 | LL | / fn next(&'a mut self) -> Option -LL | | //~^ ERROR method not compatible with trait -LL | | //~| lifetime mismatch +LL | | +LL | | LL | | { LL | | Some(&mut self.0) LL | | } @@ -15,8 +15,8 @@ note: the anonymous lifetime #1 defined on the method body at 6:5... --> $DIR/issue-37884.rs:6:5 | LL | / fn next(&'a mut self) -> Option -LL | | //~^ ERROR method not compatible with trait -LL | | //~| lifetime mismatch +LL | | +LL | | LL | | { LL | | Some(&mut self.0) LL | | } diff --git a/src/test/ui/issues/issue-37887.stderr b/src/test/ui/issues/issue-37887.stderr index 3b3ce8b39bc9..24543a5efaf1 100644 --- a/src/test/ui/issues/issue-37887.stderr +++ b/src/test/ui/issues/issue-37887.stderr @@ -1,13 +1,13 @@ error[E0432]: unresolved import `libc` --> $DIR/issue-37887.rs:3:9 | -LL | use libc::*; //~ ERROR unresolved import +LL | use libc::*; | ^^^^ maybe a missing `extern crate libc;`? error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812) --> $DIR/issue-37887.rs:2:5 | -LL | extern crate libc; //~ ERROR use of unstable +LL | extern crate libc; | ^^^^^^^^^^^^^^^^^^ | = help: add #![feature(rustc_private)] to the crate attributes to enable diff --git a/src/test/ui/issues/issue-3820.stderr b/src/test/ui/issues/issue-3820.stderr index 0a36ac7616bb..b4af9c2d27db 100644 --- a/src/test/ui/issues/issue-3820.stderr +++ b/src/test/ui/issues/issue-3820.stderr @@ -1,7 +1,7 @@ error[E0369]: binary operation `*` cannot be applied to type `Thing` --> $DIR/issue-3820.rs:14:13 | -LL | let w = u * 3; //~ ERROR binary operation `*` cannot be applied to type `Thing` +LL | let w = u * 3; | ^^^^^ | = note: an implementation of `std::ops::Mul` might be missing for `Thing` diff --git a/src/test/ui/issues/issue-38293.stderr b/src/test/ui/issues/issue-38293.stderr index 409670074d9f..e0b2fe4fe054 100644 --- a/src/test/ui/issues/issue-38293.stderr +++ b/src/test/ui/issues/issue-38293.stderr @@ -1,13 +1,13 @@ error[E0432]: unresolved import `foo::f` --> $DIR/issue-38293.rs:6:14 | -LL | use foo::f::{self}; //~ ERROR unresolved import `foo::f` +LL | use foo::f::{self}; | ^^^^ no `f` in `foo` error[E0423]: expected function, found module `baz` --> $DIR/issue-38293.rs:15:5 | -LL | baz(); //~ ERROR expected function, found module `baz` +LL | baz(); | ^^^ not a function help: possible better candidate is found in another module, you can import it into scope | diff --git a/src/test/ui/issues/issue-38458.stderr b/src/test/ui/issues/issue-38458.stderr index 541a36233ca2..c04a01118a44 100644 --- a/src/test/ui/issues/issue-38458.stderr +++ b/src/test/ui/issues/issue-38458.stderr @@ -1,7 +1,7 @@ error[E0572]: return statement outside of function body --> $DIR/issue-38458.rs:2:5 | -LL | return; //~ ERROR return statement outside of function body +LL | return; | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-38604.stderr b/src/test/ui/issues/issue-38604.stderr index 30b4d2b53ff3..77b42b80613c 100644 --- a/src/test/ui/issues/issue-38604.stderr +++ b/src/test/ui/issues/issue-38604.stderr @@ -1,7 +1,7 @@ error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/issue-38604.rs:14:13 | -LL | let _f: Box = //~ ERROR `Foo` cannot be made into an object +LL | let _f: Box = | ^^^^^^^^ the trait `Foo` cannot be made into an object | = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses @@ -9,7 +9,7 @@ LL | let _f: Box = //~ ERROR `Foo` cannot be made into an object error[E0038]: the trait `Foo` cannot be made into an object --> $DIR/issue-38604.rs:15:9 | -LL | Box::new(()); //~ ERROR `Foo` cannot be made into an object +LL | Box::new(()); | ^^^^^^^^^^^^ the trait `Foo` cannot be made into an object | = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses diff --git a/src/test/ui/issues/issue-38715.stderr b/src/test/ui/issues/issue-38715.stderr index 21d96d36e274..34e08bfc93aa 100644 --- a/src/test/ui/issues/issue-38715.stderr +++ b/src/test/ui/issues/issue-38715.stderr @@ -1,7 +1,7 @@ error: a macro named `foo` has already been exported --> $DIR/issue-38715.rs:5:1 | -LL | macro_rules! foo { () => {} } //~ ERROR a macro named `foo` has already been exported +LL | macro_rules! foo { () => {} } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `foo` already exported | = note: #[deny(duplicate_macro_exports)] on by default diff --git a/src/test/ui/issues/issue-38868.stderr b/src/test/ui/issues/issue-38868.stderr index ae975ca78c11..fe932c744bf7 100644 --- a/src/test/ui/issues/issue-38868.stderr +++ b/src/test/ui/issues/issue-38868.stderr @@ -1,7 +1,7 @@ error[E0366]: Implementations of Drop cannot be specialized --> $DIR/issue-38868.rs:5:1 | -LL | / impl Drop for List { //~ ERROR E0366 +LL | / impl Drop for List { LL | | fn drop(&mut self) { LL | | panic!() LL | | } diff --git a/src/test/ui/issues/issue-38919.stderr b/src/test/ui/issues/issue-38919.stderr index 8c0943647956..d23a4dfd0a49 100644 --- a/src/test/ui/issues/issue-38919.stderr +++ b/src/test/ui/issues/issue-38919.stderr @@ -1,7 +1,7 @@ error[E0599]: no associated item named `Item` found for type `T` in the current scope --> $DIR/issue-38919.rs:2:8 | -LL | T::Item; //~ ERROR no associated item named `Item` found for type `T` in the current scope +LL | T::Item; | ---^^^^ | | | associated item not found in `T` diff --git a/src/test/ui/issues/issue-39211.stderr b/src/test/ui/issues/issue-39211.stderr index b9134445455a..ea850ea57d5b 100644 --- a/src/test/ui/issues/issue-39211.stderr +++ b/src/test/ui/issues/issue-39211.stderr @@ -1,7 +1,7 @@ error[E0220]: associated type `Row` not found for `M` --> $DIR/issue-39211.rs:11:17 | -LL | let a = [3; M::Row::DIM]; //~ ERROR associated type `Row` not found for `M` +LL | let a = [3; M::Row::DIM]; | ^^^^^^^^^^^ associated type `Row` not found error: aborting due to previous error diff --git a/src/test/ui/issues/issue-39362.stderr b/src/test/ui/issues/issue-39362.stderr index 06385127e94f..55cd14a5c1e0 100644 --- a/src/test/ui/issues/issue-39362.stderr +++ b/src/test/ui/issues/issue-39362.stderr @@ -1,8 +1,15 @@ error[E0004]: non-exhaustive patterns: `Bar { bar: C, .. }`, `Bar { bar: D, .. }`, `Bar { bar: E, .. }` and 1 more not covered --> $DIR/issue-39362.rs:10:11 | -LL | match f { - | ^ patterns `Bar { bar: C, .. }`, `Bar { bar: D, .. }`, `Bar { bar: E, .. }` and 1 more not covered +LL | / enum Foo { +LL | | Bar { bar: Bar, id: usize } +LL | | } + | |_- `Foo` defined here +... +LL | match f { + | ^ patterns `Bar { bar: C, .. }`, `Bar { bar: D, .. }`, `Bar { bar: E, .. }` and 1 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/issues/issue-39388.stderr b/src/test/ui/issues/issue-39388.stderr index 00d6598aeaf2..e04e16e2a037 100644 --- a/src/test/ui/issues/issue-39388.stderr +++ b/src/test/ui/issues/issue-39388.stderr @@ -1,7 +1,7 @@ error: expected `*` or `+` --> $DIR/issue-39388.rs:4:22 | -LL | (($($a:tt)*) = ($($b:tt))*) => { //~ ERROR expected `*` or `+` +LL | (($($a:tt)*) = ($($b:tt))*) => { | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-39616.stderr b/src/test/ui/issues/issue-39616.stderr index 082c3a6853a1..e24ffcdb0d99 100644 --- a/src/test/ui/issues/issue-39616.stderr +++ b/src/test/ui/issues/issue-39616.stderr @@ -1,13 +1,13 @@ error: expected type, found `0` --> $DIR/issue-39616.rs:1:12 | -LL | fn foo(a: [0; 1]) {} //~ ERROR expected type, found `0` +LL | fn foo(a: [0; 1]) {} | ^ error: expected one of `)`, `,`, `->`, `where`, or `{`, found `]` --> $DIR/issue-39616.rs:1:16 | -LL | fn foo(a: [0; 1]) {} //~ ERROR expected type, found `0` +LL | fn foo(a: [0; 1]) {} | ^ expected one of `)`, `,`, `->`, `where`, or `{` here error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-3973.stderr b/src/test/ui/issues/issue-3973.stderr index 8e46d8801811..2ece4c396067 100644 --- a/src/test/ui/issues/issue-3973.stderr +++ b/src/test/ui/issues/issue-3973.stderr @@ -2,7 +2,7 @@ error[E0407]: method `new` is not a member of trait `ToString_` --> $DIR/issue-3973.rs:11:5 | LL | / fn new(x: f64, y: f64) -> Point { -LL | | //~^ ERROR method `new` is not a member of trait `ToString_` +LL | | LL | | Point { x: x, y: y } LL | | } | |_____^ not a member of trait `ToString_` diff --git a/src/test/ui/issues/issue-3993.stderr b/src/test/ui/issues/issue-3993.stderr index 090bca3a759c..ce594a3f9bb2 100644 --- a/src/test/ui/issues/issue-3993.stderr +++ b/src/test/ui/issues/issue-3993.stderr @@ -1,7 +1,7 @@ error[E0603]: function `fly` is private --> $DIR/issue-3993.rs:1:10 | -LL | use zoo::fly; //~ ERROR: function `fly` is private +LL | use zoo::fly; | ^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-40000.stderr b/src/test/ui/issues/issue-40000.stderr index ce0c44c14756..c48fb24ea17d 100644 --- a/src/test/ui/issues/issue-40000.stderr +++ b/src/test/ui/issues/issue-40000.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-40000.rs:6:9 | -LL | foo(bar); //~ ERROR E0308 +LL | foo(bar); | ^^^ expected concrete lifetime, found bound lifetime parameter | = note: expected type `std::boxed::Box<(dyn for<'r> std::ops::Fn(&'r i32) + 'static)>` diff --git a/src/test/ui/issues/issue-40288.nll.stderr b/src/test/ui/issues/issue-40288.nll.stderr index bb4110948d54..fb4ecab362db 100644 --- a/src/test/ui/issues/issue-40288.nll.stderr +++ b/src/test/ui/issues/issue-40288.nll.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `*refr` because it is borrowed LL | save_ref(&*refr, &mut out); | ------ borrow of `*refr` occurs here ... -LL | *refr = 3; //~ ERROR cannot assign to `*refr` because it is borrowed +LL | *refr = 3; | ^^^^^^^^^ assignment to borrowed `*refr` occurs here ... LL | println!("{:?}", out[0]); diff --git a/src/test/ui/issues/issue-40288.stderr b/src/test/ui/issues/issue-40288.stderr index 2ac5964f5da7..5e8ad323ccb0 100644 --- a/src/test/ui/issues/issue-40288.stderr +++ b/src/test/ui/issues/issue-40288.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `*refr` because it is borrowed LL | save_ref(&*refr, &mut out); | ----- borrow of `*refr` occurs here ... -LL | *refr = 3; //~ ERROR cannot assign to `*refr` because it is borrowed +LL | *refr = 3; | ^^^^^^^^^ assignment to borrowed `*refr` occurs here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr index a4847568ba0c..fbfbc0cb9777 100644 --- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr +++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/issue-40402-1.rs:9:13 | -LL | let e = f.v[0]; //~ ERROR cannot move out of indexed content +LL | let e = f.v[0]; | ^^^^^^ | | | cannot move out of borrowed content diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr index 87b98bbcedb6..5e7be1a31012 100644 --- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr +++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of indexed content --> $DIR/issue-40402-1.rs:9:13 | -LL | let e = f.v[0]; //~ ERROR cannot move out of indexed content +LL | let e = f.v[0]; | ^^^^^^ | | | cannot move out of indexed content diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr index 5c23021ee2c8..0c4a85b59016 100644 --- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr +++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/issue-40402-2.rs:5:18 | -LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content +LL | let (a, b) = x[0]; | - - ^^^^ | | | | | | | cannot move out of borrowed content @@ -12,7 +12,7 @@ LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content note: move occurs because these variables have types that don't implement the `Copy` trait --> $DIR/issue-40402-2.rs:5:10 | -LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content +LL | let (a, b) = x[0]; | ^ ^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr index d64cd96e959f..b672029f717f 100644 --- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr +++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of indexed content --> $DIR/issue-40402-2.rs:5:18 | -LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content +LL | let (a, b) = x[0]; | - - ^^^^ cannot move out of indexed content | | | | | ...and here (use `ref b` or `ref mut b`) diff --git a/src/test/ui/issues/issue-40782.stderr b/src/test/ui/issues/issue-40782.stderr index 03f051adc6e3..fdc57466f3ca 100644 --- a/src/test/ui/issues/issue-40782.stderr +++ b/src/test/ui/issues/issue-40782.stderr @@ -1,7 +1,7 @@ error: missing `in` in `for` loop --> $DIR/issue-40782.rs:2:10 | -LL | for i 0..2 { //~ ERROR missing `in` +LL | for i 0..2 { | ^ help: try adding `in` here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-40845.stderr b/src/test/ui/issues/issue-40845.stderr index a8d75025279d..a8be38ebf065 100644 --- a/src/test/ui/issues/issue-40845.stderr +++ b/src/test/ui/issues/issue-40845.stderr @@ -1,13 +1,13 @@ error: cannot find macro `m!` in this scope --> $DIR/issue-40845.rs:4:10 | -LL | impl S { m!(); } //~ ERROR cannot find macro `m!` in this scope +LL | impl S { m!(); } | ^ error: cannot find macro `m!` in this scope --> $DIR/issue-40845.rs:1:11 | -LL | trait T { m!(); } //~ ERROR cannot find macro `m!` in this scope +LL | trait T { m!(); } | ^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-41255.stderr b/src/test/ui/issues/issue-41255.stderr index 05e930de27af..9ccfc9a00160 100644 --- a/src/test/ui/issues/issue-41255.stderr +++ b/src/test/ui/issues/issue-41255.stderr @@ -1,7 +1,7 @@ error: floating-point types cannot be used in patterns --> $DIR/issue-41255.rs:10:9 | -LL | 5.0 => {}, //~ ERROR floating-point types cannot be used in patterns +LL | 5.0 => {}, | ^^^ | note: lint level defined here @@ -15,7 +15,7 @@ LL | #![forbid(illegal_floating_point_literal_pattern)] error: floating-point types cannot be used in patterns --> $DIR/issue-41255.rs:12:9 | -LL | 5.0f32 => {}, //~ ERROR floating-point types cannot be used in patterns +LL | 5.0f32 => {}, | ^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -24,7 +24,7 @@ LL | 5.0f32 => {}, //~ ERROR floating-point types cannot be used in patt error: floating-point types cannot be used in patterns --> $DIR/issue-41255.rs:14:10 | -LL | -5.0 => {}, //~ ERROR floating-point types cannot be used in patterns +LL | -5.0 => {}, | ^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -33,7 +33,7 @@ LL | -5.0 => {}, //~ ERROR floating-point types cannot be used in patter error: floating-point types cannot be used in patterns --> $DIR/issue-41255.rs:16:9 | -LL | 1.0 .. 33.0 => {}, //~ ERROR floating-point types cannot be used in patterns +LL | 1.0 .. 33.0 => {}, | ^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -42,7 +42,7 @@ LL | 1.0 .. 33.0 => {}, //~ ERROR floating-point types cannot be used in error: floating-point types cannot be used in patterns --> $DIR/issue-41255.rs:16:16 | -LL | 1.0 .. 33.0 => {}, //~ ERROR floating-point types cannot be used in patterns +LL | 1.0 .. 33.0 => {}, | ^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -51,7 +51,7 @@ LL | 1.0 .. 33.0 => {}, //~ ERROR floating-point types cannot be used in error: floating-point types cannot be used in patterns --> $DIR/issue-41255.rs:20:9 | -LL | 39.0 ..= 70.0 => {}, //~ ERROR floating-point types cannot be used in patterns +LL | 39.0 ..= 70.0 => {}, | ^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -60,7 +60,7 @@ LL | 39.0 ..= 70.0 => {}, //~ ERROR floating-point types cannot be used error: floating-point types cannot be used in patterns --> $DIR/issue-41255.rs:20:18 | -LL | 39.0 ..= 70.0 => {}, //~ ERROR floating-point types cannot be used in patterns +LL | 39.0 ..= 70.0 => {}, | ^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -69,7 +69,7 @@ LL | 39.0 ..= 70.0 => {}, //~ ERROR floating-point types cannot be used error: floating-point types cannot be used in patterns --> $DIR/issue-41255.rs:29:10 | -LL | (3.14, 1) => {}, //~ ERROR floating-point types cannot be used +LL | (3.14, 1) => {}, | ^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -78,7 +78,7 @@ LL | (3.14, 1) => {}, //~ ERROR floating-point types cannot be used error: floating-point types cannot be used in patterns --> $DIR/issue-41255.rs:36:18 | -LL | Foo { x: 2.0 } => {}, //~ ERROR floating-point types cannot be used +LL | Foo { x: 2.0 } => {}, | ^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/issues/issue-41549.stderr b/src/test/ui/issues/issue-41549.stderr index b144387ac44b..5e102dcbf411 100644 --- a/src/test/ui/issues/issue-41549.stderr +++ b/src/test/ui/issues/issue-41549.stderr @@ -1,7 +1,7 @@ error[E0326]: implemented const `CONST` has an incompatible type for trait --> $DIR/issue-41549.rs:9:18 | -LL | const CONST: () = (); //~ ERROR incompatible type for trait +LL | const CONST: () = (); | ^^ expected u32, found () | = note: expected type `u32` diff --git a/src/test/ui/issues/issue-41726.nll.stderr b/src/test/ui/issues/issue-41726.nll.stderr index 087f557a0d4f..c92753d6e3db 100644 --- a/src/test/ui/issues/issue-41726.nll.stderr +++ b/src/test/ui/issues/issue-41726.nll.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow data in a `&` reference as mutable --> $DIR/issue-41726.rs:5:9 | -LL | things[src.as_str()].sort(); //~ ERROR cannot borrow immutable +LL | things[src.as_str()].sort(); | ^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap>` diff --git a/src/test/ui/issues/issue-41726.stderr b/src/test/ui/issues/issue-41726.stderr index e6b92dc9dfea..e29c163b8177 100644 --- a/src/test/ui/issues/issue-41726.stderr +++ b/src/test/ui/issues/issue-41726.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow immutable indexed content as mutable --> $DIR/issue-41726.rs:5:9 | -LL | things[src.as_str()].sort(); //~ ERROR cannot borrow immutable +LL | things[src.as_str()].sort(); | ^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable | = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap>` diff --git a/src/test/ui/issues/issue-41742.stderr b/src/test/ui/issues/issue-41742.stderr index 03a9710f6797..f205abf55768 100644 --- a/src/test/ui/issues/issue-41742.stderr +++ b/src/test/ui/issues/issue-41742.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-41742.rs:24:7 | -LL | H["?"].f(); //~ ERROR mismatched types +LL | H["?"].f(); | ^^^ expected u32, found reference | = note: expected type `u32` diff --git a/src/test/ui/issues/issue-41776.stderr b/src/test/ui/issues/issue-41776.stderr index 1806f68f14ae..e06873b50265 100644 --- a/src/test/ui/issues/issue-41776.stderr +++ b/src/test/ui/issues/issue-41776.stderr @@ -1,7 +1,7 @@ error: argument must be a string literal --> $DIR/issue-41776.rs:2:14 | -LL | include!(line!()); //~ ERROR argument must be a string literal +LL | include!(line!()); | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-41974.stderr b/src/test/ui/issues/issue-41974.stderr index 68712e0f0549..54fa48e8bb26 100644 --- a/src/test/ui/issues/issue-41974.stderr +++ b/src/test/ui/issues/issue-41974.stderr @@ -1,7 +1,7 @@ error[E0119]: conflicting implementations of trait `std::ops::Drop` for type `std::boxed::Box<_>`: --> $DIR/issue-41974.rs:7:1 | -LL | impl Drop for T where T: A { //~ ERROR E0119 +LL | impl Drop for T where T: A { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `alloc`: @@ -12,13 +12,13 @@ LL | impl Drop for T where T: A { //~ ERROR E0119 error[E0120]: the Drop trait may only be implemented on structures --> $DIR/issue-41974.rs:7:18 | -LL | impl Drop for T where T: A { //~ ERROR E0119 +LL | impl Drop for T where T: A { | ^ implementing Drop requires a struct error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`) --> $DIR/issue-41974.rs:7:1 | -LL | impl Drop for T where T: A { //~ ERROR E0119 +LL | impl Drop for T where T: A { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type | = note: only traits defined in the current crate can be implemented for a type parameter diff --git a/src/test/ui/issues/issue-4201.stderr b/src/test/ui/issues/issue-4201.stderr index 4f8ec96d5315..d436c929a729 100644 --- a/src/test/ui/issues/issue-4201.stderr +++ b/src/test/ui/issues/issue-4201.stderr @@ -3,10 +3,10 @@ error[E0317]: if may be missing an else clause | LL | } else if false { | ____________^ -LL | | //~^ ERROR if may be missing an else clause -LL | | //~| expected type `()` -LL | | //~| found type `{integer}` -LL | | //~| expected (), found integer +LL | | +LL | | +LL | | +LL | | LL | | 1 LL | | }; | |_____^ expected (), found integer diff --git a/src/test/ui/issues/issue-42060.stderr b/src/test/ui/issues/issue-42060.stderr index cad2bb2a67be..6f42c86e84aa 100644 --- a/src/test/ui/issues/issue-42060.stderr +++ b/src/test/ui/issues/issue-42060.stderr @@ -1,25 +1,25 @@ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/issue-42060.rs:3:23 | -LL | let other: typeof(thing) = thing; //~ ERROR attempt to use a non-constant value in a constant +LL | let other: typeof(thing) = thing; | ^^^^^ non-constant value error[E0435]: attempt to use a non-constant value in a constant --> $DIR/issue-42060.rs:9:13 | -LL | ::N //~ ERROR attempt to use a non-constant value in a constant +LL | ::N | ^ non-constant value error[E0516]: `typeof` is a reserved keyword but unimplemented --> $DIR/issue-42060.rs:3:16 | -LL | let other: typeof(thing) = thing; //~ ERROR attempt to use a non-constant value in a constant +LL | let other: typeof(thing) = thing; | ^^^^^^^^^^^^^ reserved keyword error[E0516]: `typeof` is a reserved keyword but unimplemented --> $DIR/issue-42060.rs:9:6 | -LL | ::N //~ ERROR attempt to use a non-constant value in a constant +LL | ::N | ^^^^^^^^^ reserved keyword error: aborting due to 4 previous errors diff --git a/src/test/ui/issues/issue-42106.nll.stderr b/src/test/ui/issues/issue-42106.nll.stderr index 3a31e439c078..d5a9d233bc96 100644 --- a/src/test/ui/issues/issue-42106.nll.stderr +++ b/src/test/ui/issues/issue-42106.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*collection` as mutable because it is also borrowed | LL | let _a = &collection; | ----------- immutable borrow occurs here -LL | collection.swap(1, 2); //~ ERROR also borrowed as immutable +LL | collection.swap(1, 2); | ^^^^^^^^^^ mutable borrow occurs here LL | _a.use_ref(); | -- immutable borrow later used here diff --git a/src/test/ui/issues/issue-42106.stderr b/src/test/ui/issues/issue-42106.stderr index e1018a89d209..9e3ce9878c22 100644 --- a/src/test/ui/issues/issue-42106.stderr +++ b/src/test/ui/issues/issue-42106.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*collection` as mutable because `collection` is als | LL | let _a = &collection; | ---------- immutable borrow occurs here -LL | collection.swap(1, 2); //~ ERROR also borrowed as immutable +LL | collection.swap(1, 2); | ^^^^^^^^^^ mutable borrow occurs here LL | _a.use_ref(); LL | } diff --git a/src/test/ui/issues/issue-42344.nll.stderr b/src/test/ui/issues/issue-42344.nll.stderr index 9770d26fb12d..5cffa1b51219 100644 --- a/src/test/ui/issues/issue-42344.nll.stderr +++ b/src/test/ui/issues/issue-42344.nll.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow `*TAB[_]` as mutable, as `TAB` is an immutable static item --> $DIR/issue-42344.rs:4:5 | -LL | TAB[0].iter_mut(); //~ ERROR cannot borrow data mutably in a `&` reference [E0389] +LL | TAB[0].iter_mut(); | ^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/issues/issue-42344.stderr b/src/test/ui/issues/issue-42344.stderr index cb0fe78d1020..6bf26c2cf5c5 100644 --- a/src/test/ui/issues/issue-42344.stderr +++ b/src/test/ui/issues/issue-42344.stderr @@ -1,7 +1,7 @@ error[E0389]: cannot borrow data mutably in a `&` reference --> $DIR/issue-42344.rs:4:5 | -LL | TAB[0].iter_mut(); //~ ERROR cannot borrow data mutably in a `&` reference [E0389] +LL | TAB[0].iter_mut(); | ^^^^^^ assignment into an immutable reference error: aborting due to previous error diff --git a/src/test/ui/issues/issue-4265.stderr b/src/test/ui/issues/issue-4265.stderr index b5fce14914d6..4faf5d3a9230 100644 --- a/src/test/ui/issues/issue-4265.stderr +++ b/src/test/ui/issues/issue-4265.stderr @@ -6,7 +6,7 @@ LL | | Foo { baz: 0 }.bar(); LL | | } | |_____- previous definition of `bar` here LL | -LL | / fn bar() { //~ ERROR duplicate definitions +LL | / fn bar() { LL | | } | |_____^ duplicate definition diff --git a/src/test/ui/issues/issue-42755.stderr b/src/test/ui/issues/issue-42755.stderr index 4b490f8e87f9..12047e22f1b0 100644 --- a/src/test/ui/issues/issue-42755.stderr +++ b/src/test/ui/issues/issue-42755.stderr @@ -1,7 +1,7 @@ error: repetition matches empty token tree --> $DIR/issue-42755.rs:2:7 | -LL | ($($p:vis)*) => {} //~ ERROR repetition matches empty token tree +LL | ($($p:vis)*) => {} | ^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-42796.nll.stderr b/src/test/ui/issues/issue-42796.nll.stderr index 23cc88bab52d..d9dfbc999f36 100644 --- a/src/test/ui/issues/issue-42796.nll.stderr +++ b/src/test/ui/issues/issue-42796.nll.stderr @@ -6,7 +6,7 @@ LL | let s = "Hello!".to_owned(); LL | let mut s_copy = s; | - value moved here ... -LL | println!("{}", s); //~ ERROR use of moved value +LL | println!("{}", s); | ^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/issues/issue-42796.stderr b/src/test/ui/issues/issue-42796.stderr index 530eedd68e6a..d180e6478ef1 100644 --- a/src/test/ui/issues/issue-42796.stderr +++ b/src/test/ui/issues/issue-42796.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `s` LL | let mut s_copy = s; | ---------- value moved here ... -LL | println!("{}", s); //~ ERROR use of moved value +LL | println!("{}", s); | ^ value used here after move | = note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait diff --git a/src/test/ui/issues/issue-42880.stderr b/src/test/ui/issues/issue-42880.stderr index 36b9e8a1e8af..8a40a49c0def 100644 --- a/src/test/ui/issues/issue-42880.stderr +++ b/src/test/ui/issues/issue-42880.stderr @@ -1,7 +1,7 @@ error[E0599]: no associated item named `String` found for type `std::string::String` in the current scope --> $DIR/issue-42880.rs:4:22 | -LL | let f = |&Value::String(_)| (); //~ ERROR no associated item named +LL | let f = |&Value::String(_)| (); | -------^^^^^^--- associated item not found in `std::string::String` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-42954.stderr b/src/test/ui/issues/issue-42954.stderr index 6a89724de5f7..8c35088a1bbe 100644 --- a/src/test/ui/issues/issue-42954.stderr +++ b/src/test/ui/issues/issue-42954.stderr @@ -1,7 +1,7 @@ error: `<` is interpreted as a start of generic arguments for `u32`, not a comparison --> $DIR/issue-42954.rs:7:19 | -LL | $i as u32 < 0 //~ `<` is interpreted as a start of generic arguments +LL | $i as u32 < 0 | --------- ^ - interpreted as generic arguments | | | | | not interpreted as comparison diff --git a/src/test/ui/issues/issue-43023.stderr b/src/test/ui/issues/issue-43023.stderr index b620cc5d74e8..206a51645fe6 100644 --- a/src/test/ui/issues/issue-43023.stderr +++ b/src/test/ui/issues/issue-43023.stderr @@ -1,19 +1,19 @@ error: `derive` may only be applied to structs, enums and unions --> $DIR/issue-43023.rs:4:5 | -LL | #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions +LL | #[derive(Debug)] | ^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions --> $DIR/issue-43023.rs:11:5 | -LL | #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions +LL | #[derive(Debug)] | ^^^^^^^^^^^^^^^^ error: `derive` may only be applied to structs, enums and unions --> $DIR/issue-43023.rs:16:5 | -LL | #[derive(Debug)] //~ ERROR `derive` may only be applied to structs, enums and unions +LL | #[derive(Debug)] | ^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-43162.stderr b/src/test/ui/issues/issue-43162.stderr index 3fc5317830e4..d3ff9002b967 100644 --- a/src/test/ui/issues/issue-43162.stderr +++ b/src/test/ui/issues/issue-43162.stderr @@ -1,13 +1,13 @@ error[E0268]: `break` outside of loop --> $DIR/issue-43162.rs:3:5 | -LL | break true; //~ ERROR E0268 +LL | break true; | ^^^^^^^^^^ cannot break outside of a loop error[E0268]: `break` outside of loop --> $DIR/issue-43162.rs:7:5 | -LL | break {}; //~ ERROR E0268 +LL | break {}; | ^^^^^^^^ cannot break outside of a loop error[E0308]: mismatched types @@ -17,8 +17,8 @@ LL | fn foo() -> bool { | --- ^^^^ expected bool, found () | | | this function's body doesn't return -LL | //~^ ERROR E0308 -LL | break true; //~ ERROR E0268 +LL | +LL | break true; | - help: consider removing this semicolon | = note: expected type `bool` diff --git a/src/test/ui/issues/issue-4321.stderr b/src/test/ui/issues/issue-4321.stderr index 7817fdcbce99..afb4fe775d58 100644 --- a/src/test/ui/issues/issue-4321.stderr +++ b/src/test/ui/issues/issue-4321.stderr @@ -1,8 +1,10 @@ error[E0004]: non-exhaustive patterns: `(true, false)` not covered --> $DIR/issue-4321.rs:3:31 | -LL | println!("foo {:}", match tup { //~ ERROR non-exhaustive patterns: `(true, false)` not covered +LL | println!("foo {:}", match tup { | ^^^ pattern `(true, false)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/issues/issue-43420-no-over-suggest.stderr b/src/test/ui/issues/issue-43420-no-over-suggest.stderr index bd51d7e11695..7a3722e4bd72 100644 --- a/src/test/ui/issues/issue-43420-no-over-suggest.stderr +++ b/src/test/ui/issues/issue-43420-no-over-suggest.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-43420-no-over-suggest.rs:8:9 | -LL | foo(&a); //~ ERROR mismatched types +LL | foo(&a); | ^^ expected slice, found struct `std::vec::Vec` | = note: expected type `&[u16]` diff --git a/src/test/ui/issues/issue-43424.stderr b/src/test/ui/issues/issue-43424.stderr index c81ea20170c7..6274a7928ba0 100644 --- a/src/test/ui/issues/issue-43424.stderr +++ b/src/test/ui/issues/issue-43424.stderr @@ -1,7 +1,7 @@ error: unexpected generic arguments in path --> $DIR/issue-43424.rs:10:4 | -LL | m!(inline); //~ ERROR: unexpected generic arguments in path +LL | m!(inline); | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-4366-2.stderr b/src/test/ui/issues/issue-4366-2.stderr index 8cf0e3bd520d..76f08d77232c 100644 --- a/src/test/ui/issues/issue-4366-2.stderr +++ b/src/test/ui/issues/issue-4366-2.stderr @@ -11,7 +11,7 @@ LL | use a::b::Bar; error[E0423]: expected function, found module `foo` --> $DIR/issue-4366-2.rs:25:5 | -LL | foo(); //~ ERROR expected function, found module `foo` +LL | foo(); | ^^^ not a function help: possible better candidates are found in other modules, you can import them into scope | diff --git a/src/test/ui/issues/issue-4366.stderr b/src/test/ui/issues/issue-4366.stderr index 2bad7b17d642..c59ab0045570 100644 --- a/src/test/ui/issues/issue-4366.stderr +++ b/src/test/ui/issues/issue-4366.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find function `foo` in this scope --> $DIR/issue-4366.rs:18:29 | -LL | fn sub() -> isize { foo(); 1 } //~ ERROR cannot find function `foo` in this scope +LL | fn sub() -> isize { foo(); 1 } | ^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | diff --git a/src/test/ui/issues/issue-43733.stderr b/src/test/ui/issues/issue-43733.stderr index 38fa93d44618..c48f9baf2719 100644 --- a/src/test/ui/issues/issue-43733.stderr +++ b/src/test/ui/issues/issue-43733.stderr @@ -1,7 +1,7 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block --> $DIR/issue-43733.rs:20:5 | -LL | __KEY.get() //~ ERROR call to unsafe function is unsafe +LL | __KEY.get() | ^^^^^^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior diff --git a/src/test/ui/issues/issue-43784-associated-type.stderr b/src/test/ui/issues/issue-43784-associated-type.stderr index 4beb854b0f31..fc05d280693b 100644 --- a/src/test/ui/issues/issue-43784-associated-type.stderr +++ b/src/test/ui/issues/issue-43784-associated-type.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/issue-43784-associated-type.rs:13:9 | -LL | impl Complete for T { //~ ERROR the trait bound `T: std::marker::Copy` is not satisfied +LL | impl Complete for T { | ^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound diff --git a/src/test/ui/issues/issue-43784-supertrait.stderr b/src/test/ui/issues/issue-43784-supertrait.stderr index 7771f9abfb8a..4c423f2e77fe 100644 --- a/src/test/ui/issues/issue-43784-supertrait.stderr +++ b/src/test/ui/issues/issue-43784-supertrait.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/issue-43784-supertrait.rs:8:9 | -LL | impl Complete for T {} //~ ERROR the trait bound `T: std::marker::Copy` is not satisfied +LL | impl Complete for T {} | ^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound diff --git a/src/test/ui/issues/issue-43925.stderr b/src/test/ui/issues/issue-43925.stderr index e73c2122a03f..739ace10aa6a 100644 --- a/src/test/ui/issues/issue-43925.stderr +++ b/src/test/ui/issues/issue-43925.stderr @@ -1,7 +1,7 @@ error: invalid argument for `cfg(..)` --> $DIR/issue-43925.rs:1:24 | -LL | #[link(name="foo", cfg("rlib"))] //~ ERROR invalid argument for `cfg(..)` +LL | #[link(name="foo", cfg("rlib"))] | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-43926.stderr b/src/test/ui/issues/issue-43926.stderr index 9dc9cfe5db2a..d9d6b3a34fe2 100644 --- a/src/test/ui/issues/issue-43926.stderr +++ b/src/test/ui/issues/issue-43926.stderr @@ -1,7 +1,7 @@ error: `cfg()` must have an argument --> $DIR/issue-43926.rs:1:20 | -LL | #[link(name="foo", cfg())] //~ ERROR `cfg()` must have an argument +LL | #[link(name="foo", cfg())] | ^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-44021.stderr b/src/test/ui/issues/issue-44021.stderr index 03f11312d465..94500087e553 100644 --- a/src/test/ui/issues/issue-44021.stderr +++ b/src/test/ui/issues/issue-44021.stderr @@ -1,7 +1,7 @@ error: expected one of `:`, `@`, or `|`, found `}` --> $DIR/issue-44021.rs:3:18 | -LL | fn f() {|x, y} //~ ERROR expected one of `:`, `@`, or `|`, found `}` +LL | fn f() {|x, y} | ^ expected one of `:`, `@`, or `|` here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-44023.stderr b/src/test/ui/issues/issue-44023.stderr index f1962a86ee03..153be363c1de 100644 --- a/src/test/ui/issues/issue-44023.stderr +++ b/src/test/ui/issues/issue-44023.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-44023.rs:5:36 | -LL | fn αƒ‘αƒαƒ­αƒ›αƒ”αƒšαƒαƒ“_αƒ’αƒ”αƒ›αƒ αƒ˜αƒ”αƒšαƒ˜_αƒ‘αƒαƒ“αƒ˜αƒšαƒ˜ ( ) -> isize { //~ ERROR mismatched types +LL | fn αƒ‘αƒαƒ­αƒ›αƒ”αƒšαƒαƒ“_αƒ’αƒ”αƒ›αƒ αƒ˜αƒ”αƒšαƒ˜_αƒ‘αƒαƒ“αƒ˜αƒšαƒ˜ ( ) -> isize { | ------------------------ ^^^^^ expected isize, found () | | | this function's body doesn't return diff --git a/src/test/ui/issues/issue-44078.stderr b/src/test/ui/issues/issue-44078.stderr index e7f46130f112..43b49e463128 100644 --- a/src/test/ui/issues/issue-44078.stderr +++ b/src/test/ui/issues/issue-44078.stderr @@ -1,7 +1,7 @@ error: unterminated double quote string --> $DIR/issue-44078.rs:2:8 | -LL | "😊""; //~ ERROR unterminated double quote +LL | "😊""; | _________^ LL | | } | |__^ diff --git a/src/test/ui/issues/issue-44127.rs b/src/test/ui/issues/issue-44127.rs new file mode 100644 index 000000000000..21b2e68264a1 --- /dev/null +++ b/src/test/ui/issues/issue-44127.rs @@ -0,0 +1,17 @@ +// run-pass + +#![feature(decl_macro)] + +pub struct Foo { + bar: u32, +} +pub macro pattern($a:pat) { + Foo { bar: $a } +} + +fn main() { + match (Foo { bar: 3 }) { + pattern!(3) => println!("Test OK"), + _ => unreachable!(), + } +} diff --git a/src/test/ui/issues/issue-44255.rs b/src/test/ui/issues/issue-44255.rs new file mode 100644 index 000000000000..224503204325 --- /dev/null +++ b/src/test/ui/issues/issue-44255.rs @@ -0,0 +1,29 @@ +// run-pass + +use std::marker::PhantomData; + +fn main() { + let _arr = [1; >::VAL]; +} + +trait TypeVal { + const VAL: T; +} + +struct Five; + +impl TypeVal for Five { + const VAL: usize = 5; +} + +struct Multiply { + _n: PhantomData, + _m: PhantomData, +} + +impl TypeVal for Multiply + where N: TypeVal, + M: TypeVal, +{ + const VAL: usize = N::VAL * M::VAL; +} diff --git a/src/test/ui/issues/issue-44373.nll.stderr b/src/test/ui/issues/issue-44373.nll.stderr index 8359e5af2b8d..6f92fbb1eb68 100644 --- a/src/test/ui/issues/issue-44373.nll.stderr +++ b/src/test/ui/issues/issue-44373.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/issue-44373.rs:4:42 | -LL | let _val: &'static [&'static u32] = &[&FOO]; //~ ERROR borrowed value does not live long enough +LL | let _val: &'static [&'static u32] = &[&FOO]; | ----------------------- ^^^^^^ creates a temporary which is freed while still in use | | | type annotation requires that borrow lasts for `'static` diff --git a/src/test/ui/issues/issue-44373.stderr b/src/test/ui/issues/issue-44373.stderr index 5a4bf18f3d5a..c52955833904 100644 --- a/src/test/ui/issues/issue-44373.stderr +++ b/src/test/ui/issues/issue-44373.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/issue-44373.rs:4:42 | -LL | let _val: &'static [&'static u32] = &[&FOO]; //~ ERROR borrowed value does not live long enough +LL | let _val: &'static [&'static u32] = &[&FOO]; | ^^^^^^ temporary value does not live long enough LL | } | - temporary value only lives until here diff --git a/src/test/ui/issues/issue-44406.stderr b/src/test/ui/issues/issue-44406.stderr index 105dbb677dc0..14b3b8cc5c85 100644 --- a/src/test/ui/issues/issue-44406.stderr +++ b/src/test/ui/issues/issue-44406.stderr @@ -1,11 +1,11 @@ error: expected identifier, found keyword `true` --> $DIR/issue-44406.rs:8:10 | -LL | foo!(true); //~ ERROR expected type, found keyword +LL | foo!(true); | ^^^^ expected identifier, found keyword help: you can escape reserved keywords to use them as identifiers | -LL | foo!(r#true); //~ ERROR expected type, found keyword +LL | foo!(r#true); | ^^^^^^ error: expected type, found keyword `true` @@ -14,7 +14,7 @@ error: expected type, found keyword `true` LL | bar(baz: $rest) | - help: try using a semicolon: `;` ... -LL | foo!(true); //~ ERROR expected type, found keyword +LL | foo!(true); | ^^^^ expecting a type here because of type ascription error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-45107-unnecessary-unsafe-in-closure.stderr b/src/test/ui/issues/issue-45107-unnecessary-unsafe-in-closure.stderr index 3510112daf0a..71fbba562cae 100644 --- a/src/test/ui/issues/issue-45107-unnecessary-unsafe-in-closure.stderr +++ b/src/test/ui/issues/issue-45107-unnecessary-unsafe-in-closure.stderr @@ -4,7 +4,7 @@ error: unnecessary `unsafe` block LL | unsafe { | ------ because it's nested under this `unsafe` block LL | let f = |v: &mut Vec<_>| { -LL | unsafe { //~ ERROR unnecessary `unsafe` +LL | unsafe { | ^^^^^^ unnecessary `unsafe` block | note: lint level defined here @@ -19,7 +19,7 @@ error: unnecessary `unsafe` block LL | unsafe { | ------ because it's nested under this `unsafe` block ... -LL | |w: &mut Vec| { unsafe { //~ ERROR unnecessary `unsafe` +LL | |w: &mut Vec| { unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block @@ -28,7 +28,7 @@ error: unnecessary `unsafe` block LL | unsafe { | ------ because it's nested under this `unsafe` block ... -LL | |x: &mut Vec| { unsafe { //~ ERROR unnecessary `unsafe` +LL | |x: &mut Vec| { unsafe { | ^^^^^^ unnecessary `unsafe` block error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-45157.stderr b/src/test/ui/issues/issue-45157.stderr index 3b15a8dbd9ef..fbfa1d199566 100644 --- a/src/test/ui/issues/issue-45157.stderr +++ b/src/test/ui/issues/issue-45157.stderr @@ -6,7 +6,7 @@ LL | let mref = &mut u.s.a; ... LL | let nref = &u.z.c; | ^^^^^^ immutable borrow of `u.z.c` -- which overlaps with `u.s.a` -- occurs here -LL | //~^ ERROR cannot borrow `u` (via `u.z.c`) as immutable because it is also borrowed as mutable (via `u.s.a`) [E0502] +LL | LL | println!("{} {}", mref, nref) | ---- mutable borrow later used here | diff --git a/src/test/ui/issues/issue-45296.stderr b/src/test/ui/issues/issue-45296.stderr index afea28fb7aaf..bc14d20b6238 100644 --- a/src/test/ui/issues/issue-45296.stderr +++ b/src/test/ui/issues/issue-45296.stderr @@ -1,7 +1,7 @@ error: an inner attribute is not permitted in this context --> $DIR/issue-45296.rs:4:7 | -LL | #![allow(unused_variables)] //~ ERROR not permitted in this context +LL | #![allow(unused_variables)] | ^ | = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. diff --git a/src/test/ui/issues/issue-45730.stderr b/src/test/ui/issues/issue-45730.stderr index 4f2784c6c362..3c400d6eefaa 100644 --- a/src/test/ui/issues/issue-45730.stderr +++ b/src/test/ui/issues/issue-45730.stderr @@ -1,7 +1,7 @@ error[E0641]: cannot cast to a pointer of an unknown kind --> $DIR/issue-45730.rs:3:23 | -LL | let x: *const _ = 0 as _; //~ ERROR cannot cast +LL | let x: *const _ = 0 as _; | ^^^^^- | | | help: consider giving more type information @@ -11,7 +11,7 @@ LL | let x: *const _ = 0 as _; //~ ERROR cannot cast error[E0641]: cannot cast to a pointer of an unknown kind --> $DIR/issue-45730.rs:5:23 | -LL | let x: *const _ = 0 as *const _; //~ ERROR cannot cast +LL | let x: *const _ = 0 as *const _; | ^^^^^-------- | | | help: consider giving more type information @@ -21,7 +21,7 @@ LL | let x: *const _ = 0 as *const _; //~ ERROR cannot cast error[E0641]: cannot cast to a pointer of an unknown kind --> $DIR/issue-45730.rs:8:13 | -LL | let x = 0 as *const i32 as *const _ as *mut _; //~ ERROR cannot cast +LL | let x = 0 as *const i32 as *const _ as *mut _; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------ | | | help: consider giving more type information diff --git a/src/test/ui/issues/issue-46036.stderr b/src/test/ui/issues/issue-46036.stderr index 40a77f925b94..9c1746e0fa1e 100644 --- a/src/test/ui/issues/issue-46036.stderr +++ b/src/test/ui/issues/issue-46036.stderr @@ -1,7 +1,7 @@ error[E0597]: `a` does not live long enough --> $DIR/issue-46036.rs:9:24 | -LL | let foo = Foo { x: &a }; //~ ERROR E0597 +LL | let foo = Foo { x: &a }; | ^^ | | | borrowed value does not live long enough diff --git a/src/test/ui/issues/issue-46101.rs b/src/test/ui/issues/issue-46101.rs new file mode 100644 index 000000000000..2d9111e9b3a9 --- /dev/null +++ b/src/test/ui/issues/issue-46101.rs @@ -0,0 +1,4 @@ +#![feature(use_extern_macros)] +trait Foo {} +#[derive(Foo::Anything)] //~ ERROR failed to resolve: partially resolved path in a derive macro +struct S; diff --git a/src/test/ui/issues/issue-46101.stderr b/src/test/ui/issues/issue-46101.stderr new file mode 100644 index 000000000000..3ad5383294a5 --- /dev/null +++ b/src/test/ui/issues/issue-46101.stderr @@ -0,0 +1,14 @@ +error[E0433]: failed to resolve: partially resolved path in a derive macro + --> $DIR/issue-46101.rs:3:10 + | +LL | #[derive(Foo::Anything)] + | ^^^^^^^^^^^^^ partially resolved path in a derive macro + +error[E0601]: `main` function not found in crate `issue_46101` + | + = note: consider adding a `main` function to `$DIR/issue-46101.rs` + +error: aborting due to 2 previous errors + +Some errors occurred: E0433, E0601. +For more information about an error, try `rustc --explain E0433`. diff --git a/src/test/ui/issues/issue-46311.stderr b/src/test/ui/issues/issue-46311.stderr index 8ceb1d62c25c..d72d6477db64 100644 --- a/src/test/ui/issues/issue-46311.stderr +++ b/src/test/ui/issues/issue-46311.stderr @@ -1,7 +1,7 @@ error: invalid label name `'break` --> $DIR/issue-46311.rs:2:5 | -LL | 'break: loop { //~ ERROR invalid label name `'break` +LL | 'break: loop { | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-46438.stderr b/src/test/ui/issues/issue-46438.stderr index c670459c7816..c1fad44b885f 100644 --- a/src/test/ui/issues/issue-46438.stderr +++ b/src/test/ui/issues/issue-46438.stderr @@ -1,7 +1,7 @@ error: expected a trait, found type --> $DIR/issue-46438.rs:11:4 | -LL | m!(&'static u8); //~ ERROR expected a trait, found type +LL | m!(&'static u8); | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-46771.stderr b/src/test/ui/issues/issue-46771.stderr index 3c9c679ece43..76c86d7aa907 100644 --- a/src/test/ui/issues/issue-46771.stderr +++ b/src/test/ui/issues/issue-46771.stderr @@ -3,7 +3,7 @@ error[E0618]: expected function, found `main::Foo` | LL | struct Foo; | ----------- `main::Foo` defined here -LL | (1 .. 2).find(|_| Foo(0) == 0); //~ ERROR expected function, found `main::Foo` +LL | (1 .. 2).find(|_| Foo(0) == 0); | ^^^--- | | | call expression requires function diff --git a/src/test/ui/issues/issue-46843.stderr b/src/test/ui/issues/issue-46843.stderr index d02561e4a272..c252f0d0758c 100644 --- a/src/test/ui/issues/issue-46843.stderr +++ b/src/test/ui/issues/issue-46843.stderr @@ -1,13 +1,13 @@ error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants --> $DIR/issue-46843.rs:7:26 | -LL | pub const Q: i32 = match non_const() { //~ ERROR E0015 +LL | pub const Q: i32 = match non_const() { | ^^^^^^^^^^^ error[E0019]: constant contains unimplemented expression type --> $DIR/issue-46843.rs:8:5 | -LL | Thing::This => 1, //~ ERROR unimplemented expression type +LL | Thing::This => 1, | ^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-4736.stderr b/src/test/ui/issues/issue-4736.stderr index 39c649ba3e0e..b4ac12643bca 100644 --- a/src/test/ui/issues/issue-4736.stderr +++ b/src/test/ui/issues/issue-4736.stderr @@ -1,7 +1,7 @@ error[E0560]: struct `NonCopyable` has no field named `p` --> $DIR/issue-4736.rs:4:26 | -LL | let z = NonCopyable{ p: () }; //~ ERROR struct `NonCopyable` has no field named `p` +LL | let z = NonCopyable{ p: () }; | ^ help: a field with a similar name exists: `0` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-47623.stderr b/src/test/ui/issues/issue-47623.stderr index eb160ff86aec..53968a2960cc 100644 --- a/src/test/ui/issues/issue-47623.stderr +++ b/src/test/ui/issues/issue-47623.stderr @@ -1,7 +1,7 @@ error[E0429]: `self` imports are only allowed within a { } list --> $DIR/issue-47623.rs:1:5 | -LL | use self; //~ERROR `self` imports are only allowed within a { } list +LL | use self; | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-47646.stderr b/src/test/ui/issues/issue-47646.stderr index c30fedeea73d..db9f227d6b77 100644 --- a/src/test/ui/issues/issue-47646.stderr +++ b/src/test/ui/issues/issue-47646.stderr @@ -7,7 +7,7 @@ LL | LL | match (borrow, ()) { | ------------ a temporary with access to the mutable borrow is created here ... LL | (Some(_), ()) => { -LL | println!("{:?}", heap); //~ ERROR cannot borrow `heap` as immutable +LL | println!("{:?}", heap); | ^^^^ immutable borrow occurs here ... LL | }; diff --git a/src/test/ui/issues/issue-48131.stderr b/src/test/ui/issues/issue-48131.stderr index 6e454173f8bc..adc36e266c27 100644 --- a/src/test/ui/issues/issue-48131.stderr +++ b/src/test/ui/issues/issue-48131.stderr @@ -1,19 +1,19 @@ error: unnecessary `unsafe` block --> $DIR/issue-48131.rs:8:9 | -LL | unsafe { /* unnecessary */ } //~ ERROR unnecessary `unsafe` +LL | unsafe { /* unnecessary */ } | ^^^^^^ unnecessary `unsafe` block | note: lint level defined here --> $DIR/issue-48131.rs:3:9 | -LL | #![deny(unused_unsafe)] //~ NOTE +LL | #![deny(unused_unsafe)] | ^^^^^^^^^^^^^ error: unnecessary `unsafe` block --> $DIR/issue-48131.rs:19:13 | -LL | unsafe { /* unnecessary */ } //~ ERROR unnecessary `unsafe` +LL | unsafe { /* unnecessary */ } | ^^^^^^ unnecessary `unsafe` block error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-48728.stderr b/src/test/ui/issues/issue-48728.stderr index e2f549ac4256..99a9bf9903e2 100644 --- a/src/test/ui/issues/issue-48728.stderr +++ b/src/test/ui/issues/issue-48728.stderr @@ -1,7 +1,7 @@ error[E0119]: conflicting implementations of trait `std::clone::Clone` for type `Node<[_]>`: --> $DIR/issue-48728.rs:4:10 | -LL | #[derive(Clone)] //~ ERROR conflicting implementations of trait `std::clone::Clone` +LL | #[derive(Clone)] | ^^^^^ conflicting implementation for `Node<[_]>` ... LL | impl Clone for Node<[T]> { diff --git a/src/test/ui/issues/issue-48803.stderr b/src/test/ui/issues/issue-48803.stderr index 2635520ef078..9a6da9e625da 100644 --- a/src/test/ui/issues/issue-48803.stderr +++ b/src/test/ui/issues/issue-48803.stderr @@ -6,7 +6,7 @@ LL | let y = &x; ... LL | x = "modified"; | ^^^^^^^^^^^^^^ assignment to borrowed `x` occurs here -LL | //~^ ERROR cannot assign to `x` because it is borrowed [E0506] +LL | LL | println!("{}", w); // prints "modified" | - borrow later used here diff --git a/src/test/ui/issues/issue-48838.stderr b/src/test/ui/issues/issue-48838.stderr index 32eea5e5fbb8..3007d67336b5 100644 --- a/src/test/ui/issues/issue-48838.stderr +++ b/src/test/ui/issues/issue-48838.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-48838.rs:2:14 | -LL | Square = |x| x, //~ ERROR mismatched types +LL | Square = |x| x, | ^^^^^ expected isize, found closure | = note: expected type `isize` diff --git a/src/test/ui/issues/issue-49040.stderr b/src/test/ui/issues/issue-49040.stderr index 12e78e2f3bc9..de78b8d3c14a 100644 --- a/src/test/ui/issues/issue-49040.stderr +++ b/src/test/ui/issues/issue-49040.stderr @@ -1,7 +1,7 @@ error: expected item, found `;` --> $DIR/issue-49040.rs:1:28 | -LL | #![allow(unused_variables)]; //~ ERROR expected item, found `;` +LL | #![allow(unused_variables)]; | ^ help: remove this semicolon error[E0601]: `main` function not found in crate `issue_49040` diff --git a/src/test/ui/issues/issue-49074.stderr b/src/test/ui/issues/issue-49074.stderr index a25d8ee35268..b41d9130f122 100644 --- a/src/test/ui/issues/issue-49074.stderr +++ b/src/test/ui/issues/issue-49074.stderr @@ -9,7 +9,7 @@ LL | #[marco_use] // typo error: cannot find macro `bar!` in this scope --> $DIR/issue-49074.rs:12:4 | -LL | bar!(); //~ ERROR cannot find macro `bar!` in this scope +LL | bar!(); | ^^^ | = help: have you added the `#[macro_use]` on the module/import? diff --git a/src/test/ui/issues/issue-49257.stderr b/src/test/ui/issues/issue-49257.stderr index 0bccfbbf7e5a..43a505cfe85f 100644 --- a/src/test/ui/issues/issue-49257.stderr +++ b/src/test/ui/issues/issue-49257.stderr @@ -1,33 +1,33 @@ error: expected `}`, found `,` --> $DIR/issue-49257.rs:10:19 | -LL | let Point { .., y, } = p; //~ ERROR expected `}`, found `,` +LL | let Point { .., y, } = p; | --^ | | | | | expected `}` | `..` must be at the end and cannot have a trailing comma help: move the `..` to the end of the field list | -LL | let Point { y, .. } = p; //~ ERROR expected `}`, found `,` +LL | let Point { y, .. } = p; | -- ^^^^ error: expected `}`, found `,` --> $DIR/issue-49257.rs:11:19 | -LL | let Point { .., y } = p; //~ ERROR expected `}`, found `,` +LL | let Point { .., y } = p; | --^ | | | | | expected `}` | `..` must be at the end and cannot have a trailing comma help: move the `..` to the end of the field list | -LL | let Point { y , .. } = p; //~ ERROR expected `}`, found `,` +LL | let Point { y , .. } = p; | -- ^^^^^^ error: expected `}`, found `,` --> $DIR/issue-49257.rs:12:19 | -LL | let Point { .., } = p; //~ ERROR expected `}`, found `,` +LL | let Point { .., } = p; | --^ | | | | | expected `}` diff --git a/src/test/ui/issues/issue-4935.stderr b/src/test/ui/issues/issue-4935.stderr index 42869ab48318..a99581fdca18 100644 --- a/src/test/ui/issues/issue-4935.stderr +++ b/src/test/ui/issues/issue-4935.stderr @@ -3,7 +3,7 @@ error[E0061]: this function takes 1 parameter but 2 parameters were supplied | LL | fn foo(a: usize) {} | ---------------- defined here -LL | //~^ defined here +LL | LL | fn main() { foo(5, 6) } | ^^^^^^^^^ expected 1 parameter diff --git a/src/test/ui/issues/issue-4972.stderr b/src/test/ui/issues/issue-4972.stderr index 30664c90ce81..b1947e2a9dff 100644 --- a/src/test/ui/issues/issue-4972.stderr +++ b/src/test/ui/issues/issue-4972.stderr @@ -1,7 +1,7 @@ error[E0033]: type `std::boxed::Box<(dyn MyTrait + 'static)>` cannot be dereferenced --> $DIR/issue-4972.rs:14:25 | -LL | TraitWrapper::A(box ref map) => map, //~ ERROR cannot be dereferenced +LL | TraitWrapper::A(box ref map) => map, | ^^^^^^^^^^^ type `std::boxed::Box<(dyn MyTrait + 'static)>` cannot be dereferenced error: aborting due to previous error diff --git a/src/test/ui/issues/issue-49824.nll.stderr b/src/test/ui/issues/issue-49824.nll.stderr index 4e2f3f59a644..bfa07059c685 100644 --- a/src/test/ui/issues/issue-49824.nll.stderr +++ b/src/test/ui/issues/issue-49824.nll.stderr @@ -17,7 +17,7 @@ error: compilation successful --> $DIR/issue-49824.rs:8:1 | LL | / fn main() { -LL | | //~^ compilation successful +LL | | LL | | let mut x = 0; LL | | || { ... | diff --git a/src/test/ui/issues/issue-49824.stderr b/src/test/ui/issues/issue-49824.stderr index f487c363ea67..4ad537f3eb5d 100644 --- a/src/test/ui/issues/issue-49824.stderr +++ b/src/test/ui/issues/issue-49824.stderr @@ -2,7 +2,7 @@ error: compilation successful --> $DIR/issue-49824.rs:8:1 | LL | / fn main() { -LL | | //~^ compilation successful +LL | | LL | | let mut x = 0; LL | | || { ... | diff --git a/src/test/ui/issues/issue-49934.stderr b/src/test/ui/issues/issue-49934.stderr index 295f4f1b559a..6ca751a47c47 100644 --- a/src/test/ui/issues/issue-49934.stderr +++ b/src/test/ui/issues/issue-49934.stderr @@ -9,31 +9,31 @@ LL | #[derive(Debug)] warning: unused attribute --> $DIR/issue-49934.rs:6:8 | -LL | fn foo<#[derive(Debug)] T>() { //~ WARN unused attribute +LL | fn foo<#[derive(Debug)] T>() { | ^^^^^^^^^^^^^^^^ | note: lint level defined here --> $DIR/issue-49934.rs:4:9 | -LL | #![warn(unused_attributes)] //~ NOTE lint level defined here +LL | #![warn(unused_attributes)] | ^^^^^^^^^^^^^^^^^ warning: unused attribute --> $DIR/issue-49934.rs:8:9 | -LL | #[derive(Debug)] //~ WARN unused attribute +LL | #[derive(Debug)] | ^^^^^^^^^^^^^^^^ warning: unused attribute --> $DIR/issue-49934.rs:26:5 | -LL | #[derive(Debug)] //~ WARN unused attribute +LL | #[derive(Debug)] | ^^^^^^^^^^^^^^^^ warning: unused attribute --> $DIR/issue-49934.rs:30:5 | -LL | #[derive(Debug)] //~ WARN unused attribute +LL | #[derive(Debug)] | ^^^^^^^^^^^^^^^^ warning: unused attribute @@ -45,6 +45,6 @@ LL | let _ = #[derive(Debug)] "Hello, world!"; warning: unused attribute --> $DIR/issue-49934.rs:39:9 | -LL | #[derive(Debug)] //~ WARN unused attribute +LL | #[derive(Debug)] | ^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/issues/issue-50403.stderr b/src/test/ui/issues/issue-50403.stderr index f84d9d7769da..d20a98ecc6ad 100644 --- a/src/test/ui/issues/issue-50403.stderr +++ b/src/test/ui/issues/issue-50403.stderr @@ -1,7 +1,7 @@ error: concat_idents! takes 1 or more arguments. --> $DIR/issue-50403.rs:4:13 | -LL | let x = concat_idents!(); //~ ERROR concat_idents! takes 1 or more arguments +LL | let x = concat_idents!(); | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-50480.stderr b/src/test/ui/issues/issue-50480.stderr index 240a0f222864..fb111e87d185 100644 --- a/src/test/ui/issues/issue-50480.stderr +++ b/src/test/ui/issues/issue-50480.stderr @@ -18,7 +18,7 @@ error[E0204]: the trait `Copy` may not be implemented for this type | LL | #[derive(Clone, Copy)] | ^^^^ -LL | //~^ ERROR the trait `Copy` may not be implemented for this type +LL | LL | struct Foo(NotDefined, ::Item, Vec, String); | -------- ------ this field does not implement `Copy` | | diff --git a/src/test/ui/issues/issue-50576.stderr b/src/test/ui/issues/issue-50576.stderr index 98624d141a61..22d978262c46 100644 --- a/src/test/ui/issues/issue-50576.stderr +++ b/src/test/ui/issues/issue-50576.stderr @@ -13,7 +13,7 @@ LL | |bool: [u8; break 'L]| 0; error[E0268]: `break` outside of loop --> $DIR/issue-50576.rs:5:16 | -LL | Vec::<[u8; break]>::new(); //~ ERROR [E0268] +LL | Vec::<[u8; break]>::new(); | ^^^^^ cannot break outside of a loop error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-50581.stderr b/src/test/ui/issues/issue-50581.stderr index 70ac9ecc9edf..01a5f9b3c443 100644 --- a/src/test/ui/issues/issue-50581.stderr +++ b/src/test/ui/issues/issue-50581.stderr @@ -1,7 +1,7 @@ error[E0268]: `break` outside of loop --> $DIR/issue-50581.rs:2:14 | -LL | |_: [u8; break]| (); //~ ERROR [E0268] +LL | |_: [u8; break]| (); | ^^^^^ cannot break outside of a loop error: aborting due to previous error diff --git a/src/test/ui/issues/issue-50582.rs b/src/test/ui/issues/issue-50582.rs new file mode 100644 index 000000000000..1358e0bde4c8 --- /dev/null +++ b/src/test/ui/issues/issue-50582.rs @@ -0,0 +1,4 @@ +fn main() { + Vec::<[(); 1 + for x in 0..1 {}]>::new(); + //~^ ERROR cannot add +} diff --git a/src/test/ui/issues/issue-50582.stderr b/src/test/ui/issues/issue-50582.stderr new file mode 100644 index 000000000000..226f5a3f0fed --- /dev/null +++ b/src/test/ui/issues/issue-50582.stderr @@ -0,0 +1,11 @@ +error[E0277]: cannot add `()` to `{integer}` + --> $DIR/issue-50582.rs:2:18 + | +LL | Vec::<[(); 1 + for x in 0..1 {}]>::new(); + | ^ no implementation for `{integer} + ()` + | + = help: the trait `std::ops::Add<()>` is not implemented for `{integer}` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/issues/issue-50599.stderr b/src/test/ui/issues/issue-50599.stderr index cf2f309340de..e0c9bea4023d 100644 --- a/src/test/ui/issues/issue-50599.stderr +++ b/src/test/ui/issues/issue-50599.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `LOG10_2` in module `std::f64` --> $DIR/issue-50599.rs:3:48 | -LL | const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize; //~ ERROR cannot find value +LL | const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize; | ^^^^^^^ not found in `std::f64` help: possible candidates are found in other modules, you can import them into scope | diff --git a/src/test/ui/issues/issue-50600.stderr b/src/test/ui/issues/issue-50600.stderr index 36219390c519..2d97c2781c2d 100644 --- a/src/test/ui/issues/issue-50600.stderr +++ b/src/test/ui/issues/issue-50600.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-50600.rs:2:13 | -LL | fn([u8; |x: u8| {}]), //~ ERROR mismatched types +LL | fn([u8; |x: u8| {}]), | ^^^^^^^^^^ expected usize, found closure | = note: expected type `usize` diff --git a/src/test/ui/issues/issue-50688.stderr b/src/test/ui/issues/issue-50688.stderr index 2a1315c9a015..13eec8361ba8 100644 --- a/src/test/ui/issues/issue-50688.stderr +++ b/src/test/ui/issues/issue-50688.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-50688.rs:2:9 | -LL | [1; || {}]; //~ ERROR mismatched types +LL | [1; || {}]; | ^^^^^ expected usize, found closure | = note: expected type `usize` diff --git a/src/test/ui/issues/issue-50714-1.stderr b/src/test/ui/issues/issue-50714-1.stderr index e5fdd18d3328..427b200adf43 100644 --- a/src/test/ui/issues/issue-50714-1.stderr +++ b/src/test/ui/issues/issue-50714-1.stderr @@ -1,7 +1,7 @@ error[E0647]: start function is not allowed to have a `where` clause --> $DIR/issue-50714-1.rs:9:56 | -LL | fn start(_: isize, _: *const *const u8) -> isize where fn(&()): Eq { //~ ERROR [E0647] +LL | fn start(_: isize, _: *const *const u8) -> isize where fn(&()): Eq { | ^^^^^^^^^^^ start function cannot have a `where` clause error: aborting due to previous error diff --git a/src/test/ui/issues/issue-50714.stderr b/src/test/ui/issues/issue-50714.stderr index d7631adc7b26..e048f39260c5 100644 --- a/src/test/ui/issues/issue-50714.stderr +++ b/src/test/ui/issues/issue-50714.stderr @@ -1,7 +1,7 @@ error[E0646]: `main` function is not allowed to have a `where` clause --> $DIR/issue-50714.rs:3:17 | -LL | fn main() where fn(&()): Eq {} //~ ERROR [E0646] +LL | fn main() where fn(&()): Eq {} | ^^^^^^^^^^^ `main` cannot have a `where` clause error: aborting due to previous error diff --git a/src/test/ui/issues/issue-50781.stderr b/src/test/ui/issues/issue-50781.stderr index 11de59f9f009..c98f78c51ee5 100644 --- a/src/test/ui/issues/issue-50781.stderr +++ b/src/test/ui/issues/issue-50781.stderr @@ -1,7 +1,7 @@ error: the trait `X` cannot be made into an object --> $DIR/issue-50781.rs:6:5 | -LL | fn foo(&self) where Self: Trait; //~ ERROR the trait `X` cannot be made into an object +LL | fn foo(&self) where Self: Trait; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/issues/issue-50802.stderr b/src/test/ui/issues/issue-50802.stderr index 9a2ae7942939..e064fabccd04 100644 --- a/src/test/ui/issues/issue-50802.stderr +++ b/src/test/ui/issues/issue-50802.stderr @@ -1,7 +1,7 @@ error[E0590]: `break` or `continue` with no label in the condition of a `while` loop --> $DIR/issue-50802.rs:5:21 | -LL | break while continue { //~ ERROR E0590 +LL | break while continue { | ^^^^^^^^ unlabeled `continue` in the condition of a `while` loop error: aborting due to previous error diff --git a/src/test/ui/issues/issue-5099.stderr b/src/test/ui/issues/issue-5099.stderr index d103c968979a..cc11db9c5eca 100644 --- a/src/test/ui/issues/issue-5099.stderr +++ b/src/test/ui/issues/issue-5099.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `this` in this scope --> $DIR/issue-5099.rs:1:31 | -LL | trait B < A > { fn a() -> A { this.a } } //~ ERROR cannot find value `this` in this scope +LL | trait B < A > { fn a() -> A { this.a } } | ^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/issues/issue-5100.stderr b/src/test/ui/issues/issue-5100.stderr index 0a918a789703..0c1a0289cf27 100644 --- a/src/test/ui/issues/issue-5100.stderr +++ b/src/test/ui/issues/issue-5100.stderr @@ -48,7 +48,7 @@ LL | &(true, false) => () error[E0618]: expected function, found `(char, char)` --> $DIR/issue-5100.rs:48:14 | -LL | let v = [('a', 'b') //~ ERROR expected function, found `(char, char)` +LL | let v = [('a', 'b') | ______________-^^^^^^^^^ LL | | ('c', 'd'), | |_______________________- call expression requires function @@ -56,7 +56,7 @@ LL | | ('c', 'd'), error[E0308]: mismatched types --> $DIR/issue-5100.rs:55:19 | -LL | let x: char = true; //~ ERROR mismatched types +LL | let x: char = true; | ^^^^ expected char, found bool error: aborting due to 7 previous errors diff --git a/src/test/ui/issues/issue-51116.stderr b/src/test/ui/issues/issue-51116.stderr index 4c1870eb8c9f..8501ae6a1d02 100644 --- a/src/test/ui/issues/issue-51116.stderr +++ b/src/test/ui/issues/issue-51116.stderr @@ -3,7 +3,7 @@ error[E0282]: type annotations needed | LL | for tile in row { | --- the element type for this iterator is not specified -LL | //~^ NOTE the element type for this iterator is not specified +LL | LL | *tile = 0; | ^^^^^ cannot infer type | diff --git a/src/test/ui/issues/issue-51244.nll.stderr b/src/test/ui/issues/issue-51244.nll.stderr index 7a4935fafc6e..c91083955b82 100644 --- a/src/test/ui/issues/issue-51244.nll.stderr +++ b/src/test/ui/issues/issue-51244.nll.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `*my_ref` which is behind a `&` reference | LL | let ref my_ref @ _ = 0; | -------------- help: consider changing this to be a mutable reference: `ref mut my_ref @ _` -LL | *my_ref = 0; //~ ERROR cannot assign to immutable borrowed content `*my_ref` [E0594] +LL | *my_ref = 0; | ^^^^^^^^^^^ `my_ref` is a `&` reference, so the data it refers to cannot be written error: aborting due to previous error diff --git a/src/test/ui/issues/issue-51244.stderr b/src/test/ui/issues/issue-51244.stderr index a5b06aa22829..f798b5f1fce2 100644 --- a/src/test/ui/issues/issue-51244.stderr +++ b/src/test/ui/issues/issue-51244.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to immutable borrowed content `*my_ref` | LL | let ref my_ref @ _ = 0; | -------------- help: use a mutable reference instead: `ref mut my_ref @ _` -LL | *my_ref = 0; //~ ERROR cannot assign to immutable borrowed content `*my_ref` [E0594] +LL | *my_ref = 0; | ^^^^^^^^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/issues/issue-51848.stderr b/src/test/ui/issues/issue-51848.stderr index 1bb6f3c1f1ff..31faaab6141c 100644 --- a/src/test/ui/issues/issue-51848.stderr +++ b/src/test/ui/issues/issue-51848.stderr @@ -1,7 +1,7 @@ error: invalid format string: expected `'}'` but string was terminated --> $DIR/issue-51848.rs:6:20 | -LL | println!("{"); //~ ERROR invalid +LL | println!("{"); | -^ expected `'}'` in format string | | | because of this opening brace @@ -14,7 +14,7 @@ LL | macro_with_error!(); error: invalid format string: unmatched `}` found --> $DIR/issue-51848.rs:18:15 | -LL | println!("}"); //~ ERROR invalid +LL | println!("}"); | ^ unmatched `}` in format string | = note: if you intended to print `}`, you can escape it using `}}` diff --git a/src/test/ui/issues/issue-51874.stderr b/src/test/ui/issues/issue-51874.stderr index 38c380c4bab8..9b1a6bf2e12d 100644 --- a/src/test/ui/issues/issue-51874.stderr +++ b/src/test/ui/issues/issue-51874.stderr @@ -1,11 +1,11 @@ error[E0689]: can't call method `pow` on ambiguous numeric type `{float}` --> $DIR/issue-51874.rs:2:19 | -LL | let a = (1.0).pow(1.0); //~ ERROR can't call method `pow` on ambiguous numeric type +LL | let a = (1.0).pow(1.0); | ^^^ help: you must specify a concrete type for this numeric value, like `f32` | -LL | let a = (1.0_f32).pow(1.0); //~ ERROR can't call method `pow` on ambiguous numeric type +LL | let a = (1.0_f32).pow(1.0); | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-52023-array-size-pointer-cast.stderr b/src/test/ui/issues/issue-52023-array-size-pointer-cast.stderr index f687be5edb09..60e0792954ae 100644 --- a/src/test/ui/issues/issue-52023-array-size-pointer-cast.stderr +++ b/src/test/ui/issues/issue-52023-array-size-pointer-cast.stderr @@ -1,7 +1,7 @@ error[E0658]: casting pointers to integers in constants is unstable (see issue #51910) --> $DIR/issue-52023-array-size-pointer-cast.rs:2:17 | -LL | let _ = [0; (&0 as *const i32) as usize]; //~ ERROR casting pointers to integers in constants +LL | let _ = [0; (&0 as *const i32) as usize]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | let _ = [0; (&0 as *const i32) as usize]; //~ ERROR casting pointers to error[E0080]: it is undefined behavior to use this value --> $DIR/issue-52023-array-size-pointer-cast.rs:2:17 | -LL | let _ = [0; (&0 as *const i32) as usize]; //~ ERROR casting pointers to integers in constants +LL | let _ = [0; (&0 as *const i32) as usize]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes | = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior diff --git a/src/test/ui/issues/issue-5216.stderr b/src/test/ui/issues/issue-5216.stderr index 5afea5873d56..ccfe7e04a2cf 100644 --- a/src/test/ui/issues/issue-5216.stderr +++ b/src/test/ui/issues/issue-5216.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-5216.rs:3:21 | -LL | pub static C: S = S(f); //~ ERROR mismatched types +LL | pub static C: S = S(f); | ^ expected struct `std::boxed::Box`, found fn item | = note: expected type `std::boxed::Box<(dyn std::ops::FnMut() + 'static)>` @@ -10,7 +10,7 @@ LL | pub static C: S = S(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/issue-5216.rs:8:19 | -LL | pub static D: T = g; //~ ERROR mismatched types +LL | pub static D: T = g; | ^ expected struct `std::boxed::Box`, found fn item | = note: expected type `std::boxed::Box<(dyn std::ops::FnMut() + 'static)>` diff --git a/src/test/ui/issues/issue-52213.stderr b/src/test/ui/issues/issue-52213.stderr index 4d3346f325dd..8d74b8ecb881 100644 --- a/src/test/ui/issues/issue-52213.stderr +++ b/src/test/ui/issues/issue-52213.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> $DIR/issue-52213.rs:2:11 | -LL | match (&t,) { //~ ERROR cannot infer an appropriate lifetime +LL | match (&t,) { | ^^^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 1:23... diff --git a/src/test/ui/issues/issue-52891.stderr b/src/test/ui/issues/issue-52891.stderr index 65b2b9460bc9..1385693e91ae 100644 --- a/src/test/ui/issues/issue-52891.stderr +++ b/src/test/ui/issues/issue-52891.stderr @@ -3,7 +3,7 @@ error[E0252]: the name `a` is defined multiple times | LL | use issue_52891::a; | -------------- previous import of the module `a` here -LL | use issue_52891::a; //~ ERROR `a` is defined multiple times +LL | use issue_52891::a; | ----^^^^^^^^^^^^^^- | | | | | `a` reimported here @@ -17,7 +17,7 @@ error[E0252]: the name `a` is defined multiple times LL | use issue_52891::a; | -------------- previous import of the module `a` here ... -LL | use issue_52891::{a, b, c}; //~ ERROR `a` is defined multiple times +LL | use issue_52891::{a, b, c}; | ^-- | | | `a` reimported here @@ -31,7 +31,7 @@ error[E0252]: the name `a` is defined multiple times LL | use issue_52891::a; | -------------- previous import of the module `a` here ... -LL | use issue_52891::{d, a, e}; //~ ERROR `a` is defined multiple times +LL | use issue_52891::{d, a, e}; | ^-- | | | `a` reimported here @@ -45,7 +45,7 @@ error[E0252]: the name `a` is defined multiple times LL | use issue_52891::a; | -------------- previous import of the module `a` here ... -LL | use issue_52891::{f, g, a}; //~ ERROR `a` is defined multiple times +LL | use issue_52891::{f, g, a}; | --^ | | | | | `a` reimported here @@ -59,7 +59,7 @@ error[E0252]: the name `a` is defined multiple times LL | use issue_52891::a; | -------------- previous import of the module `a` here ... -LL | use issue_52891::{a, //~ ERROR `a` is defined multiple times +LL | use issue_52891::{a, | ^-- | | | `a` reimported here @@ -73,7 +73,7 @@ error[E0252]: the name `a` is defined multiple times LL | use issue_52891::a; | -------------- previous import of the module `a` here ... -LL | a, //~ ERROR `a` is defined multiple times +LL | a, | ^-- | | | `a` reimported here @@ -89,7 +89,7 @@ LL | use issue_52891::a; ... LL | m, | ______- -LL | | a}; //~ ERROR `a` is defined multiple times +LL | | a}; | | ^ | | | | |_____`a` reimported here @@ -102,13 +102,13 @@ error[E0252]: the name `inner` is defined multiple times | LL | use issue_52891::a::inner; | --------------------- previous import of the module `inner` here -LL | use issue_52891::b::inner; //~ ERROR `inner` is defined multiple times +LL | use issue_52891::b::inner; | ^^^^^^^^^^^^^^^^^^^^^ `inner` reimported here | = note: `inner` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use issue_52891::b::inner as other_inner; //~ ERROR `inner` is defined multiple times +LL | use issue_52891::b::inner as other_inner; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0254]: the name `issue_52891` is defined multiple times @@ -134,7 +134,7 @@ LL | use issue_52891::n; | | previous import of the module `n` here | help: remove unnecessary import LL | #[macro_use] -LL | use issue_52891::n; //~ ERROR `n` is defined multiple times +LL | use issue_52891::n; | ^^^^^^^^^^^^^^ `n` reimported here | = note: `n` must be defined only once in the type namespace of this module diff --git a/src/test/ui/issues/issue-54348.stderr b/src/test/ui/issues/issue-54348.stderr index d4ee94aa411b..e39a1cb20cff 100644 --- a/src/test/ui/issues/issue-54348.stderr +++ b/src/test/ui/issues/issue-54348.stderr @@ -1,7 +1,7 @@ error: index out of bounds: the len is 1 but the index is 1 --> $DIR/issue-54348.rs:3:5 | -LL | [1][1.5 as usize]; //~ ERROR index out of bounds +LL | [1][1.5 as usize]; | ^^^^^^^^^^^^^^^^^ | = note: #[deny(const_err)] on by default @@ -9,7 +9,7 @@ LL | [1][1.5 as usize]; //~ ERROR index out of bounds error: index out of bounds: the len is 1 but the index is 1 --> $DIR/issue-54348.rs:4:5 | -LL | [1][1u64 as usize]; //~ ERROR index out of bounds +LL | [1][1u64 as usize]; | ^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-5439.stderr b/src/test/ui/issues/issue-5439.stderr index 847bc7695807..bd0cb670bc21 100644 --- a/src/test/ui/issues/issue-5439.stderr +++ b/src/test/ui/issues/issue-5439.stderr @@ -1,7 +1,7 @@ error[E0560]: struct `Foo` has no field named `nonexistent` --> $DIR/issue-5439.rs:13:26 | -LL | return box Foo { nonexistent: self, foo: i }; //~ ERROR: no field named +LL | return box Foo { nonexistent: self, foo: i }; | ^^^^^^^^^^^ `Foo` does not have this field | = note: available fields are: `foo` diff --git a/src/test/ui/issues/issue-55587.stderr b/src/test/ui/issues/issue-55587.stderr index 876fb4391b1b..1334f249256d 100644 --- a/src/test/ui/issues/issue-55587.stderr +++ b/src/test/ui/issues/issue-55587.stderr @@ -1,7 +1,7 @@ error[E0164]: expected tuple struct/variant, found method `::new` --> $DIR/issue-55587.rs:4:9 | -LL | let Path::new(); //~ ERROR expected tuple struct/variant +LL | let Path::new(); | ^^^^^^^^^^^ not a tuple variant or struct error: aborting due to previous error diff --git a/src/test/ui/issues/issue-55731.rs b/src/test/ui/issues/issue-55731.rs new file mode 100644 index 000000000000..7b4f4e2cd3b4 --- /dev/null +++ b/src/test/ui/issues/issue-55731.rs @@ -0,0 +1,52 @@ +use std::marker::PhantomData; + +trait DistributedIterator { + fn reduce(self) + where + Self: Sized, + { + unreachable!() + } +} + +trait DistributedIteratorMulti { + type Item; +} + +struct Connect(PhantomData); +impl DistributedIteratorMulti<&'a ()>> DistributedIterator for Connect where {} + +struct Cloned(PhantomData); +impl<'a, Source> DistributedIteratorMulti<&'a Source> for Cloned<&'a Source> { + type Item = (); +} + +struct Map { + i: I, + f: F, +} +impl, F, Source> DistributedIteratorMulti for Map +where + F: A<>::Item>, +{ + type Item = (); +} + +trait A {} + +struct X; +impl A<()> for X {} + +fn multi(_reducer: I) +where + I: for<'a> DistributedIteratorMulti<&'a ()>, +{ + DistributedIterator::reduce(Connect::(PhantomData)) +} + +fn main() { + multi(Map { //~ ERROR implementation of `DistributedIteratorMulti` is not general enough + i: Cloned(PhantomData), + f: X, + }); +} diff --git a/src/test/ui/issues/issue-55731.stderr b/src/test/ui/issues/issue-55731.stderr new file mode 100644 index 000000000000..f25e18e5d90c --- /dev/null +++ b/src/test/ui/issues/issue-55731.stderr @@ -0,0 +1,11 @@ +error: implementation of `DistributedIteratorMulti` is not general enough + --> $DIR/issue-55731.rs:48:5 + | +LL | multi(Map { + | ^^^^^ + | + = note: `DistributedIteratorMulti<&'0 ()>` would have to be implemented for the type `Cloned<&()>`, for any lifetime `'0` + = note: but `DistributedIteratorMulti<&'1 ()>` is actually implemented for the type `Cloned<&'1 ()>`, for some specific lifetime `'1` + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-57362-1.stderr b/src/test/ui/issues/issue-57362-1.stderr index b21b35849b17..1d2ff7669c09 100644 --- a/src/test/ui/issues/issue-57362-1.stderr +++ b/src/test/ui/issues/issue-57362-1.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `f` found for type `fn(&u8)` in the current scope --> $DIR/issue-57362-1.rs:20:7 | -LL | a.f(); //~ ERROR no method named `f` +LL | a.f(); | ^ | = note: a is a function, perhaps you wish to call it diff --git a/src/test/ui/issues/issue-57362-2.stderr b/src/test/ui/issues/issue-57362-2.stderr index b8211691f7be..522b201ec78c 100644 --- a/src/test/ui/issues/issue-57362-2.stderr +++ b/src/test/ui/issues/issue-57362-2.stderr @@ -1,7 +1,7 @@ error[E0599]: no function or associated item named `make_g` found for type `for<'r> fn(&'r ())` in the current scope --> $DIR/issue-57362-2.rs:22:25 | -LL | let x = ::make_g(); //~ ERROR no function or associated item +LL | let x = ::make_g(); | ------------^^^^^^ | | | function or associated item not found in `for<'r> fn(&'r ())` diff --git a/src/test/ui/issues/issue-57781.rs b/src/test/ui/issues/issue-57781.rs new file mode 100644 index 000000000000..f5015aaf5d81 --- /dev/null +++ b/src/test/ui/issues/issue-57781.rs @@ -0,0 +1,20 @@ +// run-pass + +use std::cell::UnsafeCell; +use std::collections::HashMap; + +struct OnceCell { + _value: UnsafeCell>, +} + +impl OnceCell { + const INIT: OnceCell = OnceCell { + _value: UnsafeCell::new(None), + }; +} + +pub fn crash() { + let _ = OnceCell::>::INIT; +} + +fn main() {} diff --git a/src/test/ui/issues/issue-57843.stderr b/src/test/ui/issues/issue-57843.stderr index 4ef884cb3f58..57b206d7bff6 100644 --- a/src/test/ui/issues/issue-57843.stderr +++ b/src/test/ui/issues/issue-57843.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-57843.rs:23:9 | -LL | Foo(Box::new(|_| ())); //~ ERROR mismatched types +LL | Foo(Box::new(|_| ())); | ^^^^^^^^^^^^^^^^ one type is more general than the other | = note: expected type `std::ops::FnOnce<(&'a bool,)>` diff --git a/src/test/ui/issues/issue-57979.rs b/src/test/ui/issues/issue-57979.rs deleted file mode 100644 index abd46b60ab19..000000000000 --- a/src/test/ui/issues/issue-57979.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Regression test for #57979. This situation is meant to be an error. -// As noted in the issue thread, we decided to forbid nested impl -// trait of this kind: -// -// ```rust -// fn foo() -> impl Foo { .. } -// ``` -// -// Basically there are two hidden variables here, let's call them `X` -// and `Y`, and we must prove that: -// -// ``` -// X: Foo -// Y: Bar -// ``` -// -// However, the user is only giving us the return type `X`. It's true -// that in some cases, we can infer `Y` from `X`, because `X` only -// implements `Foo` for one type (and indeed the compiler does -// inference of this kind), but I do recall that we intended to forbid -// this -- in part because such inference is fragile, and there is not -// necessarily a way for the user to be more explicit should the -// inference fail (so you could get stuck with no way to port your -// code forward if, for example, more impls are added to an existing -// type). -// -// The same seems to apply in this situation. Here there are three impl traits, so we have -// -// ``` -// X: IntoIterator -// Y: Borrow> -// Z: AsRef<[u8]> -// ``` - -use std::borrow::Borrow; - -pub struct Data(TBody); - -pub fn collect(_: impl IntoIterator>>>) { - //~^ ERROR - unimplemented!() -} diff --git a/src/test/ui/issues/issue-57979.stderr b/src/test/ui/issues/issue-57979.stderr deleted file mode 100644 index 488f30ab7c5a..000000000000 --- a/src/test/ui/issues/issue-57979.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0666]: nested `impl Trait` is not allowed - --> $DIR/issue-57979.rs:39:61 - | -LL | pub fn collect(_: impl IntoIterator>>>) { - | -----------------^^^^^^^^^^^^^^^^-- - | | | - | | nested `impl Trait` here - | outer `impl Trait` - -error[E0601]: `main` function not found in crate `issue_57979` - | - = note: consider adding a `main` function to `$DIR/issue-57979.rs` - -error: aborting due to 2 previous errors - -Some errors occurred: E0601, E0666. -For more information about an error, try `rustc --explain E0601`. diff --git a/src/test/ui/issues/issue-5844.stderr b/src/test/ui/issues/issue-5844.stderr index 876151fb25cb..ed5a3dc6b1e1 100644 --- a/src/test/ui/issues/issue-5844.stderr +++ b/src/test/ui/issues/issue-5844.stderr @@ -1,7 +1,7 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block --> $DIR/issue-5844.rs:6:5 | -LL | issue_5844_aux::rand(); //~ ERROR: requires unsafe +LL | issue_5844_aux::rand(); | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior diff --git a/src/test/ui/issues/issue-58712.rs b/src/test/ui/issues/issue-58712.rs new file mode 100644 index 000000000000..577709cf2919 --- /dev/null +++ b/src/test/ui/issues/issue-58712.rs @@ -0,0 +1,15 @@ +struct AddrVec { + h: H, + a: A, +} + +impl AddrVec { + //~^ ERROR cannot find type `DeviceId` in this scope + pub fn device(&self) -> DeviceId { + //~^ ERROR cannot find type `DeviceId` in this scope + self.tail() + } +} + +fn main() {} + diff --git a/src/test/ui/issues/issue-58712.stderr b/src/test/ui/issues/issue-58712.stderr new file mode 100644 index 000000000000..6164ad7ee19b --- /dev/null +++ b/src/test/ui/issues/issue-58712.stderr @@ -0,0 +1,15 @@ +error[E0412]: cannot find type `DeviceId` in this scope + --> $DIR/issue-58712.rs:6:20 + | +LL | impl AddrVec { + | ^^^^^^^^ not found in this scope + +error[E0412]: cannot find type `DeviceId` in this scope + --> $DIR/issue-58712.rs:8:29 + | +LL | pub fn device(&self) -> DeviceId { + | ^^^^^^^^ not found in this scope + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0412`. diff --git a/src/test/ui/issues/issue-5883.stderr b/src/test/ui/issues/issue-5883.stderr index ad463d4c478c..7753881f7368 100644 --- a/src/test/ui/issues/issue-5883.stderr +++ b/src/test/ui/issues/issue-5883.stderr @@ -12,7 +12,7 @@ LL | fn new_struct(r: A+'static) error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time --> $DIR/issue-5883.rs:8:8 | -LL | -> Struct { //~^ ERROR the size for values of type +LL | -> Struct { | ^^^^^^ doesn't have a size known at compile-time | = help: within `Struct`, the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)` diff --git a/src/test/ui/issues/issue-58856-1.rs b/src/test/ui/issues/issue-58856-1.rs new file mode 100644 index 000000000000..db3984cd1898 --- /dev/null +++ b/src/test/ui/issues/issue-58856-1.rs @@ -0,0 +1,6 @@ +impl A { + fn b(self> + //~^ ERROR expected one of `)`, `,`, or `:`, found `>` +} + +fn main() {} diff --git a/src/test/ui/issues/issue-58856-1.stderr b/src/test/ui/issues/issue-58856-1.stderr new file mode 100644 index 000000000000..20cdf55365fc --- /dev/null +++ b/src/test/ui/issues/issue-58856-1.stderr @@ -0,0 +1,11 @@ +error: expected one of `)`, `,`, or `:`, found `>` + --> $DIR/issue-58856-1.rs:2:14 + | +LL | fn b(self> + | - ^ + | | | + | | help: `)` may belong here + | unclosed delimiter + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-58856-2.rs b/src/test/ui/issues/issue-58856-2.rs new file mode 100644 index 000000000000..acc38e4c2016 --- /dev/null +++ b/src/test/ui/issues/issue-58856-2.rs @@ -0,0 +1,14 @@ +struct Empty; + +trait Howness {} + +impl Howness for () { + fn how_are_you(&self -> Empty { + //~^ ERROR expected one of `)` or `,`, found `->` + //~| ERROR method `how_are_you` is not a member of trait `Howness` + Empty + } +} +//~^ ERROR expected one of `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`, + +fn main() {} diff --git a/src/test/ui/issues/issue-58856-2.stderr b/src/test/ui/issues/issue-58856-2.stderr new file mode 100644 index 000000000000..b760fd6768af --- /dev/null +++ b/src/test/ui/issues/issue-58856-2.stderr @@ -0,0 +1,30 @@ +error: expected one of `)` or `,`, found `->` + --> $DIR/issue-58856-2.rs:6:26 + | +LL | fn how_are_you(&self -> Empty { + | - -^^ + | | | + | | help: `)` may belong here + | unclosed delimiter + +error: expected one of `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found `)` + --> $DIR/issue-58856-2.rs:11:1 + | +LL | } + | - expected one of 11 possible tokens here +LL | } + | ^ unexpected token + +error[E0407]: method `how_are_you` is not a member of trait `Howness` + --> $DIR/issue-58856-2.rs:6:5 + | +LL | / fn how_are_you(&self -> Empty { +LL | | +LL | | +LL | | Empty +LL | | } + | |_____^ not a member of trait `Howness` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0407`. diff --git a/src/test/ui/issues/issue-58857.rs b/src/test/ui/issues/issue-58857.rs new file mode 100644 index 000000000000..392e4ea0c2ec --- /dev/null +++ b/src/test/ui/issues/issue-58857.rs @@ -0,0 +1,7 @@ +struct Conj {a : A} +trait Valid {} + +impl Conj{} +//~^ ERROR negative trait bounds are not supported + +fn main() {} diff --git a/src/test/ui/issues/issue-58857.stderr b/src/test/ui/issues/issue-58857.stderr new file mode 100644 index 000000000000..040e9eb8a656 --- /dev/null +++ b/src/test/ui/issues/issue-58857.stderr @@ -0,0 +1,8 @@ +error: negative trait bounds are not supported + --> $DIR/issue-58857.rs:4:7 + | +LL | impl Conj{} + | ^^^^^^^^ help: remove the trait bound + +error: aborting due to previous error + diff --git a/src/test/ui/issues/issue-5927.stderr b/src/test/ui/issues/issue-5927.stderr index 189eefe51b91..6b0a2b7b935e 100644 --- a/src/test/ui/issues/issue-5927.stderr +++ b/src/test/ui/issues/issue-5927.stderr @@ -1,13 +1,13 @@ error[E0531]: cannot find tuple struct/variant `x` in this scope --> $DIR/issue-5927.rs:3:9 | -LL | x(1) => x(1) //~ ERROR cannot find tuple struct/variant `x` in this scope +LL | x(1) => x(1) | ^ not found in this scope error[E0425]: cannot find function `x` in this scope --> $DIR/issue-5927.rs:3:17 | -LL | x(1) => x(1) //~ ERROR cannot find tuple struct/variant `x` in this scope +LL | x(1) => x(1) | ^ not found in this scope error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-5997-struct.stderr b/src/test/ui/issues/issue-5997-struct.stderr index a60987b3f98b..cb1b5146b6c8 100644 --- a/src/test/ui/issues/issue-5997-struct.stderr +++ b/src/test/ui/issues/issue-5997-struct.stderr @@ -5,7 +5,7 @@ LL | fn f() -> bool { | - - type variable from outer function | | | try adding a local generic parameter in this method instead -LL | struct S(T); //~ ERROR can't use generic parameters from outer function +LL | struct S(T); | ^ use of generic parameter from outer function error: aborting due to previous error diff --git a/src/test/ui/issues/issue-6458-4.stderr b/src/test/ui/issues/issue-6458-4.stderr index c087292e978c..90b493e1634c 100644 --- a/src/test/ui/issues/issue-6458-4.stderr +++ b/src/test/ui/issues/issue-6458-4.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-6458-4.rs:1:20 | -LL | fn foo(b: bool) -> Result { //~ ERROR mismatched types +LL | fn foo(b: bool) -> Result { | --- ^^^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found () | | | this function's body doesn't return diff --git a/src/test/ui/issues/issue-6642.stderr b/src/test/ui/issues/issue-6642.stderr index a99d9b3cd77c..6668108d0245 100644 --- a/src/test/ui/issues/issue-6642.stderr +++ b/src/test/ui/issues/issue-6642.stderr @@ -1,7 +1,7 @@ error[E0434]: can't capture dynamic environment in a fn item --> $DIR/issue-6642.rs:5:13 | -LL | self.m() //~ ERROR can't capture dynamic environment in a fn item +LL | self.m() | ^^^^ | = help: use the `|| { ... }` closure form instead diff --git a/src/test/ui/issues/issue-6801.nll.stderr b/src/test/ui/issues/issue-6801.nll.stderr index 2c0fedf351a2..dbb8e6530c05 100644 --- a/src/test/ui/issues/issue-6801.nll.stderr +++ b/src/test/ui/issues/issue-6801.nll.stderr @@ -6,7 +6,7 @@ LL | let sq = || { *x * *x }; | | | borrow of `x` occurs here LL | -LL | twice(x); //~ ERROR: cannot move out of +LL | twice(x); | ^ move out of `x` occurs here LL | invoke(sq); | -- borrow later used here diff --git a/src/test/ui/issues/issue-6801.stderr b/src/test/ui/issues/issue-6801.stderr index fa0e1928ba4b..482e4873f3a7 100644 --- a/src/test/ui/issues/issue-6801.stderr +++ b/src/test/ui/issues/issue-6801.stderr @@ -4,7 +4,7 @@ error[E0505]: cannot move out of `x` because it is borrowed LL | let sq = || { *x * *x }; | -- borrow of `x` occurs here LL | -LL | twice(x); //~ ERROR: cannot move out of +LL | twice(x); | ^ move out of `x` occurs here error: aborting due to previous error diff --git a/src/test/ui/issues/issue-6804.stderr b/src/test/ui/issues/issue-6804.stderr index 965148d478e0..1c251ed8445f 100644 --- a/src/test/ui/issues/issue-6804.stderr +++ b/src/test/ui/issues/issue-6804.stderr @@ -1,7 +1,7 @@ error: floating-point types cannot be used in patterns --> $DIR/issue-6804.rs:11:9 | -LL | NAN => {}, //~ ERROR floating-point types cannot be used +LL | NAN => {}, | ^^^ | note: lint level defined here @@ -15,7 +15,7 @@ LL | #![deny(illegal_floating_point_literal_pattern)] error: floating-point types cannot be used in patterns --> $DIR/issue-6804.rs:17:10 | -LL | [NAN, _] => {}, //~ ERROR floating-point types cannot be used +LL | [NAN, _] => {}, | ^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/issues/issue-6936.stderr b/src/test/ui/issues/issue-6936.stderr index b3fe1ddc4834..9292d60ca68f 100644 --- a/src/test/ui/issues/issue-6936.stderr +++ b/src/test/ui/issues/issue-6936.stderr @@ -3,7 +3,7 @@ error[E0428]: the name `Foo` is defined multiple times | LL | type Foo = ::T; | --------------- previous definition of the type `Foo` here -LL | mod Foo {} //~ ERROR the name `Foo` is defined multiple times +LL | mod Foo {} | ^^^^^^^ `Foo` redefined here | = note: `Foo` must be defined only once in the type namespace of this module @@ -13,7 +13,7 @@ error[E0428]: the name `Foo` is defined multiple times | LL | type Foo = ::T; | --------------- previous definition of the type `Foo` here -LL | struct Foo; //~ ERROR the name `Foo` is defined multiple times +LL | struct Foo; | ^^^^^^^^^^^ `Foo` redefined here | = note: `Foo` must be defined only once in the type namespace of this module @@ -23,7 +23,7 @@ error[E0428]: the name `Foo` is defined multiple times | LL | type Foo = ::T; | --------------- previous definition of the type `Foo` here -LL | enum Foo {} //~ ERROR the name `Foo` is defined multiple times +LL | enum Foo {} | ^^^^^^^^ `Foo` redefined here | = note: `Foo` must be defined only once in the type namespace of this module @@ -33,7 +33,7 @@ error[E0428]: the name `Bar` is defined multiple times | LL | type Bar = T; | ---------------- previous definition of the type `Bar` here -LL | mod Bar {} //~ ERROR the name `Bar` is defined multiple times +LL | mod Bar {} | ^^^^^^^ `Bar` redefined here | = note: `Bar` must be defined only once in the type namespace of this module diff --git a/src/test/ui/issues/issue-7044.stderr b/src/test/ui/issues/issue-7044.stderr index 46c5d164e42c..2ad67ec23be8 100644 --- a/src/test/ui/issues/issue-7044.stderr +++ b/src/test/ui/issues/issue-7044.stderr @@ -3,7 +3,7 @@ error[E0428]: the name `X` is defined multiple times | LL | static X: isize = 0; | -------------------- previous definition of the value `X` here -LL | struct X; //~ ERROR the name `X` is defined multiple times +LL | struct X; | ^^^^^^^^^ `X` redefined here | = note: `X` must be defined only once in the value namespace of this module diff --git a/src/test/ui/issues/issue-7246.stderr b/src/test/ui/issues/issue-7246.stderr index 5b8652597d3f..e049295e9136 100644 --- a/src/test/ui/issues/issue-7246.stderr +++ b/src/test/ui/issues/issue-7246.stderr @@ -1,7 +1,7 @@ error: unreachable statement --> $DIR/issue-7246.rs:7:5 | -LL | if *ptr::null() {}; //~ ERROR unreachable +LL | if *ptr::null() {}; | ^^^^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/issues/issue-7607-1.stderr b/src/test/ui/issues/issue-7607-1.stderr index aa0a6c761bf0..9320943a8276 100644 --- a/src/test/ui/issues/issue-7607-1.stderr +++ b/src/test/ui/issues/issue-7607-1.stderr @@ -1,7 +1,7 @@ error[E0412]: cannot find type `Fo` in this scope --> $DIR/issue-7607-1.rs:5:6 | -LL | impl Fo { //~ ERROR cannot find type `Fo` in this scope +LL | impl Fo { | ^^ help: a trait with a similar name exists: `Fn` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-7813.stderr b/src/test/ui/issues/issue-7813.stderr index da5fc6357a66..45b9c915885b 100644 --- a/src/test/ui/issues/issue-7813.stderr +++ b/src/test/ui/issues/issue-7813.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/issue-7813.rs:2:13 | -LL | let v = &[]; //~ ERROR type annotations needed +LL | let v = &[]; | - ^^^ cannot infer type | | | consider giving `v` a type diff --git a/src/test/ui/issues/issue-8153.stderr b/src/test/ui/issues/issue-8153.stderr index 800b0277c9ac..4389c3dc288f 100644 --- a/src/test/ui/issues/issue-8153.stderr +++ b/src/test/ui/issues/issue-8153.stderr @@ -3,7 +3,7 @@ error[E0201]: duplicate definitions with name `bar`: | LL | fn bar(&self) -> isize {1} | -------------------------- previous definition of `bar` here -LL | fn bar(&self) -> isize {2} //~ ERROR duplicate definitions +LL | fn bar(&self) -> isize {2} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate definition error: aborting due to previous error diff --git a/src/test/ui/issues/issue-8208.rs b/src/test/ui/issues/issue-8208.rs index ad94f99098db..1c566938f9d0 100644 --- a/src/test/ui/issues/issue-8208.rs +++ b/src/test/ui/issues/issue-8208.rs @@ -1,14 +1,14 @@ use self::*; //~ ERROR: unresolved import `self::*` [E0432] - //~^ Cannot glob-import a module into itself. + //~^ cannot glob-import a module into itself mod foo { use foo::*; //~ ERROR: unresolved import `foo::*` [E0432] - //~^ Cannot glob-import a module into itself. + //~^ cannot glob-import a module into itself mod bar { use super::bar::*; //~^ ERROR: unresolved import `super::bar::*` [E0432] - //~| Cannot glob-import a module into itself. + //~| cannot glob-import a module into itself } } diff --git a/src/test/ui/issues/issue-8208.stderr b/src/test/ui/issues/issue-8208.stderr index 6de95fb953a9..e59aea12cda2 100644 --- a/src/test/ui/issues/issue-8208.stderr +++ b/src/test/ui/issues/issue-8208.stderr @@ -1,20 +1,20 @@ error[E0432]: unresolved import `self::*` --> $DIR/issue-8208.rs:1:5 | -LL | use self::*; //~ ERROR: unresolved import `self::*` [E0432] - | ^^^^^^^ Cannot glob-import a module into itself. +LL | use self::*; + | ^^^^^^^ cannot glob-import a module into itself error[E0432]: unresolved import `foo::*` --> $DIR/issue-8208.rs:5:9 | -LL | use foo::*; //~ ERROR: unresolved import `foo::*` [E0432] - | ^^^^^^ Cannot glob-import a module into itself. +LL | use foo::*; + | ^^^^^^ cannot glob-import a module into itself error[E0432]: unresolved import `super::bar::*` --> $DIR/issue-8208.rs:9:13 | LL | use super::bar::*; - | ^^^^^^^^^^^^^ Cannot glob-import a module into itself. + | ^^^^^^^^^^^^^ cannot glob-import a module into itself error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-8767.stderr b/src/test/ui/issues/issue-8767.stderr index 80280f8c5358..91d99f393b61 100644 --- a/src/test/ui/issues/issue-8767.stderr +++ b/src/test/ui/issues/issue-8767.stderr @@ -1,7 +1,7 @@ error[E0412]: cannot find type `B` in this scope --> $DIR/issue-8767.rs:1:6 | -LL | impl B { //~ ERROR cannot find type `B` in this scope +LL | impl B { | ^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/issues/issue-9814.stderr b/src/test/ui/issues/issue-9814.stderr index fe105a9c3cef..bd9e7df4991b 100644 --- a/src/test/ui/issues/issue-9814.stderr +++ b/src/test/ui/issues/issue-9814.stderr @@ -1,7 +1,7 @@ error[E0614]: type `Foo` cannot be dereferenced --> $DIR/issue-9814.rs:7:13 | -LL | let _ = *Foo::Bar(2); //~ ERROR type `Foo` cannot be dereferenced +LL | let _ = *Foo::Bar(2); | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-pr29383.stderr b/src/test/ui/issues/issue-pr29383.stderr index 1fe49f8fb14a..9695e1e3c07f 100644 --- a/src/test/ui/issues/issue-pr29383.stderr +++ b/src/test/ui/issues/issue-pr29383.stderr @@ -1,13 +1,13 @@ error[E0532]: expected tuple struct/variant, found unit variant `E::A` --> $DIR/issue-pr29383.rs:9:14 | -LL | Some(E::A(..)) => {} //~ ERROR expected tuple struct/variant, found unit variant `E::A` +LL | Some(E::A(..)) => {} | ^^^^ not a tuple struct/variant error[E0532]: expected tuple struct/variant, found unit variant `E::B` --> $DIR/issue-pr29383.rs:10:14 | -LL | Some(E::B(..)) => {} //~ ERROR expected tuple struct/variant, found unit variant `E::B` +LL | Some(E::B(..)) => {} | ^^^^ not a tuple struct/variant error: aborting due to 2 previous errors diff --git a/src/test/ui/keyword/extern/keyword-extern-as-identifier-expr.stderr b/src/test/ui/keyword/extern/keyword-extern-as-identifier-expr.stderr index 150fc88e7efc..8bb89d2ee215 100644 --- a/src/test/ui/keyword/extern/keyword-extern-as-identifier-expr.stderr +++ b/src/test/ui/keyword/extern/keyword-extern-as-identifier-expr.stderr @@ -1,7 +1,7 @@ error: expected expression, found keyword `extern` --> $DIR/keyword-extern-as-identifier-expr.rs:2:13 | -LL | let s = extern::foo::Bar; //~ ERROR expected expression, found keyword `extern` +LL | let s = extern::foo::Bar; | ^^^^^^ expected expression error: aborting due to previous error diff --git a/src/test/ui/keyword/extern/keyword-extern-as-identifier-pat.stderr b/src/test/ui/keyword/extern/keyword-extern-as-identifier-pat.stderr index 426b4eef0569..d7b9ad2abe97 100644 --- a/src/test/ui/keyword/extern/keyword-extern-as-identifier-pat.stderr +++ b/src/test/ui/keyword/extern/keyword-extern-as-identifier-pat.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `extern` --> $DIR/keyword-extern-as-identifier-pat.rs:2:9 | -LL | let extern = 0; //~ ERROR expected pattern, found keyword `extern` +LL | let extern = 0; | ^^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/keyword/extern/keyword-extern-as-identifier-type.stderr b/src/test/ui/keyword/extern/keyword-extern-as-identifier-type.stderr index 97b641fbea55..447c76a5bbce 100644 --- a/src/test/ui/keyword/extern/keyword-extern-as-identifier-type.stderr +++ b/src/test/ui/keyword/extern/keyword-extern-as-identifier-type.stderr @@ -1,7 +1,7 @@ error: expected `fn`, found `::` --> $DIR/keyword-extern-as-identifier-type.rs:1:16 | -LL | type A = extern::foo::bar; //~ ERROR expected `fn`, found `::` +LL | type A = extern::foo::bar; | ^^ expected `fn` here error: aborting due to previous error diff --git a/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr b/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr index 31b575a92e0c..4b833f806819 100644 --- a/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr +++ b/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr @@ -1,11 +1,11 @@ error: expected identifier, found keyword `extern` --> $DIR/keyword-extern-as-identifier-use.rs:1:5 | -LL | use extern::foo; //~ ERROR expected identifier, found keyword `extern` +LL | use extern::foo; | ^^^^^^ expected identifier, found keyword help: you can escape reserved keywords to use them as identifiers | -LL | use r#extern::foo; //~ ERROR expected identifier, found keyword `extern` +LL | use r#extern::foo; | ^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/keyword/keyword-false-as-identifier.stderr b/src/test/ui/keyword/keyword-false-as-identifier.stderr index 6c8dffa7e22c..954460459983 100644 --- a/src/test/ui/keyword/keyword-false-as-identifier.stderr +++ b/src/test/ui/keyword/keyword-false-as-identifier.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/keyword-false-as-identifier.rs:2:9 | -LL | let false = 22; //~ error: mismatched types +LL | let false = 22; | ^^^^^ expected integer, found bool | = note: expected type `{integer}` diff --git a/src/test/ui/keyword/keyword-self-as-identifier.stderr b/src/test/ui/keyword/keyword-self-as-identifier.stderr index 6ea19620a660..be57c6ad26fd 100644 --- a/src/test/ui/keyword/keyword-self-as-identifier.stderr +++ b/src/test/ui/keyword/keyword-self-as-identifier.stderr @@ -1,7 +1,7 @@ error[E0531]: cannot find unit struct/variant or constant `Self` in this scope --> $DIR/keyword-self-as-identifier.rs:2:9 | -LL | let Self = 22; //~ ERROR cannot find unit struct/variant or constant `Self` in this scope +LL | let Self = 22; | ^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/keyword/keyword-super-as-identifier.stderr b/src/test/ui/keyword/keyword-super-as-identifier.stderr index b0973bd170e5..bbeaed942879 100644 --- a/src/test/ui/keyword/keyword-super-as-identifier.stderr +++ b/src/test/ui/keyword/keyword-super-as-identifier.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: there are too many initial `super`s. --> $DIR/keyword-super-as-identifier.rs:2:9 | -LL | let super = 22; //~ ERROR failed to resolve: there are too many initial `super`s +LL | let super = 22; | ^^^^^ there are too many initial `super`s. error: aborting due to previous error diff --git a/src/test/ui/keyword/keyword-super.stderr b/src/test/ui/keyword/keyword-super.stderr index 5ec33ae30a69..63394c7852a5 100644 --- a/src/test/ui/keyword/keyword-super.stderr +++ b/src/test/ui/keyword/keyword-super.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: there are too many initial `super`s. --> $DIR/keyword-super.rs:2:9 | -LL | let super: isize; //~ ERROR failed to resolve: there are too many initial `super`s +LL | let super: isize; | ^^^^^ there are too many initial `super`s. error: aborting due to previous error diff --git a/src/test/ui/keyword/keyword-true-as-identifier.stderr b/src/test/ui/keyword/keyword-true-as-identifier.stderr index e5d3938e54ac..36b1d882a347 100644 --- a/src/test/ui/keyword/keyword-true-as-identifier.stderr +++ b/src/test/ui/keyword/keyword-true-as-identifier.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/keyword-true-as-identifier.rs:2:9 | -LL | let true = 22; //~ error: mismatched types +LL | let true = 22; | ^^^^ expected integer, found bool | = note: expected type `{integer}` diff --git a/src/test/ui/kindck/kindck-copy.stderr b/src/test/ui/kindck/kindck-copy.stderr index 65c06b8308c9..2680cb7c012f 100644 --- a/src/test/ui/kindck/kindck-copy.stderr +++ b/src/test/ui/kindck/kindck-copy.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `&'static mut isize: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:27:5 | -LL | assert_copy::<&'static mut isize>(); //~ ERROR : std::marker::Copy` is not satisfied +LL | assert_copy::<&'static mut isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'static mut isize` | = help: the following implementations were found: @@ -15,7 +15,7 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `&'a mut isize: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:28:5 | -LL | assert_copy::<&'a mut isize>(); //~ ERROR : std::marker::Copy` is not satisfied +LL | assert_copy::<&'a mut isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'a mut isize` | = help: the following implementations were found: @@ -29,7 +29,7 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `std::boxed::Box: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:31:5 | -LL | assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied +LL | assert_copy::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box` | note: required by `assert_copy` @@ -41,7 +41,7 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:32:5 | -LL | assert_copy::(); //~ ERROR : std::marker::Copy` is not satisfied +LL | assert_copy::(); | ^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String` | note: required by `assert_copy` @@ -53,7 +53,7 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `std::vec::Vec: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:33:5 | -LL | assert_copy:: >(); //~ ERROR : std::marker::Copy` is not satisfied +LL | assert_copy:: >(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::vec::Vec` | note: required by `assert_copy` @@ -65,7 +65,7 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `std::boxed::Box<&'a mut isize>: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:34:5 | -LL | assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied +LL | assert_copy::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<&'a mut isize>` | note: required by `assert_copy` @@ -77,7 +77,7 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `std::boxed::Box: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:42:5 | -LL | assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied +LL | assert_copy::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box` | note: required by `assert_copy` @@ -89,7 +89,7 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `std::boxed::Box: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:43:5 | -LL | assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied +LL | assert_copy::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box` | note: required by `assert_copy` @@ -101,7 +101,7 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `&'a mut (dyn Dummy + std::marker::Send + 'a): std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:46:5 | -LL | assert_copy::<&'a mut (Dummy+Send)>(); //~ ERROR : std::marker::Copy` is not satisfied +LL | assert_copy::<&'a mut (Dummy+Send)>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'a mut (dyn Dummy + std::marker::Send + 'a)` | note: required by `assert_copy` @@ -113,7 +113,7 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `MyNoncopyStruct: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:64:5 | -LL | assert_copy::(); //~ ERROR : std::marker::Copy` is not satisfied +LL | assert_copy::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `MyNoncopyStruct` | note: required by `assert_copy` @@ -125,7 +125,7 @@ LL | fn assert_copy() { } error[E0277]: the trait bound `std::rc::Rc: std::marker::Copy` is not satisfied --> $DIR/kindck-copy.rs:67:5 | -LL | assert_copy::>(); //~ ERROR : std::marker::Copy` is not satisfied +LL | assert_copy::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::rc::Rc` | note: required by `assert_copy` diff --git a/src/test/ui/kindck/kindck-inherited-copy-bound.stderr b/src/test/ui/kindck/kindck-inherited-copy-bound.stderr index fe8e02e35477..1b7f9cd55173 100644 --- a/src/test/ui/kindck/kindck-inherited-copy-bound.stderr +++ b/src/test/ui/kindck/kindck-inherited-copy-bound.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `std::boxed::Box<{integer}>: std::marker::Copy` is not satisfied --> $DIR/kindck-inherited-copy-bound.rs:18:5 | -LL | take_param(&x); //~ ERROR E0277 +LL | take_param(&x); | ^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<{integer}>` | = note: required because of the requirements on the impl of `Foo` for `std::boxed::Box<{integer}>` diff --git a/src/test/ui/label/label-static.stderr b/src/test/ui/label/label-static.stderr index 52ab547aa7bb..1d3251d1b5f4 100644 --- a/src/test/ui/label/label-static.stderr +++ b/src/test/ui/label/label-static.stderr @@ -1,13 +1,13 @@ error: invalid label name `'static` --> $DIR/label-static.rs:2:5 | -LL | 'static: loop { //~ ERROR invalid label name `'static` +LL | 'static: loop { | ^^^^^^^ error: invalid label name `'static` --> $DIR/label-static.rs:3:15 | -LL | break 'static //~ ERROR invalid label name `'static` +LL | break 'static | ^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/label/label-underscore.stderr b/src/test/ui/label/label-underscore.stderr index a4925c8619ed..4558ec4cb41f 100644 --- a/src/test/ui/label/label-underscore.stderr +++ b/src/test/ui/label/label-underscore.stderr @@ -1,13 +1,13 @@ error: invalid label name `'_` --> $DIR/label-underscore.rs:2:5 | -LL | '_: loop { //~ ERROR invalid label name `'_` +LL | '_: loop { | ^^ error: invalid label name `'_` --> $DIR/label-underscore.rs:3:15 | -LL | break '_ //~ ERROR invalid label name `'_` +LL | break '_ | ^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/label/label_break_value_continue.stderr b/src/test/ui/label/label_break_value_continue.stderr index c0decc825524..bd1dd5938988 100644 --- a/src/test/ui/label/label_break_value_continue.stderr +++ b/src/test/ui/label/label_break_value_continue.stderr @@ -1,27 +1,27 @@ error[E0695]: unlabeled `continue` inside of a labeled block --> $DIR/label_break_value_continue.rs:7:9 | -LL | continue; //~ ERROR unlabeled `continue` inside of a labeled block +LL | continue; | ^^^^^^^^ `continue` statements that would diverge to or through a labeled block need to bear a label error[E0696]: `continue` pointing to a labeled block --> $DIR/label_break_value_continue.rs:14:9 | -LL | continue 'b; //~ ERROR `continue` pointing to a labeled block +LL | continue 'b; | ^^^^^^^^^^^ labeled blocks cannot be `continue`'d | note: labeled block the continue points to --> $DIR/label_break_value_continue.rs:13:5 | LL | / 'b: { -LL | | continue 'b; //~ ERROR `continue` pointing to a labeled block +LL | | continue 'b; LL | | } | |_____^ error[E0695]: unlabeled `continue` inside of a labeled block --> $DIR/label_break_value_continue.rs:22:13 | -LL | continue; //~ ERROR unlabeled `continue` inside of a labeled block +LL | continue; | ^^^^^^^^ `continue` statements that would diverge to or through a labeled block need to bear a label error: aborting due to 3 previous errors diff --git a/src/test/ui/label/label_break_value_illegal_uses.stderr b/src/test/ui/label/label_break_value_illegal_uses.stderr index 889df17de44d..0b9754c3c70e 100644 --- a/src/test/ui/label/label_break_value_illegal_uses.stderr +++ b/src/test/ui/label/label_break_value_illegal_uses.stderr @@ -1,13 +1,13 @@ error: expected one of `extern`, `fn`, or `{`, found `'b` --> $DIR/label_break_value_illegal_uses.rs:6:12 | -LL | unsafe 'b: {} //~ ERROR expected one of `extern`, `fn`, or `{` +LL | unsafe 'b: {} | ^^ expected one of `extern`, `fn`, or `{` here error: expected `{`, found `'b` --> $DIR/label_break_value_illegal_uses.rs:10:13 | -LL | if true 'b: {} //~ ERROR expected `{`, found `'b` +LL | if true 'b: {} | -- ^^---- | | | | | expected `{` @@ -17,7 +17,7 @@ LL | if true 'b: {} //~ ERROR expected `{`, found `'b` error: expected `{`, found `'b` --> $DIR/label_break_value_illegal_uses.rs:14:21 | -LL | if true {} else 'b: {} //~ ERROR expected `{`, found `'b` +LL | if true {} else 'b: {} | ^^---- | | | expected `{` @@ -26,7 +26,7 @@ LL | if true {} else 'b: {} //~ ERROR expected `{`, found `'b` error: expected one of `.`, `?`, `{`, or an operator, found `'b` --> $DIR/label_break_value_illegal_uses.rs:18:17 | -LL | match false 'b: {} //~ ERROR expected one of `.`, `?`, `{`, or an operator +LL | match false 'b: {} | ----- ^^ expected one of `.`, `?`, `{`, or an operator here | | | while parsing this match expression diff --git a/src/test/ui/label/label_break_value_unlabeled_break.stderr b/src/test/ui/label/label_break_value_unlabeled_break.stderr index 1d6e27d4c3d0..0c4f573d27db 100644 --- a/src/test/ui/label/label_break_value_unlabeled_break.stderr +++ b/src/test/ui/label/label_break_value_unlabeled_break.stderr @@ -1,13 +1,13 @@ error[E0695]: unlabeled `break` inside of a labeled block --> $DIR/label_break_value_unlabeled_break.rs:7:9 | -LL | break; //~ ERROR unlabeled `break` inside of a labeled block +LL | break; | ^^^^^ `break` statements that would diverge to or through a labeled block need to bear a label error[E0695]: unlabeled `break` inside of a labeled block --> $DIR/label_break_value_unlabeled_break.rs:15:13 | -LL | break; //~ ERROR unlabeled `break` inside of a labeled block +LL | break; | ^^^^^ `break` statements that would diverge to or through a labeled block need to bear a label error: aborting due to 2 previous errors diff --git a/src/test/ui/lexical-scopes.stderr b/src/test/ui/lexical-scopes.stderr index 51313033a02d..fb823ebde2ed 100644 --- a/src/test/ui/lexical-scopes.stderr +++ b/src/test/ui/lexical-scopes.stderr @@ -1,7 +1,7 @@ error[E0574]: expected struct, variant or union type, found type parameter `T` --> $DIR/lexical-scopes.rs:3:13 | -LL | let t = T { i: 0 }; //~ ERROR expected struct, variant or union type, found type parameter `T` +LL | let t = T { i: 0 }; | ^ not a struct, variant or union type help: possible better candidate is found in another module, you can import it into scope | @@ -11,7 +11,7 @@ LL | use T; error[E0599]: no function or associated item named `f` found for type `Foo` in the current scope --> $DIR/lexical-scopes.rs:10:10 | -LL | Foo::f(); //~ ERROR no function or associated item named `f` +LL | Foo::f(); | -----^ | | | function or associated item not found in `Foo` diff --git a/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr b/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr index d70524b2387f..0e2fc0a0fe97 100644 --- a/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr +++ b/src/test/ui/lifetimes/borrowck-let-suggestion.nll.stderr @@ -5,7 +5,7 @@ LL | let mut x = vec![1].iter(); | ^^^^^^^ - temporary value is freed at the end of this statement | | | creates a temporary which is freed while still in use -LL | //~^ ERROR borrowed value does not live long enough +LL | LL | x.use_mut(); | - borrow later used here | diff --git a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr index a283a0b29e6c..1af4bd501ba4 100644 --- a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr +++ b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/lifetime-bound-will-change-warning.rs:34:13 | -LL | ref_obj(x) //~ ERROR mismatched types +LL | ref_obj(x) | ^ lifetime mismatch | = note: expected type `&std::boxed::Box<(dyn std::ops::Fn() + 'static)>` @@ -16,7 +16,7 @@ LL | fn test2<'a>(x: &'a Box) { error[E0308]: mismatched types --> $DIR/lifetime-bound-will-change-warning.rs:39:18 | -LL | lib::ref_obj(x) //~ ERROR mismatched types +LL | lib::ref_obj(x) | ^ lifetime mismatch | = note: expected type `&std::boxed::Box<(dyn std::ops::Fn() + 'static)>` diff --git a/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr b/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr index d4ca1aec6978..90bec01df63e 100644 --- a/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr +++ b/src/test/ui/lifetimes/lifetime-doesnt-live-long-enough.stderr @@ -46,7 +46,7 @@ LL | fn baz<'a, L, M: X<&'a Nested>>() { | ^ - help: consider adding an explicit lifetime bound `L: 'a`... | _____| | | -LL | | //~^ ERROR may not live long enough +LL | | LL | | } | |_____^ | @@ -54,7 +54,7 @@ note: ...so that the reference type `&'a Nested` does not outlive the data it --> $DIR/lifetime-doesnt-live-long-enough.rs:32:5 | LL | / fn baz<'a, L, M: X<&'a Nested>>() { -LL | | //~^ ERROR may not live long enough +LL | | LL | | } | |_____^ @@ -64,7 +64,7 @@ error[E0309]: the parameter type `K` may not live long enough LL | impl Nested { | - help: consider adding an explicit lifetime bound `K: 'a`... LL | / fn generic_in_parent<'a, L: X<&'a Nested>>() { -LL | | //~^ ERROR may not live long enough +LL | | LL | | } | |_____^ | @@ -72,7 +72,7 @@ note: ...so that the reference type `&'a Nested` does not outlive the data it --> $DIR/lifetime-doesnt-live-long-enough.rs:41:5 | LL | / fn generic_in_parent<'a, L: X<&'a Nested>>() { -LL | | //~^ ERROR may not live long enough +LL | | LL | | } | |_____^ @@ -83,7 +83,7 @@ LL | fn generic_in_child<'a, 'b, L: X<&'a Nested>, M: 'b>() { | ^ -- help: consider adding an explicit lifetime bound `M: 'a`... | _____| | | -LL | | //~^ ERROR may not live long enough +LL | | LL | | } | |_____^ | @@ -91,7 +91,7 @@ note: ...so that the reference type `&'a Nested` does not outlive the data it --> $DIR/lifetime-doesnt-live-long-enough.rs:44:5 | LL | / fn generic_in_child<'a, 'b, L: X<&'a Nested>, M: 'b>() { -LL | | //~^ ERROR may not live long enough +LL | | LL | | } | |_____^ diff --git a/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr b/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr index cf825c52f569..3f7c3934a0ba 100644 --- a/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr +++ b/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr @@ -1,7 +1,7 @@ error[E0106]: missing lifetime specifier --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:2:11 | -LL | fn f() -> &isize { //~ ERROR missing lifetime specifier +LL | fn f() -> &isize { | ^ help: consider giving it a 'static lifetime: `&'static` | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from @@ -9,7 +9,7 @@ LL | fn f() -> &isize { //~ ERROR missing lifetime specifier error[E0106]: missing lifetime specifier --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:7:33 | -LL | fn g(_x: &isize, _y: &isize) -> &isize { //~ ERROR missing lifetime specifier +LL | fn g(_x: &isize, _y: &isize) -> &isize { | ^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `_x` or `_y` @@ -17,7 +17,7 @@ LL | fn g(_x: &isize, _y: &isize) -> &isize { //~ ERROR missing lifetime spec error[E0106]: missing lifetime specifier --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:17:19 | -LL | fn h(_x: &Foo) -> &isize { //~ ERROR missing lifetime specifier +LL | fn h(_x: &Foo) -> &isize { | ^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say which one of `_x`'s 2 lifetimes it is borrowed from @@ -25,7 +25,7 @@ LL | fn h(_x: &Foo) -> &isize { //~ ERROR missing lifetime specifier error[E0106]: missing lifetime specifier --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:21:20 | -LL | fn i(_x: isize) -> &isize { //~ ERROR missing lifetime specifier +LL | fn i(_x: isize) -> &isize { | ^ help: consider giving it an explicit bounded or 'static lifetime: `&'static` | = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments @@ -33,7 +33,7 @@ LL | fn i(_x: isize) -> &isize { //~ ERROR missing lifetime specifier error[E0106]: missing lifetime specifier --> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:34:24 | -LL | fn j(_x: StaticStr) -> &isize { //~ ERROR missing lifetime specifier +LL | fn j(_x: StaticStr) -> &isize { | ^ help: consider giving it an explicit bounded or 'static lifetime: `&'static` | = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments diff --git a/src/test/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.stderr b/src/test/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.stderr index 6211a9a11417..63d00875dd33 100644 --- a/src/test/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.stderr @@ -4,7 +4,7 @@ error[E0621]: explicit lifetime required in the type of `x` LL | fn foo2<'a>(a: &'a Foo, x: &i32) -> &'a i32 { | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32` ... -LL | &*x //~ ERROR explicit lifetime +LL | &*x | ^^^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr index 9fe1679936d8..64aa8361cd5e 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr @@ -4,7 +4,7 @@ error[E0621]: explicit lifetime required in the type of `other` LL | fn bar(&self, other: Foo) -> Foo<'a> { | --- help: add explicit lifetime `'a` to the type of `other`: `Foo<'a>` ... -LL | other //~ ERROR explicit lifetime +LL | other | ^^^^^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr index 94ec5248eb00..b40481ecdc40 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `x` | LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32` -LL | if x > y { x } else { y } //~ ERROR explicit lifetime +LL | if x > y { x } else { y } | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr index 4be638bf4c21..194fd95891eb 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in parameter type | LL | fn foo<'a>((x, y): (&'a i32, &i32)) -> &'a i32 { | --------------- help: add explicit lifetime `'a` to type: `(&'a i32, &'a i32)` -LL | if x > y { x } else { y } //~ ERROR explicit lifetime +LL | if x > y { x } else { y } | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr index d61271b81ac1..64f4bd0fc706 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `x` | LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32` -LL | if x > y { x } else { y } //~ ERROR explicit lifetime +LL | if x > y { x } else { y } | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr index 15642be44b7e..f764ec43ad1c 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr @@ -4,7 +4,7 @@ error[E0621]: explicit lifetime required in the type of `x` LL | fn foo<'a>(&'a self, x: &i32) -> &i32 { | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32` LL | -LL | if true { &self.field } else { x } //~ ERROR explicit lifetime +LL | if true { &self.field } else { x } | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr index 1eaa9c8339f7..e9f5fc311dfc 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr @@ -6,7 +6,7 @@ LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 { | | | this parameter and the return type are declared with different lifetimes... LL | -LL | if x > y { x } else { y } //~ ERROR lifetime mismatch +LL | if x > y { x } else { y } | ^ ...but data from `x` is returned here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.stderr index d48adf168080..29a70695710f 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `y` | LL | fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 { | ---- help: add explicit lifetime `'a` to the type of `y`: `&'a i32` -LL | if x > y { x } else { y } //~ ERROR explicit lifetime +LL | if x > y { x } else { y } | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr index f4b2efa8438c..0d506f2b9fcb 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr @@ -6,7 +6,7 @@ LL | fn foo<'a>(&self, x: &'a i32) -> &i32 { | | | this parameter and the return type are declared with different lifetimes... LL | -LL | x //~ ERROR lifetime mismatch +LL | x | ^ ...but data from `x` is returned here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr index 328c69bb6586..98a23613c363 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr @@ -6,7 +6,7 @@ LL | fn foo<'a>(&self, x: &'a Foo) -> &'a Foo { | | | this parameter and the return type are declared with different lifetimes... LL | -LL | if true { x } else { self } //~ ERROR lifetime mismatch +LL | if true { x } else { self } | ^^^^ ...but data from `self` is returned here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.stderr index 9fc1124685c5..a4e0d71a3fa6 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.stderr @@ -1,7 +1,7 @@ error[E0106]: missing lifetime specifier --> $DIR/ex1b-return-no-names-if-else.rs:1:29 | -LL | fn foo(x: &i32, y: &i32) -> &i32 { //~ ERROR missing lifetime +LL | fn foo(x: &i32, y: &i32) -> &i32 { | ^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `x` or `y` diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.stderr index 3df29e62a283..412cac435636 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `x` | LL | fn foo<'a>(x: Ref, y: &mut Vec>) { | -------- help: add explicit lifetime `'a` to the type of `x`: `Ref<'a, i32>` -LL | y.push(x); //~ ERROR explicit lifetime +LL | y.push(x); | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr index 0fd085c39f28..30826c3613c5 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr @@ -4,7 +4,7 @@ error[E0621]: explicit lifetime required in the type of `y` LL | fn baz<'a, 'b, T>(x: &mut Vec<&'a T>, y: &T) | -- help: add explicit lifetime `'a` to the type of `y`: `&'a T` ... -LL | x.push(y); //~ ERROR explicit lifetime required +LL | x.push(y); | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.stderr index a669e33ab098..13d0835287d0 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `y` | LL | fn foo<'a>(x: &mut Vec>, y: Ref) { | -------- help: add explicit lifetime `'a` to the type of `y`: `Ref<'a, i32>` -LL | x.push(y); //~ ERROR explicit lifetime +LL | x.push(y); | ^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr index 7ac61df49548..e505c9c0dc26 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(x: &mut Vec>, y: Ref) { | -------- -------- these two types are declared with different lifetimes... -LL | x.push(y); //~ ERROR lifetime mismatch +LL | x.push(y); | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr index bfa9c0d15f0f..63b1c6db28f1 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr @@ -4,7 +4,7 @@ error[E0623]: lifetime mismatch LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { | ------------ ------------ these two types are declared with different lifetimes... LL | let z = Ref { data: y.data }; -LL | x.push(z); //~ ERROR lifetime mismatch +LL | x.push(z); | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr index 2db81f8aba6e..2f669efcf1eb 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { | ------------ ------------ these two types are declared with different lifetimes... -LL | let a: &mut Vec> = x; //~ ERROR lifetime mismatch +LL | let a: &mut Vec> = x; | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr index 85a6dba92893..258b6805acd5 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { | ------------ ------------ these two types are declared with different lifetimes... -LL | let a: &mut Vec> = x; //~ ERROR lifetime mismatch +LL | let a: &mut Vec> = x; | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr index b8f97d145772..0aff80c6fbdd 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(&mut (ref mut v, w): &mut (&u8, &u8), x: &u8) { | --- --- these two types are declared with different lifetimes... -LL | *v = x; //~ ERROR lifetime mismatch +LL | *v = x; | ^ ...but data from `x` flows here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr index acfe809b6785..2e5ff6782d3b 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { | --- --- these two types are declared with different lifetimes... -LL | z.push((x,y)); //~ ERROR lifetime mismatch +LL | z.push((x,y)); | ^ ...but data flows into `z` here error[E0623]: lifetime mismatch @@ -11,7 +11,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { | --- --- these two types are declared with different lifetimes... -LL | z.push((x,y)); //~ ERROR lifetime mismatch +LL | z.push((x,y)); | ^ ...but data flows into `z` here error: aborting due to 2 previous errors diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr index cb1ca5e1485b..8e41d7c54e68 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(mut x: Ref, y: Ref) { | --- --- these two types are declared with different lifetimes... -LL | x.b = y.b; //~ ERROR lifetime mismatch +LL | x.b = y.b; | ^^^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr index 863ec9806fca..da83ebc984c4 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr @@ -5,7 +5,7 @@ LL | fn foo(mut x: Ref) { | --- | | | this type is declared with multiple lifetimes... -LL | x.a = x.b; //~ ERROR lifetime mismatch +LL | x.a = x.b; | ^^^ ...but data with one lifetime flows into the other here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr index 57174385b4dd..374bbd93d087 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr @@ -4,7 +4,7 @@ error[E0623]: lifetime mismatch LL | fn foo<'a, 'b>(mut x: Vec>, y: Ref<'b>) | ------- ------- these two types are declared with different lifetimes... ... -LL | x.push(y); //~ ERROR lifetime mismatch +LL | x.push(y); | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr index caa7397979bc..94798d1ce2ab 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo<'a, 'b>(mut x: Vec>, y: Ref<'b>) { | ------- ------- these two types are declared with different lifetimes... -LL | x.push(y); //~ ERROR lifetime mismatch +LL | x.push(y); | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr index 27d5f5da7e53..9f5a79ed333d 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(mut x: Vec, y: Ref) { | --- --- these two types are declared with different lifetimes... -LL | x.push(y); //~ ERROR lifetime mismatch +LL | x.push(y); | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr index 97da7f8ac6df..2c87f8dbd2c2 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) { | ------ ------ these two types are declared with different lifetimes... -LL | x.push(y); //~ ERROR lifetime mismatch +LL | x.push(y); | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr index 8c4e3daed4ca..60b92ed2b324 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr @@ -5,7 +5,7 @@ LL | fn foo(mut x: Ref, y: &u32) { | --- ---- | | | these two types are declared with different lifetimes... -LL | y = x.b; //~ ERROR lifetime mismatch +LL | y = x.b; | ^^^ ...but data from `x` flows into `y` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr index b443707bbae4..a220c8ddb2be 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(mut y: Ref, x: &u32) { | --- ---- these two types are declared with different lifetimes... -LL | y.b = x; //~ ERROR lifetime mismatch +LL | y.b = x; | ^ ...but data from `x` flows into `y` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr index 77d43cd17c8f..73472a8d0225 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(mut y: Ref, x: &u32) { | --- ---- these two types are declared with different lifetimes... -LL | y.b = x; //~ ERROR lifetime mismatch +LL | y.b = x; | ^ ...but data from `x` flows into `y` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr index eef3aa50e0f2..eb6e6f2e95e7 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(mut x: Ref, y: &u32) { | --- ---- these two types are declared with different lifetimes... -LL | x.b = y; //~ ERROR lifetime mismatch +LL | x.b = y; | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr index 917b90fd47f9..199f880b3c48 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr @@ -5,7 +5,7 @@ LL | fn foo<'a>(&self, x: &i32) -> &i32 { | ---- ---- | | | this parameter and the return type are declared with different lifetimes... -LL | x //~ ERROR lifetime mismatch +LL | x | ^ ...but data from `x` is returned here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr index a2ba41ef4f09..838f43b37747 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr @@ -5,7 +5,7 @@ LL | fn foo<'a>(&self, x: &Foo) -> &Foo { | ---- ---- | | | this parameter and the return type are declared with different lifetimes... -LL | if true { x } else { self } //~ ERROR lifetime mismatch +LL | if true { x } else { self } | ^ ...but data from `x` is returned here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr index 43e54d640859..d2cc3dba6a43 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) { | --- --- these two types are declared with different lifetimes... -LL | y.push(z); //~ ERROR lifetime mismatch +LL | y.push(z); | ^ ...but data from `z` flows into `y` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr index 39896a3c8a05..e8b0208f092f 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(x: &mut Vec<&u8>, y: &u8) { | --- --- these two types are declared with different lifetimes... -LL | x.push(y); //~ ERROR lifetime mismatch +LL | x.push(y); | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr index 46eca5ea64f6..5ad85c97e72d 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { | --- --- these two types are declared with different lifetimes... -LL | y.push(z); //~ ERROR lifetime mismatch +LL | y.push(z); | ^ ...but data from `z` flows into `y` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr index 07d6cafd6339..b2784827672b 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr @@ -3,7 +3,7 @@ error[E0623]: lifetime mismatch | LL | fn foo(x: &mut Vec<&u8>, y: &u8) { | --- --- these two types are declared with different lifetimes... -LL | x.push(y); //~ ERROR lifetime mismatch +LL | x.push(y); | ^ ...but data from `y` flows into `x` here error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.stderr b/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.stderr index f66bd3b35f78..e15290f0b9ee 100644 --- a/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.stderr +++ b/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.stderr @@ -3,7 +3,7 @@ error[E0384]: cannot assign twice to immutable variable `x` (Ast) | LL | x = 2; | ----- first assignment to `x` -LL | x = 3; //~ ERROR (Ast) [E0384] +LL | x = 3; | ^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` (Ast) @@ -11,22 +11,22 @@ error[E0384]: cannot assign twice to immutable variable `x` (Ast) | LL | x = 2; | ----- first assignment to `x` -LL | x = 3; //~ ERROR (Ast) [E0384] +LL | x = 3; | ^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` (Ast) --> $DIR/liveness-assign-imm-local-notes.rs:35:13 | -LL | x = 1; //~ ERROR (Ast) [E0384] +LL | x = 1; | ^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` (Ast) --> $DIR/liveness-assign-imm-local-notes.rs:38:13 | -LL | x = 1; //~ ERROR (Ast) [E0384] +LL | x = 1; | ----- first assignment to `x` ... -LL | x = 2; //~ ERROR (Ast) [E0384] +LL | x = 2; | ^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` (Mir) @@ -37,7 +37,7 @@ LL | let x; ... LL | x = 2; | ----- first assignment to `x` -LL | x = 3; //~ ERROR (Ast) [E0384] +LL | x = 3; | ^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` (Mir) @@ -48,7 +48,7 @@ LL | let x; ... LL | x = 2; | ----- first assignment to `x` -LL | x = 3; //~ ERROR (Ast) [E0384] +LL | x = 3; | ^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` (Mir) @@ -57,7 +57,7 @@ error[E0384]: cannot assign twice to immutable variable `x` (Mir) LL | let x; | - help: make this binding mutable: `mut x` ... -LL | x = 1; //~ ERROR (Ast) [E0384] +LL | x = 1; | ^^^^^ cannot assign twice to immutable variable error[E0384]: cannot assign twice to immutable variable `x` (Mir) @@ -66,10 +66,10 @@ error[E0384]: cannot assign twice to immutable variable `x` (Mir) LL | let x; | - help: make this binding mutable: `mut x` ... -LL | x = 1; //~ ERROR (Ast) [E0384] +LL | x = 1; | ----- first assignment to `x` ... -LL | x = 2; //~ ERROR (Ast) [E0384] +LL | x = 2; | ^^^^^ cannot assign twice to immutable variable error: aborting due to 8 previous errors diff --git a/src/test/ui/lifetimes/lifetime-no-keyword.stderr b/src/test/ui/lifetimes/lifetime-no-keyword.stderr index 912befff01cc..ba8ceb80fe0f 100644 --- a/src/test/ui/lifetimes/lifetime-no-keyword.stderr +++ b/src/test/ui/lifetimes/lifetime-no-keyword.stderr @@ -1,25 +1,25 @@ error: lifetimes cannot use keyword names --> $DIR/lifetime-no-keyword.rs:3:8 | -LL | fn baz<'let>(a: &'let isize) { } //~ ERROR lifetimes cannot use keyword names +LL | fn baz<'let>(a: &'let isize) { } | ^^^^ error: lifetimes cannot use keyword names --> $DIR/lifetime-no-keyword.rs:3:18 | -LL | fn baz<'let>(a: &'let isize) { } //~ ERROR lifetimes cannot use keyword names +LL | fn baz<'let>(a: &'let isize) { } | ^^^^ error: lifetimes cannot use keyword names --> $DIR/lifetime-no-keyword.rs:5:8 | -LL | fn zab<'self>(a: &'self isize) { } //~ ERROR lifetimes cannot use keyword names +LL | fn zab<'self>(a: &'self isize) { } | ^^^^^ error: lifetimes cannot use keyword names --> $DIR/lifetime-no-keyword.rs:5:19 | -LL | fn zab<'self>(a: &'self isize) { } //~ ERROR lifetimes cannot use keyword names +LL | fn zab<'self>(a: &'self isize) { } | ^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/lint/command-line-lint-group-deny.stderr b/src/test/ui/lint/command-line-lint-group-deny.stderr index 3250a41ee0ec..04c3f6f26379 100644 --- a/src/test/ui/lint/command-line-lint-group-deny.stderr +++ b/src/test/ui/lint/command-line-lint-group-deny.stderr @@ -1,7 +1,7 @@ error: variable `_InappropriateCamelCasing` should have a snake case name --> $DIR/command-line-lint-group-deny.rs:4:9 | -LL | let _InappropriateCamelCasing = true; //~ ERROR should have a snake +LL | let _InappropriateCamelCasing = true; | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `_inappropriate_camel_casing` | = note: `-D non-snake-case` implied by `-D bad-style` diff --git a/src/test/ui/lint/command-line-lint-group-forbid.stderr b/src/test/ui/lint/command-line-lint-group-forbid.stderr index 39f6da400c49..736782140639 100644 --- a/src/test/ui/lint/command-line-lint-group-forbid.stderr +++ b/src/test/ui/lint/command-line-lint-group-forbid.stderr @@ -1,7 +1,7 @@ error: variable `_InappropriateCamelCasing` should have a snake case name --> $DIR/command-line-lint-group-forbid.rs:4:9 | -LL | let _InappropriateCamelCasing = true; //~ ERROR should have a snake +LL | let _InappropriateCamelCasing = true; | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert the identifier to snake case: `_inappropriate_camel_casing` | = note: `-F non-snake-case` implied by `-F bad-style` diff --git a/src/test/ui/lint/issue-54538-unused-parens-lint.stderr b/src/test/ui/lint/issue-54538-unused-parens-lint.stderr index fd55ffbdf437..3cf321b072f4 100644 --- a/src/test/ui/lint/issue-54538-unused-parens-lint.stderr +++ b/src/test/ui/lint/issue-54538-unused-parens-lint.stderr @@ -1,7 +1,7 @@ warning: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:9:9 | -LL | (_) => {} //~ WARNING: unnecessary parentheses around pattern +LL | (_) => {} | ^^^ help: remove these parentheses | note: lint level defined here @@ -13,30 +13,30 @@ LL | #![warn(unused_parens)] warning: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:10:9 | -LL | (y) => {} //~ WARNING: unnecessary parentheses around pattern +LL | (y) => {} | ^^^ help: remove these parentheses warning: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:11:9 | -LL | (ref r) => {} //~ WARNING: unnecessary parentheses around pattern +LL | (ref r) => {} | ^^^^^^^ help: remove these parentheses warning: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:12:9 | -LL | (e @ 1..=2) => {} //~ WARNING: unnecessary parentheses around outer pattern +LL | (e @ 1..=2) => {} | ^^^^^^^^^^^ help: remove these parentheses warning: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:18:9 | -LL | (e @ &(1...2)) => {} //~ WARNING: unnecessary parentheses around outer pattern +LL | (e @ &(1...2)) => {} | ^^^^^^^^^^^^^^ help: remove these parentheses warning: unnecessary parentheses around pattern --> $DIR/issue-54538-unused-parens-lint.rs:19:10 | -LL | &(_) => {} //~ WARNING: unnecessary parentheses around pattern +LL | &(_) => {} | ^^^ help: remove these parentheses diff --git a/src/test/ui/lint/lint-attr-non-item-node.stderr b/src/test/ui/lint/lint-attr-non-item-node.stderr index 2c95831f3759..6eb72c098df5 100644 --- a/src/test/ui/lint/lint-attr-non-item-node.stderr +++ b/src/test/ui/lint/lint-attr-non-item-node.stderr @@ -1,7 +1,7 @@ error: unreachable statement --> $DIR/lint-attr-non-item-node.rs:7:9 | -LL | "unreachable"; //~ ERROR unreachable statement +LL | "unreachable"; | ^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/lint/lint-change-warnings.stderr b/src/test/ui/lint/lint-change-warnings.stderr index 7d7a066613ac..c4b8ab5fc185 100644 --- a/src/test/ui/lint/lint-change-warnings.stderr +++ b/src/test/ui/lint/lint-change-warnings.stderr @@ -1,7 +1,7 @@ error: denote infinite loops with `loop { ... }` --> $DIR/lint-change-warnings.rs:5:5 | -LL | while true {} //~ ERROR: infinite +LL | while true {} | ^^^^^^^^^^ help: use `loop` | note: lint level defined here @@ -14,7 +14,7 @@ LL | #![deny(warnings)] warning: denote infinite loops with `loop { ... }` --> $DIR/lint-change-warnings.rs:15:5 | -LL | while true {} //~ WARNING: infinite +LL | while true {} | ^^^^^^^^^^ help: use `loop` | = note: #[warn(while_true)] on by default @@ -22,7 +22,7 @@ LL | while true {} //~ WARNING: infinite error: denote infinite loops with `loop { ... }` --> $DIR/lint-change-warnings.rs:20:5 | -LL | while true {} //~ ERROR: infinite +LL | while true {} | ^^^^^^^^^^ help: use `loop` | note: lint level defined here diff --git a/src/test/ui/lint/lint-ctypes-enum.stderr b/src/test/ui/lint/lint-ctypes-enum.stderr index dd33cc77458d..92f76cfc38a7 100644 --- a/src/test/ui/lint/lint-ctypes-enum.stderr +++ b/src/test/ui/lint/lint-ctypes-enum.stderr @@ -1,7 +1,7 @@ error: `extern` block uses type `U` which is not FFI-safe: enum has no representation hint --> $DIR/lint-ctypes-enum.rs:20:13 | -LL | fn uf(x: U); //~ ERROR enum has no representation hint +LL | fn uf(x: U); | ^ | note: lint level defined here @@ -19,7 +19,7 @@ LL | enum U { A } error: `extern` block uses type `B` which is not FFI-safe: enum has no representation hint --> $DIR/lint-ctypes-enum.rs:21:13 | -LL | fn bf(x: B); //~ ERROR enum has no representation hint +LL | fn bf(x: B); | ^ | = help: consider adding a #[repr(...)] attribute to this enum @@ -32,7 +32,7 @@ LL | enum B { C, D } error: `extern` block uses type `T` which is not FFI-safe: enum has no representation hint --> $DIR/lint-ctypes-enum.rs:22:13 | -LL | fn tf(x: T); //~ ERROR enum has no representation hint +LL | fn tf(x: T); | ^ | = help: consider adding a #[repr(...)] attribute to this enum diff --git a/src/test/ui/lint/lint-ctypes.stderr b/src/test/ui/lint/lint-ctypes.stderr index 51211c876317..67ba30a81c50 100644 --- a/src/test/ui/lint/lint-ctypes.stderr +++ b/src/test/ui/lint/lint-ctypes.stderr @@ -1,7 +1,7 @@ error: `extern` block uses type `Foo` which is not FFI-safe: this struct has unspecified layout --> $DIR/lint-ctypes.rs:46:28 | -LL | pub fn ptr_type1(size: *const Foo); //~ ERROR: uses type `Foo` +LL | pub fn ptr_type1(size: *const Foo); | ^^^^^^^^^^ | note: lint level defined here @@ -19,7 +19,7 @@ LL | pub struct Foo; error: `extern` block uses type `Foo` which is not FFI-safe: this struct has unspecified layout --> $DIR/lint-ctypes.rs:47:28 | -LL | pub fn ptr_type2(size: *const Foo); //~ ERROR: uses type `Foo` +LL | pub fn ptr_type2(size: *const Foo); | ^^^^^^^^^^ | = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct @@ -32,7 +32,7 @@ LL | pub struct Foo; error: `extern` block uses type `[u32]` which is not FFI-safe: slices have no C equivalent --> $DIR/lint-ctypes.rs:48:26 | -LL | pub fn slice_type(p: &[u32]); //~ ERROR: uses type `[u32]` +LL | pub fn slice_type(p: &[u32]); | ^^^^^^ | = help: consider using a raw pointer instead @@ -40,7 +40,7 @@ LL | pub fn slice_type(p: &[u32]); //~ ERROR: uses type `[u32]` error: `extern` block uses type `str` which is not FFI-safe: string slices have no C equivalent --> $DIR/lint-ctypes.rs:49:24 | -LL | pub fn str_type(p: &str); //~ ERROR: uses type `str` +LL | pub fn str_type(p: &str); | ^^^^ | = help: consider using `*const u8` and a length instead @@ -48,7 +48,7 @@ LL | pub fn str_type(p: &str); //~ ERROR: uses type `str` error: `extern` block uses type `std::boxed::Box` which is not FFI-safe: this struct has unspecified layout --> $DIR/lint-ctypes.rs:50:24 | -LL | pub fn box_type(p: Box); //~ ERROR uses type `std::boxed::Box` +LL | pub fn box_type(p: Box); | ^^^^^^^^ | = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct @@ -56,7 +56,7 @@ LL | pub fn box_type(p: Box); //~ ERROR uses type `std::boxed::Box error: `extern` block uses type `char` which is not FFI-safe: the `char` type has no C equivalent --> $DIR/lint-ctypes.rs:51:25 | -LL | pub fn char_type(p: char); //~ ERROR uses type `char` +LL | pub fn char_type(p: char); | ^^^^ | = help: consider using `u32` or `libc::wchar_t` instead @@ -64,25 +64,25 @@ LL | pub fn char_type(p: char); //~ ERROR uses type `char` error: `extern` block uses type `i128` which is not FFI-safe: 128-bit integers don't currently have a known stable ABI --> $DIR/lint-ctypes.rs:52:25 | -LL | pub fn i128_type(p: i128); //~ ERROR uses type `i128` +LL | pub fn i128_type(p: i128); | ^^^^ error: `extern` block uses type `u128` which is not FFI-safe: 128-bit integers don't currently have a known stable ABI --> $DIR/lint-ctypes.rs:53:25 | -LL | pub fn u128_type(p: u128); //~ ERROR uses type `u128` +LL | pub fn u128_type(p: u128); | ^^^^ error: `extern` block uses type `dyn std::clone::Clone` which is not FFI-safe: trait objects have no C equivalent --> $DIR/lint-ctypes.rs:54:26 | -LL | pub fn trait_type(p: &Clone); //~ ERROR uses type `dyn std::clone::Clone` +LL | pub fn trait_type(p: &Clone); | ^^^^^^ error: `extern` block uses type `(i32, i32)` which is not FFI-safe: tuples have unspecified layout --> $DIR/lint-ctypes.rs:55:26 | -LL | pub fn tuple_type(p: (i32, i32)); //~ ERROR uses type `(i32, i32)` +LL | pub fn tuple_type(p: (i32, i32)); | ^^^^^^^^^^ | = help: consider using a struct instead @@ -90,7 +90,7 @@ LL | pub fn tuple_type(p: (i32, i32)); //~ ERROR uses type `(i32, i32)` error: `extern` block uses type `(i32, i32)` which is not FFI-safe: tuples have unspecified layout --> $DIR/lint-ctypes.rs:56:27 | -LL | pub fn tuple_type2(p: I32Pair); //~ ERROR uses type `(i32, i32)` +LL | pub fn tuple_type2(p: I32Pair); | ^^^^^^^ | = help: consider using a struct instead @@ -98,7 +98,7 @@ LL | pub fn tuple_type2(p: I32Pair); //~ ERROR uses type `(i32, i32)` error: `extern` block uses type `ZeroSize` which is not FFI-safe: this struct has no fields --> $DIR/lint-ctypes.rs:57:25 | -LL | pub fn zero_size(p: ZeroSize); //~ ERROR struct has no fields +LL | pub fn zero_size(p: ZeroSize); | ^^^^^^^^ | = help: consider adding a member to this struct @@ -111,19 +111,19 @@ LL | pub struct ZeroSize; error: `extern` block uses type `ZeroSizeWithPhantomData` which is not FFI-safe: composed only of PhantomData --> $DIR/lint-ctypes.rs:58:33 | -LL | pub fn zero_size_phantom(p: ZeroSizeWithPhantomData); //~ ERROR composed only of PhantomData +LL | pub fn zero_size_phantom(p: ZeroSizeWithPhantomData); | ^^^^^^^^^^^^^^^^^^^^^^^ error: `extern` block uses type `std::marker::PhantomData` which is not FFI-safe: composed only of PhantomData --> $DIR/lint-ctypes.rs:60:12 | -LL | -> ::std::marker::PhantomData; //~ ERROR: composed only of PhantomData +LL | -> ::std::marker::PhantomData; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `extern` block uses type `fn()` which is not FFI-safe: this function pointer has Rust-specific calling convention --> $DIR/lint-ctypes.rs:61:23 | -LL | pub fn fn_type(p: RustFn); //~ ERROR function pointer has Rust-specific +LL | pub fn fn_type(p: RustFn); | ^^^^^^ | = help: consider using an `extern fn(...) -> ...` function pointer instead @@ -131,7 +131,7 @@ LL | pub fn fn_type(p: RustFn); //~ ERROR function pointer has Rust-specific error: `extern` block uses type `fn()` which is not FFI-safe: this function pointer has Rust-specific calling convention --> $DIR/lint-ctypes.rs:62:24 | -LL | pub fn fn_type2(p: fn()); //~ ERROR function pointer has Rust-specific +LL | pub fn fn_type2(p: fn()); | ^^^^ | = help: consider using an `extern fn(...) -> ...` function pointer instead @@ -139,7 +139,7 @@ LL | pub fn fn_type2(p: fn()); //~ ERROR function pointer has Rust-specific error: `extern` block uses type `std::boxed::Box` which is not FFI-safe: this struct has unspecified layout --> $DIR/lint-ctypes.rs:63:28 | -LL | pub fn fn_contained(p: RustBadRet); //~ ERROR: uses type `std::boxed::Box` +LL | pub fn fn_contained(p: RustBadRet); | ^^^^^^^^^^ | = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct @@ -147,13 +147,13 @@ LL | pub fn fn_contained(p: RustBadRet); //~ ERROR: uses type `std::boxed::B error: `extern` block uses type `i128` which is not FFI-safe: 128-bit integers don't currently have a known stable ABI --> $DIR/lint-ctypes.rs:64:32 | -LL | pub fn transparent_i128(p: TransparentI128); //~ ERROR: uses type `i128` +LL | pub fn transparent_i128(p: TransparentI128); | ^^^^^^^^^^^^^^^ error: `extern` block uses type `str` which is not FFI-safe: string slices have no C equivalent --> $DIR/lint-ctypes.rs:65:31 | -LL | pub fn transparent_str(p: TransparentStr); //~ ERROR: uses type `str` +LL | pub fn transparent_str(p: TransparentStr); | ^^^^^^^^^^^^^^ | = help: consider using `*const u8` and a length instead @@ -161,7 +161,7 @@ LL | pub fn transparent_str(p: TransparentStr); //~ ERROR: uses type `str` error: `extern` block uses type `std::boxed::Box` which is not FFI-safe: this struct has unspecified layout --> $DIR/lint-ctypes.rs:66:30 | -LL | pub fn transparent_fn(p: TransparentBadFn); //~ ERROR: uses type `std::boxed::Box` +LL | pub fn transparent_fn(p: TransparentBadFn); | ^^^^^^^^^^^^^^^^ | = help: consider adding a #[repr(C)] or #[repr(transparent)] attribute to this struct diff --git a/src/test/ui/lint/lint-dead-code-1.stderr b/src/test/ui/lint/lint-dead-code-1.stderr index 6d0295002f1c..be96c697d994 100644 --- a/src/test/ui/lint/lint-dead-code-1.stderr +++ b/src/test/ui/lint/lint-dead-code-1.stderr @@ -1,7 +1,7 @@ error: struct is never constructed: `Bar` --> $DIR/lint-dead-code-1.rs:12:5 | -LL | pub struct Bar; //~ ERROR: struct is never constructed +LL | pub struct Bar; | ^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,55 +13,55 @@ LL | #![deny(dead_code)] error: static item is never used: `priv_static` --> $DIR/lint-dead-code-1.rs:20:1 | -LL | static priv_static: isize = 0; //~ ERROR: static item is never used +LL | static priv_static: isize = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: constant item is never used: `priv_const` --> $DIR/lint-dead-code-1.rs:27:1 | -LL | const priv_const: isize = 0; //~ ERROR: constant item is never used +LL | const priv_const: isize = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: struct is never constructed: `PrivStruct` --> $DIR/lint-dead-code-1.rs:35:1 | -LL | struct PrivStruct; //~ ERROR: struct is never constructed +LL | struct PrivStruct; | ^^^^^^^^^^^^^^^^^^ error: enum is never used: `priv_enum` --> $DIR/lint-dead-code-1.rs:64:1 | -LL | enum priv_enum { foo2, bar2 } //~ ERROR: enum is never used +LL | enum priv_enum { foo2, bar2 } | ^^^^^^^^^^^^^^ error: variant is never constructed: `bar3` --> $DIR/lint-dead-code-1.rs:67:5 | -LL | bar3 //~ ERROR variant is never constructed +LL | bar3 | ^^^^ error: function is never used: `priv_fn` --> $DIR/lint-dead-code-1.rs:88:1 | -LL | fn priv_fn() { //~ ERROR: function is never used +LL | fn priv_fn() { | ^^^^^^^^^^^^ error: function is never used: `foo` --> $DIR/lint-dead-code-1.rs:93:1 | -LL | fn foo() { //~ ERROR: function is never used +LL | fn foo() { | ^^^^^^^^ error: function is never used: `bar` --> $DIR/lint-dead-code-1.rs:98:1 | -LL | fn bar() { //~ ERROR: function is never used +LL | fn bar() { | ^^^^^^^^ error: function is never used: `baz` --> $DIR/lint-dead-code-1.rs:102:1 | -LL | fn baz() -> impl Copy { //~ ERROR: function is never used +LL | fn baz() -> impl Copy { | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 10 previous errors diff --git a/src/test/ui/lint/lint-dead-code-2.stderr b/src/test/ui/lint/lint-dead-code-2.stderr index d17149104dba..1226f9823ac5 100644 --- a/src/test/ui/lint/lint-dead-code-2.stderr +++ b/src/test/ui/lint/lint-dead-code-2.stderr @@ -1,7 +1,7 @@ error: function is never used: `dead_fn` --> $DIR/lint-dead-code-2.rs:22:1 | -LL | fn dead_fn() {} //~ ERROR: function is never used +LL | fn dead_fn() {} | ^^^^^^^^^^^^ | note: lint level defined here @@ -13,13 +13,13 @@ LL | #![deny(dead_code)] error: function is never used: `dead_fn2` --> $DIR/lint-dead-code-2.rs:25:1 | -LL | fn dead_fn2() {} //~ ERROR: function is never used +LL | fn dead_fn2() {} | ^^^^^^^^^^^^^ error: function is never used: `main` --> $DIR/lint-dead-code-2.rs:38:1 | -LL | fn main() { //~ ERROR: function is never used +LL | fn main() { | ^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/lint/lint-dead-code-3.stderr b/src/test/ui/lint/lint-dead-code-3.stderr index 72bcac22de8c..2408da0af89e 100644 --- a/src/test/ui/lint/lint-dead-code-3.stderr +++ b/src/test/ui/lint/lint-dead-code-3.stderr @@ -1,7 +1,7 @@ error: struct is never constructed: `Foo` --> $DIR/lint-dead-code-3.rs:13:1 | -LL | struct Foo; //~ ERROR: struct is never constructed +LL | struct Foo; | ^^^^^^^^^^^ | note: lint level defined here @@ -13,25 +13,25 @@ LL | #![deny(dead_code)] error: method is never used: `foo` --> $DIR/lint-dead-code-3.rs:15:5 | -LL | fn foo(&self) { //~ ERROR: method is never used +LL | fn foo(&self) { | ^^^^^^^^^^^^^ error: function is never used: `bar` --> $DIR/lint-dead-code-3.rs:20:1 | -LL | fn bar() { //~ ERROR: function is never used +LL | fn bar() { | ^^^^^^^^ error: enum is never used: `c_void` --> $DIR/lint-dead-code-3.rs:59:1 | -LL | enum c_void {} //~ ERROR: enum is never used +LL | enum c_void {} | ^^^^^^^^^^^ error: foreign function is never used: `free` --> $DIR/lint-dead-code-3.rs:61:5 | -LL | fn free(p: *const c_void); //~ ERROR: foreign function is never used +LL | fn free(p: *const c_void); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/lint/lint-dead-code-4.stderr b/src/test/ui/lint/lint-dead-code-4.stderr index 62de048d5e91..b7ceee99998d 100644 --- a/src/test/ui/lint/lint-dead-code-4.stderr +++ b/src/test/ui/lint/lint-dead-code-4.stderr @@ -1,7 +1,7 @@ error: field is never used: `b` --> $DIR/lint-dead-code-4.rs:7:5 | -LL | b: bool, //~ ERROR: field is never used +LL | b: bool, | ^^^^^^^ | note: lint level defined here @@ -13,13 +13,13 @@ LL | #![deny(dead_code)] error: variant is never constructed: `X` --> $DIR/lint-dead-code-4.rs:15:5 | -LL | X, //~ ERROR variant is never constructed +LL | X, | ^ error: variant is never constructed: `Y` --> $DIR/lint-dead-code-4.rs:16:5 | -LL | / Y { //~ ERROR variant is never constructed +LL | / Y { LL | | a: String, LL | | b: i32, LL | | c: i32, @@ -29,43 +29,43 @@ LL | | }, error: enum is never used: `ABC` --> $DIR/lint-dead-code-4.rs:24:1 | -LL | enum ABC { //~ ERROR enum is never used +LL | enum ABC { | ^^^^^^^^ error: variant is never constructed: `I` --> $DIR/lint-dead-code-4.rs:36:5 | -LL | I, //~ ERROR variant is never constructed +LL | I, | ^ error: field is never used: `b` --> $DIR/lint-dead-code-4.rs:39:9 | -LL | b: i32, //~ ERROR field is never used +LL | b: i32, | ^^^^^^ error: field is never used: `c` --> $DIR/lint-dead-code-4.rs:40:9 | -LL | c: i32, //~ ERROR field is never used +LL | c: i32, | ^^^^^^ error: variant is never constructed: `K` --> $DIR/lint-dead-code-4.rs:42:5 | -LL | K //~ ERROR variant is never constructed +LL | K | ^ error: field is never used: `x` --> $DIR/lint-dead-code-4.rs:61:5 | -LL | x: usize, //~ ERROR: field is never used +LL | x: usize, | ^^^^^^^^ error: field is never used: `c` --> $DIR/lint-dead-code-4.rs:63:5 | -LL | c: bool, //~ ERROR: field is never used +LL | c: bool, | ^^^^^^^ error: aborting due to 10 previous errors diff --git a/src/test/ui/lint/lint-dead-code-5.stderr b/src/test/ui/lint/lint-dead-code-5.stderr index e6c2354783a2..740cfde2c069 100644 --- a/src/test/ui/lint/lint-dead-code-5.stderr +++ b/src/test/ui/lint/lint-dead-code-5.stderr @@ -1,7 +1,7 @@ error: variant is never constructed: `Variant2` --> $DIR/lint-dead-code-5.rs:6:5 | -LL | Variant2 //~ ERROR: variant is never constructed +LL | Variant2 | ^^^^^^^^ | note: lint level defined here @@ -13,19 +13,19 @@ LL | #![deny(dead_code)] error: variant is never constructed: `Variant5` --> $DIR/lint-dead-code-5.rs:13:5 | -LL | Variant5 { _x: isize }, //~ ERROR: variant is never constructed: `Variant5` +LL | Variant5 { _x: isize }, | ^^^^^^^^^^^^^^^^^^^^^^ error: variant is never constructed: `Variant6` --> $DIR/lint-dead-code-5.rs:14:5 | -LL | Variant6(isize), //~ ERROR: variant is never constructed: `Variant6` +LL | Variant6(isize), | ^^^^^^^^^^^^^^^ error: enum is never used: `Enum3` --> $DIR/lint-dead-code-5.rs:18:1 | -LL | enum Enum3 { //~ ERROR: enum is never used +LL | enum Enum3 { | ^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/lint/lint-dead-code-impl-trait.rs b/src/test/ui/lint/lint-dead-code-impl-trait.rs new file mode 100644 index 000000000000..a2736d97308a --- /dev/null +++ b/src/test/ui/lint/lint-dead-code-impl-trait.rs @@ -0,0 +1,18 @@ +#![deny(dead_code)] + +trait Trait { + type Type; +} + +impl Trait for () { + type Type = (); +} + +type Used = (); +type Unused = (); //~ ERROR type alias is never used + +fn foo() -> impl Trait {} + +fn main() { + foo(); +} diff --git a/src/test/ui/lint/lint-dead-code-impl-trait.stderr b/src/test/ui/lint/lint-dead-code-impl-trait.stderr new file mode 100644 index 000000000000..61d0954bf314 --- /dev/null +++ b/src/test/ui/lint/lint-dead-code-impl-trait.stderr @@ -0,0 +1,14 @@ +error: type alias is never used: `Unused` + --> $DIR/lint-dead-code-impl-trait.rs:12:1 + | +LL | type Unused = (); + | ^^^^^^^^^^^^^^^^^ + | +note: lint level defined here + --> $DIR/lint-dead-code-impl-trait.rs:1:9 + | +LL | #![deny(dead_code)] + | ^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/lint/lint-dead-code-type-alias.stderr b/src/test/ui/lint/lint-dead-code-type-alias.stderr index a4d4727be7ca..4198ddfb6cb0 100644 --- a/src/test/ui/lint/lint-dead-code-type-alias.stderr +++ b/src/test/ui/lint/lint-dead-code-type-alias.stderr @@ -1,7 +1,7 @@ error: type alias is never used: `Unused` --> $DIR/lint-dead-code-type-alias.rs:4:1 | -LL | type Unused = u8; //~ ERROR type alias is never used +LL | type Unused = u8; | ^^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/lint/lint-dead-code-variant.stderr b/src/test/ui/lint/lint-dead-code-variant.stderr index b9465e73b0d7..a79432dc68d6 100644 --- a/src/test/ui/lint/lint-dead-code-variant.stderr +++ b/src/test/ui/lint/lint-dead-code-variant.stderr @@ -1,7 +1,7 @@ error: variant is never constructed: `Variant1` --> $DIR/lint-dead-code-variant.rs:5:5 | -LL | Variant1, //~ ERROR: variant is never constructed +LL | Variant1, | ^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/lint/lint-directives-on-use-items-issue-10534.stderr b/src/test/ui/lint/lint-directives-on-use-items-issue-10534.stderr index 170b98a12a84..020591ccff74 100644 --- a/src/test/ui/lint/lint-directives-on-use-items-issue-10534.stderr +++ b/src/test/ui/lint/lint-directives-on-use-items-issue-10534.stderr @@ -1,7 +1,7 @@ error: unused import: `a::x` --> $DIR/lint-directives-on-use-items-issue-10534.rs:12:9 | -LL | use a::x; //~ ERROR: unused import +LL | use a::x; | ^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unused_imports)] error: unused import: `a::y` --> $DIR/lint-directives-on-use-items-issue-10534.rs:21:9 | -LL | use a::y; //~ ERROR: unused import +LL | use a::y; | ^^^^ | note: lint level defined here diff --git a/src/test/ui/lint/lint-exceeding-bitshifts.stderr b/src/test/ui/lint/lint-exceeding-bitshifts.stderr index be739eb41bd3..f9f168c14dee 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts.stderr +++ b/src/test/ui/lint/lint-exceeding-bitshifts.stderr @@ -1,7 +1,7 @@ error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts.rs:7:15 | -LL | let n = 1u8 << 8; //~ ERROR: attempt to shift left with overflow +LL | let n = 1u8 << 8; | ^^^^^^^^ | note: lint level defined here @@ -13,103 +13,103 @@ LL | #![deny(exceeding_bitshifts, const_err)] error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts.rs:9:15 | -LL | let n = 1u16 << 16; //~ ERROR: attempt to shift left with overflow +LL | let n = 1u16 << 16; | ^^^^^^^^^^ error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts.rs:11:15 | -LL | let n = 1u32 << 32; //~ ERROR: attempt to shift left with overflow +LL | let n = 1u32 << 32; | ^^^^^^^^^^ error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts.rs:13:15 | -LL | let n = 1u64 << 64; //~ ERROR: attempt to shift left with overflow +LL | let n = 1u64 << 64; | ^^^^^^^^^^ error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts.rs:15:15 | -LL | let n = 1i8 << 8; //~ ERROR: attempt to shift left with overflow +LL | let n = 1i8 << 8; | ^^^^^^^^ error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts.rs:17:15 | -LL | let n = 1i16 << 16; //~ ERROR: attempt to shift left with overflow +LL | let n = 1i16 << 16; | ^^^^^^^^^^ error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts.rs:19:15 | -LL | let n = 1i32 << 32; //~ ERROR: attempt to shift left with overflow +LL | let n = 1i32 << 32; | ^^^^^^^^^^ error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts.rs:21:15 | -LL | let n = 1i64 << 64; //~ ERROR: attempt to shift left with overflow +LL | let n = 1i64 << 64; | ^^^^^^^^^^ error: attempt to shift right with overflow --> $DIR/lint-exceeding-bitshifts.rs:24:15 | -LL | let n = 1u8 >> 8; //~ ERROR: attempt to shift right with overflow +LL | let n = 1u8 >> 8; | ^^^^^^^^ error: attempt to shift right with overflow --> $DIR/lint-exceeding-bitshifts.rs:26:15 | -LL | let n = 1u16 >> 16; //~ ERROR: attempt to shift right with overflow +LL | let n = 1u16 >> 16; | ^^^^^^^^^^ error: attempt to shift right with overflow --> $DIR/lint-exceeding-bitshifts.rs:28:15 | -LL | let n = 1u32 >> 32; //~ ERROR: attempt to shift right with overflow +LL | let n = 1u32 >> 32; | ^^^^^^^^^^ error: attempt to shift right with overflow --> $DIR/lint-exceeding-bitshifts.rs:30:15 | -LL | let n = 1u64 >> 64; //~ ERROR: attempt to shift right with overflow +LL | let n = 1u64 >> 64; | ^^^^^^^^^^ error: attempt to shift right with overflow --> $DIR/lint-exceeding-bitshifts.rs:32:15 | -LL | let n = 1i8 >> 8; //~ ERROR: attempt to shift right with overflow +LL | let n = 1i8 >> 8; | ^^^^^^^^ error: attempt to shift right with overflow --> $DIR/lint-exceeding-bitshifts.rs:34:15 | -LL | let n = 1i16 >> 16; //~ ERROR: attempt to shift right with overflow +LL | let n = 1i16 >> 16; | ^^^^^^^^^^ error: attempt to shift right with overflow --> $DIR/lint-exceeding-bitshifts.rs:36:15 | -LL | let n = 1i32 >> 32; //~ ERROR: attempt to shift right with overflow +LL | let n = 1i32 >> 32; | ^^^^^^^^^^ error: attempt to shift right with overflow --> $DIR/lint-exceeding-bitshifts.rs:38:15 | -LL | let n = 1i64 >> 64; //~ ERROR: attempt to shift right with overflow +LL | let n = 1i64 >> 64; | ^^^^^^^^^^ error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts.rs:42:15 | -LL | let n = n << 8; //~ ERROR: attempt to shift left with overflow +LL | let n = n << 8; | ^^^^^^ error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts.rs:44:15 | -LL | let n = 1u8 << -8; //~ ERROR: attempt to shift left with overflow +LL | let n = 1u8 << -8; | ^^^^^^^^^ error: aborting due to 18 previous errors diff --git a/src/test/ui/lint/lint-exceeding-bitshifts2.stderr b/src/test/ui/lint/lint-exceeding-bitshifts2.stderr index 0adcde02acb7..8a6d2a89c706 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts2.stderr +++ b/src/test/ui/lint/lint-exceeding-bitshifts2.stderr @@ -1,7 +1,7 @@ error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts2.rs:7:15 | -LL | let n = 1u8 << (4+4); //~ ERROR: attempt to shift left with overflow +LL | let n = 1u8 << (4+4); | ^^^^^^^^^^^^ | note: lint level defined here @@ -13,13 +13,13 @@ LL | #![deny(exceeding_bitshifts, const_err)] error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts2.rs:15:15 | -LL | let n = 1_isize << BITS; //~ ERROR: attempt to shift left with overflow +LL | let n = 1_isize << BITS; | ^^^^^^^^^^^^^^^ error: attempt to shift left with overflow --> $DIR/lint-exceeding-bitshifts2.rs:16:15 | -LL | let n = 1_usize << BITS; //~ ERROR: attempt to shift left with overflow +LL | let n = 1_usize << BITS; | ^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/lint/lint-forbid-cmdline.stderr b/src/test/ui/lint/lint-forbid-cmdline.stderr index 35539f0e8777..bece4775abb9 100644 --- a/src/test/ui/lint/lint-forbid-cmdline.stderr +++ b/src/test/ui/lint/lint-forbid-cmdline.stderr @@ -1,7 +1,7 @@ error[E0453]: allow(deprecated) overruled by outer forbid(deprecated) --> $DIR/lint-forbid-cmdline.rs:3:9 | -LL | #[allow(deprecated)] //~ ERROR allow(deprecated) overruled by outer forbid(deprecated) +LL | #[allow(deprecated)] | ^^^^^^^^^^ overruled by previous forbid | = note: `forbid` lint level was set on command line diff --git a/src/test/ui/lint/lint-group-nonstandard-style.stderr b/src/test/ui/lint/lint-group-nonstandard-style.stderr index ab36cda57ec8..a365204f12ad 100644 --- a/src/test/ui/lint/lint-group-nonstandard-style.stderr +++ b/src/test/ui/lint/lint-group-nonstandard-style.stderr @@ -1,7 +1,7 @@ warning: type `snake_case` should have an upper camel case name --> $DIR/lint-group-nonstandard-style.rs:22:16 | -LL | struct snake_case; //~ WARN should have an upper camel +LL | struct snake_case; | ^^^^^^^^^^ help: convert the identifier to upper camel case: `SnakeCase` | note: lint level defined here @@ -14,7 +14,7 @@ LL | #![warn(nonstandard_style)] error: function `CamelCase` should have a snake case name --> $DIR/lint-group-nonstandard-style.rs:4:4 | -LL | fn CamelCase() {} //~ ERROR should have a snake +LL | fn CamelCase() {} | ^^^^^^^^^ help: convert the identifier to snake case: `camel_case` | note: lint level defined here @@ -27,7 +27,7 @@ LL | #![deny(nonstandard_style)] error: function `CamelCase` should have a snake case name --> $DIR/lint-group-nonstandard-style.rs:12:12 | -LL | fn CamelCase() {} //~ ERROR should have a snake +LL | fn CamelCase() {} | ^^^^^^^^^ help: convert the identifier to snake case: `camel_case` | note: lint level defined here @@ -40,7 +40,7 @@ LL | #[forbid(nonstandard_style)] error: static variable `bad` should have an upper case name --> $DIR/lint-group-nonstandard-style.rs:14:16 | -LL | static bad: isize = 1; //~ ERROR should have an upper +LL | static bad: isize = 1; | ^^^ help: convert the identifier to upper case: `BAD` | note: lint level defined here @@ -53,7 +53,7 @@ LL | #[forbid(nonstandard_style)] warning: function `CamelCase` should have a snake case name --> $DIR/lint-group-nonstandard-style.rs:20:12 | -LL | fn CamelCase() {} //~ WARN should have a snake +LL | fn CamelCase() {} | ^^^^^^^^^ help: convert the identifier to snake case: `camel_case` | note: lint level defined here diff --git a/src/test/ui/lint/lint-impl-fn.stderr b/src/test/ui/lint/lint-impl-fn.stderr index b0a3f6197843..2c9a264287c9 100644 --- a/src/test/ui/lint/lint-impl-fn.stderr +++ b/src/test/ui/lint/lint-impl-fn.stderr @@ -1,7 +1,7 @@ error: denote infinite loops with `loop { ... }` --> $DIR/lint-impl-fn.rs:10:21 | -LL | fn bar(&self) { while true {} } //~ ERROR: infinite loops +LL | fn bar(&self) { while true {} } | ^^^^^^^^^^ help: use `loop` | note: lint level defined here @@ -13,7 +13,7 @@ LL | #[deny(while_true)] error: denote infinite loops with `loop { ... }` --> $DIR/lint-impl-fn.rs:18:25 | -LL | fn foo(&self) { while true {} } //~ ERROR: infinite loops +LL | fn foo(&self) { while true {} } | ^^^^^^^^^^ help: use `loop` | note: lint level defined here @@ -25,7 +25,7 @@ LL | #[deny(while_true)] error: denote infinite loops with `loop { ... }` --> $DIR/lint-impl-fn.rs:27:5 | -LL | while true {} //~ ERROR: infinite loops +LL | while true {} | ^^^^^^^^^^ help: use `loop` | note: lint level defined here diff --git a/src/test/ui/lint/lint-malformed.stderr b/src/test/ui/lint/lint-malformed.stderr index 98a7cecc2bb2..f5b9e2b0a0f6 100644 --- a/src/test/ui/lint/lint-malformed.stderr +++ b/src/test/ui/lint/lint-malformed.stderr @@ -1,13 +1,13 @@ error[E0452]: malformed lint attribute --> $DIR/lint-malformed.rs:2:10 | -LL | #![allow(bar = "baz")] //~ ERROR malformed lint attribute +LL | #![allow(bar = "baz")] | ^^^^^^^^^^^ error: attribute must be of the form `#[deny(lint1, lint2, ..., /*opt*/ reason = "...")]` --> $DIR/lint-malformed.rs:1:1 | -LL | #![deny = "foo"] //~ ERROR attribute must be of the form +LL | #![deny = "foo"] | ^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/lint/lint-misplaced-attr.stderr b/src/test/ui/lint/lint-misplaced-attr.stderr index 2a28d54619c6..1419f858f8e7 100644 --- a/src/test/ui/lint/lint-misplaced-attr.stderr +++ b/src/test/ui/lint/lint-misplaced-attr.stderr @@ -1,7 +1,7 @@ error: unused attribute --> $DIR/lint-misplaced-attr.rs:7:5 | -LL | #![crate_type = "bin"] //~ ERROR unused attribute +LL | #![crate_type = "bin"] | ^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,19 +13,19 @@ LL | #![deny(unused_attributes)] error: crate-level attribute should be in the root module --> $DIR/lint-misplaced-attr.rs:7:5 | -LL | #![crate_type = "bin"] //~ ERROR unused attribute +LL | #![crate_type = "bin"] | ^^^^^^^^^^^^^^^^^^^^^^ error: unused attribute --> $DIR/lint-misplaced-attr.rs:11:1 | -LL | #[crate_type = "bin"] fn main() {} //~ ERROR unused attribute +LL | #[crate_type = "bin"] fn main() {} | ^^^^^^^^^^^^^^^^^^^^^ error: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] --> $DIR/lint-misplaced-attr.rs:11:1 | -LL | #[crate_type = "bin"] fn main() {} //~ ERROR unused attribute +LL | #[crate_type = "bin"] fn main() {} | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/lint/lint-missing-copy-implementations.stderr b/src/test/ui/lint/lint-missing-copy-implementations.stderr index 30da3ac879ea..7b6674e71bf1 100644 --- a/src/test/ui/lint/lint-missing-copy-implementations.stderr +++ b/src/test/ui/lint/lint-missing-copy-implementations.stderr @@ -1,7 +1,7 @@ error: type could implement `Copy`; consider adding `impl Copy` --> $DIR/lint-missing-copy-implementations.rs:6:5 | -LL | / pub struct Foo { //~ ERROR type could implement `Copy`; consider adding `impl Copy` +LL | / pub struct Foo { LL | | pub field: i32 LL | | } | |_____^ diff --git a/src/test/ui/lint/lint-missing-doc.stderr b/src/test/ui/lint/lint-missing-doc.stderr index ea5a14bca7cf..3532c9315d8d 100644 --- a/src/test/ui/lint/lint-missing-doc.stderr +++ b/src/test/ui/lint/lint-missing-doc.stderr @@ -1,7 +1,7 @@ error: missing documentation for a type alias --> $DIR/lint-missing-doc.rs:11:1 | -LL | pub type PubTypedef = String; //~ ERROR: missing documentation for a type alias +LL | pub type PubTypedef = String; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,109 +13,109 @@ LL | #![deny(missing_docs)] error: missing documentation for a struct --> $DIR/lint-missing-doc.rs:18:1 | -LL | pub struct PubFoo { //~ ERROR: missing documentation for a struct +LL | pub struct PubFoo { | ^^^^^^^^^^^^^^^^^ error: missing documentation for a struct field --> $DIR/lint-missing-doc.rs:19:5 | -LL | pub a: isize, //~ ERROR: missing documentation for a struct field +LL | pub a: isize, | ^^^^^^^^^^^^ error: missing documentation for a module --> $DIR/lint-missing-doc.rs:30:1 | -LL | pub mod pub_module_no_dox {} //~ ERROR: missing documentation for a module +LL | pub mod pub_module_no_dox {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function --> $DIR/lint-missing-doc.rs:34:1 | -LL | pub fn foo2() {} //~ ERROR: missing documentation for a function +LL | pub fn foo2() {} | ^^^^^^^^^^^^^ error: missing documentation for a trait --> $DIR/lint-missing-doc.rs:52:1 | -LL | pub trait C { //~ ERROR: missing documentation for a trait +LL | pub trait C { | ^^^^^^^^^^^ error: missing documentation for a trait method --> $DIR/lint-missing-doc.rs:53:5 | -LL | fn foo(&self); //~ ERROR: missing documentation for a trait method +LL | fn foo(&self); | ^^^^^^^^^^^^^^ error: missing documentation for a trait method --> $DIR/lint-missing-doc.rs:54:5 | -LL | fn foo_with_impl(&self) {} //~ ERROR: missing documentation for a trait method +LL | fn foo_with_impl(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for an associated type --> $DIR/lint-missing-doc.rs:64:5 | -LL | type AssociatedType; //~ ERROR: missing documentation for an associated type +LL | type AssociatedType; | ^^^^^^^^^^^^^^^^^^^^ error: missing documentation for an associated type --> $DIR/lint-missing-doc.rs:65:5 | -LL | type AssociatedTypeDef = Self; //~ ERROR: missing documentation for an associated type +LL | type AssociatedTypeDef = Self; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a method --> $DIR/lint-missing-doc.rs:81:5 | -LL | pub fn foo() {} //~ ERROR: missing documentation for a method +LL | pub fn foo() {} | ^^^^^^^^^^^^ error: missing documentation for an enum --> $DIR/lint-missing-doc.rs:118:1 | -LL | pub enum PubBaz { //~ ERROR: missing documentation for an enum +LL | pub enum PubBaz { | ^^^^^^^^^^^^^^^ error: missing documentation for a variant --> $DIR/lint-missing-doc.rs:119:5 | -LL | PubBazA { //~ ERROR: missing documentation for a variant +LL | PubBazA { | ^^^^^^^ error: missing documentation for a struct field --> $DIR/lint-missing-doc.rs:120:9 | -LL | a: isize, //~ ERROR: missing documentation for a struct field +LL | a: isize, | ^^^^^^^^ error: missing documentation for a constant --> $DIR/lint-missing-doc.rs:151:1 | -LL | pub const FOO4: u32 = 0; //~ ERROR: missing documentation for a const +LL | pub const FOO4: u32 = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a static --> $DIR/lint-missing-doc.rs:161:1 | -LL | pub static BAR4: u32 = 0; //~ ERROR: missing documentation for a static +LL | pub static BAR4: u32 = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function --> $DIR/lint-missing-doc.rs:167:5 | -LL | pub fn undocumented1() {} //~ ERROR: missing documentation for a function +LL | pub fn undocumented1() {} | ^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function --> $DIR/lint-missing-doc.rs:168:5 | -LL | pub fn undocumented2() {} //~ ERROR: missing documentation for a function +LL | pub fn undocumented2() {} | ^^^^^^^^^^^^^^^^^^^^^^ error: missing documentation for a function --> $DIR/lint-missing-doc.rs:174:9 | -LL | pub fn also_undocumented1() {} //~ ERROR: missing documentation for a function +LL | pub fn also_undocumented1() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 19 previous errors diff --git a/src/test/ui/lint/lint-non-camel-case-types.stderr b/src/test/ui/lint/lint-non-camel-case-types.stderr index 7afacf64d877..432a16debc69 100644 --- a/src/test/ui/lint/lint-non-camel-case-types.stderr +++ b/src/test/ui/lint/lint-non-camel-case-types.stderr @@ -13,43 +13,43 @@ LL | #![forbid(non_camel_case_types)] error: type `foo` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:7:8 | -LL | struct foo { //~ ERROR type `foo` should have an upper camel case name +LL | struct foo { | ^^^ help: convert the identifier to upper camel case: `Foo` error: type `foo2` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:11:6 | -LL | enum foo2 { //~ ERROR type `foo2` should have an upper camel case name +LL | enum foo2 { | ^^^^ help: convert the identifier to upper camel case: `Foo2` error: type `foo3` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:15:8 | -LL | struct foo3 { //~ ERROR type `foo3` should have an upper camel case name +LL | struct foo3 { | ^^^^ help: convert the identifier to upper camel case: `Foo3` error: type `foo4` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:19:6 | -LL | type foo4 = isize; //~ ERROR type `foo4` should have an upper camel case name +LL | type foo4 = isize; | ^^^^ help: convert the identifier to upper camel case: `Foo4` error: variant `bar` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:22:5 | -LL | bar //~ ERROR variant `bar` should have an upper camel case name +LL | bar | ^^^ help: convert the identifier to upper camel case: `Bar` error: trait `foo6` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:25:7 | -LL | trait foo6 { //~ ERROR trait `foo6` should have an upper camel case name +LL | trait foo6 { | ^^^^ help: convert the identifier to upper camel case: `Foo6` error: type parameter `ty` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:29:6 | -LL | fn f(_: ty) {} //~ ERROR type parameter `ty` should have an upper camel case name +LL | fn f(_: ty) {} | ^^ help: convert the identifier to upper camel case: `Ty` error: aborting due to 8 previous errors diff --git a/src/test/ui/lint/lint-non-snake-case-lifetimes.stderr b/src/test/ui/lint/lint-non-snake-case-lifetimes.stderr index 970666ebcfdc..d638626495ac 100644 --- a/src/test/ui/lint/lint-non-snake-case-lifetimes.stderr +++ b/src/test/ui/lint/lint-non-snake-case-lifetimes.stderr @@ -1,7 +1,7 @@ error: lifetime `'FooBar` should have a snake case name --> $DIR/lint-non-snake-case-lifetimes.rs:4:6 | -LL | fn f<'FooBar>( //~ ERROR lifetime `'FooBar` should have a snake case name +LL | fn f<'FooBar>( | ^^^^^^^ help: convert the identifier to snake case: `'foo_bar` | note: lint level defined here diff --git a/src/test/ui/lint/lint-non-snake-case-modules.stderr b/src/test/ui/lint/lint-non-snake-case-modules.stderr index 651132e49d91..847c43e1b04e 100644 --- a/src/test/ui/lint/lint-non-snake-case-modules.stderr +++ b/src/test/ui/lint/lint-non-snake-case-modules.stderr @@ -1,7 +1,7 @@ error: module `FooBar` should have a snake case name --> $DIR/lint-non-snake-case-modules.rs:4:5 | -LL | mod FooBar { //~ ERROR module `FooBar` should have a snake case name +LL | mod FooBar { | ^^^^^^ help: convert the identifier to snake case: `foo_bar` | note: lint level defined here diff --git a/src/test/ui/lint/lint-non-uppercase-statics.stderr b/src/test/ui/lint/lint-non-uppercase-statics.stderr index f5bba5f145de..8b477276efc9 100644 --- a/src/test/ui/lint/lint-non-uppercase-statics.stderr +++ b/src/test/ui/lint/lint-non-uppercase-statics.stderr @@ -1,7 +1,7 @@ error: static variable `foo` should have an upper case name --> $DIR/lint-non-uppercase-statics.rs:4:8 | -LL | static foo: isize = 1; //~ ERROR static variable `foo` should have an upper case name +LL | static foo: isize = 1; | ^^^ help: convert the identifier to upper case: `FOO` | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![forbid(non_upper_case_globals)] error: static variable `bar` should have an upper case name --> $DIR/lint-non-uppercase-statics.rs:6:12 | -LL | static mut bar: isize = 1; //~ ERROR static variable `bar` should have an upper case name +LL | static mut bar: isize = 1; | ^^^ help: convert the identifier to upper case: `BAR` error: aborting due to 2 previous errors diff --git a/src/test/ui/lint/lint-obsolete-attr.stderr b/src/test/ui/lint/lint-obsolete-attr.stderr index c71bde54acfb..c06bd26df2b9 100644 --- a/src/test/ui/lint/lint-obsolete-attr.stderr +++ b/src/test/ui/lint/lint-obsolete-attr.stderr @@ -1,7 +1,7 @@ error: unused attribute --> $DIR/lint-obsolete-attr.rs:8:1 | -LL | #[ab_isize="stdcall"] extern {} //~ ERROR unused attribute +LL | #[ab_isize="stdcall"] extern {} | ^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unused_attributes)] error: unused attribute --> $DIR/lint-obsolete-attr.rs:10:1 | -LL | #[fixed_stack_segment] fn f() {} //~ ERROR unused attribute +LL | #[fixed_stack_segment] fn f() {} | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/lint/lint-output-format.stderr b/src/test/ui/lint/lint-output-format.stderr index 4dcd8c231643..21b12301e2c7 100644 --- a/src/test/ui/lint/lint-output-format.stderr +++ b/src/test/ui/lint/lint-output-format.stderr @@ -1,7 +1,7 @@ error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-output-format.rs:6:1 | -LL | extern crate lint_output_format; //~ ERROR use of unstable library feature +LL | extern crate lint_output_format; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | extern crate lint_output_format; //~ ERROR use of unstable library feature error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-output-format.rs:7:31 | -LL | use lint_output_format::{foo, bar}; //~ ERROR use of unstable library feature +LL | use lint_output_format::{foo, bar}; | ^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | use lint_output_format::{foo, bar}; //~ ERROR use of unstable library featu error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-output-format.rs:11:14 | -LL | let _y = bar(); //~ ERROR use of unstable library feature +LL | let _y = bar(); | ^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable diff --git a/src/test/ui/lint/lint-owned-heap-memory.stderr b/src/test/ui/lint/lint-owned-heap-memory.stderr index 572b82b3366b..c61b3d31558c 100644 --- a/src/test/ui/lint/lint-owned-heap-memory.stderr +++ b/src/test/ui/lint/lint-owned-heap-memory.stderr @@ -1,7 +1,7 @@ error: type uses owned (Box type) pointers: std::boxed::Box --> $DIR/lint-owned-heap-memory.rs:6:5 | -LL | x: Box //~ ERROR type uses owned +LL | x: Box | ^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/lint/lint-qualification.stderr b/src/test/ui/lint/lint-qualification.stderr index 953ff0f5f652..78f7e32a30cd 100644 --- a/src/test/ui/lint/lint-qualification.stderr +++ b/src/test/ui/lint/lint-qualification.stderr @@ -1,7 +1,7 @@ error: unnecessary qualification --> $DIR/lint-qualification.rs:9:5 | -LL | foo::bar(); //~ ERROR: unnecessary qualification +LL | foo::bar(); | ^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/lint/lint-removed-allow.stderr b/src/test/ui/lint/lint-removed-allow.stderr index f796a14d6379..32af7389b6c7 100644 --- a/src/test/ui/lint/lint-removed-allow.stderr +++ b/src/test/ui/lint/lint-removed-allow.stderr @@ -1,7 +1,7 @@ error: unused variable: `unused` --> $DIR/lint-removed-allow.rs:8:17 | -LL | fn main() { let unused = (); } //~ ERROR unused +LL | fn main() { let unused = (); } | ^^^^^^ help: consider prefixing with an underscore: `_unused` | note: lint level defined here diff --git a/src/test/ui/lint/lint-removed.stderr b/src/test/ui/lint/lint-removed.stderr index 55f010348fe1..cde494f22f09 100644 --- a/src/test/ui/lint/lint-removed.stderr +++ b/src/test/ui/lint/lint-removed.stderr @@ -1,7 +1,7 @@ warning: lint `raw_pointer_derive` has been removed: `using derive with raw pointers is ok` --> $DIR/lint-removed.rs:6:8 | -LL | #[deny(raw_pointer_derive)] //~ WARN `raw_pointer_derive` has been removed +LL | #[deny(raw_pointer_derive)] | ^^^^^^^^^^^^^^^^^^ | = note: #[warn(renamed_and_removed_lints)] on by default @@ -9,7 +9,7 @@ LL | #[deny(raw_pointer_derive)] //~ WARN `raw_pointer_derive` has been removed error: unused variable: `unused` --> $DIR/lint-removed.rs:8:17 | -LL | fn main() { let unused = (); } //~ ERROR unused +LL | fn main() { let unused = (); } | ^^^^^^ help: consider prefixing with an underscore: `_unused` | note: lint level defined here diff --git a/src/test/ui/lint/lint-renamed-allow.stderr b/src/test/ui/lint/lint-renamed-allow.stderr index b2eeeae8f8e6..383a800b54a8 100644 --- a/src/test/ui/lint/lint-renamed-allow.stderr +++ b/src/test/ui/lint/lint-renamed-allow.stderr @@ -1,7 +1,7 @@ error: unused variable: `unused` --> $DIR/lint-renamed-allow.rs:8:17 | -LL | fn main() { let unused = (); } //~ ERROR unused +LL | fn main() { let unused = (); } | ^^^^^^ help: consider prefixing with an underscore: `_unused` | note: lint level defined here diff --git a/src/test/ui/lint/lint-renamed.stderr b/src/test/ui/lint/lint-renamed.stderr index b140a93ab38b..2174b22ffb9d 100644 --- a/src/test/ui/lint/lint-renamed.stderr +++ b/src/test/ui/lint/lint-renamed.stderr @@ -9,7 +9,7 @@ LL | #[deny(bare_trait_object)] error: unused variable: `unused` --> $DIR/lint-renamed.rs:4:17 | -LL | fn main() { let unused = (); } //~ ERROR unused +LL | fn main() { let unused = (); } | ^^^^^^ help: consider prefixing with an underscore: `_unused` | note: lint level defined here diff --git a/src/test/ui/lint/lint-shorthand-field.stderr b/src/test/ui/lint/lint-shorthand-field.stderr index 32c69fdddcbf..366ab55d7d4d 100644 --- a/src/test/ui/lint/lint-shorthand-field.stderr +++ b/src/test/ui/lint/lint-shorthand-field.stderr @@ -1,7 +1,7 @@ error: the `x:` in this pattern is redundant --> $DIR/lint-shorthand-field.rs:12:13 | -LL | x: x, //~ ERROR the `x:` in this pattern is redundant +LL | x: x, | --^^ | | | help: remove this @@ -15,7 +15,7 @@ LL | #![deny(non_shorthand_field_patterns)] error: the `y:` in this pattern is redundant --> $DIR/lint-shorthand-field.rs:13:13 | -LL | y: ref y, //~ ERROR the `y:` in this pattern is redundant +LL | y: ref y, | --^^^^^^ | | | help: remove this diff --git a/src/test/ui/lint/lint-stability-2.stderr b/src/test/ui/lint/lint-stability-2.stderr index 4142ce5af793..808c16c95a49 100644 --- a/src/test/ui/lint/lint-stability-2.stderr +++ b/src/test/ui/lint/lint-stability-2.stderr @@ -81,7 +81,7 @@ LL | ::trait_deprecated_unstable_text(&foo); error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-2.rs:62:13 | -LL | foo.method_unstable(); //~ ERROR use of unstable library feature +LL | foo.method_unstable(); | ^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -89,7 +89,7 @@ LL | foo.method_unstable(); //~ ERROR use of unstable library feature error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-2.rs:63:9 | -LL | Foo::method_unstable(&foo); //~ ERROR use of unstable library feature +LL | Foo::method_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -97,7 +97,7 @@ LL | Foo::method_unstable(&foo); //~ ERROR use of unstable library featu error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-2.rs:64:9 | -LL | ::method_unstable(&foo); //~ ERROR use of unstable library feature +LL | ::method_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -105,7 +105,7 @@ LL | ::method_unstable(&foo); //~ ERROR use of unstable library fea error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-2.rs:65:13 | -LL | foo.trait_unstable(); //~ ERROR use of unstable library feature +LL | foo.trait_unstable(); | ^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -113,7 +113,7 @@ LL | foo.trait_unstable(); //~ ERROR use of unstable library feature error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-2.rs:66:9 | -LL | ::trait_unstable(&foo); //~ ERROR use of unstable library feature +LL | ::trait_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -193,7 +193,7 @@ LL | ::trait_deprecated_unstable_text(&foo); error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-2.rs:139:13 | -LL | foo.trait_unstable(); //~ ERROR use of unstable library feature +LL | foo.trait_unstable(); | ^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -201,7 +201,7 @@ LL | foo.trait_unstable(); //~ ERROR use of unstable library feature error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-2.rs:140:9 | -LL | ::trait_unstable(&foo); //~ ERROR use of unstable library feature +LL | ::trait_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -241,7 +241,7 @@ LL | foo.trait_deprecated_unstable_text(); error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-2.rs:158:13 | -LL | foo.trait_unstable(); //~ ERROR use of unstable library feature +LL | foo.trait_unstable(); | ^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable diff --git a/src/test/ui/lint/lint-stability-deprecated.stderr b/src/test/ui/lint/lint-stability-deprecated.stderr index a1748ac59fb4..811004ee12cc 100644 --- a/src/test/ui/lint/lint-stability-deprecated.stderr +++ b/src/test/ui/lint/lint-stability-deprecated.stderr @@ -1,7 +1,7 @@ warning: use of deprecated item 'lint_stability::deprecated': text --> $DIR/lint-stability-deprecated.rs:26:9 | -LL | deprecated(); //~ WARN use of deprecated item 'lint_stability::deprecated' +LL | deprecated(); | ^^^^^^^^^^ | note: lint level defined here @@ -13,73 +13,73 @@ LL | #![warn(deprecated)] warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:31:9 | -LL | Trait::trait_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' +LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:33:9 | -LL | ::trait_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::deprecated_text': text --> $DIR/lint-stability-deprecated.rs:35:9 | -LL | deprecated_text(); //~ WARN use of deprecated item 'lint_stability::deprecated_text': text +LL | deprecated_text(); | ^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:40:9 | -LL | Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text +LL | Trait::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:42:9 | -LL | ::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:44:9 | -LL | deprecated_unstable(); //~ WARN use of deprecated item 'lint_stability::deprecated_unstable' +LL | deprecated_unstable(); | ^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:49:9 | -LL | Trait::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' +LL | Trait::trait_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:51:9 | -LL | ::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' +LL | ::trait_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:53:9 | -LL | deprecated_unstable_text(); //~ WARN use of deprecated item 'lint_stability::deprecated_unstable_text': text +LL | deprecated_unstable_text(); | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:58:9 | -LL | Trait::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text +LL | Trait::trait_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:60:9 | -LL | ::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text +LL | ::trait_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedStruct': text --> $DIR/lint-stability-deprecated.rs:107:17 | -LL | let _ = DeprecatedStruct { //~ WARN use of deprecated item 'lint_stability::DeprecatedStruct' +LL | let _ = DeprecatedStruct { | ^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedUnstableStruct': text @@ -91,157 +91,157 @@ LL | let _ = DeprecatedUnstableStruct { warning: use of deprecated item 'lint_stability::DeprecatedUnitStruct': text --> $DIR/lint-stability-deprecated.rs:117:17 | -LL | let _ = DeprecatedUnitStruct; //~ WARN use of deprecated item 'lint_stability::DeprecatedUnitStruct' +LL | let _ = DeprecatedUnitStruct; | ^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedUnstableUnitStruct': text --> $DIR/lint-stability-deprecated.rs:118:17 | -LL | let _ = DeprecatedUnstableUnitStruct; //~ WARN use of deprecated item 'lint_stability::DeprecatedUnstableUnitStruct' +LL | let _ = DeprecatedUnstableUnitStruct; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Enum::DeprecatedVariant': text --> $DIR/lint-stability-deprecated.rs:122:17 | -LL | let _ = Enum::DeprecatedVariant; //~ WARN use of deprecated item 'lint_stability::Enum::DeprecatedVariant' +LL | let _ = Enum::DeprecatedVariant; | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Enum::DeprecatedUnstableVariant': text --> $DIR/lint-stability-deprecated.rs:123:17 | -LL | let _ = Enum::DeprecatedUnstableVariant; //~ WARN use of deprecated item 'lint_stability::Enum::DeprecatedUnstableVariant' +LL | let _ = Enum::DeprecatedUnstableVariant; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedTupleStruct': text --> $DIR/lint-stability-deprecated.rs:127:17 | -LL | let _ = DeprecatedTupleStruct (1); //~ WARN use of deprecated item 'lint_stability::DeprecatedTupleStruct' +LL | let _ = DeprecatedTupleStruct (1); | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedUnstableTupleStruct': text --> $DIR/lint-stability-deprecated.rs:128:17 | -LL | let _ = DeprecatedUnstableTupleStruct (1); //~ WARN use of deprecated item 'lint_stability::DeprecatedUnstableTupleStruct' +LL | let _ = DeprecatedUnstableTupleStruct (1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::deprecated_text': text --> $DIR/lint-stability-deprecated.rs:137:25 | -LL | macro_test_arg!(deprecated_text()); //~ WARN use of deprecated item 'lint_stability::deprecated_text': text +LL | macro_test_arg!(deprecated_text()); | ^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:138:25 | -LL | macro_test_arg!(deprecated_unstable_text()); //~ WARN use of deprecated item 'lint_stability::deprecated_unstable_text': text +LL | macro_test_arg!(deprecated_unstable_text()); | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::deprecated_text': text --> $DIR/lint-stability-deprecated.rs:139:41 | -LL | macro_test_arg!(macro_test_arg!(deprecated_text())); //~ WARN use of deprecated item 'lint_stability::deprecated_text': text +LL | macro_test_arg!(macro_test_arg!(deprecated_text())); | ^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:144:9 | -LL | Trait::trait_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' +LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:146:9 | -LL | ::trait_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:148:9 | -LL | Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text +LL | Trait::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:150:9 | -LL | ::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:152:9 | -LL | Trait::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' +LL | Trait::trait_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:154:9 | -LL | ::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' +LL | ::trait_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:156:9 | -LL | Trait::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text +LL | Trait::trait_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:158:9 | -LL | ::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text +LL | ::trait_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedTrait': text --> $DIR/lint-stability-deprecated.rs:186:10 | -LL | impl DeprecatedTrait for S {} //~ WARN use of deprecated item 'lint_stability::DeprecatedTrait': text +LL | impl DeprecatedTrait for S {} | ^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedTrait': text --> $DIR/lint-stability-deprecated.rs:188:25 | -LL | trait LocalTrait2 : DeprecatedTrait { } //~ WARN use of deprecated item 'lint_stability::DeprecatedTrait': text +LL | trait LocalTrait2 : DeprecatedTrait { } | ^^^^^^^^^^^^^^^ warning: use of deprecated item 'inheritance::inherited_stability::unstable_mod::deprecated': text --> $DIR/lint-stability-deprecated.rs:207:9 | -LL | unstable_mod::deprecated(); //~ WARN use of deprecated item 'inheritance::inherited_stability::unstable_mod::deprecated': text +LL | unstable_mod::deprecated(); | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::deprecated': text --> $DIR/lint-stability-deprecated.rs:329:9 | -LL | deprecated(); //~ WARN use of deprecated item 'this_crate::deprecated' +LL | deprecated(); | ^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:334:9 | -LL | Trait::trait_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:336:9 | -LL | ::trait_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::deprecated_text': text --> $DIR/lint-stability-deprecated.rs:338:9 | -LL | deprecated_text(); //~ WARN use of deprecated item 'this_crate::deprecated_text': text +LL | deprecated_text(); | ^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:343:9 | -LL | Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | Trait::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:345:9 | -LL | ::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::DeprecatedStruct': text @@ -253,67 +253,67 @@ LL | let _ = DeprecatedStruct { warning: use of deprecated item 'this_crate::DeprecatedUnitStruct': text --> $DIR/lint-stability-deprecated.rs:390:17 | -LL | let _ = DeprecatedUnitStruct; //~ WARN use of deprecated item 'this_crate::DeprecatedUnitStruct' +LL | let _ = DeprecatedUnitStruct; | ^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Enum::DeprecatedVariant': text --> $DIR/lint-stability-deprecated.rs:394:17 | -LL | let _ = Enum::DeprecatedVariant; //~ WARN use of deprecated item 'this_crate::Enum::DeprecatedVariant' +LL | let _ = Enum::DeprecatedVariant; | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::DeprecatedTupleStruct': text --> $DIR/lint-stability-deprecated.rs:398:17 | -LL | let _ = DeprecatedTupleStruct (1); //~ WARN use of deprecated item 'this_crate::DeprecatedTupleStruct' +LL | let _ = DeprecatedTupleStruct (1); | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:405:9 | -LL | Trait::trait_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:407:9 | -LL | ::trait_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:409:9 | -LL | Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | Trait::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:411:9 | -LL | ::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::test_fn_body::fn_in_body': text --> $DIR/lint-stability-deprecated.rs:438:9 | -LL | fn_in_body(); //~ WARN use of deprecated item 'this_crate::test_fn_body::fn_in_body': text +LL | fn_in_body(); | ^^^^^^^^^^ warning: use of deprecated item 'this_crate::DeprecatedTrait': text --> $DIR/lint-stability-deprecated.rs:458:10 | -LL | impl DeprecatedTrait for S { } //~ WARN use of deprecated item 'this_crate::DeprecatedTrait' +LL | impl DeprecatedTrait for S { } | ^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::DeprecatedTrait': text --> $DIR/lint-stability-deprecated.rs:460:24 | -LL | trait LocalTrait : DeprecatedTrait { } //~ WARN use of deprecated item 'this_crate::DeprecatedTrait' +LL | trait LocalTrait : DeprecatedTrait { } | ^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::MethodTester::test_method_body::fn_in_body': text --> $DIR/lint-stability-deprecated.rs:446:13 | -LL | fn_in_body(); //~ WARN use of deprecated item 'this_crate::MethodTester::test_method_body::fn_in_body': text +LL | fn_in_body(); | ^^^^^^^^^^ warning: use of deprecated item 'lint_stability::TraitWithAssociatedTypes::TypeDeprecated': text @@ -331,306 +331,306 @@ LL | TypeDeprecated = u16, warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated': text --> $DIR/lint-stability-deprecated.rs:27:13 | -LL | foo.method_deprecated(); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated' +LL | foo.method_deprecated(); | ^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated': text --> $DIR/lint-stability-deprecated.rs:28:9 | -LL | Foo::method_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated' +LL | Foo::method_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated': text --> $DIR/lint-stability-deprecated.rs:29:9 | -LL | ::method_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated' +LL | ::method_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:30:13 | -LL | foo.trait_deprecated(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' +LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:32:9 | -LL | ::trait_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:36:13 | -LL | foo.method_deprecated_text(); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_text': text +LL | foo.method_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:37:9 | -LL | Foo::method_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_text': text +LL | Foo::method_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:38:9 | -LL | ::method_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_text': text +LL | ::method_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:39:13 | -LL | foo.trait_deprecated_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text +LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:41:9 | -LL | ::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:45:13 | -LL | foo.method_deprecated_unstable(); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable' +LL | foo.method_deprecated_unstable(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:46:9 | -LL | Foo::method_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable' +LL | Foo::method_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:47:9 | -LL | ::method_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable' +LL | ::method_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:48:13 | -LL | foo.trait_deprecated_unstable(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' +LL | foo.trait_deprecated_unstable(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:50:9 | -LL | ::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' +LL | ::trait_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:54:13 | -LL | foo.method_deprecated_unstable_text(); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable_text': text +LL | foo.method_deprecated_unstable_text(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:55:9 | -LL | Foo::method_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable_text': text +LL | Foo::method_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:56:9 | -LL | ::method_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable_text': text +LL | ::method_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:57:13 | -LL | foo.trait_deprecated_unstable_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text +LL | foo.trait_deprecated_unstable_text(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:59:9 | -LL | ::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text +LL | ::trait_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::DeprecatedStruct::i': text --> $DIR/lint-stability-deprecated.rs:108:13 | -LL | i: 0 //~ WARN use of deprecated item 'lint_stability::DeprecatedStruct::i' +LL | i: 0 | ^^^^ warning: use of deprecated item 'lint_stability::DeprecatedUnstableStruct::i': text --> $DIR/lint-stability-deprecated.rs:112:13 | -LL | i: 0 //~ WARN use of deprecated item 'lint_stability::DeprecatedUnstableStruct::i' +LL | i: 0 | ^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:143:13 | -LL | foo.trait_deprecated(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' +LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:145:9 | -LL | ::trait_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:147:13 | -LL | foo.trait_deprecated_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text +LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:149:9 | -LL | ::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:151:13 | -LL | foo.trait_deprecated_unstable(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' +LL | foo.trait_deprecated_unstable(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:153:9 | -LL | ::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' +LL | ::trait_deprecated_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:155:13 | -LL | foo.trait_deprecated_unstable_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text +LL | foo.trait_deprecated_unstable_text(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:157:9 | -LL | ::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text +LL | ::trait_deprecated_unstable_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:174:13 | -LL | foo.trait_deprecated(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated' +LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:175:13 | -LL | foo.trait_deprecated_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text +LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text --> $DIR/lint-stability-deprecated.rs:176:13 | -LL | foo.trait_deprecated_unstable(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable' +LL | foo.trait_deprecated_unstable(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text --> $DIR/lint-stability-deprecated.rs:177:13 | -LL | foo.trait_deprecated_unstable_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text +LL | foo.trait_deprecated_unstable_text(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::MethodTester::method_deprecated': text --> $DIR/lint-stability-deprecated.rs:330:13 | -LL | foo.method_deprecated(); //~ WARN use of deprecated item 'this_crate::MethodTester::method_deprecated' +LL | foo.method_deprecated(); | ^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::MethodTester::method_deprecated': text --> $DIR/lint-stability-deprecated.rs:331:9 | -LL | Foo::method_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::MethodTester::method_deprecated' +LL | Foo::method_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::MethodTester::method_deprecated': text --> $DIR/lint-stability-deprecated.rs:332:9 | -LL | ::method_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::MethodTester::method_deprecated' +LL | ::method_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:333:13 | -LL | foo.trait_deprecated(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:335:9 | -LL | ::trait_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:339:13 | -LL | foo.method_deprecated_text(); //~ WARN use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text +LL | foo.method_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:340:9 | -LL | Foo::method_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text +LL | Foo::method_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:341:9 | -LL | ::method_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text +LL | ::method_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:342:13 | -LL | foo.trait_deprecated_text(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:344:9 | -LL | ::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::DeprecatedStruct::i': text --> $DIR/lint-stability-deprecated.rs:385:13 | -LL | i: 0 //~ WARN use of deprecated item 'this_crate::DeprecatedStruct::i' +LL | i: 0 | ^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:404:13 | -LL | foo.trait_deprecated(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:406:9 | -LL | ::trait_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | ::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:408:13 | -LL | foo.trait_deprecated_text(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:410:9 | -LL | ::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | ::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text --> $DIR/lint-stability-deprecated.rs:427:13 | -LL | foo.trait_deprecated(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated' +LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text --> $DIR/lint-stability-deprecated.rs:428:13 | -LL | foo.trait_deprecated_text(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text +LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-stability-fields.stderr b/src/test/ui/lint/lint-stability-fields.stderr index 93f8075b2b27..e80e745922de 100644 --- a/src/test/ui/lint/lint-stability-fields.stderr +++ b/src/test/ui/lint/lint-stability-fields.stderr @@ -1,7 +1,7 @@ error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:51:17 | -LL | let x = Unstable { //~ ERROR use of unstable +LL | let x = Unstable { | ^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | let x = Unstable { //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:61:13 | -LL | let Unstable { //~ ERROR use of unstable +LL | let Unstable { | ^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | let Unstable { //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:67:13 | -LL | let Unstable //~ ERROR use of unstable +LL | let Unstable | ^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | let Unstable //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:72:17 | -LL | let x = reexport::Unstable2(1, 2, 3); //~ ERROR use of unstable +LL | let x = reexport::Unstable2(1, 2, 3); | ^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -33,7 +33,7 @@ LL | let x = reexport::Unstable2(1, 2, 3); //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:74:17 | -LL | let x = Unstable2(1, 2, 3); //~ ERROR use of unstable +LL | let x = Unstable2(1, 2, 3); | ^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -41,7 +41,7 @@ LL | let x = Unstable2(1, 2, 3); //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:80:13 | -LL | let Unstable2 //~ ERROR use of unstable +LL | let Unstable2 | ^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -49,7 +49,7 @@ LL | let Unstable2 //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:85:13 | -LL | let Unstable2 //~ ERROR use of unstable +LL | let Unstable2 | ^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -57,7 +57,7 @@ LL | let Unstable2 //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:90:17 | -LL | let x = Deprecated { //~ ERROR use of unstable +LL | let x = Deprecated { | ^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -65,7 +65,7 @@ LL | let x = Deprecated { //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:100:13 | -LL | let Deprecated { //~ ERROR use of unstable +LL | let Deprecated { | ^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -73,7 +73,7 @@ LL | let Deprecated { //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:106:13 | -LL | let Deprecated //~ ERROR use of unstable +LL | let Deprecated | ^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -81,7 +81,7 @@ LL | let Deprecated //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:110:17 | -LL | let x = Deprecated2(1, 2, 3); //~ ERROR use of unstable +LL | let x = Deprecated2(1, 2, 3); | ^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -89,7 +89,7 @@ LL | let x = Deprecated2(1, 2, 3); //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:116:13 | -LL | let Deprecated2 //~ ERROR use of unstable +LL | let Deprecated2 | ^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -97,7 +97,7 @@ LL | let Deprecated2 //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:121:13 | -LL | let Deprecated2 //~ ERROR use of unstable +LL | let Deprecated2 | ^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -105,7 +105,7 @@ LL | let Deprecated2 //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:21:13 | -LL | override1: 2, //~ ERROR use of unstable +LL | override1: 2, | ^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -113,7 +113,7 @@ LL | override1: 2, //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:22:13 | -LL | override2: 3, //~ ERROR use of unstable +LL | override2: 3, | ^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -121,7 +121,7 @@ LL | override2: 3, //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:26:17 | -LL | let _ = x.override1; //~ ERROR use of unstable +LL | let _ = x.override1; | ^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -129,7 +129,7 @@ LL | let _ = x.override1; //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:27:17 | -LL | let _ = x.override2; //~ ERROR use of unstable +LL | let _ = x.override2; | ^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -137,7 +137,7 @@ LL | let _ = x.override2; //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:31:13 | -LL | override1: _, //~ ERROR use of unstable +LL | override1: _, | ^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -145,7 +145,7 @@ LL | override1: _, //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:32:13 | -LL | override2: _ //~ ERROR use of unstable +LL | override2: _ | ^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -153,7 +153,7 @@ LL | override2: _ //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:40:17 | -LL | let _ = x.1; //~ ERROR use of unstable +LL | let _ = x.1; | ^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -161,7 +161,7 @@ LL | let _ = x.1; //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:41:17 | -LL | let _ = x.2; //~ ERROR use of unstable +LL | let _ = x.2; | ^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -169,7 +169,7 @@ LL | let _ = x.2; //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:44:20 | -LL | _, //~ ERROR use of unstable +LL | _, | ^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -177,7 +177,7 @@ LL | _, //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:45:20 | -LL | _) //~ ERROR use of unstable +LL | _) | ^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -185,7 +185,7 @@ LL | _) //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:52:13 | -LL | inherit: 1, //~ ERROR use of unstable +LL | inherit: 1, | ^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -193,7 +193,7 @@ LL | inherit: 1, //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:54:13 | -LL | override2: 3, //~ ERROR use of unstable +LL | override2: 3, | ^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -201,7 +201,7 @@ LL | override2: 3, //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:57:17 | -LL | let _ = x.inherit; //~ ERROR use of unstable +LL | let _ = x.inherit; | ^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -209,7 +209,7 @@ LL | let _ = x.inherit; //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:59:17 | -LL | let _ = x.override2; //~ ERROR use of unstable +LL | let _ = x.override2; | ^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -217,7 +217,7 @@ LL | let _ = x.override2; //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:62:13 | -LL | inherit: _, //~ ERROR use of unstable +LL | inherit: _, | ^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -225,7 +225,7 @@ LL | inherit: _, //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:64:13 | -LL | override2: _ //~ ERROR use of unstable +LL | override2: _ | ^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -233,7 +233,7 @@ LL | override2: _ //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:76:17 | -LL | let _ = x.0; //~ ERROR use of unstable +LL | let _ = x.0; | ^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -241,7 +241,7 @@ LL | let _ = x.0; //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:78:17 | -LL | let _ = x.2; //~ ERROR use of unstable +LL | let _ = x.2; | ^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -249,7 +249,7 @@ LL | let _ = x.2; //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:81:14 | -LL | (_, //~ ERROR use of unstable +LL | (_, | ^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -257,7 +257,7 @@ LL | (_, //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:83:14 | -LL | _) //~ ERROR use of unstable +LL | _) | ^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -265,7 +265,7 @@ LL | _) //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:91:13 | -LL | inherit: 1, //~ ERROR use of unstable +LL | inherit: 1, | ^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -273,7 +273,7 @@ LL | inherit: 1, //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:93:13 | -LL | override2: 3, //~ ERROR use of unstable +LL | override2: 3, | ^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -281,7 +281,7 @@ LL | override2: 3, //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:96:17 | -LL | let _ = x.inherit; //~ ERROR use of unstable +LL | let _ = x.inherit; | ^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -289,7 +289,7 @@ LL | let _ = x.inherit; //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:98:17 | -LL | let _ = x.override2; //~ ERROR use of unstable +LL | let _ = x.override2; | ^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -297,7 +297,7 @@ LL | let _ = x.override2; //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:101:13 | -LL | inherit: _, //~ ERROR use of unstable +LL | inherit: _, | ^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -305,7 +305,7 @@ LL | inherit: _, //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:103:13 | -LL | override2: _ //~ ERROR use of unstable +LL | override2: _ | ^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -313,7 +313,7 @@ LL | override2: _ //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:112:17 | -LL | let _ = x.0; //~ ERROR use of unstable +LL | let _ = x.0; | ^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -321,7 +321,7 @@ LL | let _ = x.0; //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:114:17 | -LL | let _ = x.2; //~ ERROR use of unstable +LL | let _ = x.2; | ^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -329,7 +329,7 @@ LL | let _ = x.2; //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:117:14 | -LL | (_, //~ ERROR use of unstable +LL | (_, | ^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -337,7 +337,7 @@ LL | (_, //~ ERROR use of unstable error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability-fields.rs:119:14 | -LL | _) //~ ERROR use of unstable +LL | _) | ^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable diff --git a/src/test/ui/lint/lint-stability.stderr b/src/test/ui/lint/lint-stability.stderr index 03c42e59c679..dd7f7182530b 100644 --- a/src/test/ui/lint/lint-stability.stderr +++ b/src/test/ui/lint/lint-stability.stderr @@ -1,7 +1,7 @@ error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:17:5 | -LL | extern crate stability_cfg2; //~ ERROR use of unstable library feature +LL | extern crate stability_cfg2; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -57,7 +57,7 @@ LL | ::trait_deprecated_unstable_text(&foo); error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:59:9 | -LL | unstable(); //~ ERROR use of unstable library feature +LL | unstable(); | ^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -65,7 +65,7 @@ LL | unstable(); //~ ERROR use of unstable library feature error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:60:9 | -LL | Trait::trait_unstable(&foo); //~ ERROR use of unstable library feature +LL | Trait::trait_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -73,7 +73,7 @@ LL | Trait::trait_unstable(&foo); //~ ERROR use of unstable library feat error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:61:9 | -LL | ::trait_unstable(&foo); //~ ERROR use of unstable library feature +LL | ::trait_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -113,7 +113,7 @@ LL | let _ = DeprecatedUnstableStruct { error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:103:17 | -LL | let _ = UnstableStruct { i: 0 }; //~ ERROR use of unstable library feature +LL | let _ = UnstableStruct { i: 0 }; | ^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -129,7 +129,7 @@ LL | let _ = DeprecatedUnstableUnitStruct; error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:109:17 | -LL | let _ = UnstableUnitStruct; //~ ERROR use of unstable library feature +LL | let _ = UnstableUnitStruct; | ^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -145,7 +145,7 @@ LL | let _ = Enum::DeprecatedUnstableVariant; error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:115:17 | -LL | let _ = Enum::UnstableVariant; //~ ERROR use of unstable library feature +LL | let _ = Enum::UnstableVariant; | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -161,7 +161,7 @@ LL | let _ = DeprecatedUnstableTupleStruct (1); error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:121:17 | -LL | let _ = UnstableTupleStruct (1); //~ ERROR use of unstable library feature +LL | let _ = UnstableTupleStruct (1); | ^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -209,7 +209,7 @@ LL | ::trait_deprecated_unstable_text(&foo); error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:152:9 | -LL | Trait::trait_unstable(&foo); //~ ERROR use of unstable library feature +LL | Trait::trait_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -217,7 +217,7 @@ LL | Trait::trait_unstable(&foo); //~ ERROR use of unstable library feat error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:153:9 | -LL | ::trait_unstable(&foo); //~ ERROR use of unstable library feature +LL | ::trait_unstable(&foo); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -241,7 +241,7 @@ LL | ::trait_unstable_text(&foo); error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:172:10 | -LL | impl UnstableTrait for S { } //~ ERROR use of unstable library feature +LL | impl UnstableTrait for S { } | ^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -249,7 +249,7 @@ LL | impl UnstableTrait for S { } //~ ERROR use of unstable library feature error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:174:24 | -LL | trait LocalTrait : UnstableTrait { } //~ ERROR use of unstable library feature +LL | trait LocalTrait : UnstableTrait { } | ^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -257,7 +257,7 @@ LL | trait LocalTrait : UnstableTrait { } //~ ERROR use of unstable library error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:179:9 | -LL | fn trait_unstable(&self) {} //~ ERROR use of unstable library feature +LL | fn trait_unstable(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -265,7 +265,7 @@ LL | fn trait_unstable(&self) {} //~ ERROR use of unstable library featu error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:184:5 | -LL | extern crate inherited_stability; //~ ERROR use of unstable library feature +LL | extern crate inherited_stability; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -273,7 +273,7 @@ LL | extern crate inherited_stability; //~ ERROR use of unstable library fea error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:185:9 | -LL | use self::inherited_stability::*; //~ ERROR use of unstable library feature +LL | use self::inherited_stability::*; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -281,7 +281,7 @@ LL | use self::inherited_stability::*; //~ ERROR use of unstable library fea error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:188:9 | -LL | unstable(); //~ ERROR use of unstable library feature +LL | unstable(); | ^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -289,7 +289,7 @@ LL | unstable(); //~ ERROR use of unstable library feature error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:191:9 | -LL | stable_mod::unstable(); //~ ERROR use of unstable library feature +LL | stable_mod::unstable(); | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -297,7 +297,7 @@ LL | stable_mod::unstable(); //~ ERROR use of unstable library feature error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:195:9 | -LL | unstable_mod::unstable(); //~ ERROR use of unstable library feature +LL | unstable_mod::unstable(); | ^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -305,7 +305,7 @@ LL | unstable_mod::unstable(); //~ ERROR use of unstable library feature error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:197:17 | -LL | let _ = Unstable::UnstableVariant; //~ ERROR use of unstable library feature +LL | let _ = Unstable::UnstableVariant; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable @@ -321,7 +321,7 @@ LL | struct S1(T::TypeUnstable); error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-stability.rs:92:13 | -LL | TypeUnstable = u8, //~ ERROR use of unstable library feature +LL | TypeUnstable = u8, | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_test_feature)] to the crate attributes to enable diff --git a/src/test/ui/lint/lint-type-limits.stderr b/src/test/ui/lint/lint-type-limits.stderr index 14ef953d294e..71a2b3bfda8c 100644 --- a/src/test/ui/lint/lint-type-limits.stderr +++ b/src/test/ui/lint/lint-type-limits.stderr @@ -1,7 +1,7 @@ error: comparison is useless due to type limits --> $DIR/lint-type-limits.rs:8:11 | -LL | while i >= 0 { //~ ERROR comparison is useless due to type limits +LL | while i >= 0 { | ^^^^^^ | = note: requested on the command line with `-D unused-comparisons` @@ -9,49 +9,49 @@ LL | while i >= 0 { //~ ERROR comparison is useless due to type limits error: comparison is useless due to type limits --> $DIR/lint-type-limits.rs:19:13 | -LL | let _ = u > 255; //~ ERROR comparison is useless due to type limits +LL | let _ = u > 255; | ^^^^^^^ error: comparison is useless due to type limits --> $DIR/lint-type-limits.rs:20:13 | -LL | let _ = 255 < u; //~ ERROR comparison is useless due to type limits +LL | let _ = 255 < u; | ^^^^^^^ error: comparison is useless due to type limits --> $DIR/lint-type-limits.rs:21:13 | -LL | let _ = u < 0; //~ ERROR comparison is useless due to type limits +LL | let _ = u < 0; | ^^^^^ error: comparison is useless due to type limits --> $DIR/lint-type-limits.rs:22:13 | -LL | let _ = 0 > u; //~ ERROR comparison is useless due to type limits +LL | let _ = 0 > u; | ^^^^^ error: comparison is useless due to type limits --> $DIR/lint-type-limits.rs:23:13 | -LL | let _ = u <= 255; //~ ERROR comparison is useless due to type limits +LL | let _ = u <= 255; | ^^^^^^^^ error: comparison is useless due to type limits --> $DIR/lint-type-limits.rs:24:13 | -LL | let _ = 255 >= u; //~ ERROR comparison is useless due to type limits +LL | let _ = 255 >= u; | ^^^^^^^^ error: comparison is useless due to type limits --> $DIR/lint-type-limits.rs:25:13 | -LL | let _ = u >= 0; //~ ERROR comparison is useless due to type limits +LL | let _ = u >= 0; | ^^^^^^ error: comparison is useless due to type limits --> $DIR/lint-type-limits.rs:26:13 | -LL | let _ = 0 <= u; //~ ERROR comparison is useless due to type limits +LL | let _ = 0 <= u; | ^^^^^^ error: aborting due to 9 previous errors diff --git a/src/test/ui/lint/lint-type-limits2.stderr b/src/test/ui/lint/lint-type-limits2.stderr index f88fff62e21f..e7bc407422a1 100644 --- a/src/test/ui/lint/lint-type-limits2.stderr +++ b/src/test/ui/lint/lint-type-limits2.stderr @@ -1,7 +1,7 @@ error: comparison is useless due to type limits --> $DIR/lint-type-limits2.rs:13:5 | -LL | 128 > bar() //~ ERROR comparison is useless due to type limits +LL | 128 > bar() | ^^^^^^^^^^^ | = note: requested on the command line with `-D unused-comparisons` @@ -9,7 +9,7 @@ LL | 128 > bar() //~ ERROR comparison is useless due to type limits warning: literal out of range for i8 --> $DIR/lint-type-limits2.rs:13:5 | -LL | 128 > bar() //~ ERROR comparison is useless due to type limits +LL | 128 > bar() | ^^^ | note: lint level defined here diff --git a/src/test/ui/lint/lint-type-limits3.stderr b/src/test/ui/lint/lint-type-limits3.stderr index 4f47a7ce3166..742b6695c24f 100644 --- a/src/test/ui/lint/lint-type-limits3.stderr +++ b/src/test/ui/lint/lint-type-limits3.stderr @@ -1,7 +1,7 @@ error: comparison is useless due to type limits --> $DIR/lint-type-limits3.rs:9:11 | -LL | while 200 != i { //~ ERROR comparison is useless due to type limits +LL | while 200 != i { | ^^^^^^^^ | = note: requested on the command line with `-D unused-comparisons` @@ -9,7 +9,7 @@ LL | while 200 != i { //~ ERROR comparison is useless due to type limits warning: literal out of range for i8 --> $DIR/lint-type-limits3.rs:9:11 | -LL | while 200 != i { //~ ERROR comparison is useless due to type limits +LL | while 200 != i { | ^^^ | note: lint level defined here diff --git a/src/test/ui/lint/lint-type-overflow.stderr b/src/test/ui/lint/lint-type-overflow.stderr index 987ee8a640c9..9da007457aa8 100644 --- a/src/test/ui/lint/lint-type-overflow.stderr +++ b/src/test/ui/lint/lint-type-overflow.stderr @@ -1,7 +1,7 @@ error: literal out of range for u8 --> $DIR/lint-type-overflow.rs:12:18 | -LL | let x1: u8 = 256; //~ error: literal out of range for u8 +LL | let x1: u8 = 256; | ^^^ | note: lint level defined here @@ -13,103 +13,103 @@ LL | #![deny(overflowing_literals)] error: literal out of range for u8 --> $DIR/lint-type-overflow.rs:15:14 | -LL | let x1 = 256_u8; //~ error: literal out of range for u8 +LL | let x1 = 256_u8; | ^^^^^^ error: literal out of range for i8 --> $DIR/lint-type-overflow.rs:18:18 | -LL | let x1: i8 = 128; //~ error: literal out of range for i8 +LL | let x1: i8 = 128; | ^^^ error: literal out of range for i8 --> $DIR/lint-type-overflow.rs:20:19 | -LL | let x3: i8 = -129; //~ error: literal out of range for i8 +LL | let x3: i8 = -129; | ^^^ error: literal out of range for i8 --> $DIR/lint-type-overflow.rs:21:19 | -LL | let x3: i8 = -(129); //~ error: literal out of range for i8 +LL | let x3: i8 = -(129); | ^^^^^ error: literal out of range for i8 --> $DIR/lint-type-overflow.rs:22:20 | -LL | let x3: i8 = -{129}; //~ error: literal out of range for i8 +LL | let x3: i8 = -{129}; | ^^^ error: literal out of range for i8 --> $DIR/lint-type-overflow.rs:24:10 | -LL | test(1000); //~ error: literal out of range for i8 +LL | test(1000); | ^^^^ error: literal out of range for i8 --> $DIR/lint-type-overflow.rs:26:13 | -LL | let x = 128_i8; //~ error: literal out of range for i8 +LL | let x = 128_i8; | ^^^^^^ error: literal out of range for i8 --> $DIR/lint-type-overflow.rs:30:14 | -LL | let x = -129_i8; //~ error: literal out of range for i8 +LL | let x = -129_i8; | ^^^^^^ error: literal out of range for i32 --> $DIR/lint-type-overflow.rs:34:18 | -LL | let x: i32 = 2147483648; //~ error: literal out of range for i32 +LL | let x: i32 = 2147483648; | ^^^^^^^^^^ error: literal out of range for i32 --> $DIR/lint-type-overflow.rs:35:13 | -LL | let x = 2147483648_i32; //~ error: literal out of range for i32 +LL | let x = 2147483648_i32; | ^^^^^^^^^^^^^^ error: literal out of range for i32 --> $DIR/lint-type-overflow.rs:38:19 | -LL | let x: i32 = -2147483649; //~ error: literal out of range for i32 +LL | let x: i32 = -2147483649; | ^^^^^^^^^^ error: literal out of range for i32 --> $DIR/lint-type-overflow.rs:39:14 | -LL | let x = -2147483649_i32; //~ error: literal out of range for i32 +LL | let x = -2147483649_i32; | ^^^^^^^^^^^^^^ error: literal out of range for i32 --> $DIR/lint-type-overflow.rs:40:13 | -LL | let x = 2147483648; //~ error: literal out of range for i32 +LL | let x = 2147483648; | ^^^^^^^^^^ error: literal out of range for i64 --> $DIR/lint-type-overflow.rs:42:13 | -LL | let x = 9223372036854775808_i64; //~ error: literal out of range for i64 +LL | let x = 9223372036854775808_i64; | ^^^^^^^^^^^^^^^^^^^^^^^ error: literal out of range for i64 --> $DIR/lint-type-overflow.rs:44:13 | -LL | let x = 18446744073709551615_i64; //~ error: literal out of range for i64 +LL | let x = 18446744073709551615_i64; | ^^^^^^^^^^^^^^^^^^^^^^^^ error: literal out of range for i64 --> $DIR/lint-type-overflow.rs:45:19 | -LL | let x: i64 = -9223372036854775809; //~ error: literal out of range for i64 +LL | let x: i64 = -9223372036854775809; | ^^^^^^^^^^^^^^^^^^^ error: literal out of range for i64 --> $DIR/lint-type-overflow.rs:46:14 | -LL | let x = -9223372036854775809_i64; //~ error: literal out of range for i64 +LL | let x = -9223372036854775809_i64; | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 18 previous errors diff --git a/src/test/ui/lint/lint-type-overflow2.stderr b/src/test/ui/lint/lint-type-overflow2.stderr index 5f63ce49680b..5255f6c75934 100644 --- a/src/test/ui/lint/lint-type-overflow2.stderr +++ b/src/test/ui/lint/lint-type-overflow2.stderr @@ -1,7 +1,7 @@ warning: literal out of range for i8 --> $DIR/lint-type-overflow2.rs:9:20 | -LL | let x2: i8 = --128; //~ warn: literal out of range for i8 +LL | let x2: i8 = --128; | ^^^ | note: lint level defined here @@ -13,31 +13,31 @@ LL | #![warn(overflowing_literals)] warning: literal out of range for f32 --> $DIR/lint-type-overflow2.rs:11:14 | -LL | let x = -3.40282357e+38_f32; //~ warn: literal out of range for f32 +LL | let x = -3.40282357e+38_f32; | ^^^^^^^^^^^^^^^^^^ warning: literal out of range for f32 --> $DIR/lint-type-overflow2.rs:12:14 | -LL | let x = 3.40282357e+38_f32; //~ warn: literal out of range for f32 +LL | let x = 3.40282357e+38_f32; | ^^^^^^^^^^^^^^^^^^ warning: literal out of range for f64 --> $DIR/lint-type-overflow2.rs:13:14 | -LL | let x = -1.7976931348623159e+308_f64; //~ warn: literal out of range for f64 +LL | let x = -1.7976931348623159e+308_f64; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: literal out of range for f64 --> $DIR/lint-type-overflow2.rs:14:14 | -LL | let x = 1.7976931348623159e+308_f64; //~ warn: literal out of range for f64 +LL | let x = 1.7976931348623159e+308_f64; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: this expression will panic at runtime --> $DIR/lint-type-overflow2.rs:9:18 | -LL | let x2: i8 = --128; //~ warn: literal out of range for i8 +LL | let x2: i8 = --128; | ^^^^^ attempt to negate with overflow | note: lint level defined here diff --git a/src/test/ui/lint/lint-unconditional-recursion.stderr b/src/test/ui/lint/lint-unconditional-recursion.stderr index 50daa537591b..5d2e8201b142 100644 --- a/src/test/ui/lint/lint-unconditional-recursion.stderr +++ b/src/test/ui/lint/lint-unconditional-recursion.stderr @@ -1,7 +1,7 @@ error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:4:1 | -LL | fn foo() { //~ ERROR function cannot return without recursing +LL | fn foo() { | ^^^^^^^^ cannot return without recursing LL | foo(); | ----- recursive call site @@ -16,7 +16,7 @@ LL | #![deny(unconditional_recursion)] error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:14:1 | -LL | fn baz() { //~ ERROR function cannot return without recursing +LL | fn baz() { | ^^^^^^^^ cannot return without recursing LL | if true { LL | baz() @@ -30,7 +30,7 @@ LL | baz() error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:26:1 | -LL | fn quz() -> bool { //~ ERROR function cannot return without recursing +LL | fn quz() -> bool { | ^^^^^^^^^^^^^^^^ cannot return without recursing LL | if true { LL | while quz() {} @@ -44,7 +44,7 @@ LL | loop { quz(); } error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:37:5 | -LL | fn bar(&self) { //~ ERROR function cannot return without recursing +LL | fn bar(&self) { | ^^^^^^^^^^^^^ cannot return without recursing LL | self.bar() | ---------- recursive call site @@ -54,7 +54,7 @@ LL | self.bar() error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:43:5 | -LL | fn bar(&self) { //~ ERROR function cannot return without recursing +LL | fn bar(&self) { | ^^^^^^^^^^^^^ cannot return without recursing LL | loop { LL | self.bar() @@ -65,7 +65,7 @@ LL | self.bar() error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:52:5 | -LL | fn bar(&self) { //~ ERROR function cannot return without recursing +LL | fn bar(&self) { | ^^^^^^^^^^^^^ cannot return without recursing LL | 0.bar() | ------- recursive call site @@ -75,7 +75,7 @@ LL | 0.bar() error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:65:5 | -LL | fn bar(&self) { //~ ERROR function cannot return without recursing +LL | fn bar(&self) { | ^^^^^^^^^^^^^ cannot return without recursing LL | Foo2::bar(self) | --------------- recursive call site @@ -85,7 +85,7 @@ LL | Foo2::bar(self) error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:71:5 | -LL | fn bar(&self) { //~ ERROR function cannot return without recursing +LL | fn bar(&self) { | ^^^^^^^^^^^^^ cannot return without recursing LL | loop { LL | Foo2::bar(self) @@ -96,7 +96,7 @@ LL | Foo2::bar(self) error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:81:5 | -LL | fn qux(&self) { //~ ERROR function cannot return without recursing +LL | fn qux(&self) { | ^^^^^^^^^^^^^ cannot return without recursing LL | self.qux(); | ---------- recursive call site @@ -106,7 +106,7 @@ LL | self.qux(); error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:86:5 | -LL | fn as_ref(&self) -> &Self { //~ ERROR function cannot return without recursing +LL | fn as_ref(&self) -> &Self { | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing LL | Baz::as_ref(self) | ----------------- recursive call site @@ -116,7 +116,7 @@ LL | Baz::as_ref(self) error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:93:5 | -LL | fn default() -> Baz { //~ ERROR function cannot return without recursing +LL | fn default() -> Baz { | ^^^^^^^^^^^^^^^^^^^ cannot return without recursing LL | let x = Default::default(); | ------------------ recursive call site @@ -126,7 +126,7 @@ LL | let x = Default::default(); error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:102:5 | -LL | fn deref(&self) -> &() { //~ ERROR function cannot return without recursing +LL | fn deref(&self) -> &() { | ^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing LL | &**self | ------ recursive call site @@ -136,7 +136,7 @@ LL | &**self error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:109:5 | -LL | fn index(&self, x: usize) -> &Baz { //~ ERROR function cannot return without recursing +LL | fn index(&self, x: usize) -> &Baz { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing LL | &self[x] | ------- recursive call site @@ -146,7 +146,7 @@ LL | &self[x] error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:118:5 | -LL | fn deref(&self) -> &Baz { //~ ERROR function cannot return without recursing +LL | fn deref(&self) -> &Baz { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing LL | self.as_ref() | ---- recursive call site diff --git a/src/test/ui/lint/lint-unexported-no-mangle.stderr b/src/test/ui/lint/lint-unexported-no-mangle.stderr index f6a1087635af..586ee8ed411c 100644 --- a/src/test/ui/lint/lint-unexported-no-mangle.stderr +++ b/src/test/ui/lint/lint-unexported-no-mangle.stderr @@ -9,7 +9,7 @@ warning: lint `private_no_mangle_statics` has been removed: `no longer a warning error: const items should never be #[no_mangle] --> $DIR/lint-unexported-no-mangle.rs:9:1 | -LL | const FOO: u64 = 1; //~ ERROR const items should never be #[no_mangle] +LL | const FOO: u64 = 1; | -----^^^^^^^^^^^^^^ | | | help: try a static value: `pub static` @@ -19,7 +19,7 @@ LL | const FOO: u64 = 1; //~ ERROR const items should never be #[no_mangle] error: const items should never be #[no_mangle] --> $DIR/lint-unexported-no-mangle.rs:12:1 | -LL | pub const PUB_FOO: u64 = 1; //~ ERROR const items should never be #[no_mangle] +LL | pub const PUB_FOO: u64 = 1; | ---------^^^^^^^^^^^^^^^^^^ | | | help: try a static value: `pub static` diff --git a/src/test/ui/lint/lint-unknown-attr.stderr b/src/test/ui/lint/lint-unknown-attr.stderr index 435b03b1f658..9817760c2247 100644 --- a/src/test/ui/lint/lint-unknown-attr.stderr +++ b/src/test/ui/lint/lint-unknown-attr.stderr @@ -1,7 +1,7 @@ error: unused attribute --> $DIR/lint-unknown-attr.rs:9:1 | -LL | #[dance] mod a {} //~ ERROR unused attribute +LL | #[dance] mod a {} | ^^^^^^^^ | note: lint level defined here @@ -13,13 +13,13 @@ LL | #![deny(unused_attributes)] error: unused attribute --> $DIR/lint-unknown-attr.rs:11:1 | -LL | #[dance] fn main() {} //~ ERROR unused attribute +LL | #[dance] fn main() {} | ^^^^^^^^ error: unused attribute --> $DIR/lint-unknown-attr.rs:7:1 | -LL | #![mutable_doc] //~ ERROR unused attribute +LL | #![mutable_doc] | ^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/lint/lint-unknown-lint.stderr b/src/test/ui/lint/lint-unknown-lint.stderr index 976c88c11d0c..b3ba6e31bc1e 100644 --- a/src/test/ui/lint/lint-unknown-lint.stderr +++ b/src/test/ui/lint/lint-unknown-lint.stderr @@ -1,7 +1,7 @@ error: unknown lint: `not_a_real_lint` --> $DIR/lint-unknown-lint.rs:3:10 | -LL | #![allow(not_a_real_lint)] //~ ERROR unknown lint +LL | #![allow(not_a_real_lint)] | ^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unknown_lints)] error: unknown lint: `dead_cod` --> $DIR/lint-unknown-lint.rs:5:9 | -LL | #![deny(dead_cod)] //~ ERROR unknown lint +LL | #![deny(dead_cod)] | ^^^^^^^^ help: did you mean: `dead_code` error: aborting due to 2 previous errors diff --git a/src/test/ui/lint/lint-unnecessary-import-braces.stderr b/src/test/ui/lint/lint-unnecessary-import-braces.stderr index 40e7ab4dd139..41e274bc5450 100644 --- a/src/test/ui/lint/lint-unnecessary-import-braces.stderr +++ b/src/test/ui/lint/lint-unnecessary-import-braces.stderr @@ -1,7 +1,7 @@ error: braces around A is unnecessary --> $DIR/lint-unnecessary-import-braces.rs:3:1 | -LL | use test::{A}; //~ ERROR braces around A is unnecessary +LL | use test::{A}; | ^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/lint/lint-unnecessary-parens.stderr b/src/test/ui/lint/lint-unnecessary-parens.stderr index c14ebb6be976..fe2ee38eb42a 100644 --- a/src/test/ui/lint/lint-unnecessary-parens.stderr +++ b/src/test/ui/lint/lint-unnecessary-parens.stderr @@ -1,7 +1,7 @@ error: unnecessary parentheses around `return` value --> $DIR/lint-unnecessary-parens.rs:10:12 | -LL | return (1); //~ ERROR unnecessary parentheses around `return` value +LL | return (1); | ^^^ help: remove these parentheses | note: lint level defined here @@ -13,67 +13,67 @@ LL | #![deny(unused_parens)] error: unnecessary parentheses around `return` value --> $DIR/lint-unnecessary-parens.rs:13:12 | -LL | return (X { y }); //~ ERROR unnecessary parentheses around `return` value +LL | return (X { y }); | ^^^^^^^^^ help: remove these parentheses error: unnecessary parentheses around function argument --> $DIR/lint-unnecessary-parens.rs:18:9 | -LL | bar((true)); //~ ERROR unnecessary parentheses around function argument +LL | bar((true)); | ^^^^^^ help: remove these parentheses error: unnecessary parentheses around `if` condition --> $DIR/lint-unnecessary-parens.rs:20:8 | -LL | if (true) {} //~ ERROR unnecessary parentheses around `if` condition +LL | if (true) {} | ^^^^^^ help: remove these parentheses error: unnecessary parentheses around `while` condition --> $DIR/lint-unnecessary-parens.rs:21:11 | -LL | while (true) {} //~ ERROR unnecessary parentheses around `while` condition +LL | while (true) {} | ^^^^^^ help: remove these parentheses error: unnecessary parentheses around `match` head expression --> $DIR/lint-unnecessary-parens.rs:22:11 | -LL | match (true) { //~ ERROR unnecessary parentheses around `match` head expression +LL | match (true) { | ^^^^^^ help: remove these parentheses error: unnecessary parentheses around `if let` head expression --> $DIR/lint-unnecessary-parens.rs:25:16 | -LL | if let 1 = (1) {} //~ ERROR unnecessary parentheses around `if let` head expression +LL | if let 1 = (1) {} | ^^^ help: remove these parentheses error: unnecessary parentheses around `while let` head expression --> $DIR/lint-unnecessary-parens.rs:26:19 | -LL | while let 1 = (2) {} //~ ERROR unnecessary parentheses around `while let` head expression +LL | while let 1 = (2) {} | ^^^ help: remove these parentheses error: unnecessary parentheses around method argument --> $DIR/lint-unnecessary-parens.rs:40:24 | -LL | X { y: false }.foo((true)); //~ ERROR unnecessary parentheses around method argument +LL | X { y: false }.foo((true)); | ^^^^^^ help: remove these parentheses error: unnecessary parentheses around assigned value --> $DIR/lint-unnecessary-parens.rs:42:18 | -LL | let mut _a = (0); //~ ERROR unnecessary parentheses around assigned value +LL | let mut _a = (0); | ^^^ help: remove these parentheses error: unnecessary parentheses around assigned value --> $DIR/lint-unnecessary-parens.rs:43:10 | -LL | _a = (0); //~ ERROR unnecessary parentheses around assigned value +LL | _a = (0); | ^^^ help: remove these parentheses error: unnecessary parentheses around assigned value --> $DIR/lint-unnecessary-parens.rs:44:11 | -LL | _a += (1); //~ ERROR unnecessary parentheses around assigned value +LL | _a += (1); | ^^^ help: remove these parentheses error: aborting due to 12 previous errors diff --git a/src/test/ui/lint/lint-unsafe-code.stderr b/src/test/ui/lint/lint-unsafe-code.stderr index e2dd45e2c8a3..96ad0c33691d 100644 --- a/src/test/ui/lint/lint-unsafe-code.stderr +++ b/src/test/ui/lint/lint-unsafe-code.stderr @@ -1,7 +1,7 @@ error: declaration of an `unsafe` function --> $DIR/lint-unsafe-code.rs:23:1 | -LL | unsafe fn baz() {} //~ ERROR: declaration of an `unsafe` function +LL | unsafe fn baz() {} | ^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,79 +13,79 @@ LL | #![deny(unsafe_code)] error: declaration of an `unsafe` trait --> $DIR/lint-unsafe-code.rs:24:1 | -LL | unsafe trait Foo {} //~ ERROR: declaration of an `unsafe` trait +LL | unsafe trait Foo {} | ^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` trait --> $DIR/lint-unsafe-code.rs:25:1 | -LL | unsafe impl Foo for Bar {} //~ ERROR: implementation of an `unsafe` trait +LL | unsafe impl Foo for Bar {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: declaration of an `unsafe` method --> $DIR/lint-unsafe-code.rs:28:5 | -LL | unsafe fn baz(&self); //~ ERROR: declaration of an `unsafe` method +LL | unsafe fn baz(&self); | ^^^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` method --> $DIR/lint-unsafe-code.rs:29:5 | -LL | unsafe fn provided(&self) {} //~ ERROR: implementation of an `unsafe` method +LL | unsafe fn provided(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` method --> $DIR/lint-unsafe-code.rs:30:5 | -LL | unsafe fn provided_override(&self) {} //~ ERROR: implementation of an `unsafe` method +LL | unsafe fn provided_override(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` method --> $DIR/lint-unsafe-code.rs:34:5 | -LL | unsafe fn baz(&self) {} //~ ERROR: implementation of an `unsafe` method +LL | unsafe fn baz(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` method --> $DIR/lint-unsafe-code.rs:35:5 | -LL | unsafe fn provided_override(&self) {} //~ ERROR: implementation of an `unsafe` method +LL | unsafe fn provided_override(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` method --> $DIR/lint-unsafe-code.rs:54:5 | -LL | unsafe fn provided_override(&self) {} //~ ERROR: implementation of an `unsafe` method +LL | unsafe fn provided_override(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` method --> $DIR/lint-unsafe-code.rs:65:5 | -LL | unsafe fn provided(&self) {} //~ ERROR: implementation of an `unsafe` method +LL | unsafe fn provided(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` method --> $DIR/lint-unsafe-code.rs:71:5 | -LL | unsafe fn provided(&self) {} //~ ERROR: implementation of an `unsafe` method +LL | unsafe fn provided(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: implementation of an `unsafe` method --> $DIR/lint-unsafe-code.rs:75:5 | -LL | unsafe fn baz(&self) {} //~ ERROR: implementation of an `unsafe` method +LL | unsafe fn baz(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^ error: usage of an `unsafe` block --> $DIR/lint-unsafe-code.rs:86:5 | -LL | unsafe {} //~ ERROR: usage of an `unsafe` block +LL | unsafe {} | ^^^^^^^^^ error: usage of an `unsafe` block --> $DIR/lint-unsafe-code.rs:19:9 | -LL | unsafe {} //~ ERROR: usage of an `unsafe` block +LL | unsafe {} | ^^^^^^^^^ ... LL | unsafe_in_macro!() diff --git a/src/test/ui/lint/lint-unused-extern-crate.stderr b/src/test/ui/lint/lint-unused-extern-crate.stderr index 46499515fa75..aa4a8dad24c9 100644 --- a/src/test/ui/lint/lint-unused-extern-crate.stderr +++ b/src/test/ui/lint/lint-unused-extern-crate.stderr @@ -1,7 +1,7 @@ error: unused extern crate --> $DIR/lint-unused-extern-crate.rs:11:1 | -LL | extern crate lint_unused_extern_crate5; //~ ERROR: unused extern crate +LL | extern crate lint_unused_extern_crate5; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unused_extern_crates)] error: unused extern crate --> $DIR/lint-unused-extern-crate.rs:29:5 | -LL | extern crate lint_unused_extern_crate2; //~ ERROR unused extern crate +LL | extern crate lint_unused_extern_crate2; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it error: aborting due to 2 previous errors diff --git a/src/test/ui/lint/lint-unused-imports.stderr b/src/test/ui/lint/lint-unused-imports.stderr index 18f2fae0067e..f9a54f477f99 100644 --- a/src/test/ui/lint/lint-unused-imports.stderr +++ b/src/test/ui/lint/lint-unused-imports.stderr @@ -19,37 +19,37 @@ LL | use std::option::Option::{Some, None}; error: unused import: `test::A` --> $DIR/lint-unused-imports.rs:15:5 | -LL | use test::A; //~ ERROR unused import: `test::A` +LL | use test::A; | ^^^^^^^ error: unused import: `bar` --> $DIR/lint-unused-imports.rs:24:18 | -LL | use test2::{foo, bar}; //~ ERROR unused import: `bar` +LL | use test2::{foo, bar}; | ^^^ error: unused import: `foo::Square` --> $DIR/lint-unused-imports.rs:52:13 | -LL | use foo::Square; //~ ERROR unused import: `foo::Square` +LL | use foo::Square; | ^^^^^^^^^^^ error: unused import: `self::g` --> $DIR/lint-unused-imports.rs:68:9 | -LL | use self::g; //~ ERROR unused import: `self::g` +LL | use self::g; | ^^^^^^^ error: unused import: `test2::foo` --> $DIR/lint-unused-imports.rs:77:9 | -LL | use test2::foo; //~ ERROR unused import: `test2::foo` +LL | use test2::foo; | ^^^^^^^^^^ error: unused import: `test::B2` --> $DIR/lint-unused-imports.rs:20:5 | -LL | use test::B2; //~ ERROR unused import: `test::B2` +LL | use test::B2; | ^^^^^^^^ error: aborting due to 8 previous errors diff --git a/src/test/ui/lint/lint-unused-mut-self.stderr b/src/test/ui/lint/lint-unused-mut-self.stderr index 62be0c8f159c..b5f6b717dc39 100644 --- a/src/test/ui/lint/lint-unused-mut-self.stderr +++ b/src/test/ui/lint/lint-unused-mut-self.stderr @@ -1,7 +1,7 @@ error: variable does not need to be mutable --> $DIR/lint-unused-mut-self.rs:8:12 | -LL | fn foo(mut self) {} //~ ERROR: variable does not need to be mutable +LL | fn foo(mut self) {} | ----^^^^ | | | help: remove this `mut` @@ -15,7 +15,7 @@ LL | #![deny(unused_mut)] error: variable does not need to be mutable --> $DIR/lint-unused-mut-self.rs:9:12 | -LL | fn bar(mut self: Box) {} //~ ERROR: variable does not need to be mutable +LL | fn bar(mut self: Box) {} | ----^^^^ | | | help: remove this `mut` diff --git a/src/test/ui/lint/lint-unused-mut-variables.stderr b/src/test/ui/lint/lint-unused-mut-variables.stderr index a90cc964a84d..e41d8f8ac740 100644 --- a/src/test/ui/lint/lint-unused-mut-variables.stderr +++ b/src/test/ui/lint/lint-unused-mut-variables.stderr @@ -1,7 +1,7 @@ error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:46:14 | -LL | let x = |mut y: isize| 10; //~ ERROR: variable does not need to be mutable +LL | let x = |mut y: isize| 10; | ----^ | | | help: remove this `mut` @@ -15,7 +15,7 @@ LL | #![deny(unused_mut)] error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:11:9 | -LL | let mut a = 3; //~ ERROR: variable does not need to be mutable +LL | let mut a = 3; | ----^ | | | help: remove this `mut` @@ -23,7 +23,7 @@ LL | let mut a = 3; //~ ERROR: variable does not need to be mutable error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:13:9 | -LL | let mut a = 2; //~ ERROR: variable does not need to be mutable +LL | let mut a = 2; | ----^ | | | help: remove this `mut` @@ -31,7 +31,7 @@ LL | let mut a = 2; //~ ERROR: variable does not need to be mutable error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:15:9 | -LL | let mut b = 3; //~ ERROR: variable does not need to be mutable +LL | let mut b = 3; | ----^ | | | help: remove this `mut` @@ -39,7 +39,7 @@ LL | let mut b = 3; //~ ERROR: variable does not need to be mutable error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:17:9 | -LL | let mut a = vec![3]; //~ ERROR: variable does not need to be mutable +LL | let mut a = vec![3]; | ----^ | | | help: remove this `mut` @@ -47,7 +47,7 @@ LL | let mut a = vec![3]; //~ ERROR: variable does not need to be mutable error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:19:10 | -LL | let (mut a, b) = (1, 2); //~ ERROR: variable does not need to be mutable +LL | let (mut a, b) = (1, 2); | ----^ | | | help: remove this `mut` @@ -55,7 +55,7 @@ LL | let (mut a, b) = (1, 2); //~ ERROR: variable does not need to be mutabl error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:21:9 | -LL | let mut a; //~ ERROR: variable does not need to be mutable +LL | let mut a; | ----^ | | | help: remove this `mut` @@ -63,7 +63,7 @@ LL | let mut a; //~ ERROR: variable does not need to be mutable error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:25:9 | -LL | let mut b; //~ ERROR: variable does not need to be mutable +LL | let mut b; | ----^ | | | help: remove this `mut` @@ -71,7 +71,7 @@ LL | let mut b; //~ ERROR: variable does not need to be mutable error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:34:9 | -LL | mut x => {} //~ ERROR: variable does not need to be mutable +LL | mut x => {} | ----^ | | | help: remove this `mut` @@ -79,7 +79,7 @@ LL | mut x => {} //~ ERROR: variable does not need to be mutable error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:38:8 | -LL | (mut x, 1) | //~ ERROR: variable does not need to be mutable +LL | (mut x, 1) | | ----^ | | | help: remove this `mut` @@ -87,7 +87,7 @@ LL | (mut x, 1) | //~ ERROR: variable does not need to be mutable error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:51:9 | -LL | let mut a = &mut 5; //~ ERROR: variable does not need to be mutable +LL | let mut a = &mut 5; | ----^ | | | help: remove this `mut` @@ -95,7 +95,7 @@ LL | let mut a = &mut 5; //~ ERROR: variable does not need to be mutable error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:56:9 | -LL | let mut b = (&mut a,); //~ ERROR: variable does not need to be mutable +LL | let mut b = (&mut a,); | ----^ | | | help: remove this `mut` @@ -103,7 +103,7 @@ LL | let mut b = (&mut a,); //~ ERROR: variable does not need to be mutable error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:59:9 | -LL | let mut x = &mut 1; //~ ERROR: variable does not need to be mutable +LL | let mut x = &mut 1; | ----^ | | | help: remove this `mut` @@ -111,7 +111,7 @@ LL | let mut x = &mut 1; //~ ERROR: variable does not need to be mutable error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:71:9 | -LL | let mut v : &mut Vec<()> = &mut vec![]; //~ ERROR: variable does not need to be mutable +LL | let mut v : &mut Vec<()> = &mut vec![]; | ----^ | | | help: remove this `mut` @@ -119,7 +119,7 @@ LL | let mut v : &mut Vec<()> = &mut vec![]; //~ ERROR: variable does not ne error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:48:13 | -LL | fn what(mut foo: isize) {} //~ ERROR: variable does not need to be mutable +LL | fn what(mut foo: isize) {} | ----^^^ | | | help: remove this `mut` @@ -135,7 +135,7 @@ LL | fn mut_ref_arg(mut arg : &mut [u8]) -> &mut [u8] { error: variable does not need to be mutable --> $DIR/lint-unused-mut-variables.rs:130:9 | -LL | let mut b = vec![2]; //~ ERROR: variable does not need to be mutable +LL | let mut b = vec![2]; | ----^ | | | help: remove this `mut` diff --git a/src/test/ui/lint/lint-uppercase-variables.stderr b/src/test/ui/lint/lint-uppercase-variables.stderr index f2267f351ddd..40c13231c182 100644 --- a/src/test/ui/lint/lint-uppercase-variables.stderr +++ b/src/test/ui/lint/lint-uppercase-variables.stderr @@ -20,7 +20,7 @@ LL | #![warn(unused)] error: structure field `X` should have a snake case name --> $DIR/lint-uppercase-variables.rs:10:5 | -LL | X: usize //~ ERROR structure field `X` should have a snake case name +LL | X: usize | ^ help: convert the identifier to snake case: `x` | note: lint level defined here @@ -32,13 +32,13 @@ LL | #![deny(non_snake_case)] error: variable `Xx` should have a snake case name --> $DIR/lint-uppercase-variables.rs:13:9 | -LL | fn test(Xx: usize) { //~ ERROR variable `Xx` should have a snake case name +LL | fn test(Xx: usize) { | ^^ help: convert the identifier to snake case: `xx` error: variable `Test` should have a snake case name --> $DIR/lint-uppercase-variables.rs:18:9 | -LL | let Test: usize = 0; //~ ERROR variable `Test` should have a snake case name +LL | let Test: usize = 0; | ^^^^ help: convert the identifier to snake case: `test` error: variable `Foo` should have a snake case name diff --git a/src/test/ui/lint/lints-in-foreign-macros.stderr b/src/test/ui/lint/lints-in-foreign-macros.stderr index 8287ca5692bd..3fc3c2281f2e 100644 --- a/src/test/ui/lint/lints-in-foreign-macros.stderr +++ b/src/test/ui/lint/lints-in-foreign-macros.stderr @@ -1,7 +1,7 @@ warning: unused import: `std::string::ToString` --> $DIR/lints-in-foreign-macros.rs:11:16 | -LL | () => {use std::string::ToString;} //~ WARN: unused import +LL | () => {use std::string::ToString;} | ^^^^^^^^^^^^^^^^^^^^^ ... LL | mod a { foo!(); } @@ -10,25 +10,25 @@ LL | mod a { foo!(); } note: lint level defined here --> $DIR/lints-in-foreign-macros.rs:4:9 | -LL | #![warn(unused_imports)] //~ missing documentation for crate [missing_docs] +LL | #![warn(unused_imports)] | ^^^^^^^^^^^^^^ warning: unused import: `std::string::ToString` --> $DIR/lints-in-foreign-macros.rs:16:18 | -LL | mod c { baz!(use std::string::ToString;); } //~ WARN: unused import +LL | mod c { baz!(use std::string::ToString;); } | ^^^^^^^^^^^^^^^^^^^^^ warning: unused import: `std::string::ToString` --> $DIR/lints-in-foreign-macros.rs:17:19 | -LL | mod d { baz2!(use std::string::ToString;); } //~ WARN: unused import +LL | mod d { baz2!(use std::string::ToString;); } | ^^^^^^^^^^^^^^^^^^^^^ warning: missing documentation for crate --> $DIR/lints-in-foreign-macros.rs:4:1 | -LL | / #![warn(unused_imports)] //~ missing documentation for crate [missing_docs] +LL | / #![warn(unused_imports)] LL | | #![warn(missing_docs)] LL | | LL | | #[macro_use] @@ -46,12 +46,12 @@ LL | #![warn(missing_docs)] warning: missing documentation for a function --> $DIR/lints-in-foreign-macros.rs:18:6 | -LL | baz!(pub fn undocumented() {}); //~ WARN: missing documentation for a function +LL | baz!(pub fn undocumented() {}); | ^^^^^^^^^^^^^^^^^^^^^ warning: missing documentation for a function --> $DIR/lints-in-foreign-macros.rs:19:7 | -LL | baz2!(pub fn undocumented2() {}); //~ WARN: missing documentation for a function +LL | baz2!(pub fn undocumented2() {}); | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/must_use-trait.stderr b/src/test/ui/lint/must_use-trait.stderr index 94f5f4f40d2d..7e2b2f67964a 100644 --- a/src/test/ui/lint/must_use-trait.stderr +++ b/src/test/ui/lint/must_use-trait.stderr @@ -1,7 +1,7 @@ error: unused implementer of `Critical` that must be used --> $DIR/must_use-trait.rs:21:5 | -LL | get_critical(); //~ ERROR unused implementer of `Critical` that must be used +LL | get_critical(); | ^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/lint/must_use-unit.stderr b/src/test/ui/lint/must_use-unit.stderr index ee61c2d1dbc5..f6229c0442f9 100644 --- a/src/test/ui/lint/must_use-unit.stderr +++ b/src/test/ui/lint/must_use-unit.stderr @@ -1,7 +1,7 @@ error: unused return value of `foo` that must be used --> $DIR/must_use-unit.rs:14:5 | -LL | foo(); //~ unused return value of `foo` +LL | foo(); | ^^^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unused_must_use)] error: unused return value of `bar` that must be used --> $DIR/must_use-unit.rs:16:5 | -LL | bar(); //~ unused return value of `bar` +LL | bar(); | ^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/lint/outer-forbid.stderr b/src/test/ui/lint/outer-forbid.stderr index 57ad55a37f05..310a5d88f8c1 100644 --- a/src/test/ui/lint/outer-forbid.stderr +++ b/src/test/ui/lint/outer-forbid.stderr @@ -4,7 +4,7 @@ error[E0453]: allow(unused_variables) overruled by outer forbid(unused) LL | #![forbid(unused, non_snake_case)] | ------ `forbid` level set here LL | -LL | #[allow(unused_variables)] //~ ERROR overruled +LL | #[allow(unused_variables)] | ^^^^^^^^^^^^^^^^ overruled by previous forbid error[E0453]: allow(unused) overruled by outer forbid(unused) @@ -13,7 +13,7 @@ error[E0453]: allow(unused) overruled by outer forbid(unused) LL | #![forbid(unused, non_snake_case)] | ------ `forbid` level set here ... -LL | #[allow(unused)] //~ ERROR overruled +LL | #[allow(unused)] | ^^^^^^ overruled by previous forbid error[E0453]: allow(nonstandard_style) overruled by outer forbid(non_snake_case) @@ -22,7 +22,7 @@ error[E0453]: allow(nonstandard_style) overruled by outer forbid(non_snake_case) LL | #![forbid(unused, non_snake_case)] | -------------- `forbid` level set here ... -LL | #[allow(nonstandard_style)] //~ ERROR overruled +LL | #[allow(nonstandard_style)] | ^^^^^^^^^^^^^^^^^ overruled by previous forbid error: aborting due to 3 previous errors diff --git a/src/test/ui/lint/suggestions.stderr b/src/test/ui/lint/suggestions.stderr index 1e4eabc9db0f..c28814aeee8f 100644 --- a/src/test/ui/lint/suggestions.stderr +++ b/src/test/ui/lint/suggestions.stderr @@ -59,7 +59,7 @@ warning: functions generic over types or consts must be mangled | LL | #[no_mangle] | ------------ help: remove this attribute -LL | //~^ HELP remove this attribute +LL | LL | pub fn defiant(_t: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | diff --git a/src/test/ui/lint/test-inner-fn.stderr b/src/test/ui/lint/test-inner-fn.stderr index 12838cec0247..bf476a45f772 100644 --- a/src/test/ui/lint/test-inner-fn.stderr +++ b/src/test/ui/lint/test-inner-fn.stderr @@ -1,7 +1,7 @@ error: cannot test inner items --> $DIR/test-inner-fn.rs:5:5 | -LL | #[test] //~ ERROR cannot test inner items [unnameable_test_items] +LL | #[test] | ^^^^^^^ | = note: requested on the command line with `-D unnameable-test-items` @@ -9,7 +9,7 @@ LL | #[test] //~ ERROR cannot test inner items [unnameable_test_items] error: cannot test inner items --> $DIR/test-inner-fn.rs:13:9 | -LL | #[test] //~ ERROR cannot test inner items [unnameable_test_items] +LL | #[test] | ^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/lint/type-overflow.stderr b/src/test/ui/lint/type-overflow.stderr index 349d0be01649..5235c9851b53 100644 --- a/src/test/ui/lint/type-overflow.stderr +++ b/src/test/ui/lint/type-overflow.stderr @@ -1,7 +1,7 @@ warning: literal out of range for i8 --> $DIR/type-overflow.rs:5:17 | -LL | let error = 255i8; //~WARNING literal out of range for i8 +LL | let error = 255i8; | ^^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![warn(overflowing_literals)] warning: literal out of range for i8 --> $DIR/type-overflow.rs:10:16 | -LL | let fail = 0b1000_0001i8; //~WARNING literal out of range for i8 +LL | let fail = 0b1000_0001i8; | ^^^^^^^^^^^^^ help: consider using `u8` instead: `0b1000_0001u8` | = note: the literal `0b1000_0001i8` (decimal `129`) does not fit into an `i8` and will become `-127i8` @@ -21,7 +21,7 @@ LL | let fail = 0b1000_0001i8; //~WARNING literal out of range for i8 warning: literal out of range for i64 --> $DIR/type-overflow.rs:12:16 | -LL | let fail = 0x8000_0000_0000_0000i64; //~WARNING literal out of range for i64 +LL | let fail = 0x8000_0000_0000_0000i64; | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `u64` instead: `0x8000_0000_0000_0000u64` | = note: the literal `0x8000_0000_0000_0000i64` (decimal `9223372036854775808`) does not fit into an `i64` and will become `-9223372036854775808i64` @@ -29,7 +29,7 @@ LL | let fail = 0x8000_0000_0000_0000i64; //~WARNING literal out of range fo warning: literal out of range for u32 --> $DIR/type-overflow.rs:14:16 | -LL | let fail = 0x1_FFFF_FFFFu32; //~WARNING literal out of range for u32 +LL | let fail = 0x1_FFFF_FFFFu32; | ^^^^^^^^^^^^^^^^ help: consider using `u64` instead: `0x1_FFFF_FFFFu64` | = note: the literal `0x1_FFFF_FFFFu32` (decimal `8589934591`) does not fit into an `u32` and will become `4294967295u32` @@ -46,7 +46,7 @@ LL | let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000; warning: literal out of range for i32 --> $DIR/type-overflow.rs:19:16 | -LL | let fail = 0x8FFF_FFFF_FFFF_FFFE; //~WARNING literal out of range for i32 +LL | let fail = 0x8FFF_FFFF_FFFF_FFFE; | ^^^^^^^^^^^^^^^^^^^^^ | = note: the literal `0x8FFF_FFFF_FFFF_FFFE` (decimal `10376293541461622782`) does not fit into an `i32` and will become `-2i32` @@ -55,7 +55,7 @@ LL | let fail = 0x8FFF_FFFF_FFFF_FFFE; //~WARNING literal out of range for i warning: literal out of range for i8 --> $DIR/type-overflow.rs:21:17 | -LL | let fail = -0b1111_1111i8; //~WARNING literal out of range for i8 +LL | let fail = -0b1111_1111i8; | ^^^^^^^^^^^^^ help: consider using `i16` instead: `0b1111_1111i16` | = note: the literal `0b1111_1111i8` (decimal `255`) does not fit into an `i8` and will become `-1i8` diff --git a/src/test/ui/lint/unused_labels.stderr b/src/test/ui/lint/unused_labels.stderr index 39d0a7850efa..08f8548e0493 100644 --- a/src/test/ui/lint/unused_labels.stderr +++ b/src/test/ui/lint/unused_labels.stderr @@ -57,7 +57,7 @@ warning: label name `'many_used_shadowed` shadows a label name that is already i | LL | 'many_used_shadowed: for _ in 0..10 { | ------------------- first declared here -LL | //~^ WARN unused label +LL | LL | 'many_used_shadowed: for _ in 0..10 { | ^^^^^^^^^^^^^^^^^^^ lifetime 'many_used_shadowed already in scope diff --git a/src/test/ui/liveness/liveness-closure-require-ret.stderr b/src/test/ui/liveness/liveness-closure-require-ret.stderr index 3133efdedd76..e8f185a5cb27 100644 --- a/src/test/ui/liveness/liveness-closure-require-ret.stderr +++ b/src/test/ui/liveness/liveness-closure-require-ret.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/liveness-closure-require-ret.rs:2:37 | -LL | fn main() { println!("{}", force(|| {})); } //~ ERROR mismatched types +LL | fn main() { println!("{}", force(|| {})); } | ^^ expected isize, found () | = note: expected type `isize` diff --git a/src/test/ui/liveness/liveness-dead.stderr b/src/test/ui/liveness/liveness-dead.stderr index c89135e5135f..d054b1d497e5 100644 --- a/src/test/ui/liveness/liveness-dead.stderr +++ b/src/test/ui/liveness/liveness-dead.stderr @@ -1,7 +1,7 @@ error: value assigned to `x` is never read --> $DIR/liveness-dead.rs:9:13 | -LL | let mut x: isize = 3; //~ ERROR: value assigned to `x` is never read +LL | let mut x: isize = 3; | ^ | note: lint level defined here @@ -14,7 +14,7 @@ LL | #![deny(unused_assignments)] error: value assigned to `x` is never read --> $DIR/liveness-dead.rs:17:5 | -LL | x = 4; //~ ERROR: value assigned to `x` is never read +LL | x = 4; | ^ | = help: maybe it is overwritten before being read? @@ -22,7 +22,7 @@ LL | x = 4; //~ ERROR: value assigned to `x` is never read error: value passed to `x` is never read --> $DIR/liveness-dead.rs:20:11 | -LL | fn f4(mut x: i32) { //~ ERROR: value passed to `x` is never read +LL | fn f4(mut x: i32) { | ^ | = help: maybe it is overwritten before being read? @@ -30,7 +30,7 @@ LL | fn f4(mut x: i32) { //~ ERROR: value passed to `x` is never read error: value assigned to `x` is never read --> $DIR/liveness-dead.rs:27:5 | -LL | x = 4; //~ ERROR: value assigned to `x` is never read +LL | x = 4; | ^ | = help: maybe it is overwritten before being read? diff --git a/src/test/ui/liveness/liveness-issue-2163.stderr b/src/test/ui/liveness/liveness-issue-2163.stderr index e91994d9a229..780a2548f1f8 100644 --- a/src/test/ui/liveness/liveness-issue-2163.stderr +++ b/src/test/ui/liveness/liveness-issue-2163.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | a.iter().all(|_| -> bool { | ______________________________^ -LL | | //~^ ERROR mismatched types +LL | | LL | | }); | |_____^ expected bool, found () | diff --git a/src/test/ui/liveness/liveness-missing-ret2.stderr b/src/test/ui/liveness/liveness-missing-ret2.stderr index 58d0249ee3b2..ab7d411880bb 100644 --- a/src/test/ui/liveness/liveness-missing-ret2.stderr +++ b/src/test/ui/liveness/liveness-missing-ret2.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/liveness-missing-ret2.rs:1:11 | -LL | fn f() -> isize { //~ ERROR mismatched types +LL | fn f() -> isize { | - ^^^^^ expected isize, found () | | | this function's body doesn't return diff --git a/src/test/ui/liveness/liveness-move-call-arg.nll.stderr b/src/test/ui/liveness/liveness-move-call-arg.nll.stderr index 521304d56055..ab4460a32684 100644 --- a/src/test/ui/liveness/liveness-move-call-arg.nll.stderr +++ b/src/test/ui/liveness/liveness-move-call-arg.nll.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `x` LL | let x: Box = box 25; | - move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait LL | loop { -LL | take(x); //~ ERROR use of moved value: `x` +LL | take(x); | ^ value moved here, in previous iteration of loop error: aborting due to previous error diff --git a/src/test/ui/liveness/liveness-move-call-arg.stderr b/src/test/ui/liveness/liveness-move-call-arg.stderr index 21d285463e38..c50c01e2a9e6 100644 --- a/src/test/ui/liveness/liveness-move-call-arg.stderr +++ b/src/test/ui/liveness/liveness-move-call-arg.stderr @@ -1,7 +1,7 @@ error[E0382]: use of moved value: `x` --> $DIR/liveness-move-call-arg.rs:9:14 | -LL | take(x); //~ ERROR use of moved value: `x` +LL | take(x); | ^ value moved here in previous iteration of loop | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/liveness/liveness-move-in-loop.nll.stderr b/src/test/ui/liveness/liveness-move-in-loop.nll.stderr index b7e973bc9140..150c1ec82b83 100644 --- a/src/test/ui/liveness/liveness-move-in-loop.nll.stderr +++ b/src/test/ui/liveness/liveness-move-in-loop.nll.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `y` LL | let y: Box = box 42; | - move occurs because `y` has type `std::boxed::Box`, which does not implement the `Copy` trait ... -LL | x = y; //~ ERROR use of moved value +LL | x = y; | ^ value moved here, in previous iteration of loop error: aborting due to previous error diff --git a/src/test/ui/liveness/liveness-move-in-loop.stderr b/src/test/ui/liveness/liveness-move-in-loop.stderr index d00c2d6ac35e..52e83a6a68f2 100644 --- a/src/test/ui/liveness/liveness-move-in-loop.stderr +++ b/src/test/ui/liveness/liveness-move-in-loop.stderr @@ -1,7 +1,7 @@ error[E0382]: use of moved value: `y` --> $DIR/liveness-move-in-loop.rs:11:25 | -LL | x = y; //~ ERROR use of moved value +LL | x = y; | ^ value moved here in previous iteration of loop | = note: move occurs because `y` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/liveness/liveness-move-in-while.nll.stderr b/src/test/ui/liveness/liveness-move-in-while.nll.stderr index 167dcc6b6437..e1eed1b59f47 100644 --- a/src/test/ui/liveness/liveness-move-in-while.nll.stderr +++ b/src/test/ui/liveness/liveness-move-in-while.nll.stderr @@ -4,7 +4,7 @@ error[E0382]: borrow of moved value: `y` LL | let y: Box = box 42; | - move occurs because `y` has type `std::boxed::Box`, which does not implement the `Copy` trait ... -LL | println!("{}", y); //~ ERROR use of moved value: `y` +LL | println!("{}", y); | ^ value borrowed here after move LL | while true { while true { while true { x = y; x.clone(); } } } | - value moved here, in previous iteration of loop diff --git a/src/test/ui/liveness/liveness-move-in-while.stderr b/src/test/ui/liveness/liveness-move-in-while.stderr index 91f722cb4228..61b4cd8c630e 100644 --- a/src/test/ui/liveness/liveness-move-in-while.stderr +++ b/src/test/ui/liveness/liveness-move-in-while.stderr @@ -1,7 +1,7 @@ error[E0382]: use of moved value: `y` --> $DIR/liveness-move-in-while.rs:7:24 | -LL | println!("{}", y); //~ ERROR use of moved value: `y` +LL | println!("{}", y); | ^ value used here after move LL | while true { while true { while true { x = y; x.clone(); } } } | - value moved here diff --git a/src/test/ui/liveness/liveness-return-last-stmt-semi.stderr b/src/test/ui/liveness/liveness-return-last-stmt-semi.stderr index c6d166d8b31a..a5d9734c069e 100644 --- a/src/test/ui/liveness/liveness-return-last-stmt-semi.stderr +++ b/src/test/ui/liveness/liveness-return-last-stmt-semi.stderr @@ -16,7 +16,7 @@ LL | test!(); error[E0308]: mismatched types --> $DIR/liveness-return-last-stmt-semi.rs:7:19 | -LL | fn no_return() -> i32 {} //~ ERROR mismatched types +LL | fn no_return() -> i32 {} | --------- ^^^ expected i32, found () | | | this function's body doesn't return @@ -27,7 +27,7 @@ LL | fn no_return() -> i32 {} //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/liveness-return-last-stmt-semi.rs:9:19 | -LL | fn bar(x: u32) -> u32 { //~ ERROR mismatched types +LL | fn bar(x: u32) -> u32 { | --- ^^^ expected u32, found () | | | this function's body doesn't return @@ -40,7 +40,7 @@ LL | x * 2; error[E0308]: mismatched types --> $DIR/liveness-return-last-stmt-semi.rs:13:19 | -LL | fn baz(x: u64) -> u32 { //~ ERROR mismatched types +LL | fn baz(x: u64) -> u32 { | --- ^^^ expected u32, found () | | | this function's body doesn't return diff --git a/src/test/ui/liveness/liveness-unused.stderr b/src/test/ui/liveness/liveness-unused.stderr index 49795faa59c8..d6077111f71b 100644 --- a/src/test/ui/liveness/liveness-unused.stderr +++ b/src/test/ui/liveness/liveness-unused.stderr @@ -1,7 +1,7 @@ warning: unreachable statement --> $DIR/liveness-unused.rs:92:9 | -LL | drop(*x as i32); //~ WARNING unreachable statement +LL | drop(*x as i32); | ^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -105,7 +105,7 @@ LL | let x; error: value assigned to `x` is never read --> $DIR/liveness-unused.rs:116:9 | -LL | x = 0; //~ ERROR value assigned to `x` is never read +LL | x = 0; | ^ | = help: maybe it is overwritten before being read? diff --git a/src/test/ui/liveness/liveness-use-after-move.nll.stderr b/src/test/ui/liveness/liveness-use-after-move.nll.stderr index 36c25882ccd4..383b89afaa75 100644 --- a/src/test/ui/liveness/liveness-use-after-move.nll.stderr +++ b/src/test/ui/liveness/liveness-use-after-move.nll.stderr @@ -5,7 +5,7 @@ LL | let x: Box<_> = box 5; | - move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait LL | let y = x; | - value moved here -LL | println!("{}", *x); //~ ERROR use of moved value: `*x` +LL | println!("{}", *x); | ^^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/liveness/liveness-use-after-move.stderr b/src/test/ui/liveness/liveness-use-after-move.stderr index 62475943d0e3..ce192ae05f01 100644 --- a/src/test/ui/liveness/liveness-use-after-move.stderr +++ b/src/test/ui/liveness/liveness-use-after-move.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `*x` | LL | let y = x; | - value moved here -LL | println!("{}", *x); //~ ERROR use of moved value: `*x` +LL | println!("{}", *x); | ^^ value used here after move | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/liveness/liveness-use-after-send.nll.stderr b/src/test/ui/liveness/liveness-use-after-send.nll.stderr index d9367c871165..ccf9499f6440 100644 --- a/src/test/ui/liveness/liveness-use-after-send.nll.stderr +++ b/src/test/ui/liveness/liveness-use-after-send.nll.stderr @@ -5,7 +5,7 @@ LL | fn test00_start(ch: Chan>, message: Box, _count: Box`, which does not implement the `Copy` trait LL | send(ch, message); | ------- value moved here -LL | println!("{}", message); //~ ERROR use of moved value: `message` +LL | println!("{}", message); | ^^^^^^^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/liveness/liveness-use-after-send.stderr b/src/test/ui/liveness/liveness-use-after-send.stderr index 1fdb1d3ec39b..28173285fb45 100644 --- a/src/test/ui/liveness/liveness-use-after-send.stderr +++ b/src/test/ui/liveness/liveness-use-after-send.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `message` | LL | send(ch, message); | ------- value moved here -LL | println!("{}", message); //~ ERROR use of moved value: `message` +LL | println!("{}", message); | ^^^^^^^ value used here after move | = note: move occurs because `message` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/loops/loop-break-value-no-repeat.stderr b/src/test/ui/loops/loop-break-value-no-repeat.stderr index f5c6544a815a..066dce531a54 100644 --- a/src/test/ui/loops/loop-break-value-no-repeat.stderr +++ b/src/test/ui/loops/loop-break-value-no-repeat.stderr @@ -1,11 +1,11 @@ error[E0571]: `break` with value from a `for` loop --> $DIR/loop-break-value-no-repeat.rs:12:9 | -LL | break 22 //~ ERROR `break` with value from a `for` loop +LL | break 22 | ^^^^^^^^ can only break with a value inside `loop` or breakable block help: instead, use `break` on its own without a value inside this `for` loop | -LL | break //~ ERROR `break` with value from a `for` loop +LL | break | ^^^^^ error: aborting due to previous error diff --git a/src/test/ui/loops/loop-break-value.stderr b/src/test/ui/loops/loop-break-value.stderr index 3e009c007e08..8823eecab646 100644 --- a/src/test/ui/loops/loop-break-value.stderr +++ b/src/test/ui/loops/loop-break-value.stderr @@ -1,11 +1,11 @@ error[E0571]: `break` with value from a `while` loop --> $DIR/loop-break-value.rs:28:9 | -LL | break (); //~ ERROR `break` with value from a `while` loop +LL | break (); | ^^^^^^^^ can only break with a value inside `loop` or breakable block help: instead, use `break` on its own without a value inside this `while` loop | -LL | break; //~ ERROR `break` with value from a `while` loop +LL | break; | ^^^^^ error[E0571]: `break` with value from a `while` loop @@ -21,11 +21,11 @@ LL | break; error[E0571]: `break` with value from a `while let` loop --> $DIR/loop-break-value.rs:38:12 | -LL | if break () { //~ ERROR `break` with value from a `while let` loop +LL | if break () { | ^^^^^^^^ can only break with a value inside `loop` or breakable block help: instead, use `break` on its own without a value inside this `while let` loop | -LL | if break { //~ ERROR `break` with value from a `while let` loop +LL | if break { | ^^^^^ error[E0571]: `break` with value from a `while let` loop @@ -51,11 +51,11 @@ LL | break; error[E0571]: `break` with value from a `for` loop --> $DIR/loop-break-value.rs:56:9 | -LL | break (); //~ ERROR `break` with value from a `for` loop +LL | break (); | ^^^^^^^^ can only break with a value inside `loop` or breakable block help: instead, use `break` on its own without a value inside this `for` loop | -LL | break; //~ ERROR `break` with value from a `for` loop +LL | break; | ^^^^^ error[E0571]: `break` with value from a `for` loop @@ -90,7 +90,7 @@ LL | let val: ! = loop { break break; }; error[E0308]: mismatched types --> $DIR/loop-break-value.rs:11:19 | -LL | break 123; //~ ERROR mismatched types +LL | break 123; | ^^^ expected &str, found integer | = note: expected type `&str` @@ -99,7 +99,7 @@ LL | break 123; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/loop-break-value.rs:16:15 | -LL | break "asdf"; //~ ERROR mismatched types +LL | break "asdf"; | ^^^^^^ expected i32, found reference | = note: expected type `i32` @@ -108,7 +108,7 @@ LL | break "asdf"; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/loop-break-value.rs:21:31 | -LL | break 'outer_loop "nope"; //~ ERROR mismatched types +LL | break 'outer_loop "nope"; | ^^^^^^ expected i32, found reference | = note: expected type `i32` @@ -117,7 +117,7 @@ LL | break 'outer_loop "nope"; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/loop-break-value.rs:73:26 | -LL | break 'c 123; //~ ERROR mismatched types +LL | break 'c 123; | ^^^ expected (), found integer | = note: expected type `()` @@ -126,7 +126,7 @@ LL | break 'c 123; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/loop-break-value.rs:80:15 | -LL | break (break, break); //~ ERROR mismatched types +LL | break (break, break); | ^^^^^^^^^^^^^^ expected (), found tuple | = note: expected type `()` @@ -135,7 +135,7 @@ LL | break (break, break); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/loop-break-value.rs:85:15 | -LL | break 2; //~ ERROR mismatched types +LL | break 2; | ^ expected (), found integer | = note: expected type `()` @@ -144,7 +144,7 @@ LL | break 2; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/loop-break-value.rs:90:9 | -LL | break; //~ ERROR mismatched types +LL | break; | ^^^^^ expected (), found integer | = note: expected type `()` diff --git a/src/test/ui/loops/loop-labeled-break-value.stderr b/src/test/ui/loops/loop-labeled-break-value.stderr index 5cfd86ea5047..ad7cb4b0c2e5 100644 --- a/src/test/ui/loops/loop-labeled-break-value.stderr +++ b/src/test/ui/loops/loop-labeled-break-value.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/loop-labeled-break-value.rs:3:29 | -LL | let _: i32 = loop { break }; //~ ERROR mismatched types +LL | let _: i32 = loop { break }; | ^^^^^ expected (), found i32 | = note: expected type `()` @@ -10,7 +10,7 @@ LL | let _: i32 = loop { break }; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/loop-labeled-break-value.rs:6:37 | -LL | let _: i32 = 'inner: loop { break 'inner }; //~ ERROR mismatched types +LL | let _: i32 = 'inner: loop { break 'inner }; | ^^^^^^^^^^^^ expected (), found i32 | = note: expected type `()` @@ -19,7 +19,7 @@ LL | let _: i32 = 'inner: loop { break 'inner }; //~ ERROR mismatched ty error[E0308]: mismatched types --> $DIR/loop-labeled-break-value.rs:9:45 | -LL | let _: i32 = 'inner2: loop { loop { break 'inner2 } }; //~ ERROR mismatched types +LL | let _: i32 = 'inner2: loop { loop { break 'inner2 } }; | ^^^^^^^^^^^^^ expected (), found i32 | = note: expected type `()` diff --git a/src/test/ui/loops/loop-proper-liveness.nll.stderr b/src/test/ui/loops/loop-proper-liveness.nll.stderr index 745f0876b404..c87720659fd7 100644 --- a/src/test/ui/loops/loop-proper-liveness.nll.stderr +++ b/src/test/ui/loops/loop-proper-liveness.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `x` --> $DIR/loop-proper-liveness.rs:9:22 | -LL | println!("{:?}", x); //~ ERROR use of possibly uninitialized variable +LL | println!("{:?}", x); | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/loops/loop-proper-liveness.stderr b/src/test/ui/loops/loop-proper-liveness.stderr index b8fb3fe00ee5..392b961fa075 100644 --- a/src/test/ui/loops/loop-proper-liveness.stderr +++ b/src/test/ui/loops/loop-proper-liveness.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/loop-proper-liveness.rs:9:22 | -LL | println!("{:?}", x); //~ ERROR use of possibly uninitialized variable +LL | println!("{:?}", x); | ^ use of possibly uninitialized `x` error: aborting due to previous error diff --git a/src/test/ui/loops/loop-properly-diverging-2.stderr b/src/test/ui/loops/loop-properly-diverging-2.stderr index 5bd088fa0114..6293fdb058a0 100644 --- a/src/test/ui/loops/loop-properly-diverging-2.stderr +++ b/src/test/ui/loops/loop-properly-diverging-2.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/loop-properly-diverging-2.rs:2:23 | -LL | let x: i32 = loop { break }; //~ ERROR mismatched types +LL | let x: i32 = loop { break }; | ^^^^^ expected (), found i32 | = note: expected type `()` diff --git a/src/test/ui/loops/loops-reject-duplicate-labels-2.stderr b/src/test/ui/loops/loops-reject-duplicate-labels-2.stderr index 4d1a29f71658..fc42449aa58b 100644 --- a/src/test/ui/loops/loops-reject-duplicate-labels-2.stderr +++ b/src/test/ui/loops/loops-reject-duplicate-labels-2.stderr @@ -3,7 +3,7 @@ warning: label name `'fl` shadows a label name that is already in scope | LL | { 'fl: for _ in 0..10 { break; } } | --- first declared here -LL | { 'fl: loop { break; } } //~ WARN label name `'fl` shadows a label name that is already in scope +LL | { 'fl: loop { break; } } | ^^^ lifetime 'fl already in scope warning: label name `'lf` shadows a label name that is already in scope @@ -11,7 +11,7 @@ warning: label name `'lf` shadows a label name that is already in scope | LL | { 'lf: loop { break; } } | --- first declared here -LL | { 'lf: for _ in 0..10 { break; } } //~ WARN label name `'lf` shadows a label name that is already in scope +LL | { 'lf: for _ in 0..10 { break; } } | ^^^ lifetime 'lf already in scope warning: label name `'wl` shadows a label name that is already in scope @@ -19,7 +19,7 @@ warning: label name `'wl` shadows a label name that is already in scope | LL | { 'wl: while 2 > 1 { break; } } | --- first declared here -LL | { 'wl: loop { break; } } //~ WARN label name `'wl` shadows a label name that is already in scope +LL | { 'wl: loop { break; } } | ^^^ lifetime 'wl already in scope warning: label name `'lw` shadows a label name that is already in scope @@ -27,7 +27,7 @@ warning: label name `'lw` shadows a label name that is already in scope | LL | { 'lw: loop { break; } } | --- first declared here -LL | { 'lw: while 2 > 1 { break; } } //~ WARN label name `'lw` shadows a label name that is already in scope +LL | { 'lw: while 2 > 1 { break; } } | ^^^ lifetime 'lw already in scope warning: label name `'fw` shadows a label name that is already in scope @@ -35,7 +35,7 @@ warning: label name `'fw` shadows a label name that is already in scope | LL | { 'fw: for _ in 0..10 { break; } } | --- first declared here -LL | { 'fw: while 2 > 1 { break; } } //~ WARN label name `'fw` shadows a label name that is already in scope +LL | { 'fw: while 2 > 1 { break; } } | ^^^ lifetime 'fw already in scope warning: label name `'wf` shadows a label name that is already in scope @@ -43,7 +43,7 @@ warning: label name `'wf` shadows a label name that is already in scope | LL | { 'wf: while 2 > 1 { break; } } | --- first declared here -LL | { 'wf: for _ in 0..10 { break; } } //~ WARN label name `'wf` shadows a label name that is already in scope +LL | { 'wf: for _ in 0..10 { break; } } | ^^^ lifetime 'wf already in scope warning: label name `'tl` shadows a label name that is already in scope @@ -51,7 +51,7 @@ warning: label name `'tl` shadows a label name that is already in scope | LL | { 'tl: while let Some(_) = None:: { break; } } | --- first declared here -LL | { 'tl: loop { break; } } //~ WARN label name `'tl` shadows a label name that is already in scope +LL | { 'tl: loop { break; } } | ^^^ lifetime 'tl already in scope warning: label name `'lt` shadows a label name that is already in scope diff --git a/src/test/ui/loops/loops-reject-duplicate-labels.stderr b/src/test/ui/loops/loops-reject-duplicate-labels.stderr index f9a19ad57f04..4574c5ca0bd5 100644 --- a/src/test/ui/loops/loops-reject-duplicate-labels.stderr +++ b/src/test/ui/loops/loops-reject-duplicate-labels.stderr @@ -3,7 +3,7 @@ warning: label name `'fl` shadows a label name that is already in scope | LL | 'fl: for _ in 0..10 { break; } | --- first declared here -LL | 'fl: loop { break; } //~ WARN label name `'fl` shadows a label name that is already in scope +LL | 'fl: loop { break; } | ^^^ lifetime 'fl already in scope warning: label name `'lf` shadows a label name that is already in scope @@ -11,7 +11,7 @@ warning: label name `'lf` shadows a label name that is already in scope | LL | 'lf: loop { break; } | --- first declared here -LL | 'lf: for _ in 0..10 { break; } //~ WARN label name `'lf` shadows a label name that is already in scope +LL | 'lf: for _ in 0..10 { break; } | ^^^ lifetime 'lf already in scope warning: label name `'wl` shadows a label name that is already in scope @@ -19,7 +19,7 @@ warning: label name `'wl` shadows a label name that is already in scope | LL | 'wl: while 2 > 1 { break; } | --- first declared here -LL | 'wl: loop { break; } //~ WARN label name `'wl` shadows a label name that is already in scope +LL | 'wl: loop { break; } | ^^^ lifetime 'wl already in scope warning: label name `'lw` shadows a label name that is already in scope @@ -27,7 +27,7 @@ warning: label name `'lw` shadows a label name that is already in scope | LL | 'lw: loop { break; } | --- first declared here -LL | 'lw: while 2 > 1 { break; } //~ WARN label name `'lw` shadows a label name that is already in scope +LL | 'lw: while 2 > 1 { break; } | ^^^ lifetime 'lw already in scope warning: label name `'fw` shadows a label name that is already in scope @@ -35,7 +35,7 @@ warning: label name `'fw` shadows a label name that is already in scope | LL | 'fw: for _ in 0..10 { break; } | --- first declared here -LL | 'fw: while 2 > 1 { break; } //~ WARN label name `'fw` shadows a label name that is already in scope +LL | 'fw: while 2 > 1 { break; } | ^^^ lifetime 'fw already in scope warning: label name `'wf` shadows a label name that is already in scope @@ -43,7 +43,7 @@ warning: label name `'wf` shadows a label name that is already in scope | LL | 'wf: while 2 > 1 { break; } | --- first declared here -LL | 'wf: for _ in 0..10 { break; } //~ WARN label name `'wf` shadows a label name that is already in scope +LL | 'wf: for _ in 0..10 { break; } | ^^^ lifetime 'wf already in scope warning: label name `'tl` shadows a label name that is already in scope @@ -51,7 +51,7 @@ warning: label name `'tl` shadows a label name that is already in scope | LL | 'tl: while let Some(_) = None:: { break; } | --- first declared here -LL | 'tl: loop { break; } //~ WARN label name `'tl` shadows a label name that is already in scope +LL | 'tl: loop { break; } | ^^^ lifetime 'tl already in scope warning: label name `'lt` shadows a label name that is already in scope diff --git a/src/test/ui/lub-glb/old-lub-glb-hr.stderr b/src/test/ui/lub-glb/old-lub-glb-hr.stderr index 8f228ea4cad4..475c1801ca12 100644 --- a/src/test/ui/lub-glb/old-lub-glb-hr.stderr +++ b/src/test/ui/lub-glb/old-lub-glb-hr.stderr @@ -5,7 +5,7 @@ LL | let z = match 22 { | _____________- LL | | 0 => x, | | - this is found to be of type `for<'r, 's> fn(&'r u8, &'s u8)` -LL | | _ => y, //~ ERROR match arms have incompatible types +LL | | _ => y, | | ^ expected bound lifetime parameter, found concrete lifetime LL | | }; | |_____- `match` arms have incompatible types diff --git a/src/test/ui/lub-glb/old-lub-glb-object.stderr b/src/test/ui/lub-glb/old-lub-glb-object.stderr index 056f9131dd21..e02ede399e6a 100644 --- a/src/test/ui/lub-glb/old-lub-glb-object.stderr +++ b/src/test/ui/lub-glb/old-lub-glb-object.stderr @@ -5,7 +5,7 @@ LL | let z = match 22 { | _____________- LL | | 0 => x, | | - this is found to be of type `&dyn for<'a, 'b> Foo<&'a u8, &'b u8>` -LL | | _ => y, //~ ERROR match arms have incompatible types +LL | | _ => y, | | ^ expected bound lifetime parameter 'a, found concrete lifetime LL | | }; | |_____- `match` arms have incompatible types diff --git a/src/test/ui/lub-if.stderr b/src/test/ui/lub-if.stderr index 2cf12ba60414..26f756c91833 100644 --- a/src/test/ui/lub-if.stderr +++ b/src/test/ui/lub-if.stderr @@ -1,7 +1,7 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... --> $DIR/lub-if.rs:28:9 | -LL | s //~ ERROR E0312 +LL | s | ^ | = note: ...the reference is valid for the static lifetime... @@ -14,7 +14,7 @@ LL | pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { error[E0312]: lifetime of reference outlives lifetime of borrowed content... --> $DIR/lub-if.rs:35:9 | -LL | s //~ ERROR E0312 +LL | s | ^ | = note: ...the reference is valid for the static lifetime... diff --git a/src/test/ui/lub-match.stderr b/src/test/ui/lub-match.stderr index 0db27f91717b..0cb0a23c6f2d 100644 --- a/src/test/ui/lub-match.stderr +++ b/src/test/ui/lub-match.stderr @@ -1,7 +1,7 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... --> $DIR/lub-match.rs:30:13 | -LL | s //~ ERROR E0312 +LL | s | ^ | = note: ...the reference is valid for the static lifetime... @@ -14,7 +14,7 @@ LL | pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { error[E0312]: lifetime of reference outlives lifetime of borrowed content... --> $DIR/lub-match.rs:39:13 | -LL | s //~ ERROR E0312 +LL | s | ^ | = note: ...the reference is valid for the static lifetime... diff --git a/src/test/ui/macros/ambiguity-legacy-vs-modern.stderr b/src/test/ui/macros/ambiguity-legacy-vs-modern.stderr index 2785594585dd..d9a0a9f00543 100644 --- a/src/test/ui/macros/ambiguity-legacy-vs-modern.stderr +++ b/src/test/ui/macros/ambiguity-legacy-vs-modern.stderr @@ -1,7 +1,7 @@ error[E0659]: `m` is ambiguous (`macro_rules` vs non-`macro_rules` from other module) --> $DIR/ambiguity-legacy-vs-modern.rs:31:9 | -LL | m!() //~ ERROR `m` is ambiguous +LL | m!() | ^ ambiguous name | note: `m` could refer to the macro defined here @@ -18,7 +18,7 @@ LL | macro m() { 0 } error[E0659]: `m` is ambiguous (`macro_rules` vs non-`macro_rules` from other module) --> $DIR/ambiguity-legacy-vs-modern.rs:43:5 | -LL | m!() //~ ERROR `m` is ambiguous +LL | m!() | ^ ambiguous name | note: `m` could refer to the macro defined here diff --git a/src/test/ui/macros/assert.stderr b/src/test/ui/macros/assert.stderr index 2cfcebabcb93..fa604506b946 100644 --- a/src/test/ui/macros/assert.stderr +++ b/src/test/ui/macros/assert.stderr @@ -1,19 +1,19 @@ error: macro requires a boolean expression as an argument --> $DIR/assert.rs:2:5 | -LL | assert!(); //~ ERROR requires a boolean expression +LL | assert!(); | ^^^^^^^^^^ boolean expression required error: expected expression, found keyword `struct` --> $DIR/assert.rs:3:13 | -LL | assert!(struct); //~ ERROR expected expression +LL | assert!(struct); | ^^^^^^ expected expression error: macro requires a boolean expression as an argument --> $DIR/assert.rs:4:5 | -LL | debug_assert!(); //~ ERROR requires a boolean expression +LL | debug_assert!(); | ^^^^^^^^^^^^^^^^ boolean expression required | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) @@ -21,7 +21,7 @@ LL | debug_assert!(); //~ ERROR requires a boolean expression error: expected expression, found keyword `struct` --> $DIR/assert.rs:5:19 | -LL | debug_assert!(struct); //~ ERROR expected expression +LL | debug_assert!(struct); | ^^^^^^ expected expression error: aborting due to 4 previous errors diff --git a/src/test/ui/macros/cfg.stderr b/src/test/ui/macros/cfg.stderr index a7aca88f3e56..0fdb62922a75 100644 --- a/src/test/ui/macros/cfg.stderr +++ b/src/test/ui/macros/cfg.stderr @@ -1,19 +1,19 @@ error: macro requires a cfg-pattern as an argument --> $DIR/cfg.rs:2:5 | -LL | cfg!(); //~ ERROR macro requires a cfg-pattern +LL | cfg!(); | ^^^^^^^ cfg-pattern required error: expected identifier, found `123` --> $DIR/cfg.rs:3:10 | -LL | cfg!(123); //~ ERROR expected identifier +LL | cfg!(123); | ^^^ expected identifier error[E0565]: literal in `cfg` predicate value must be a string --> $DIR/cfg.rs:4:16 | -LL | cfg!(foo = 123); //~ ERROR literal in `cfg` predicate value must be a string +LL | cfg!(foo = 123); | ^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/macros/format-foreign.stderr b/src/test/ui/macros/format-foreign.stderr index 0b8bfcbdc17b..87cadada3c78 100644 --- a/src/test/ui/macros/format-foreign.stderr +++ b/src/test/ui/macros/format-foreign.stderr @@ -1,7 +1,7 @@ error: multiple unused formatting arguments --> $DIR/format-foreign.rs:2:30 | -LL | println!("%.*3$s %s!/n", "Hello,", "World", 4); //~ ERROR multiple unused formatting arguments +LL | println!("%.*3$s %s!/n", "Hello,", "World", 4); | -------------- ^^^^^^^^ ^^^^^^^ ^ argument never used | | | | | | | argument never used @@ -11,13 +11,13 @@ LL | println!("%.*3$s %s!/n", "Hello,", "World", 4); //~ ERROR multiple unus = note: printf formatting not supported; see the documentation for `std::fmt` help: format specifiers use curly braces | -LL | println!("{:.2$} {}!/n", "Hello,", "World", 4); //~ ERROR multiple unused formatting arguments +LL | println!("{:.2$} {}!/n", "Hello,", "World", 4); | ^^^^^^ ^^ error: argument never used --> $DIR/format-foreign.rs:3:29 | -LL | println!("%1$*2$.*3$f", 123.456); //~ ERROR never used +LL | println!("%1$*2$.*3$f", 123.456); | ----------- ^^^^^^^ argument never used | | | help: format specifiers use curly braces: `{0:1$.2$}` @@ -47,7 +47,7 @@ LL | {}!/n error: argument never used --> $DIR/format-foreign.rs:12:30 | -LL | println!("{} %f", "one", 2.0); //~ ERROR never used +LL | println!("{} %f", "one", 2.0); | ------- ^^^ argument never used | | | formatting specifier missing @@ -55,7 +55,7 @@ LL | println!("{} %f", "one", 2.0); //~ ERROR never used error: named argument never used --> $DIR/format-foreign.rs:14:39 | -LL | println!("Hi there, $NAME.", NAME="Tim"); //~ ERROR never used +LL | println!("Hi there, $NAME.", NAME="Tim"); | ----- ^^^^^ named argument never used | | | help: format specifiers use curly braces: `{NAME}` diff --git a/src/test/ui/macros/format-parse-errors.stderr b/src/test/ui/macros/format-parse-errors.stderr index a3d2786bce11..b634cf2d9944 100644 --- a/src/test/ui/macros/format-parse-errors.stderr +++ b/src/test/ui/macros/format-parse-errors.stderr @@ -1,7 +1,7 @@ error: requires at least a format string argument --> $DIR/format-parse-errors.rs:2:5 | -LL | format!(); //~ ERROR requires at least a format string argument +LL | format!(); | ^^^^^^^^^^ | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) @@ -9,41 +9,41 @@ LL | format!(); //~ ERROR requires at least a format string argument error: expected expression, found keyword `struct` --> $DIR/format-parse-errors.rs:3:13 | -LL | format!(struct); //~ ERROR expected expression +LL | format!(struct); | ^^^^^^ expected expression error: expected expression, found `` --> $DIR/format-parse-errors.rs:4:23 | -LL | format!("s", name =); //~ ERROR expected expression +LL | format!("s", name =); | ^ expected expression error: expected `=`, found `` --> $DIR/format-parse-errors.rs:5:29 | -LL | format!("s", foo = foo, bar); //~ ERROR expected `=` +LL | format!("s", foo = foo, bar); | ^^^ expected `=` error: expected expression, found keyword `struct` --> $DIR/format-parse-errors.rs:6:24 | -LL | format!("s", foo = struct); //~ ERROR expected expression +LL | format!("s", foo = struct); | ^^^^^^ expected expression error: expected expression, found keyword `struct` --> $DIR/format-parse-errors.rs:7:18 | -LL | format!("s", struct); //~ ERROR expected expression +LL | format!("s", struct); | ^^^^^^ expected expression error: format argument must be a string literal --> $DIR/format-parse-errors.rs:10:13 | -LL | format!(123); //~ ERROR format argument must be a string literal +LL | format!(123); | ^^^ help: you might be missing a string literal to format with | -LL | format!("{}", 123); //~ ERROR format argument must be a string literal +LL | format!("{}", 123); | ^^^^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/macros/format-unused-lables.stderr b/src/test/ui/macros/format-unused-lables.stderr index 0a5e379a4adb..7423c7b7c8b4 100644 --- a/src/test/ui/macros/format-unused-lables.stderr +++ b/src/test/ui/macros/format-unused-lables.stderr @@ -13,7 +13,7 @@ error: multiple unused formatting arguments | LL | println!("Test2", | ------- multiple missing formatting specifiers -LL | 123, //~ ERROR multiple unused formatting arguments +LL | 123, | ^^^ argument never used LL | 456, | ^^^ argument never used @@ -23,7 +23,7 @@ LL | 789 error: named argument never used --> $DIR/format-unused-lables.rs:11:35 | -LL | println!("Some stuff", UNUSED="args"); //~ ERROR named argument never used +LL | println!("Some stuff", UNUSED="args"); | ------------ ^^^^^^ named argument never used | | | formatting specifier missing @@ -36,7 +36,7 @@ LL | println!("Some more $STUFF", | | | | | help: format specifiers use curly braces: `{STUFF}` | multiple missing formatting specifiers -LL | "woo!", //~ ERROR multiple unused formatting arguments +LL | "woo!", | ^^^^^^ argument never used LL | STUFF= LL | "things" diff --git a/src/test/ui/macros/global-asm.stderr b/src/test/ui/macros/global-asm.stderr index 94664c96db39..c43bf83fe191 100644 --- a/src/test/ui/macros/global-asm.stderr +++ b/src/test/ui/macros/global-asm.stderr @@ -1,19 +1,19 @@ error: macro requires a string literal as an argument --> $DIR/global-asm.rs:4:5 | -LL | global_asm!(); //~ ERROR requires a string literal as an argument +LL | global_asm!(); | ^^^^^^^^^^^^^^ string literal required error: expected expression, found keyword `struct` --> $DIR/global-asm.rs:5:17 | -LL | global_asm!(struct); //~ ERROR expected expression +LL | global_asm!(struct); | ^^^^^^ expected expression error: inline assembly must be a string literal --> $DIR/global-asm.rs:6:17 | -LL | global_asm!(123); //~ ERROR inline assembly must be a string literal +LL | global_asm!(123); | ^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/macros/issue-54441.stderr b/src/test/ui/macros/issue-54441.stderr index e27056b412a0..b0fafdc3b632 100644 --- a/src/test/ui/macros/issue-54441.stderr +++ b/src/test/ui/macros/issue-54441.stderr @@ -1,7 +1,7 @@ error: expected one of `crate`, `fn`, `pub`, `static`, or `type`, found `let` --> $DIR/issue-54441.rs:5:9 | -LL | let //~ ERROR expected +LL | let | ^^^ unexpected token ... LL | m!(); diff --git a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr index b27b60459d63..e78f2833078c 100644 --- a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr +++ b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr @@ -1,18 +1,18 @@ error: expected `*` or `+` --> $DIR/macro-at-most-once-rep-2015-ques-rep.rs:6:10 | -LL | ($(a)?) => {} //~ERROR expected `*` or `+` +LL | ($(a)?) => {} | ^ | - = note: `?` is not a macro repetition operator + = note: `?` is not a macro repetition operator in the 2015 edition, but is accepted in the 2018 edition error: expected `*` or `+` --> $DIR/macro-at-most-once-rep-2015-ques-rep.rs:10:11 | -LL | ($(a),?) => {} //~ERROR expected `*` or `+` +LL | ($(a),?) => {} | ^ | - = note: `?` is not a macro repetition operator + = note: `?` is not a macro repetition operator in the 2015 edition, but is accepted in the 2018 edition error: aborting due to 2 previous errors diff --git a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.stderr b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.stderr index b171cf8b34df..bf1861ae5405 100644 --- a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.stderr +++ b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.stderr @@ -1,7 +1,7 @@ warning: using `?` as a separator is deprecated and will be a hard error in an upcoming edition --> $DIR/macro-at-most-once-rep-2015-ques-sep.rs:10:10 | -LL | ($(a)?*) => {} //~WARN using `?` as a separator +LL | ($(a)?*) => {} | ^ | note: lint level defined here @@ -16,7 +16,7 @@ LL | #![warn(rust_2018_compatibility)] warning: using `?` as a separator is deprecated and will be a hard error in an upcoming edition --> $DIR/macro-at-most-once-rep-2015-ques-sep.rs:15:10 | -LL | ($(a)?+) => {} //~WARN using `?` as a separator +LL | ($(a)?+) => {} | ^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! diff --git a/src/test/ui/macros/macro-at-most-once-rep-2018.stderr b/src/test/ui/macros/macro-at-most-once-rep-2018.stderr index 657c7e54d976..f285c7cc7c27 100644 --- a/src/test/ui/macros/macro-at-most-once-rep-2018.stderr +++ b/src/test/ui/macros/macro-at-most-once-rep-2018.stderr @@ -1,7 +1,7 @@ error: the `?` macro repetition operator does not take a separator --> $DIR/macro-at-most-once-rep-2018.rs:10:10 | -LL | ($(a),?) => {}; //~ERROR the `?` macro repetition operator +LL | ($(a),?) => {}; | ^ error: no rules expected the token `?` @@ -10,7 +10,7 @@ error: no rules expected the token `?` LL | macro_rules! foo { | ---------------- when calling this macro ... -LL | foo!(a?); //~ ERROR no rules expected the token `?` +LL | foo!(a?); | ^ no rules expected this token in macro call error: no rules expected the token `?` @@ -19,7 +19,7 @@ error: no rules expected the token `?` LL | macro_rules! foo { | ---------------- when calling this macro ... -LL | foo!(a?a); //~ ERROR no rules expected the token `?` +LL | foo!(a?a); | ^ no rules expected this token in macro call error: no rules expected the token `?` @@ -28,7 +28,7 @@ error: no rules expected the token `?` LL | macro_rules! foo { | ---------------- when calling this macro ... -LL | foo!(a?a?a); //~ ERROR no rules expected the token `?` +LL | foo!(a?a?a); | ^ no rules expected this token in macro call error: unexpected end of macro invocation @@ -37,7 +37,7 @@ error: unexpected end of macro invocation LL | macro_rules! barplus { | -------------------- when calling this macro ... -LL | barplus!(); //~ERROR unexpected end of macro invocation +LL | barplus!(); | ^^^^^^^^^^^ missing tokens in macro arguments error: unexpected end of macro invocation @@ -46,7 +46,7 @@ error: unexpected end of macro invocation LL | macro_rules! barplus { | -------------------- when calling this macro ... -LL | barplus!(a); //~ERROR unexpected end of macro invocation +LL | barplus!(a); | ^ missing tokens in macro arguments error: no rules expected the token `?` @@ -55,7 +55,7 @@ error: no rules expected the token `?` LL | macro_rules! barplus { | -------------------- when calling this macro ... -LL | barplus!(a?); //~ ERROR no rules expected the token `?` +LL | barplus!(a?); | ^ no rules expected this token in macro call error: no rules expected the token `?` @@ -64,7 +64,7 @@ error: no rules expected the token `?` LL | macro_rules! barplus { | -------------------- when calling this macro ... -LL | barplus!(a?a); //~ ERROR no rules expected the token `?` +LL | barplus!(a?a); | ^ no rules expected this token in macro call error: unexpected end of macro invocation @@ -73,7 +73,7 @@ error: unexpected end of macro invocation LL | macro_rules! barstar { | -------------------- when calling this macro ... -LL | barstar!(); //~ERROR unexpected end of macro invocation +LL | barstar!(); | ^^^^^^^^^^^ missing tokens in macro arguments error: unexpected end of macro invocation @@ -82,7 +82,7 @@ error: unexpected end of macro invocation LL | macro_rules! barstar { | -------------------- when calling this macro ... -LL | barstar!(a); //~ERROR unexpected end of macro invocation +LL | barstar!(a); | ^ missing tokens in macro arguments error: no rules expected the token `?` @@ -91,7 +91,7 @@ error: no rules expected the token `?` LL | macro_rules! barstar { | -------------------- when calling this macro ... -LL | barstar!(a?); //~ ERROR no rules expected the token `?` +LL | barstar!(a?); | ^ no rules expected this token in macro call error: no rules expected the token `?` @@ -100,7 +100,7 @@ error: no rules expected the token `?` LL | macro_rules! barstar { | -------------------- when calling this macro ... -LL | barstar!(a?a); //~ ERROR no rules expected the token `?` +LL | barstar!(a?a); | ^ no rules expected this token in macro call error: aborting due to 12 previous errors diff --git a/src/test/ui/macros/macro-attribute.rs b/src/test/ui/macros/macro-attribute.rs index 7ddac2745c5a..f580dfa8e34e 100644 --- a/src/test/ui/macros/macro-attribute.rs +++ b/src/test/ui/macros/macro-attribute.rs @@ -1,4 +1,2 @@ -#![feature(unrestricted_attribute_tokens)] - -#[doc = $not_there] //~ ERROR expected `]`, found `not_there` +#[doc = $not_there] //~ ERROR unexpected token: `$` fn main() { } diff --git a/src/test/ui/macros/macro-attribute.stderr b/src/test/ui/macros/macro-attribute.stderr index fd4e7252d530..aa1cd94b0c63 100644 --- a/src/test/ui/macros/macro-attribute.stderr +++ b/src/test/ui/macros/macro-attribute.stderr @@ -1,8 +1,8 @@ -error: expected `]`, found `not_there` - --> $DIR/macro-attribute.rs:3:10 +error: unexpected token: `$` + --> $DIR/macro-attribute.rs:1:7 | -LL | #[doc = $not_there] //~ ERROR expected `]`, found `not_there` - | ^^^^^^^^^ expected `]` +LL | #[doc = $not_there] + | ^ error: aborting due to previous error diff --git a/src/test/ui/macros/macro-backtrace-invalid-internals.stderr b/src/test/ui/macros/macro-backtrace-invalid-internals.stderr index 353ae1d0ea69..11a4b44eff10 100644 --- a/src/test/ui/macros/macro-backtrace-invalid-internals.stderr +++ b/src/test/ui/macros/macro-backtrace-invalid-internals.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `fake` found for type `{integer}` in the current scope --> $DIR/macro-backtrace-invalid-internals.rs:5:13 | -LL | 1.fake() //~ ERROR no method +LL | 1.fake() | ^^^^ ... LL | fake_method_stmt!(); @@ -10,7 +10,7 @@ LL | fake_method_stmt!(); error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/macro-backtrace-invalid-internals.rs:11:13 | -LL | 1.fake //~ ERROR doesn't have fields +LL | 1.fake | ^^^^ ... LL | fake_field_stmt!(); @@ -19,7 +19,7 @@ LL | fake_field_stmt!(); error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/macro-backtrace-invalid-internals.rs:17:15 | -LL | (1).0 //~ ERROR doesn't have fields +LL | (1).0 | ^ ... LL | fake_anon_field_stmt!(); @@ -28,20 +28,20 @@ LL | fake_anon_field_stmt!(); error[E0689]: can't call method `neg` on ambiguous numeric type `{float}` --> $DIR/macro-backtrace-invalid-internals.rs:41:15 | -LL | 2.0.neg() //~ ERROR can't call method `neg` on ambiguous numeric type `{float}` +LL | 2.0.neg() | ^^^ ... LL | real_method_stmt!(); | -------------------- in this macro invocation help: you must specify a concrete type for this numeric value, like `f32` | -LL | 2.0_f32.neg() //~ ERROR can't call method `neg` on ambiguous numeric type `{float}` +LL | 2.0_f32.neg() | ^^^^^^^ error[E0599]: no method named `fake` found for type `{integer}` in the current scope --> $DIR/macro-backtrace-invalid-internals.rs:23:13 | -LL | 1.fake() //~ ERROR no method +LL | 1.fake() | ^^^^ ... LL | let _ = fake_method_expr!(); @@ -50,7 +50,7 @@ LL | let _ = fake_method_expr!(); error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/macro-backtrace-invalid-internals.rs:29:13 | -LL | 1.fake //~ ERROR doesn't have fields +LL | 1.fake | ^^^^ ... LL | let _ = fake_field_expr!(); @@ -59,7 +59,7 @@ LL | let _ = fake_field_expr!(); error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/macro-backtrace-invalid-internals.rs:35:15 | -LL | (1).0 //~ ERROR doesn't have fields +LL | (1).0 | ^ ... LL | let _ = fake_anon_field_expr!(); @@ -68,14 +68,14 @@ LL | let _ = fake_anon_field_expr!(); error[E0689]: can't call method `neg` on ambiguous numeric type `{float}` --> $DIR/macro-backtrace-invalid-internals.rs:47:15 | -LL | 2.0.neg() //~ ERROR can't call method `neg` on ambiguous numeric type `{float}` +LL | 2.0.neg() | ^^^ ... LL | let _ = real_method_expr!(); | ------------------- in this macro invocation help: you must specify a concrete type for this numeric value, like `f32` | -LL | 2.0_f32.neg() //~ ERROR can't call method `neg` on ambiguous numeric type `{float}` +LL | 2.0_f32.neg() | ^^^^^^^ error: aborting due to 8 previous errors diff --git a/src/test/ui/macros/macro-backtrace-nested.stderr b/src/test/ui/macros/macro-backtrace-nested.stderr index 61a11231efef..501f525a05f7 100644 --- a/src/test/ui/macros/macro-backtrace-nested.stderr +++ b/src/test/ui/macros/macro-backtrace-nested.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `fake` in this scope --> $DIR/macro-backtrace-nested.rs:5:12 | -LL | () => (fake) //~ ERROR cannot find +LL | () => (fake) | ^^^^ not found in this scope ... LL | 1 + call_nested_expr!(); @@ -10,7 +10,7 @@ LL | 1 + call_nested_expr!(); error[E0425]: cannot find value `fake` in this scope --> $DIR/macro-backtrace-nested.rs:5:12 | -LL | () => (fake) //~ ERROR cannot find +LL | () => (fake) | ^^^^ not found in this scope ... LL | call_nested_expr_sum!(); diff --git a/src/test/ui/macros/macro-backtrace-println.stderr b/src/test/ui/macros/macro-backtrace-println.stderr index c24a88c4159f..573184b63b1e 100644 --- a/src/test/ui/macros/macro-backtrace-println.stderr +++ b/src/test/ui/macros/macro-backtrace-println.stderr @@ -1,7 +1,7 @@ error: 1 positional argument in format string, but no arguments were given --> $DIR/macro-backtrace-println.rs:14:30 | -LL | ($fmt:expr) => (myprint!(concat!($fmt, "/n"))); //~ ERROR no arguments were given +LL | ($fmt:expr) => (myprint!(concat!($fmt, "/n"))); | ^^^^^^^^^^^^^^^^^^^ ... LL | myprintln!("{}"); diff --git a/src/test/ui/macros/macro-comma-support.stderr b/src/test/ui/macros/macro-comma-support.stderr index a4bb8a9b32fb..28d064f7f5bd 100644 --- a/src/test/ui/macros/macro-comma-support.stderr +++ b/src/test/ui/macros/macro-comma-support.stderr @@ -1,13 +1,13 @@ error: lel --> $DIR/macro-comma-support.rs:6:5 | -LL | compile_error!("lel"); //~ ERROR lel +LL | compile_error!("lel"); | ^^^^^^^^^^^^^^^^^^^^^^ error: lel --> $DIR/macro-comma-support.rs:7:5 | -LL | compile_error!("lel",); //~ ERROR lel +LL | compile_error!("lel",); | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/macros/macro-context.stderr b/src/test/ui/macros/macro-context.stderr index 9a4a8e31985f..2a0779190f57 100644 --- a/src/test/ui/macros/macro-context.stderr +++ b/src/test/ui/macros/macro-context.stderr @@ -1,7 +1,7 @@ error: macro expansion ignores token `;` and any following --> $DIR/macro-context.rs:3:15 | -LL | () => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof` +LL | () => ( i ; typeof ); | ^ ... LL | let a: m!(); @@ -12,7 +12,7 @@ LL | let a: m!(); error: macro expansion ignores token `typeof` and any following --> $DIR/macro-context.rs:3:17 | -LL | () => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof` +LL | () => ( i ; typeof ); | ^^^^^^ ... LL | let i = m!(); @@ -23,7 +23,7 @@ LL | let i = m!(); error: macro expansion ignores token `;` and any following --> $DIR/macro-context.rs:3:15 | -LL | () => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof` +LL | () => ( i ; typeof ); | ^ ... LL | m!() => {} @@ -34,7 +34,7 @@ LL | m!() => {} error: expected expression, found reserved keyword `typeof` --> $DIR/macro-context.rs:3:17 | -LL | () => ( i ; typeof ); //~ ERROR expected expression, found reserved keyword `typeof` +LL | () => ( i ; typeof ); | ^^^^^^ expected expression ... LL | m!(); diff --git a/src/test/ui/macros/macro-crate-nonterminal-non-root.stderr b/src/test/ui/macros/macro-crate-nonterminal-non-root.stderr index a1af9ba17584..1eca0186da95 100644 --- a/src/test/ui/macros/macro-crate-nonterminal-non-root.stderr +++ b/src/test/ui/macros/macro-crate-nonterminal-non-root.stderr @@ -1,7 +1,7 @@ error[E0468]: an `extern crate` loading macros must be at the crate root --> $DIR/macro-crate-nonterminal-non-root.rs:5:5 | -LL | extern crate macro_crate_nonterminal; //~ ERROR must be at the crate root +LL | extern crate macro_crate_nonterminal; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/macros/macro-error.stderr b/src/test/ui/macros/macro-error.stderr index f56b67e7cd06..b3aed8c2cef2 100644 --- a/src/test/ui/macros/macro-error.stderr +++ b/src/test/ui/macros/macro-error.stderr @@ -1,13 +1,13 @@ error: macro rhs must be delimited --> $DIR/macro-error.rs:2:18 | -LL | ($a:expr) => a; //~ ERROR macro rhs must be delimited +LL | ($a:expr) => a; | ^ error: non-type macro in type position: cfg --> $DIR/macro-error.rs:8:12 | -LL | let _: cfg!(foo) = (); //~ ERROR non-type macro in type position +LL | let _: cfg!(foo) = (); | ^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/macros/macro-follow.stderr b/src/test/ui/macros/macro-follow.stderr index e3302eac4ac0..d3f081bb4a28 100644 --- a/src/test/ui/macros/macro-follow.stderr +++ b/src/test/ui/macros/macro-follow.stderr @@ -1,7 +1,7 @@ error: `$p:pat` is followed by `(`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:8:14 | -LL | ($p:pat ()) => {}; //~ERROR `$p:pat` is followed by `(` +LL | ($p:pat ()) => {}; | ^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -9,7 +9,7 @@ LL | ($p:pat ()) => {}; //~ERROR `$p:pat` is followed by `(` error: `$p:pat` is followed by `[`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:9:14 | -LL | ($p:pat []) => {}; //~ERROR `$p:pat` is followed by `[` +LL | ($p:pat []) => {}; | ^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -17,7 +17,7 @@ LL | ($p:pat []) => {}; //~ERROR `$p:pat` is followed by `[` error: `$p:pat` is followed by `{`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:10:14 | -LL | ($p:pat {}) => {}; //~ERROR `$p:pat` is followed by `{` +LL | ($p:pat {}) => {}; | ^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -25,7 +25,7 @@ LL | ($p:pat {}) => {}; //~ERROR `$p:pat` is followed by `{` error: `$p:pat` is followed by `:`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:11:13 | -LL | ($p:pat :) => {}; //~ERROR `$p:pat` is followed by `:` +LL | ($p:pat :) => {}; | ^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -33,7 +33,7 @@ LL | ($p:pat :) => {}; //~ERROR `$p:pat` is followed by `:` error: `$p:pat` is followed by `>`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:12:13 | -LL | ($p:pat >) => {}; //~ERROR `$p:pat` is followed by `>` +LL | ($p:pat >) => {}; | ^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -41,7 +41,7 @@ LL | ($p:pat >) => {}; //~ERROR `$p:pat` is followed by `>` error: `$p:pat` is followed by `+`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:13:13 | -LL | ($p:pat +) => {}; //~ERROR `$p:pat` is followed by `+` +LL | ($p:pat +) => {}; | ^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -49,7 +49,7 @@ LL | ($p:pat +) => {}; //~ERROR `$p:pat` is followed by `+` error: `$p:pat` is followed by `ident`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:14:13 | -LL | ($p:pat ident) => {}; //~ERROR `$p:pat` is followed by `ident` +LL | ($p:pat ident) => {}; | ^^^^^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -57,7 +57,7 @@ LL | ($p:pat ident) => {}; //~ERROR `$p:pat` is followed by `ident` error: `$p:pat` is followed by `$q:pat`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:15:13 | -LL | ($p:pat $q:pat) => {}; //~ERROR `$p:pat` is followed by `$q:pat` +LL | ($p:pat $q:pat) => {}; | ^^^^^^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -65,7 +65,7 @@ LL | ($p:pat $q:pat) => {}; //~ERROR `$p:pat` is followed by `$q:pat` error: `$p:pat` is followed by `$e:expr`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:16:13 | -LL | ($p:pat $e:expr) => {}; //~ERROR `$p:pat` is followed by `$e:expr` +LL | ($p:pat $e:expr) => {}; | ^^^^^^^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -73,7 +73,7 @@ LL | ($p:pat $e:expr) => {}; //~ERROR `$p:pat` is followed by `$e:expr` error: `$p:pat` is followed by `$t:ty`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:17:13 | -LL | ($p:pat $t:ty) => {}; //~ERROR `$p:pat` is followed by `$t:ty` +LL | ($p:pat $t:ty) => {}; | ^^^^^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -81,7 +81,7 @@ LL | ($p:pat $t:ty) => {}; //~ERROR `$p:pat` is followed by `$t:ty` error: `$p:pat` is followed by `$s:stmt`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:18:13 | -LL | ($p:pat $s:stmt) => {}; //~ERROR `$p:pat` is followed by `$s:stmt` +LL | ($p:pat $s:stmt) => {}; | ^^^^^^^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -89,7 +89,7 @@ LL | ($p:pat $s:stmt) => {}; //~ERROR `$p:pat` is followed by `$s:stmt` error: `$p:pat` is followed by `$q:path`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:19:13 | -LL | ($p:pat $q:path) => {}; //~ERROR `$p:pat` is followed by `$q:path` +LL | ($p:pat $q:path) => {}; | ^^^^^^^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -97,7 +97,7 @@ LL | ($p:pat $q:path) => {}; //~ERROR `$p:pat` is followed by `$q:path` error: `$p:pat` is followed by `$b:block`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:20:13 | -LL | ($p:pat $b:block) => {}; //~ERROR `$p:pat` is followed by `$b:block` +LL | ($p:pat $b:block) => {}; | ^^^^^^^^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -105,7 +105,7 @@ LL | ($p:pat $b:block) => {}; //~ERROR `$p:pat` is followed by `$b:block` error: `$p:pat` is followed by `$i:ident`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:21:13 | -LL | ($p:pat $i:ident) => {}; //~ERROR `$p:pat` is followed by `$i:ident` +LL | ($p:pat $i:ident) => {}; | ^^^^^^^^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -113,7 +113,7 @@ LL | ($p:pat $i:ident) => {}; //~ERROR `$p:pat` is followed by `$i:ident` error: `$p:pat` is followed by `$t:tt`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:22:13 | -LL | ($p:pat $t:tt) => {}; //~ERROR `$p:pat` is followed by `$t:tt` +LL | ($p:pat $t:tt) => {}; | ^^^^^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -121,7 +121,7 @@ LL | ($p:pat $t:tt) => {}; //~ERROR `$p:pat` is followed by `$t:tt` error: `$p:pat` is followed by `$i:item`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:23:13 | -LL | ($p:pat $i:item) => {}; //~ERROR `$p:pat` is followed by `$i:item` +LL | ($p:pat $i:item) => {}; | ^^^^^^^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -129,7 +129,7 @@ LL | ($p:pat $i:item) => {}; //~ERROR `$p:pat` is followed by `$i:item` error: `$p:pat` is followed by `$m:meta`, which is not allowed for `pat` fragments --> $DIR/macro-follow.rs:24:13 | -LL | ($p:pat $m:meta) => {}; //~ERROR `$p:pat` is followed by `$m:meta` +LL | ($p:pat $m:meta) => {}; | ^^^^^^^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -137,7 +137,7 @@ LL | ($p:pat $m:meta) => {}; //~ERROR `$p:pat` is followed by `$m:meta` error: `$e:expr` is followed by `(`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:28:15 | -LL | ($e:expr ()) => {}; //~ERROR `$e:expr` is followed by `(` +LL | ($e:expr ()) => {}; | ^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -145,7 +145,7 @@ LL | ($e:expr ()) => {}; //~ERROR `$e:expr` is followed by `(` error: `$e:expr` is followed by `[`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:29:15 | -LL | ($e:expr []) => {}; //~ERROR `$e:expr` is followed by `[` +LL | ($e:expr []) => {}; | ^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -153,7 +153,7 @@ LL | ($e:expr []) => {}; //~ERROR `$e:expr` is followed by `[` error: `$e:expr` is followed by `{`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:30:15 | -LL | ($e:expr {}) => {}; //~ERROR `$e:expr` is followed by `{` +LL | ($e:expr {}) => {}; | ^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -161,7 +161,7 @@ LL | ($e:expr {}) => {}; //~ERROR `$e:expr` is followed by `{` error: `$e:expr` is followed by `=`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:31:14 | -LL | ($e:expr =) => {}; //~ERROR `$e:expr` is followed by `=` +LL | ($e:expr =) => {}; | ^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -169,7 +169,7 @@ LL | ($e:expr =) => {}; //~ERROR `$e:expr` is followed by `=` error: `$e:expr` is followed by `|`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:32:14 | -LL | ($e:expr |) => {}; //~ERROR `$e:expr` is followed by `|` +LL | ($e:expr |) => {}; | ^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -177,7 +177,7 @@ LL | ($e:expr |) => {}; //~ERROR `$e:expr` is followed by `|` error: `$e:expr` is followed by `:`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:33:14 | -LL | ($e:expr :) => {}; //~ERROR `$e:expr` is followed by `:` +LL | ($e:expr :) => {}; | ^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -185,7 +185,7 @@ LL | ($e:expr :) => {}; //~ERROR `$e:expr` is followed by `:` error: `$e:expr` is followed by `>`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:34:14 | -LL | ($e:expr >) => {}; //~ERROR `$e:expr` is followed by `>` +LL | ($e:expr >) => {}; | ^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -193,7 +193,7 @@ LL | ($e:expr >) => {}; //~ERROR `$e:expr` is followed by `>` error: `$e:expr` is followed by `+`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:35:14 | -LL | ($e:expr +) => {}; //~ERROR `$e:expr` is followed by `+` +LL | ($e:expr +) => {}; | ^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -201,7 +201,7 @@ LL | ($e:expr +) => {}; //~ERROR `$e:expr` is followed by `+` error: `$e:expr` is followed by `ident`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:36:14 | -LL | ($e:expr ident) => {}; //~ERROR `$e:expr` is followed by `ident` +LL | ($e:expr ident) => {}; | ^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -209,7 +209,7 @@ LL | ($e:expr ident) => {}; //~ERROR `$e:expr` is followed by `ident` error: `$e:expr` is followed by `if`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:37:14 | -LL | ($e:expr if) => {}; //~ERROR `$e:expr` is followed by `if` +LL | ($e:expr if) => {}; | ^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -217,7 +217,7 @@ LL | ($e:expr if) => {}; //~ERROR `$e:expr` is followed by `if` error: `$e:expr` is followed by `in`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:38:14 | -LL | ($e:expr in) => {}; //~ERROR `$e:expr` is followed by `in` +LL | ($e:expr in) => {}; | ^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -225,7 +225,7 @@ LL | ($e:expr in) => {}; //~ERROR `$e:expr` is followed by `in` error: `$e:expr` is followed by `$p:pat`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:39:14 | -LL | ($e:expr $p:pat) => {}; //~ERROR `$e:expr` is followed by `$p:pat` +LL | ($e:expr $p:pat) => {}; | ^^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -233,7 +233,7 @@ LL | ($e:expr $p:pat) => {}; //~ERROR `$e:expr` is followed by `$p:pat` error: `$e:expr` is followed by `$f:expr`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:40:14 | -LL | ($e:expr $f:expr) => {}; //~ERROR `$e:expr` is followed by `$f:expr` +LL | ($e:expr $f:expr) => {}; | ^^^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -241,7 +241,7 @@ LL | ($e:expr $f:expr) => {}; //~ERROR `$e:expr` is followed by `$f:expr` error: `$e:expr` is followed by `$t:ty`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:41:14 | -LL | ($e:expr $t:ty) => {}; //~ERROR `$e:expr` is followed by `$t:ty` +LL | ($e:expr $t:ty) => {}; | ^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -249,7 +249,7 @@ LL | ($e:expr $t:ty) => {}; //~ERROR `$e:expr` is followed by `$t:ty` error: `$e:expr` is followed by `$s:stmt`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:42:14 | -LL | ($e:expr $s:stmt) => {}; //~ERROR `$e:expr` is followed by `$s:stmt` +LL | ($e:expr $s:stmt) => {}; | ^^^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -257,7 +257,7 @@ LL | ($e:expr $s:stmt) => {}; //~ERROR `$e:expr` is followed by `$s:stmt` error: `$e:expr` is followed by `$p:path`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:43:14 | -LL | ($e:expr $p:path) => {}; //~ERROR `$e:expr` is followed by `$p:path` +LL | ($e:expr $p:path) => {}; | ^^^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -265,7 +265,7 @@ LL | ($e:expr $p:path) => {}; //~ERROR `$e:expr` is followed by `$p:path` error: `$e:expr` is followed by `$b:block`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:44:14 | -LL | ($e:expr $b:block) => {}; //~ERROR `$e:expr` is followed by `$b:block` +LL | ($e:expr $b:block) => {}; | ^^^^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -273,7 +273,7 @@ LL | ($e:expr $b:block) => {}; //~ERROR `$e:expr` is followed by `$b:block` error: `$e:expr` is followed by `$i:ident`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:45:14 | -LL | ($e:expr $i:ident) => {}; //~ERROR `$e:expr` is followed by `$i:ident` +LL | ($e:expr $i:ident) => {}; | ^^^^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -281,7 +281,7 @@ LL | ($e:expr $i:ident) => {}; //~ERROR `$e:expr` is followed by `$i:ident` error: `$e:expr` is followed by `$t:tt`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:46:14 | -LL | ($e:expr $t:tt) => {}; //~ERROR `$e:expr` is followed by `$t:tt` +LL | ($e:expr $t:tt) => {}; | ^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -289,7 +289,7 @@ LL | ($e:expr $t:tt) => {}; //~ERROR `$e:expr` is followed by `$t:tt` error: `$e:expr` is followed by `$i:item`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:47:14 | -LL | ($e:expr $i:item) => {}; //~ERROR `$e:expr` is followed by `$i:item` +LL | ($e:expr $i:item) => {}; | ^^^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -297,7 +297,7 @@ LL | ($e:expr $i:item) => {}; //~ERROR `$e:expr` is followed by `$i:item` error: `$e:expr` is followed by `$m:meta`, which is not allowed for `expr` fragments --> $DIR/macro-follow.rs:48:14 | -LL | ($e:expr $m:meta) => {}; //~ERROR `$e:expr` is followed by `$m:meta` +LL | ($e:expr $m:meta) => {}; | ^^^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -305,7 +305,7 @@ LL | ($e:expr $m:meta) => {}; //~ERROR `$e:expr` is followed by `$m:meta` error: `$t:ty` is followed by `(`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:53:13 | -LL | ($t:ty ()) => {}; //~ERROR `$t:ty` is followed by `(` +LL | ($t:ty ()) => {}; | ^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -313,7 +313,7 @@ LL | ($t:ty ()) => {}; //~ERROR `$t:ty` is followed by `(` error: `$t:ty` is followed by `+`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:55:12 | -LL | ($t:ty +) => {}; //~ERROR `$t:ty` is followed by `+` +LL | ($t:ty +) => {}; | ^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -321,7 +321,7 @@ LL | ($t:ty +) => {}; //~ERROR `$t:ty` is followed by `+` error: `$t:ty` is followed by `ident`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:56:12 | -LL | ($t:ty ident) => {}; //~ERROR `$t:ty` is followed by `ident` +LL | ($t:ty ident) => {}; | ^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -329,7 +329,7 @@ LL | ($t:ty ident) => {}; //~ERROR `$t:ty` is followed by `ident` error: `$t:ty` is followed by `if`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:57:12 | -LL | ($t:ty if) => {}; //~ERROR `$t:ty` is followed by `if` +LL | ($t:ty if) => {}; | ^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -337,7 +337,7 @@ LL | ($t:ty if) => {}; //~ERROR `$t:ty` is followed by `if` error: `$t:ty` is followed by `$p:pat`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:58:12 | -LL | ($t:ty $p:pat) => {}; //~ERROR `$t:ty` is followed by `$p:pat` +LL | ($t:ty $p:pat) => {}; | ^^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -345,7 +345,7 @@ LL | ($t:ty $p:pat) => {}; //~ERROR `$t:ty` is followed by `$p:pat` error: `$t:ty` is followed by `$e:expr`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:59:12 | -LL | ($t:ty $e:expr) => {}; //~ERROR `$t:ty` is followed by `$e:expr` +LL | ($t:ty $e:expr) => {}; | ^^^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -353,7 +353,7 @@ LL | ($t:ty $e:expr) => {}; //~ERROR `$t:ty` is followed by `$e:expr` error: `$t:ty` is followed by `$r:ty`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:60:12 | -LL | ($t:ty $r:ty) => {}; //~ERROR `$t:ty` is followed by `$r:ty` +LL | ($t:ty $r:ty) => {}; | ^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -361,7 +361,7 @@ LL | ($t:ty $r:ty) => {}; //~ERROR `$t:ty` is followed by `$r:ty` error: `$t:ty` is followed by `$s:stmt`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:61:12 | -LL | ($t:ty $s:stmt) => {}; //~ERROR `$t:ty` is followed by `$s:stmt` +LL | ($t:ty $s:stmt) => {}; | ^^^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -369,7 +369,7 @@ LL | ($t:ty $s:stmt) => {}; //~ERROR `$t:ty` is followed by `$s:stmt` error: `$t:ty` is followed by `$p:path`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:62:12 | -LL | ($t:ty $p:path) => {}; //~ERROR `$t:ty` is followed by `$p:path` +LL | ($t:ty $p:path) => {}; | ^^^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -377,7 +377,7 @@ LL | ($t:ty $p:path) => {}; //~ERROR `$t:ty` is followed by `$p:path` error: `$t:ty` is followed by `$i:ident`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:64:12 | -LL | ($t:ty $i:ident) => {}; //~ERROR `$t:ty` is followed by `$i:ident` +LL | ($t:ty $i:ident) => {}; | ^^^^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -385,7 +385,7 @@ LL | ($t:ty $i:ident) => {}; //~ERROR `$t:ty` is followed by `$i:ident` error: `$t:ty` is followed by `$r:tt`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:65:12 | -LL | ($t:ty $r:tt) => {}; //~ERROR `$t:ty` is followed by `$r:tt` +LL | ($t:ty $r:tt) => {}; | ^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -393,7 +393,7 @@ LL | ($t:ty $r:tt) => {}; //~ERROR `$t:ty` is followed by `$r:tt` error: `$t:ty` is followed by `$i:item`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:66:12 | -LL | ($t:ty $i:item) => {}; //~ERROR `$t:ty` is followed by `$i:item` +LL | ($t:ty $i:item) => {}; | ^^^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -401,7 +401,7 @@ LL | ($t:ty $i:item) => {}; //~ERROR `$t:ty` is followed by `$i:item` error: `$t:ty` is followed by `$m:meta`, which is not allowed for `ty` fragments --> $DIR/macro-follow.rs:67:12 | -LL | ($t:ty $m:meta) => {}; //~ERROR `$t:ty` is followed by `$m:meta` +LL | ($t:ty $m:meta) => {}; | ^^^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -409,7 +409,7 @@ LL | ($t:ty $m:meta) => {}; //~ERROR `$t:ty` is followed by `$m:meta` error: `$s:stmt` is followed by `(`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:71:15 | -LL | ($s:stmt ()) => {}; //~ERROR `$s:stmt` is followed by `(` +LL | ($s:stmt ()) => {}; | ^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -417,7 +417,7 @@ LL | ($s:stmt ()) => {}; //~ERROR `$s:stmt` is followed by `(` error: `$s:stmt` is followed by `[`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:72:15 | -LL | ($s:stmt []) => {}; //~ERROR `$s:stmt` is followed by `[` +LL | ($s:stmt []) => {}; | ^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -425,7 +425,7 @@ LL | ($s:stmt []) => {}; //~ERROR `$s:stmt` is followed by `[` error: `$s:stmt` is followed by `{`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:73:15 | -LL | ($s:stmt {}) => {}; //~ERROR `$s:stmt` is followed by `{` +LL | ($s:stmt {}) => {}; | ^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -433,7 +433,7 @@ LL | ($s:stmt {}) => {}; //~ERROR `$s:stmt` is followed by `{` error: `$s:stmt` is followed by `=`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:74:14 | -LL | ($s:stmt =) => {}; //~ERROR `$s:stmt` is followed by `=` +LL | ($s:stmt =) => {}; | ^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -441,7 +441,7 @@ LL | ($s:stmt =) => {}; //~ERROR `$s:stmt` is followed by `=` error: `$s:stmt` is followed by `|`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:75:14 | -LL | ($s:stmt |) => {}; //~ERROR `$s:stmt` is followed by `|` +LL | ($s:stmt |) => {}; | ^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -449,7 +449,7 @@ LL | ($s:stmt |) => {}; //~ERROR `$s:stmt` is followed by `|` error: `$s:stmt` is followed by `:`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:76:14 | -LL | ($s:stmt :) => {}; //~ERROR `$s:stmt` is followed by `:` +LL | ($s:stmt :) => {}; | ^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -457,7 +457,7 @@ LL | ($s:stmt :) => {}; //~ERROR `$s:stmt` is followed by `:` error: `$s:stmt` is followed by `>`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:77:14 | -LL | ($s:stmt >) => {}; //~ERROR `$s:stmt` is followed by `>` +LL | ($s:stmt >) => {}; | ^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -465,7 +465,7 @@ LL | ($s:stmt >) => {}; //~ERROR `$s:stmt` is followed by `>` error: `$s:stmt` is followed by `+`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:78:14 | -LL | ($s:stmt +) => {}; //~ERROR `$s:stmt` is followed by `+` +LL | ($s:stmt +) => {}; | ^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -473,7 +473,7 @@ LL | ($s:stmt +) => {}; //~ERROR `$s:stmt` is followed by `+` error: `$s:stmt` is followed by `ident`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:79:14 | -LL | ($s:stmt ident) => {}; //~ERROR `$s:stmt` is followed by `ident` +LL | ($s:stmt ident) => {}; | ^^^^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -481,7 +481,7 @@ LL | ($s:stmt ident) => {}; //~ERROR `$s:stmt` is followed by `ident` error: `$s:stmt` is followed by `if`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:80:14 | -LL | ($s:stmt if) => {}; //~ERROR `$s:stmt` is followed by `if` +LL | ($s:stmt if) => {}; | ^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -489,7 +489,7 @@ LL | ($s:stmt if) => {}; //~ERROR `$s:stmt` is followed by `if` error: `$s:stmt` is followed by `in`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:81:14 | -LL | ($s:stmt in) => {}; //~ERROR `$s:stmt` is followed by `in` +LL | ($s:stmt in) => {}; | ^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -497,7 +497,7 @@ LL | ($s:stmt in) => {}; //~ERROR `$s:stmt` is followed by `in` error: `$s:stmt` is followed by `$p:pat`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:82:14 | -LL | ($s:stmt $p:pat) => {}; //~ERROR `$s:stmt` is followed by `$p:pat` +LL | ($s:stmt $p:pat) => {}; | ^^^^^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -505,7 +505,7 @@ LL | ($s:stmt $p:pat) => {}; //~ERROR `$s:stmt` is followed by `$p:pat` error: `$s:stmt` is followed by `$e:expr`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:83:14 | -LL | ($s:stmt $e:expr) => {}; //~ERROR `$s:stmt` is followed by `$e:expr` +LL | ($s:stmt $e:expr) => {}; | ^^^^^^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -513,7 +513,7 @@ LL | ($s:stmt $e:expr) => {}; //~ERROR `$s:stmt` is followed by `$e:expr` error: `$s:stmt` is followed by `$t:ty`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:84:14 | -LL | ($s:stmt $t:ty) => {}; //~ERROR `$s:stmt` is followed by `$t:ty` +LL | ($s:stmt $t:ty) => {}; | ^^^^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -521,7 +521,7 @@ LL | ($s:stmt $t:ty) => {}; //~ERROR `$s:stmt` is followed by `$t:ty` error: `$s:stmt` is followed by `$t:stmt`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:85:14 | -LL | ($s:stmt $t:stmt) => {}; //~ERROR `$s:stmt` is followed by `$t:stmt` +LL | ($s:stmt $t:stmt) => {}; | ^^^^^^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -529,7 +529,7 @@ LL | ($s:stmt $t:stmt) => {}; //~ERROR `$s:stmt` is followed by `$t:stmt` error: `$s:stmt` is followed by `$p:path`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:86:14 | -LL | ($s:stmt $p:path) => {}; //~ERROR `$s:stmt` is followed by `$p:path` +LL | ($s:stmt $p:path) => {}; | ^^^^^^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -537,7 +537,7 @@ LL | ($s:stmt $p:path) => {}; //~ERROR `$s:stmt` is followed by `$p:path` error: `$s:stmt` is followed by `$b:block`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:87:14 | -LL | ($s:stmt $b:block) => {}; //~ERROR `$s:stmt` is followed by `$b:block` +LL | ($s:stmt $b:block) => {}; | ^^^^^^^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -545,7 +545,7 @@ LL | ($s:stmt $b:block) => {}; //~ERROR `$s:stmt` is followed by `$b:block` error: `$s:stmt` is followed by `$i:ident`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:88:14 | -LL | ($s:stmt $i:ident) => {}; //~ERROR `$s:stmt` is followed by `$i:ident` +LL | ($s:stmt $i:ident) => {}; | ^^^^^^^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -553,7 +553,7 @@ LL | ($s:stmt $i:ident) => {}; //~ERROR `$s:stmt` is followed by `$i:ident` error: `$s:stmt` is followed by `$t:tt`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:89:14 | -LL | ($s:stmt $t:tt) => {}; //~ERROR `$s:stmt` is followed by `$t:tt` +LL | ($s:stmt $t:tt) => {}; | ^^^^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -561,7 +561,7 @@ LL | ($s:stmt $t:tt) => {}; //~ERROR `$s:stmt` is followed by `$t:tt` error: `$s:stmt` is followed by `$i:item`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:90:14 | -LL | ($s:stmt $i:item) => {}; //~ERROR `$s:stmt` is followed by `$i:item` +LL | ($s:stmt $i:item) => {}; | ^^^^^^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -569,7 +569,7 @@ LL | ($s:stmt $i:item) => {}; //~ERROR `$s:stmt` is followed by `$i:item` error: `$s:stmt` is followed by `$m:meta`, which is not allowed for `stmt` fragments --> $DIR/macro-follow.rs:91:14 | -LL | ($s:stmt $m:meta) => {}; //~ERROR `$s:stmt` is followed by `$m:meta` +LL | ($s:stmt $m:meta) => {}; | ^^^^^^^ not allowed after `stmt` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -577,7 +577,7 @@ LL | ($s:stmt $m:meta) => {}; //~ERROR `$s:stmt` is followed by `$m:meta` error: `$p:path` is followed by `(`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:95:15 | -LL | ($p:path ()) => {}; //~ERROR `$p:path` is followed by `(` +LL | ($p:path ()) => {}; | ^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -585,7 +585,7 @@ LL | ($p:path ()) => {}; //~ERROR `$p:path` is followed by `(` error: `$p:path` is followed by `+`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:97:14 | -LL | ($p:path +) => {}; //~ERROR `$p:path` is followed by `+` +LL | ($p:path +) => {}; | ^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -593,7 +593,7 @@ LL | ($p:path +) => {}; //~ERROR `$p:path` is followed by `+` error: `$p:path` is followed by `ident`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:98:14 | -LL | ($p:path ident) => {}; //~ERROR `$p:path` is followed by `ident` +LL | ($p:path ident) => {}; | ^^^^^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -601,7 +601,7 @@ LL | ($p:path ident) => {}; //~ERROR `$p:path` is followed by `ident` error: `$p:path` is followed by `if`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:99:14 | -LL | ($p:path if) => {}; //~ERROR `$p:path` is followed by `if` +LL | ($p:path if) => {}; | ^^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -609,7 +609,7 @@ LL | ($p:path if) => {}; //~ERROR `$p:path` is followed by `if` error: `$p:path` is followed by `$q:pat`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:100:14 | -LL | ($p:path $q:pat) => {}; //~ERROR `$p:path` is followed by `$q:pat` +LL | ($p:path $q:pat) => {}; | ^^^^^^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -617,7 +617,7 @@ LL | ($p:path $q:pat) => {}; //~ERROR `$p:path` is followed by `$q:pat` error: `$p:path` is followed by `$e:expr`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:101:14 | -LL | ($p:path $e:expr) => {}; //~ERROR `$p:path` is followed by `$e:expr` +LL | ($p:path $e:expr) => {}; | ^^^^^^^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -625,7 +625,7 @@ LL | ($p:path $e:expr) => {}; //~ERROR `$p:path` is followed by `$e:expr` error: `$p:path` is followed by `$t:ty`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:102:14 | -LL | ($p:path $t:ty) => {}; //~ERROR `$p:path` is followed by `$t:ty` +LL | ($p:path $t:ty) => {}; | ^^^^^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -633,7 +633,7 @@ LL | ($p:path $t:ty) => {}; //~ERROR `$p:path` is followed by `$t:ty` error: `$p:path` is followed by `$s:stmt`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:103:14 | -LL | ($p:path $s:stmt) => {}; //~ERROR `$p:path` is followed by `$s:stmt` +LL | ($p:path $s:stmt) => {}; | ^^^^^^^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -641,7 +641,7 @@ LL | ($p:path $s:stmt) => {}; //~ERROR `$p:path` is followed by `$s:stmt` error: `$p:path` is followed by `$q:path`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:104:14 | -LL | ($p:path $q:path) => {}; //~ERROR `$p:path` is followed by `$q:path` +LL | ($p:path $q:path) => {}; | ^^^^^^^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -649,7 +649,7 @@ LL | ($p:path $q:path) => {}; //~ERROR `$p:path` is followed by `$q:path` error: `$p:path` is followed by `$i:ident`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:106:14 | -LL | ($p:path $i:ident) => {}; //~ERROR `$p:path` is followed by `$i:ident` +LL | ($p:path $i:ident) => {}; | ^^^^^^^^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -657,7 +657,7 @@ LL | ($p:path $i:ident) => {}; //~ERROR `$p:path` is followed by `$i:ident` error: `$p:path` is followed by `$t:tt`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:107:14 | -LL | ($p:path $t:tt) => {}; //~ERROR `$p:path` is followed by `$t:tt` +LL | ($p:path $t:tt) => {}; | ^^^^^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -665,7 +665,7 @@ LL | ($p:path $t:tt) => {}; //~ERROR `$p:path` is followed by `$t:tt` error: `$p:path` is followed by `$i:item`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:108:14 | -LL | ($p:path $i:item) => {}; //~ERROR `$p:path` is followed by `$i:item` +LL | ($p:path $i:item) => {}; | ^^^^^^^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -673,7 +673,7 @@ LL | ($p:path $i:item) => {}; //~ERROR `$p:path` is followed by `$i:item` error: `$p:path` is followed by `$m:meta`, which is not allowed for `path` fragments --> $DIR/macro-follow.rs:109:14 | -LL | ($p:path $m:meta) => {}; //~ERROR `$p:path` is followed by `$m:meta` +LL | ($p:path $m:meta) => {}; | ^^^^^^^ not allowed after `path` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` diff --git a/src/test/ui/macros/macro-followed-by-seq-bad.stderr b/src/test/ui/macros/macro-followed-by-seq-bad.stderr index 18403fd248d8..7097979aeddf 100644 --- a/src/test/ui/macros/macro-followed-by-seq-bad.stderr +++ b/src/test/ui/macros/macro-followed-by-seq-bad.stderr @@ -1,7 +1,7 @@ error: `$a:expr` is followed by `$b:tt`, which is not allowed for `expr` fragments --> $DIR/macro-followed-by-seq-bad.rs:7:15 | -LL | ( $a:expr $($b:tt)* ) => { }; //~ ERROR not allowed for `expr` fragments +LL | ( $a:expr $($b:tt)* ) => { }; | ^^^^^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` @@ -9,7 +9,7 @@ LL | ( $a:expr $($b:tt)* ) => { }; //~ ERROR not allowed for `expr` fragments error: `$a:ty` is followed by `$b:tt`, which is not allowed for `ty` fragments --> $DIR/macro-followed-by-seq-bad.rs:8:13 | -LL | ( $a:ty $($b:tt)* ) => { }; //~ ERROR not allowed for `ty` fragments +LL | ( $a:ty $($b:tt)* ) => { }; | ^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` diff --git a/src/test/ui/macros/macro-input-future-proofing.stderr b/src/test/ui/macros/macro-input-future-proofing.stderr index fa39fc6a2125..a35f6283afb2 100644 --- a/src/test/ui/macros/macro-input-future-proofing.stderr +++ b/src/test/ui/macros/macro-input-future-proofing.stderr @@ -1,7 +1,7 @@ error: `$ty:ty` is followed by `<`, which is not allowed for `ty` fragments --> $DIR/macro-input-future-proofing.rs:4:13 | -LL | ($ty:ty <) => (); //~ ERROR `$ty:ty` is followed by `<`, which is not allowed for `ty` +LL | ($ty:ty <) => (); | ^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -9,7 +9,7 @@ LL | ($ty:ty <) => (); //~ ERROR `$ty:ty` is followed by `<`, which is not a error: `$ty:ty` is followed by `<`, which is not allowed for `ty` fragments --> $DIR/macro-input-future-proofing.rs:5:13 | -LL | ($ty:ty < foo ,) => (); //~ ERROR `$ty:ty` is followed by `<`, which is not allowed for `ty` +LL | ($ty:ty < foo ,) => (); | ^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -17,7 +17,7 @@ LL | ($ty:ty < foo ,) => (); //~ ERROR `$ty:ty` is followed by `<`, which is error: `$pa:pat` is followed by `>`, which is not allowed for `pat` fragments --> $DIR/macro-input-future-proofing.rs:11:14 | -LL | ($pa:pat >) => (); //~ ERROR `$pa:pat` is followed by `>`, which is not allowed for `pat` +LL | ($pa:pat >) => (); | ^ not allowed after `pat` fragments | = note: allowed there are: `=>`, `,`, `=`, `|`, `if` or `in` @@ -41,7 +41,7 @@ LL | ($pa:pat $pb:pat $ty:ty ,) => (); error: `$ty:ty` is followed by `-`, which is not allowed for `ty` fragments --> $DIR/macro-input-future-proofing.rs:16:17 | -LL | ($($ty:ty)* -) => (); //~ ERROR `$ty:ty` is followed by `-` +LL | ($($ty:ty)* -) => (); | ^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -49,7 +49,7 @@ LL | ($($ty:ty)* -) => (); //~ ERROR `$ty:ty` is followed by `-` error: `$b:ty` is followed by `-`, which is not allowed for `ty` fragments --> $DIR/macro-input-future-proofing.rs:17:23 | -LL | ($($a:ty, $b:ty)* -) => (); //~ ERROR `$b:ty` is followed by `-` +LL | ($($a:ty, $b:ty)* -) => (); | ^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` @@ -57,7 +57,7 @@ LL | ($($a:ty, $b:ty)* -) => (); //~ ERROR `$b:ty` is followed by `-` error: `$ty:ty` is followed by `-`, which is not allowed for `ty` fragments --> $DIR/macro-input-future-proofing.rs:18:7 | -LL | ($($ty:ty)-+) => (); //~ ERROR `$ty:ty` is followed by `-`, which is not allowed for `ty` +LL | ($($ty:ty)-+) => (); | ^^^^^^^^ not allowed after `ty` fragments | = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where` diff --git a/src/test/ui/macros/macro-match-nonterminal.stderr b/src/test/ui/macros/macro-match-nonterminal.stderr index 15eafbde0a23..1de8c5bd4b47 100644 --- a/src/test/ui/macros/macro-match-nonterminal.stderr +++ b/src/test/ui/macros/macro-match-nonterminal.stderr @@ -1,7 +1,7 @@ error: missing fragment specifier --> $DIR/macro-match-nonterminal.rs:1:24 | -LL | macro_rules! test { ($a, $b) => (()); } //~ ERROR missing fragment +LL | macro_rules! test { ($a, $b) => (()); } | ^ error: aborting due to previous error diff --git a/src/test/ui/macros/macro-missing-delimiters.stderr b/src/test/ui/macros/macro-missing-delimiters.stderr index 63cf1826f772..e7c37c8ddbeb 100644 --- a/src/test/ui/macros/macro-missing-delimiters.stderr +++ b/src/test/ui/macros/macro-missing-delimiters.stderr @@ -1,7 +1,7 @@ error: invalid macro matcher; matchers must be contained in balanced delimiters --> $DIR/macro-missing-delimiters.rs:2:5 | -LL | baz => () //~ ERROR invalid macro matcher; +LL | baz => () | ^^^ error: aborting due to previous error diff --git a/src/test/ui/macros/macro-missing-fragment.stderr b/src/test/ui/macros/macro-missing-fragment.stderr index 8c4026760ca1..b7871c0ec3a6 100644 --- a/src/test/ui/macros/macro-missing-fragment.stderr +++ b/src/test/ui/macros/macro-missing-fragment.stderr @@ -1,7 +1,7 @@ error: missing fragment specifier --> $DIR/macro-missing-fragment.rs:2:20 | -LL | ( $( any_token $field_rust_type )* ) => {}; //~ ERROR missing fragment +LL | ( $( any_token $field_rust_type )* ) => {}; | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/macros/macro-multiple-matcher-bindings.stderr b/src/test/ui/macros/macro-multiple-matcher-bindings.stderr index bc78b471a2d1..41e9a3286aef 100644 --- a/src/test/ui/macros/macro-multiple-matcher-bindings.stderr +++ b/src/test/ui/macros/macro-multiple-matcher-bindings.stderr @@ -1,7 +1,7 @@ warning: duplicate matcher binding --> $DIR/macro-multiple-matcher-bindings.rs:11:6 | -LL | ($a:ident, $a:ident) => {}; //~WARNING duplicate matcher binding +LL | ($a:ident, $a:ident) => {}; | ^^^^^^^^ ^^^^^^^^ | = note: #[warn(duplicate_matcher_binding_name)] on by default @@ -11,7 +11,7 @@ LL | ($a:ident, $a:ident) => {}; //~WARNING duplicate matcher binding warning: duplicate matcher binding --> $DIR/macro-multiple-matcher-bindings.rs:12:6 | -LL | ($a:ident, $a:path) => {}; //~WARNING duplicate matcher binding +LL | ($a:ident, $a:path) => {}; | ^^^^^^^^ ^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -20,7 +20,7 @@ LL | ($a:ident, $a:path) => {}; //~WARNING duplicate matcher binding warning: duplicate matcher binding --> $DIR/macro-multiple-matcher-bindings.rs:21:6 | -LL | ($a:ident, $($a:ident),*) => {}; //~WARNING duplicate matcher binding +LL | ($a:ident, $($a:ident),*) => {}; | ^^^^^^^^ ^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -29,7 +29,7 @@ LL | ($a:ident, $($a:ident),*) => {}; //~WARNING duplicate matcher binding warning: duplicate matcher binding --> $DIR/macro-multiple-matcher-bindings.rs:22:8 | -LL | ($($a:ident)+ # $($($a:path),+);*) => {}; //~WARNING duplicate matcher binding +LL | ($($a:ident)+ # $($($a:path),+);*) => {}; | ^^^^^^^^ ^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/macros/macro-name-typo.stderr b/src/test/ui/macros/macro-name-typo.stderr index 5af9828fd982..a8930f243f8f 100644 --- a/src/test/ui/macros/macro-name-typo.stderr +++ b/src/test/ui/macros/macro-name-typo.stderr @@ -1,7 +1,7 @@ error: cannot find macro `printlx!` in this scope --> $DIR/macro-name-typo.rs:2:5 | -LL | printlx!("oh noes!"); //~ ERROR cannot find +LL | printlx!("oh noes!"); | ^^^^^^^ help: you could try the macro: `println` error: aborting due to previous error diff --git a/src/test/ui/macros/macro-outer-attributes.stderr b/src/test/ui/macros/macro-outer-attributes.stderr index f9413250076b..838333b95c0d 100644 --- a/src/test/ui/macros/macro-outer-attributes.stderr +++ b/src/test/ui/macros/macro-outer-attributes.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find function `bar` in module `a` --> $DIR/macro-outer-attributes.rs:18:8 | -LL | a::bar(); //~ ERROR cannot find function `bar` in module `a` +LL | a::bar(); | ^^^ not found in `a` help: possible candidate is found in another module, you can import it into scope | diff --git a/src/test/ui/macros/macro-parameter-span.stderr b/src/test/ui/macros/macro-parameter-span.stderr index c7dcb12d3d10..24e3e89ea9bf 100644 --- a/src/test/ui/macros/macro-parameter-span.stderr +++ b/src/test/ui/macros/macro-parameter-span.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `x` in this scope --> $DIR/macro-parameter-span.rs:11:9 | -LL | x //~ ERROR cannot find value `x` in this scope +LL | x | ^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/macros/macro-path-prelude-fail-1.stderr b/src/test/ui/macros/macro-path-prelude-fail-1.stderr index 4bf51bd893a8..551d2fe8ce04 100644 --- a/src/test/ui/macros/macro-path-prelude-fail-1.stderr +++ b/src/test/ui/macros/macro-path-prelude-fail-1.stderr @@ -1,13 +1,13 @@ error[E0433]: failed to resolve: not a module `Vec` --> $DIR/macro-path-prelude-fail-1.rs:5:9 | -LL | Vec::clone!(); //~ ERROR failed to resolve: not a module `Vec` +LL | Vec::clone!(); | ^^^ not a module `Vec` error[E0433]: failed to resolve: not a module `u8` --> $DIR/macro-path-prelude-fail-1.rs:6:9 | -LL | u8::clone!(); //~ ERROR failed to resolve: not a module `u8` +LL | u8::clone!(); | ^^ not a module `u8` error: aborting due to 2 previous errors diff --git a/src/test/ui/macros/macro-path-prelude-fail-2.stderr b/src/test/ui/macros/macro-path-prelude-fail-2.stderr index 6b1a5b3741a3..9574b7a1e25f 100644 --- a/src/test/ui/macros/macro-path-prelude-fail-2.stderr +++ b/src/test/ui/macros/macro-path-prelude-fail-2.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: partially resolved path in a macro --> $DIR/macro-path-prelude-fail-2.rs:3:9 | -LL | Result::Ok!(); //~ ERROR failed to resolve: partially resolved path in a macro +LL | Result::Ok!(); | ^^^^^^^^^^ partially resolved path in a macro error: aborting due to previous error diff --git a/src/test/ui/macros/macro-path-prelude-fail-3.stderr b/src/test/ui/macros/macro-path-prelude-fail-3.stderr index 177232511817..7eeddb885479 100644 --- a/src/test/ui/macros/macro-path-prelude-fail-3.stderr +++ b/src/test/ui/macros/macro-path-prelude-fail-3.stderr @@ -1,7 +1,7 @@ error: cannot find macro `inline!` in this scope --> $DIR/macro-path-prelude-fail-3.rs:2:5 | -LL | inline!(); //~ ERROR cannot find macro `inline!` in this scope +LL | inline!(); | ^^^^^^ help: you could try the macro: `line` error: aborting due to previous error diff --git a/src/test/ui/macros/macro-path-prelude-fail-4.stderr b/src/test/ui/macros/macro-path-prelude-fail-4.stderr index e354f345a4c2..f08445e1f775 100644 --- a/src/test/ui/macros/macro-path-prelude-fail-4.stderr +++ b/src/test/ui/macros/macro-path-prelude-fail-4.stderr @@ -1,7 +1,7 @@ error: expected a macro, found built-in attribute --> $DIR/macro-path-prelude-fail-4.rs:1:10 | -LL | #[derive(inline)] //~ ERROR expected a macro, found built-in attribute +LL | #[derive(inline)] | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/macros/macro-path-prelude-shadowing.stderr b/src/test/ui/macros/macro-path-prelude-shadowing.stderr index 9c0214346a6a..e7b381daf934 100644 --- a/src/test/ui/macros/macro-path-prelude-shadowing.stderr +++ b/src/test/ui/macros/macro-path-prelude-shadowing.stderr @@ -1,7 +1,7 @@ error[E0659]: `std` is ambiguous (glob import vs any other name from outer scope during import/macro resolution) --> $DIR/macro-path-prelude-shadowing.rs:29:9 | -LL | std::panic!(); //~ ERROR `std` is ambiguous +LL | std::panic!(); | ^^^ ambiguous name | = note: `std` could refer to a built-in extern crate diff --git a/src/test/ui/macros/macro-reexport-removed.stderr b/src/test/ui/macros/macro-reexport-removed.stderr index 6cfec3ee762d..302952909beb 100644 --- a/src/test/ui/macros/macro-reexport-removed.stderr +++ b/src/test/ui/macros/macro-reexport-removed.stderr @@ -1,19 +1,19 @@ error[E0557]: feature has been removed --> $DIR/macro-reexport-removed.rs:3:12 | -LL | #![feature(macro_reexport)] //~ ERROR feature has been removed +LL | #![feature(macro_reexport)] | ^^^^^^^^^^^^^^ | note: subsumed by `pub use` --> $DIR/macro-reexport-removed.rs:3:12 | -LL | #![feature(macro_reexport)] //~ ERROR feature has been removed +LL | #![feature(macro_reexport)] | ^^^^^^^^^^^^^^ error[E0658]: The attribute `macro_reexport` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/macro-reexport-removed.rs:5:3 | -LL | #[macro_reexport(macro_one)] //~ ERROR attribute `macro_reexport` is currently unknown +LL | #[macro_reexport(macro_one)] | ^^^^^^^^^^^^^^ help: a built-in attribute with a similar name exists: `macro_export` | = help: add #![feature(custom_attribute)] to the crate attributes to enable diff --git a/src/test/ui/macros/macro-shadowing.stderr b/src/test/ui/macros/macro-shadowing.stderr index c297f0ef52d7..033e12a31ae0 100644 --- a/src/test/ui/macros/macro-shadowing.stderr +++ b/src/test/ui/macros/macro-shadowing.stderr @@ -1,7 +1,7 @@ error: `macro_two` is already in scope --> $DIR/macro-shadowing.rs:12:5 | -LL | #[macro_use] //~ ERROR `macro_two` is already in scope +LL | #[macro_use] | ^^^^^^^^^^^^ ... LL | m1!(); @@ -12,7 +12,7 @@ LL | m1!(); error[E0659]: `foo` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/macro-shadowing.rs:17:1 | -LL | foo!(); //~ ERROR `foo` is ambiguous +LL | foo!(); | ^^^ ambiguous name | note: `foo` could refer to the macro defined here diff --git a/src/test/ui/macros/macro-stability.stderr b/src/test/ui/macros/macro-stability.stderr index e5c535a08e1c..a0e0c351a483 100644 --- a/src/test/ui/macros/macro-stability.stderr +++ b/src/test/ui/macros/macro-stability.stderr @@ -1,7 +1,7 @@ error[E0658]: macro unstable_macro! is unstable --> $DIR/macro-stability.rs:11:5 | -LL | unstable_macro!(); //~ ERROR: macro unstable_macro! is unstable +LL | unstable_macro!(); | ^^^^^^^^^^^^^^^^^^ | = help: add #![feature(unstable_macros)] to the crate attributes to enable diff --git a/src/test/ui/macros/macro-use-bad-args-1.stderr b/src/test/ui/macros/macro-use-bad-args-1.stderr index 1eb8cc3f4c49..f403c8a36608 100644 --- a/src/test/ui/macros/macro-use-bad-args-1.stderr +++ b/src/test/ui/macros/macro-use-bad-args-1.stderr @@ -1,7 +1,7 @@ error[E0466]: bad macro import --> $DIR/macro-use-bad-args-1.rs:4:13 | -LL | #[macro_use(foo(bar))] //~ ERROR bad macro import +LL | #[macro_use(foo(bar))] | ^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/macros/macro-use-bad-args-2.stderr b/src/test/ui/macros/macro-use-bad-args-2.stderr index 7ed6b26b1b77..93617edeeaea 100644 --- a/src/test/ui/macros/macro-use-bad-args-2.stderr +++ b/src/test/ui/macros/macro-use-bad-args-2.stderr @@ -1,7 +1,7 @@ error[E0466]: bad macro import --> $DIR/macro-use-bad-args-2.rs:4:13 | -LL | #[macro_use(foo="bar")] //~ ERROR bad macro import +LL | #[macro_use(foo="bar")] | ^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/macros/macro-use-undef.stderr b/src/test/ui/macros/macro-use-undef.stderr index 4d9fa3aeb137..85b86e2211f2 100644 --- a/src/test/ui/macros/macro-use-undef.stderr +++ b/src/test/ui/macros/macro-use-undef.stderr @@ -1,7 +1,7 @@ error[E0469]: imported macro not found --> $DIR/macro-use-undef.rs:3:24 | -LL | #[macro_use(macro_two, no_way)] //~ ERROR imported macro not found +LL | #[macro_use(macro_two, no_way)] | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/macros/macro_path_as_generic_bound.stderr b/src/test/ui/macros/macro_path_as_generic_bound.stderr index 2f0e67c1ba8a..48c33575ad2a 100644 --- a/src/test/ui/macros/macro_path_as_generic_bound.stderr +++ b/src/test/ui/macros/macro_path_as_generic_bound.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: use of undeclared type or module `m` --> $DIR/macro_path_as_generic_bound.rs:7:6 | -LL | foo!(m::m2::A); //~ ERROR failed to resolve +LL | foo!(m::m2::A); | ^ use of undeclared type or module `m` error: aborting due to previous error diff --git a/src/test/ui/macros/macro_undefined.stderr b/src/test/ui/macros/macro_undefined.stderr index b9a76e07a007..b516f91c67d1 100644 --- a/src/test/ui/macros/macro_undefined.stderr +++ b/src/test/ui/macros/macro_undefined.stderr @@ -1,7 +1,7 @@ error: cannot find macro `k!` in this scope --> $DIR/macro_undefined.rs:11:5 | -LL | k!(); //~ ERROR cannot find +LL | k!(); | ^ help: you could try the macro: `kl` error: aborting due to previous error diff --git a/src/test/ui/macros/macros-nonfatal-errors.stderr b/src/test/ui/macros/macros-nonfatal-errors.stderr index ce7035ee2746..8a8455c262b4 100644 --- a/src/test/ui/macros/macros-nonfatal-errors.stderr +++ b/src/test/ui/macros/macros-nonfatal-errors.stderr @@ -1,89 +1,89 @@ error[E0665]: `Default` cannot be derived for enums, only structs --> $DIR/macros-nonfatal-errors.rs:9:10 | -LL | #[derive(Default)] //~ ERROR +LL | #[derive(Default)] | ^^^^^^^ error: inline assembly must be a string literal --> $DIR/macros-nonfatal-errors.rs:13:10 | -LL | asm!(invalid); //~ ERROR +LL | asm!(invalid); | ^^^^^^^ error: concat_idents! requires ident args. --> $DIR/macros-nonfatal-errors.rs:15:5 | -LL | concat_idents!("not", "idents"); //~ ERROR +LL | concat_idents!("not", "idents"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: argument must be a string literal --> $DIR/macros-nonfatal-errors.rs:17:17 | -LL | option_env!(invalid); //~ ERROR +LL | option_env!(invalid); | ^^^^^^^ error: expected string literal --> $DIR/macros-nonfatal-errors.rs:18:10 | -LL | env!(invalid); //~ ERROR +LL | env!(invalid); | ^^^^^^^ error: expected string literal --> $DIR/macros-nonfatal-errors.rs:19:10 | -LL | env!(foo, abr, baz); //~ ERROR +LL | env!(foo, abr, baz); | ^^^ error: environment variable `RUST_HOPEFULLY_THIS_DOESNT_EXIST` not defined --> $DIR/macros-nonfatal-errors.rs:20:5 | -LL | env!("RUST_HOPEFULLY_THIS_DOESNT_EXIST"); //~ ERROR +LL | env!("RUST_HOPEFULLY_THIS_DOESNT_EXIST"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: format argument must be a string literal --> $DIR/macros-nonfatal-errors.rs:22:13 | -LL | format!(invalid); //~ ERROR +LL | format!(invalid); | ^^^^^^^ help: you might be missing a string literal to format with | -LL | format!("{}", invalid); //~ ERROR +LL | format!("{}", invalid); | ^^^^^ error: argument must be a string literal --> $DIR/macros-nonfatal-errors.rs:24:14 | -LL | include!(invalid); //~ ERROR +LL | include!(invalid); | ^^^^^^^ error: argument must be a string literal --> $DIR/macros-nonfatal-errors.rs:26:18 | -LL | include_str!(invalid); //~ ERROR +LL | include_str!(invalid); | ^^^^^^^ error: couldn't read $DIR/i'd be quite surprised if a file with this name existed: $FILE_NOT_FOUND_MSG (os error 2) --> $DIR/macros-nonfatal-errors.rs:27:5 | -LL | include_str!("i'd be quite surprised if a file with this name existed"); //~ ERROR +LL | include_str!("i'd be quite surprised if a file with this name existed"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: argument must be a string literal --> $DIR/macros-nonfatal-errors.rs:28:20 | -LL | include_bytes!(invalid); //~ ERROR +LL | include_bytes!(invalid); | ^^^^^^^ error: couldn't read $DIR/i'd be quite surprised if a file with this name existed: $FILE_NOT_FOUND_MSG (os error 2) --> $DIR/macros-nonfatal-errors.rs:29:5 | -LL | include_bytes!("i'd be quite surprised if a file with this name existed"); //~ ERROR +LL | include_bytes!("i'd be quite surprised if a file with this name existed"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: trace_macros! accepts only `true` or `false` --> $DIR/macros-nonfatal-errors.rs:31:5 | -LL | trace_macros!(invalid); //~ ERROR +LL | trace_macros!(invalid); | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 14 previous errors diff --git a/src/test/ui/macros/meta-item-absolute-path.stderr b/src/test/ui/macros/meta-item-absolute-path.stderr index 31b0a27bbc8d..23933f730aae 100644 --- a/src/test/ui/macros/meta-item-absolute-path.stderr +++ b/src/test/ui/macros/meta-item-absolute-path.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: maybe a missing `extern crate Absolute;`? --> $DIR/meta-item-absolute-path.rs:1:12 | -LL | #[derive(::Absolute)] //~ ERROR failed to resolve +LL | #[derive(::Absolute)] | ^^^^^^^^ maybe a missing `extern crate Absolute;`? error: aborting due to previous error diff --git a/src/test/ui/macros/must-use-in-macro-55516.stderr b/src/test/ui/macros/must-use-in-macro-55516.stderr index 47874b809727..623b5745a357 100644 --- a/src/test/ui/macros/must-use-in-macro-55516.stderr +++ b/src/test/ui/macros/must-use-in-macro-55516.stderr @@ -1,7 +1,7 @@ warning: unused `std::result::Result` that must be used --> $DIR/must-use-in-macro-55516.rs:9:5 | -LL | write!(&mut example, "{}", 42); //~WARN must be used +LL | write!(&mut example, "{}", 42); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-W unused-must-use` implied by `-W unused` diff --git a/src/test/ui/macros/nonterminal-matching.stderr b/src/test/ui/macros/nonterminal-matching.stderr index f2a191ae149c..5fba8002e1c4 100644 --- a/src/test/ui/macros/nonterminal-matching.stderr +++ b/src/test/ui/macros/nonterminal-matching.stderr @@ -1,7 +1,7 @@ error: no rules expected the token `enum E { }` --> $DIR/nonterminal-matching.rs:19:10 | -LL | n!(a $nt_item b); //~ ERROR no rules expected the token `enum E { }` +LL | n!(a $nt_item b); | ^^^^^^^^ no rules expected this token in macro call ... LL | complex_nonterminal!(enum E {}); diff --git a/src/test/ui/macros/restricted-shadowing-legacy.stderr b/src/test/ui/macros/restricted-shadowing-legacy.stderr index 9d61799713b0..8378286bdadf 100644 --- a/src/test/ui/macros/restricted-shadowing-legacy.stderr +++ b/src/test/ui/macros/restricted-shadowing-legacy.stderr @@ -1,7 +1,7 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-legacy.rs:101:13 | -LL | m!(); //~ ERROR `m` is ambiguous +LL | m!(); | ^ ambiguous name ... LL | include!(); @@ -27,7 +27,7 @@ LL | include!(); error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-legacy.rs:139:42 | -LL | macro_rules! gen_invoc { () => { m!() } } //~ ERROR `m` is ambiguous +LL | macro_rules! gen_invoc { () => { m!() } } | ^ ambiguous name ... LL | include!(); @@ -53,7 +53,7 @@ LL | include!(); error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-legacy.rs:148:9 | -LL | m!(); //~ ERROR `m` is ambiguous +LL | m!(); | ^ ambiguous name ... LL | include!(); @@ -79,7 +79,7 @@ LL | include!(); error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-legacy.rs:164:9 | -LL | m!(); //~ ERROR `m` is ambiguous +LL | m!(); | ^ ambiguous name ... LL | include!(); @@ -105,7 +105,7 @@ LL | include!(); error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-legacy.rs:180:13 | -LL | m!(); //~ ERROR `m` is ambiguous +LL | m!(); | ^ ambiguous name ... LL | include!(); @@ -131,7 +131,7 @@ LL | include!(); error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-legacy.rs:218:42 | -LL | macro_rules! gen_invoc { () => { m!() } } //~ ERROR `m` is ambiguous +LL | macro_rules! gen_invoc { () => { m!() } } | ^ ambiguous name ... LL | include!(); @@ -157,7 +157,7 @@ LL | include!(); error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-legacy.rs:232:9 | -LL | m!(); //~ ERROR `m` is ambiguous +LL | m!(); | ^ ambiguous name ... LL | include!(); @@ -183,7 +183,7 @@ LL | include!(); error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-legacy.rs:262:42 | -LL | macro_rules! gen_invoc { () => { m!() } } //~ ERROR `m` is ambiguous +LL | macro_rules! gen_invoc { () => { m!() } } | ^ ambiguous name ... LL | include!(); diff --git a/src/test/ui/macros/restricted-shadowing-modern.stderr b/src/test/ui/macros/restricted-shadowing-modern.stderr index 398a7660d309..d147debeb51b 100644 --- a/src/test/ui/macros/restricted-shadowing-modern.stderr +++ b/src/test/ui/macros/restricted-shadowing-modern.stderr @@ -1,7 +1,7 @@ error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-modern.rs:106:17 | -LL | m!(); //~ ERROR `m` is ambiguous +LL | m!(); | ^ ambiguous name ... LL | include!(); @@ -27,7 +27,7 @@ LL | include!(); error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-modern.rs:149:33 | -LL | macro gen_invoc() { m!() } //~ ERROR `m` is ambiguous +LL | macro gen_invoc() { m!() } | ^ ambiguous name ... LL | include!(); @@ -53,7 +53,7 @@ LL | include!(); error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-modern.rs:158:13 | -LL | m!(); //~ ERROR `m` is ambiguous +LL | m!(); | ^ ambiguous name ... LL | include!(); @@ -79,7 +79,7 @@ LL | include!(); error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-modern.rs:174:13 | -LL | m!(); //~ ERROR `m` is ambiguous +LL | m!(); | ^ ambiguous name ... LL | include!(); @@ -105,7 +105,7 @@ LL | include!(); error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-modern.rs:192:17 | -LL | m!(); //~ ERROR `m` is ambiguous +LL | m!(); | ^ ambiguous name ... LL | include!(); @@ -131,7 +131,7 @@ LL | include!(); error[E0659]: `m` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/restricted-shadowing-modern.rs:235:33 | -LL | macro gen_invoc() { m!() } //~ ERROR `m` is ambiguous +LL | macro gen_invoc() { m!() } | ^ ambiguous name ... LL | include!(); diff --git a/src/test/ui/macros/trace_faulty_macros.stderr b/src/test/ui/macros/trace_faulty_macros.stderr index a645590f005a..233d3dcfcb6d 100644 --- a/src/test/ui/macros/trace_faulty_macros.stderr +++ b/src/test/ui/macros/trace_faulty_macros.stderr @@ -4,7 +4,7 @@ error: no rules expected the token `bcd` LL | macro_rules! my_faulty_macro { | ---------------------------- when calling this macro LL | () => { -LL | my_faulty_macro!(bcd); //~ ERROR no rules +LL | my_faulty_macro!(bcd); | ^^^ no rules expected this token in macro call ... LL | my_faulty_macro!(); @@ -23,7 +23,7 @@ LL | my_faulty_macro!(); error: recursion limit reached while expanding the macro `my_recursive_macro` --> $DIR/trace_faulty_macros.rs:22:9 | -LL | my_recursive_macro!(); //~ ERROR recursion limit +LL | my_recursive_macro!(); | ^^^^^^^^^^^^^^^^^^^^^^ ... LL | my_recursive_macro!(); diff --git a/src/test/ui/malformed/malformed-interpolated.rs b/src/test/ui/malformed/malformed-interpolated.rs new file mode 100644 index 000000000000..e452435968ba --- /dev/null +++ b/src/test/ui/malformed/malformed-interpolated.rs @@ -0,0 +1,18 @@ +#![feature(custom_attribute)] + +macro_rules! check { + ($expr: expr) => ( + #[my_attr = $expr] //~ ERROR suffixed literals are not allowed in attributes + //~| ERROR unexpected token: `-0` + //~| ERROR unexpected token: `0 + 0` + use main as _; + ); +} + +check!("0"); // OK +check!(0); // OK +check!(0u8); // ERROR, see above +check!(-0); // ERROR, see above +check!(0 + 0); // ERROR, see above + +fn main() {} diff --git a/src/test/ui/malformed/malformed-interpolated.stderr b/src/test/ui/malformed/malformed-interpolated.stderr new file mode 100644 index 000000000000..efeede0148da --- /dev/null +++ b/src/test/ui/malformed/malformed-interpolated.stderr @@ -0,0 +1,31 @@ +error: suffixed literals are not allowed in attributes + --> $DIR/malformed-interpolated.rs:5:21 + | +LL | #[my_attr = $expr] + | ^^^^^ +... +LL | check!(0u8); // ERROR, see above + | ------------ in this macro invocation + | + = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). + +error: unexpected token: `-0` + --> $DIR/malformed-interpolated.rs:5:19 + | +LL | #[my_attr = $expr] + | ^ +... +LL | check!(-0); // ERROR, see above + | ----------- in this macro invocation + +error: unexpected token: `0 + 0` + --> $DIR/malformed-interpolated.rs:5:19 + | +LL | #[my_attr = $expr] + | ^ +... +LL | check!(0 + 0); // ERROR, see above + | -------------- in this macro invocation + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/malformed/malformed-plugin-1.stderr b/src/test/ui/malformed/malformed-plugin-1.stderr index f42e66e2b32f..cc0ac182d706 100644 --- a/src/test/ui/malformed/malformed-plugin-1.stderr +++ b/src/test/ui/malformed/malformed-plugin-1.stderr @@ -1,7 +1,7 @@ error: attribute must be of the form `#[plugin(name|name(args))]` --> $DIR/malformed-plugin-1.rs:2:1 | -LL | #![plugin] //~ ERROR attribute must be of the form +LL | #![plugin] | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/malformed/malformed-plugin-2.stderr b/src/test/ui/malformed/malformed-plugin-2.stderr index 923cbc188607..617b13b2654f 100644 --- a/src/test/ui/malformed/malformed-plugin-2.stderr +++ b/src/test/ui/malformed/malformed-plugin-2.stderr @@ -1,7 +1,7 @@ error: attribute must be of the form `#[plugin(name|name(args))]` --> $DIR/malformed-plugin-2.rs:2:1 | -LL | #![plugin="bleh"] //~ ERROR attribute must be of the form +LL | #![plugin="bleh"] | ^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/malformed/malformed-plugin-3.stderr b/src/test/ui/malformed/malformed-plugin-3.stderr index 6f19a1171490..5739770ad98b 100644 --- a/src/test/ui/malformed/malformed-plugin-3.stderr +++ b/src/test/ui/malformed/malformed-plugin-3.stderr @@ -1,7 +1,7 @@ error[E0498]: malformed plugin attribute --> $DIR/malformed-plugin-3.rs:2:1 | -LL | #![plugin(foo="bleh")] //~ ERROR malformed plugin attribute +LL | #![plugin(foo="bleh")] | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/malformed/malformed-regressions.stderr b/src/test/ui/malformed/malformed-regressions.stderr index a3b2bda07f62..9a81c1056ca9 100644 --- a/src/test/ui/malformed/malformed-regressions.stderr +++ b/src/test/ui/malformed/malformed-regressions.stderr @@ -1,7 +1,7 @@ warning: attribute must be of the form `#[doc(hidden|inline|...)]` or `#[doc = "string"]` --> $DIR/malformed-regressions.rs:3:1 | -LL | #[doc] //~ WARN attribute must be of the form +LL | #[doc] | ^^^^^^ | = note: #[warn(ill_formed_attribute_input)] on by default @@ -11,7 +11,7 @@ LL | #[doc] //~ WARN attribute must be of the form warning: attribute must be of the form `#[ignore]` or `#[ignore = "reason"]` --> $DIR/malformed-regressions.rs:4:1 | -LL | #[ignore()] //~ WARN attribute must be of the form +LL | #[ignore()] | ^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -20,7 +20,7 @@ LL | #[ignore()] //~ WARN attribute must be of the form warning: attribute must be of the form `#[inline]` or `#[inline(always|never)]` --> $DIR/malformed-regressions.rs:5:1 | -LL | #[inline = ""] //~ WARN attribute must be of the form +LL | #[inline = ""] | ^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -30,7 +30,7 @@ warning: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dyl /*opt*/ cfg = "...")]` --> $DIR/malformed-regressions.rs:6:1 | -LL | #[link] //~ WARN attribute must be of the form +LL | #[link] | ^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -40,7 +40,7 @@ warning: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dyl /*opt*/ cfg = "...")]` --> $DIR/malformed-regressions.rs:7:1 | -LL | #[link = ""] //~ WARN attribute must be of the form +LL | #[link = ""] | ^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/malformed/malformed-special-attrs.stderr b/src/test/ui/malformed/malformed-special-attrs.stderr index 1653aa150d57..8c23424087c0 100644 --- a/src/test/ui/malformed/malformed-special-attrs.stderr +++ b/src/test/ui/malformed/malformed-special-attrs.stderr @@ -3,22 +3,22 @@ error: expected `(`, found `` error: expected `(`, found `=` --> $DIR/malformed-special-attrs.rs:4:12 | -LL | #[cfg_attr] //~ ERROR expected `(`, found `` +LL | #[cfg_attr] | - expected `(` ... -LL | #[cfg_attr = ""] //~ ERROR expected `(`, found `=` +LL | #[cfg_attr = ""] | ^ unexpected token error: attribute must be of the form `#[derive(Trait1, Trait2, ...)]` --> $DIR/malformed-special-attrs.rs:7:1 | -LL | #[derive] //~ ERROR attribute must be of the form +LL | #[derive] | ^^^^^^^^^ error: attribute must be of the form `#[derive(Trait1, Trait2, ...)]` --> $DIR/malformed-special-attrs.rs:10:1 | -LL | #[derive = ""] //~ ERROR attribute must be of the form +LL | #[derive = ""] | ^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/malformed/malformed-unwind-1.rs b/src/test/ui/malformed/malformed-unwind-1.rs new file mode 100644 index 000000000000..e34c288c027c --- /dev/null +++ b/src/test/ui/malformed/malformed-unwind-1.rs @@ -0,0 +1,11 @@ +#![feature(unwind_attributes)] + +#[unwind] +//~^ ERROR attribute must be of the form +extern "C" fn f1() {} + +#[unwind = ""] +//~^ ERROR attribute must be of the form +extern "C" fn f2() {} + +fn main() {} diff --git a/src/test/ui/malformed/malformed-unwind-1.stderr b/src/test/ui/malformed/malformed-unwind-1.stderr new file mode 100644 index 000000000000..852136eed91b --- /dev/null +++ b/src/test/ui/malformed/malformed-unwind-1.stderr @@ -0,0 +1,14 @@ +error: attribute must be of the form `#[unwind(allowed|aborts)]` + --> $DIR/malformed-unwind-1.rs:3:1 + | +LL | #[unwind] + | ^^^^^^^^^ + +error: attribute must be of the form `#[unwind(allowed|aborts)]` + --> $DIR/malformed-unwind-1.rs:7:1 + | +LL | #[unwind = ""] + | ^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/malformed/malformed-unwind-2.rs b/src/test/ui/malformed/malformed-unwind-2.rs new file mode 100644 index 000000000000..d4955b433093 --- /dev/null +++ b/src/test/ui/malformed/malformed-unwind-2.rs @@ -0,0 +1,11 @@ +#![feature(unwind_attributes)] + +#[unwind(allowed, aborts)] +//~^ ERROR malformed `#[unwind]` attribute +extern "C" fn f1() {} + +#[unwind(unsupported)] +//~^ ERROR malformed `#[unwind]` attribute +extern "C" fn f2() {} + +fn main() {} diff --git a/src/test/ui/malformed/malformed-unwind-2.stderr b/src/test/ui/malformed/malformed-unwind-2.stderr new file mode 100644 index 000000000000..88fc4e00a2fd --- /dev/null +++ b/src/test/ui/malformed/malformed-unwind-2.stderr @@ -0,0 +1,15 @@ +error[E0633]: malformed `#[unwind]` attribute + --> $DIR/malformed-unwind-2.rs:3:1 + | +LL | #[unwind(allowed, aborts)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0633]: malformed `#[unwind]` attribute + --> $DIR/malformed-unwind-2.rs:7:1 + | +LL | #[unwind(unsupported)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0633`. diff --git a/src/test/ui/malformed_macro_lhs.stderr b/src/test/ui/malformed_macro_lhs.stderr index ab09bc10b86f..adf64b089350 100644 --- a/src/test/ui/malformed_macro_lhs.stderr +++ b/src/test/ui/malformed_macro_lhs.stderr @@ -1,7 +1,7 @@ error: invalid macro matcher; matchers must be contained in balanced delimiters --> $DIR/malformed_macro_lhs.rs:2:5 | -LL | t => (1); //~ ERROR invalid macro matcher +LL | t => (1); | ^ error: aborting due to previous error diff --git a/src/test/ui/marker_trait_attr/marker-attribute-on-non-trait.stderr b/src/test/ui/marker_trait_attr/marker-attribute-on-non-trait.stderr index b88c125d968d..d30b990caac2 100644 --- a/src/test/ui/marker_trait_attr/marker-attribute-on-non-trait.stderr +++ b/src/test/ui/marker_trait_attr/marker-attribute-on-non-trait.stderr @@ -1,7 +1,7 @@ error: attribute can only be applied to a trait --> $DIR/marker-attribute-on-non-trait.rs:3:1 | -LL | #[marker] //~ ERROR attribute can only be applied to a trait +LL | #[marker] | ^^^^^^^^^ LL | struct Struct {} | ---------------- not a trait @@ -9,7 +9,7 @@ LL | struct Struct {} error: attribute can only be applied to a trait --> $DIR/marker-attribute-on-non-trait.rs:6:1 | -LL | #[marker] //~ ERROR attribute can only be applied to a trait +LL | #[marker] | ^^^^^^^^^ LL | impl Struct {} | -------------- not a trait @@ -17,7 +17,7 @@ LL | impl Struct {} error: attribute can only be applied to a trait --> $DIR/marker-attribute-on-non-trait.rs:9:1 | -LL | #[marker] //~ ERROR attribute can only be applied to a trait +LL | #[marker] | ^^^^^^^^^ LL | / union Union { LL | | x: i32, @@ -27,7 +27,7 @@ LL | | } error: attribute can only be applied to a trait --> $DIR/marker-attribute-on-non-trait.rs:14:1 | -LL | #[marker] //~ ERROR attribute can only be applied to a trait +LL | #[marker] | ^^^^^^^^^ LL | const CONST: usize = 10; | ------------------------ not a trait @@ -35,7 +35,7 @@ LL | const CONST: usize = 10; error: attribute can only be applied to a trait --> $DIR/marker-attribute-on-non-trait.rs:17:1 | -LL | #[marker] //~ ERROR attribute can only be applied to a trait +LL | #[marker] | ^^^^^^^^^ LL | fn function() {} | ---------------- not a trait @@ -43,7 +43,7 @@ LL | fn function() {} error: attribute can only be applied to a trait --> $DIR/marker-attribute-on-non-trait.rs:20:1 | -LL | #[marker] //~ ERROR attribute can only be applied to a trait +LL | #[marker] | ^^^^^^^^^ LL | type Type = (); | --------------- not a trait diff --git a/src/test/ui/marker_trait_attr/marker-attribute-with-values.rs b/src/test/ui/marker_trait_attr/marker-attribute-with-values.rs index ea356d574f62..f8bcec78650e 100644 --- a/src/test/ui/marker_trait_attr/marker-attribute-with-values.rs +++ b/src/test/ui/marker_trait_attr/marker-attribute-with-values.rs @@ -1,5 +1,4 @@ #![feature(marker_trait_attr)] -#![feature(unrestricted_attribute_tokens)] #[marker(always)] trait Marker1 {} @@ -9,8 +8,8 @@ trait Marker1 {} trait Marker2 {} //~^^ ERROR attribute must be of the form -#[marker(key = value)] +#[marker(key = "value")] trait Marker3 {} -//~^^ ERROR expected unsuffixed literal or identifier, found value +//~^^ ERROR attribute must be of the form `#[marker]` fn main() {} diff --git a/src/test/ui/marker_trait_attr/marker-attribute-with-values.stderr b/src/test/ui/marker_trait_attr/marker-attribute-with-values.stderr index c683b393d84e..2b31dcb4760a 100644 --- a/src/test/ui/marker_trait_attr/marker-attribute-with-values.stderr +++ b/src/test/ui/marker_trait_attr/marker-attribute-with-values.stderr @@ -1,20 +1,20 @@ error: attribute must be of the form `#[marker]` - --> $DIR/marker-attribute-with-values.rs:4:1 + --> $DIR/marker-attribute-with-values.rs:3:1 | LL | #[marker(always)] | ^^^^^^^^^^^^^^^^^ error: attribute must be of the form `#[marker]` - --> $DIR/marker-attribute-with-values.rs:8:1 + --> $DIR/marker-attribute-with-values.rs:7:1 | LL | #[marker("never")] | ^^^^^^^^^^^^^^^^^^ -error: expected unsuffixed literal or identifier, found value - --> $DIR/marker-attribute-with-values.rs:12:10 +error: attribute must be of the form `#[marker]` + --> $DIR/marker-attribute-with-values.rs:11:1 | -LL | #[marker(key = value)] - | ^^^ +LL | #[marker(key = "value")] + | ^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr b/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr index 4579ec261164..f4a52a65af6a 100644 --- a/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr +++ b/src/test/ui/marker_trait_attr/overlap-marker-trait.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `NotDebugOrDisplay: Marker` is not satisfied --> $DIR/overlap-marker-trait.rs:27:5 | -LL | is_marker::(); //~ ERROR +LL | is_marker::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Marker` is not implemented for `NotDebugOrDisplay` | note: required by `is_marker` diff --git a/src/test/ui/match/match-argm-statics-2.stderr b/src/test/ui/match/match-argm-statics-2.stderr index 3e6f22ab8751..8c54e030823a 100644 --- a/src/test/ui/match/match-argm-statics-2.stderr +++ b/src/test/ui/match/match-argm-statics-2.stderr @@ -3,18 +3,30 @@ error[E0004]: non-exhaustive patterns: `(true, false)` not covered | LL | match (true, false) { | ^^^^^^^^^^^^^ pattern `(true, false)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `Some(Some(West))` not covered --> $DIR/match-argm-statics-2.rs:29:11 | LL | match Some(Some(North)) { | ^^^^^^^^^^^^^^^^^ pattern `Some(Some(West))` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `Foo { bar: Some(North), baz: NewBool(true) }` not covered --> $DIR/match-argm-statics-2.rs:48:11 | -LL | match (Foo { bar: Some(North), baz: NewBool(true) }) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { bar: Some(North), baz: NewBool(true) }` not covered +LL | / struct Foo { +LL | | bar: Option, +LL | | baz: NewBool +LL | | } + | |_- `Foo` defined here +... +LL | match (Foo { bar: Some(North), baz: NewBool(true) }) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { bar: Some(North), baz: NewBool(true) }` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to 3 previous errors diff --git a/src/test/ui/match/match-byte-array-patterns-2.stderr b/src/test/ui/match/match-byte-array-patterns-2.stderr index 4030cd39448a..d53e2e25b3db 100644 --- a/src/test/ui/match/match-byte-array-patterns-2.stderr +++ b/src/test/ui/match/match-byte-array-patterns-2.stderr @@ -1,14 +1,18 @@ error[E0004]: non-exhaustive patterns: `&[_, _, _, _]` not covered --> $DIR/match-byte-array-patterns-2.rs:4:11 | -LL | match buf { //~ ERROR non-exhaustive +LL | match buf { | ^^^ pattern `&[_, _, _, _]` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `&[]`, `&[_]`, `&[_, _]` and 3 more not covered --> $DIR/match-byte-array-patterns-2.rs:10:11 | -LL | match buf { //~ ERROR non-exhaustive +LL | match buf { | ^^^ patterns `&[]`, `&[_]`, `&[_, _]` and 3 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to 2 previous errors diff --git a/src/test/ui/match/match-byte-array-patterns.stderr b/src/test/ui/match/match-byte-array-patterns.stderr index a23f18536666..b28646b50cf0 100644 --- a/src/test/ui/match/match-byte-array-patterns.stderr +++ b/src/test/ui/match/match-byte-array-patterns.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/match-byte-array-patterns.rs:9:9 | -LL | &[0x41, 0x41, 0x41, 0x41] => {} //~ ERROR unreachable pattern +LL | &[0x41, 0x41, 0x41, 0x41] => {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,43 +13,43 @@ LL | #![deny(unreachable_patterns)] error: unreachable pattern --> $DIR/match-byte-array-patterns.rs:15:9 | -LL | b"AAAA" => {}, //~ ERROR unreachable pattern +LL | b"AAAA" => {}, | ^^^^^^^ error: unreachable pattern --> $DIR/match-byte-array-patterns.rs:21:9 | -LL | b"AAAA" => {}, //~ ERROR unreachable pattern +LL | b"AAAA" => {}, | ^^^^^^^ error: unreachable pattern --> $DIR/match-byte-array-patterns.rs:27:9 | -LL | b"AAAA" => {}, //~ ERROR unreachable pattern +LL | b"AAAA" => {}, | ^^^^^^^ error: unreachable pattern --> $DIR/match-byte-array-patterns.rs:35:9 | -LL | &[0x41, 0x41, 0x41, 0x41] => {} //~ ERROR unreachable pattern +LL | &[0x41, 0x41, 0x41, 0x41] => {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: unreachable pattern --> $DIR/match-byte-array-patterns.rs:41:9 | -LL | b"AAAA" => {}, //~ ERROR unreachable pattern +LL | b"AAAA" => {}, | ^^^^^^^ error: unreachable pattern --> $DIR/match-byte-array-patterns.rs:47:9 | -LL | b"AAAA" => {}, //~ ERROR unreachable pattern +LL | b"AAAA" => {}, | ^^^^^^^ error: unreachable pattern --> $DIR/match-byte-array-patterns.rs:53:9 | -LL | b"AAAA" => {}, //~ ERROR unreachable pattern +LL | b"AAAA" => {}, | ^^^^^^^ error: aborting due to 8 previous errors diff --git a/src/test/ui/match/match-ill-type2.stderr b/src/test/ui/match/match-ill-type2.stderr index 116d26ac7121..83fae10d4cb4 100644 --- a/src/test/ui/match/match-ill-type2.stderr +++ b/src/test/ui/match/match-ill-type2.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/match-ill-type2.rs:4:9 | -LL | 2u32 => 1, //~ ERROR mismatched types +LL | 2u32 => 1, | ^^^^ expected i32, found u32 error: aborting due to previous error diff --git a/src/test/ui/match/match-join.stderr b/src/test/ui/match/match-join.stderr index 6e08c92bedb5..27a82c1242cc 100644 --- a/src/test/ui/match/match-join.stderr +++ b/src/test/ui/match/match-join.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `x` in this scope --> $DIR/match-join.rs:9:20 | -LL | println!("{}", x); //~ ERROR cannot find value `x` in this scope +LL | println!("{}", x); | ^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/match/match-no-arms-unreachable-after.stderr b/src/test/ui/match/match-no-arms-unreachable-after.stderr index bd136245c1ae..65dcc6ee4655 100644 --- a/src/test/ui/match/match-no-arms-unreachable-after.stderr +++ b/src/test/ui/match/match-no-arms-unreachable-after.stderr @@ -1,7 +1,7 @@ error: unreachable statement --> $DIR/match-no-arms-unreachable-after.rs:8:5 | -LL | let x = 2; //~ ERROR unreachable +LL | let x = 2; | ^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/match/match-non-exhaustive.stderr b/src/test/ui/match/match-non-exhaustive.stderr index ab5ab18c3283..00c2bfff7eb4 100644 --- a/src/test/ui/match/match-non-exhaustive.stderr +++ b/src/test/ui/match/match-non-exhaustive.stderr @@ -1,14 +1,18 @@ error[E0004]: non-exhaustive patterns: `-2147483648i32..=0i32` and `2i32..=2147483647i32` not covered --> $DIR/match-non-exhaustive.rs:2:11 | -LL | match 0 { 1 => () } //~ ERROR non-exhaustive patterns +LL | match 0 { 1 => () } | ^ patterns `-2147483648i32..=0i32` and `2i32..=2147483647i32` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/match-non-exhaustive.rs:3:11 | -LL | match 0 { 0 if false => () } //~ ERROR non-exhaustive patterns +LL | match 0 { 0 if false => () } | ^ pattern `_` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to 2 previous errors diff --git a/src/test/ui/match/match-privately-empty.stderr b/src/test/ui/match/match-privately-empty.stderr index 23ca64e50af7..f79d180a1b8b 100644 --- a/src/test/ui/match/match-privately-empty.stderr +++ b/src/test/ui/match/match-privately-empty.stderr @@ -3,6 +3,8 @@ error[E0004]: non-exhaustive patterns: `Some(Private { misc: true, .. })` not co | LL | match private::DATA { | ^^^^^^^^^^^^^ pattern `Some(Private { misc: true, .. })` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/match/match-ref-ice.stderr b/src/test/ui/match/match-ref-ice.stderr index faefd9f21290..c4bfa0afcc27 100644 --- a/src/test/ui/match/match-ref-ice.stderr +++ b/src/test/ui/match/match-ref-ice.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/match-ref-ice.rs:13:9 | -LL | [1, 2, 3] => (), //~ ERROR unreachable pattern +LL | [1, 2, 3] => (), | ^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/match/match-ref-mut-invariance.stderr b/src/test/ui/match/match-ref-mut-invariance.stderr index 61552b44c275..30bbb8d7800f 100644 --- a/src/test/ui/match/match-ref-mut-invariance.stderr +++ b/src/test/ui/match/match-ref-mut-invariance.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/match-ref-mut-invariance.rs:10:37 | -LL | match self.0 { ref mut x => x } //~ ERROR mismatched types +LL | match self.0 { ref mut x => x } | ^ lifetime mismatch | = note: expected type `&'a mut &'a i32` diff --git a/src/test/ui/match/match-ref-mut-let-invariance.stderr b/src/test/ui/match/match-ref-mut-let-invariance.stderr index 26ec0697f410..6ca222d9c2ff 100644 --- a/src/test/ui/match/match-ref-mut-let-invariance.stderr +++ b/src/test/ui/match/match-ref-mut-let-invariance.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/match-ref-mut-let-invariance.rs:11:9 | -LL | x //~ ERROR mismatched types +LL | x | ^ lifetime mismatch | = note: expected type `&'a mut &'a i32` diff --git a/src/test/ui/match/match-slice-patterns.stderr b/src/test/ui/match/match-slice-patterns.stderr index 2b817498aba9..24769db34c93 100644 --- a/src/test/ui/match/match-slice-patterns.stderr +++ b/src/test/ui/match/match-slice-patterns.stderr @@ -3,6 +3,8 @@ error[E0004]: non-exhaustive patterns: `&[_, Some(_), None, _]` not covered | LL | match list { | ^^^^ pattern `&[_, Some(_), None, _]` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/match/match-tag-nullary.stderr b/src/test/ui/match/match-tag-nullary.stderr index 014581ea4bd0..902ccc94dde2 100644 --- a/src/test/ui/match/match-tag-nullary.stderr +++ b/src/test/ui/match/match-tag-nullary.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/match-tag-nullary.rs:4:40 | -LL | fn main() { let x: A = A::A; match x { B::B => { } } } //~ ERROR mismatched types +LL | fn main() { let x: A = A::A; match x { B::B => { } } } | ^^^^ expected enum `A`, found enum `B` | = note: expected type `A` diff --git a/src/test/ui/match/match-tag-unary.stderr b/src/test/ui/match/match-tag-unary.stderr index 53b663513696..da599c374074 100644 --- a/src/test/ui/match/match-tag-unary.stderr +++ b/src/test/ui/match/match-tag-unary.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/match-tag-unary.rs:4:43 | -LL | fn main() { let x: A = A::A(0); match x { B::B(y) => { } } } //~ ERROR mismatched types +LL | fn main() { let x: A = A::A(0); match x { B::B(y) => { } } } | - ^^^^^^^ expected enum `A`, found enum `B` | | | this match expression has type `A` diff --git a/src/test/ui/match/match-type-err-first-arm.stderr b/src/test/ui/match/match-type-err-first-arm.stderr index db8bef8dc775..a318e6cffb93 100644 --- a/src/test/ui/match/match-type-err-first-arm.stderr +++ b/src/test/ui/match/match-type-err-first-arm.stderr @@ -12,14 +12,14 @@ error[E0308]: match arms have incompatible types | LL | let x = match n { | _____________- -LL | | //~^ NOTE `match` arms have incompatible types +LL | | LL | | 12 => 'b', | | --- this is found to be of type `char` -LL | | //~^ NOTE this is found to be of type `char` +LL | | LL | | _ => 42, | | ^^ expected char, found integer ... | -LL | | //~| NOTE expected type `char` +LL | | LL | | }; | |_____- `match` arms have incompatible types | @@ -31,17 +31,17 @@ error[E0308]: match arms have incompatible types | LL | let x = match n { | _____________- -LL | | //~^ NOTE `match` arms have incompatible types +LL | | LL | | 1 => 'b', LL | | 2 => 'b', ... | LL | | 6 => 'b', | | --- this and all prior arms are found to be of type `char` -LL | | //~^ NOTE this and all prior arms are found to be of type `char` +LL | | LL | | _ => 42, | | ^^ expected char, found integer ... | -LL | | //~| NOTE expected type `char` +LL | | LL | | }; | |_____- `match` arms have incompatible types | diff --git a/src/test/ui/match/match-unresolved-one-arm.stderr b/src/test/ui/match/match-unresolved-one-arm.stderr index b013933eaae6..ad8569b4802f 100644 --- a/src/test/ui/match/match-unresolved-one-arm.stderr +++ b/src/test/ui/match/match-unresolved-one-arm.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/match-unresolved-one-arm.rs:4:9 | -LL | let x = match () { //~ ERROR type annotations needed +LL | let x = match () { | ^ | | | cannot infer type diff --git a/src/test/ui/match/match-vec-fixed.stderr b/src/test/ui/match/match-vec-fixed.stderr index f4b426bea325..ae2dd87b6954 100644 --- a/src/test/ui/match/match-vec-fixed.stderr +++ b/src/test/ui/match/match-vec-fixed.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/match-vec-fixed.rs:7:9 | -LL | [_, _, _] => {} //~ ERROR unreachable pattern +LL | [_, _, _] => {} | ^^^^^^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unreachable_patterns)] error: unreachable pattern --> $DIR/match-vec-fixed.rs:11:9 | -LL | [_, 1, _] => {} //~ ERROR unreachable pattern +LL | [_, 1, _] => {} | ^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/match/match-vec-mismatch.stderr b/src/test/ui/match/match-vec-mismatch.stderr index 93a407760a51..e19a0f956ce3 100644 --- a/src/test/ui/match/match-vec-mismatch.stderr +++ b/src/test/ui/match/match-vec-mismatch.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `does_not_exist` in this scope --> $DIR/match-vec-mismatch.rs:28:11 | -LL | match does_not_exist { //~ ERROR cannot find value `does_not_exist` in this scope +LL | match does_not_exist { | ^^^^^^^^^^^^^^ not found in this scope error[E0529]: expected an array or slice, found `std::string::String` @@ -13,19 +13,19 @@ LL | ['f', 'o', ..] => {} error[E0527]: pattern requires 1 elements but array has 3 --> $DIR/match-vec-mismatch.rs:20:9 | -LL | [0] => {}, //~ ERROR pattern requires +LL | [0] => {}, | ^^^ expected 3 elements error[E0528]: pattern requires at least 4 elements but array has 3 --> $DIR/match-vec-mismatch.rs:25:9 | -LL | [0, 1, 2, 3, x..] => {} //~ ERROR pattern requires +LL | [0, 1, 2, 3, x..] => {} | ^^^^^^^^^^^^^^^^^ pattern cannot match array of 3 elements error[E0282]: type annotations needed --> $DIR/match-vec-mismatch.rs:36:9 | -LL | [] => {} //~ ERROR type annotations needed +LL | [] => {} | ^^ cannot infer type | = note: type must be known at this point diff --git a/src/test/ui/match/match-vec-unreachable.stderr b/src/test/ui/match/match-vec-unreachable.stderr index 71e3d8c5e31c..415c24ae77ef 100644 --- a/src/test/ui/match/match-vec-unreachable.stderr +++ b/src/test/ui/match/match-vec-unreachable.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/match-vec-unreachable.rs:9:9 | -LL | [(1, 2), (2, 3), b] => (), //~ ERROR unreachable pattern +LL | [(1, 2), (2, 3), b] => (), | ^^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,13 +13,13 @@ LL | #![deny(unreachable_patterns)] error: unreachable pattern --> $DIR/match-vec-unreachable.rs:19:9 | -LL | [_, _, _, _, _] => { } //~ ERROR unreachable pattern +LL | [_, _, _, _, _] => { } | ^^^^^^^^^^^^^^^ error: unreachable pattern --> $DIR/match-vec-unreachable.rs:27:9 | -LL | ['a', 'b', 'c'] => {} //~ ERROR unreachable pattern +LL | ['a', 'b', 'c'] => {} | ^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/maybe-bounds.stderr b/src/test/ui/maybe-bounds.stderr index 58f5b790c097..20446c257df0 100644 --- a/src/test/ui/maybe-bounds.stderr +++ b/src/test/ui/maybe-bounds.stderr @@ -1,7 +1,7 @@ error: `?Trait` is not permitted in supertraits --> $DIR/maybe-bounds.rs:1:11 | -LL | trait Tr: ?Sized {} //~ ERROR `?Trait` is not permitted in supertraits +LL | trait Tr: ?Sized {} | ^^^^^^ | = note: traits are `?Sized` by default @@ -9,13 +9,13 @@ LL | trait Tr: ?Sized {} //~ ERROR `?Trait` is not permitted in supertraits error: `?Trait` is not permitted in trait object types --> $DIR/maybe-bounds.rs:3:16 | -LL | type A1 = Tr + (?Sized); //~ ERROR `?Trait` is not permitted in trait object types +LL | type A1 = Tr + (?Sized); | ^^^^^^^^ error: `?Trait` is not permitted in trait object types --> $DIR/maybe-bounds.rs:4:24 | -LL | type A2 = for<'a> Tr + (?Sized); //~ ERROR `?Trait` is not permitted in trait object types +LL | type A2 = for<'a> Tr + (?Sized); | ^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr b/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr index 53a07f5196e4..9e5f2ee4ce5f 100644 --- a/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr +++ b/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr @@ -9,7 +9,7 @@ LL | let mut x = Vec::new(); error[E0308]: mismatched types --> $DIR/method-ambig-one-trait-unknown-int-type.rs:33:20 | -LL | let y: usize = x.foo(); //~ ERROR mismatched types +LL | let y: usize = x.foo(); | ^^^^^^^ expected usize, found isize error: aborting due to 2 previous errors diff --git a/src/test/ui/methods/method-ambig-two-traits-cross-crate.stderr b/src/test/ui/methods/method-ambig-two-traits-cross-crate.stderr index 15379194777c..2b87ddfdf98e 100644 --- a/src/test/ui/methods/method-ambig-two-traits-cross-crate.stderr +++ b/src/test/ui/methods/method-ambig-two-traits-cross-crate.stderr @@ -1,7 +1,7 @@ error[E0034]: multiple applicable items in scope --> $DIR/method-ambig-two-traits-cross-crate.rs:11:21 | -LL | fn main() { 1_usize.me(); } //~ ERROR E0034 +LL | fn main() { 1_usize.me(); } | ^^ multiple `me` found | note: candidate #1 is defined in an impl of the trait `Me2` for the type `usize` diff --git a/src/test/ui/methods/method-ambig-two-traits-from-bounds.stderr b/src/test/ui/methods/method-ambig-two-traits-from-bounds.stderr index a805ca3ca56b..6c493c67e29d 100644 --- a/src/test/ui/methods/method-ambig-two-traits-from-bounds.stderr +++ b/src/test/ui/methods/method-ambig-two-traits-from-bounds.stderr @@ -1,7 +1,7 @@ error[E0034]: multiple applicable items in scope --> $DIR/method-ambig-two-traits-from-bounds.rs:5:7 | -LL | t.foo(); //~ ERROR E0034 +LL | t.foo(); | ^^^ multiple `foo` found | note: candidate #1 is defined in the trait `A` diff --git a/src/test/ui/methods/method-ambig-two-traits-with-default-method.stderr b/src/test/ui/methods/method-ambig-two-traits-with-default-method.stderr index cbb1754935a9..5d508d570225 100644 --- a/src/test/ui/methods/method-ambig-two-traits-with-default-method.stderr +++ b/src/test/ui/methods/method-ambig-two-traits-with-default-method.stderr @@ -1,7 +1,7 @@ error[E0034]: multiple applicable items in scope --> $DIR/method-ambig-two-traits-with-default-method.rs:12:13 | -LL | 1_usize.method(); //~ ERROR E0034 +LL | 1_usize.method(); | ^^^^^^ multiple `method` found | note: candidate #1 is defined in an impl of the trait `Foo` for the type `usize` diff --git a/src/test/ui/methods/method-call-err-msg.stderr b/src/test/ui/methods/method-call-err-msg.stderr index 2113add63d61..0e901a98348b 100644 --- a/src/test/ui/methods/method-call-err-msg.stderr +++ b/src/test/ui/methods/method-call-err-msg.stderr @@ -4,7 +4,7 @@ error[E0061]: this function takes 0 parameters but 1 parameter was supplied LL | fn zero(self) -> Foo { self } | -------------------- defined here ... -LL | x.zero(0) //~ ERROR this function takes 0 parameters but 1 parameter was supplied +LL | x.zero(0) | ^^^^ expected 0 parameters error[E0061]: this function takes 1 parameter but 0 parameters were supplied @@ -13,7 +13,7 @@ error[E0061]: this function takes 1 parameter but 0 parameters were supplied LL | fn one(self, _: isize) -> Foo { self } | ----------------------------- defined here ... -LL | .one() //~ ERROR this function takes 1 parameter but 0 parameters were supplied +LL | .one() | ^^^ expected 1 parameter error[E0061]: this function takes 2 parameters but 1 parameter was supplied @@ -22,7 +22,7 @@ error[E0061]: this function takes 2 parameters but 1 parameter was supplied LL | fn two(self, _: isize, _: isize) -> Foo { self } | --------------------------------------- defined here ... -LL | .two(0); //~ ERROR this function takes 2 parameters but 1 parameter was supplied +LL | .two(0); | ^^^ expected 2 parameters error[E0599]: no method named `take` found for type `Foo` in the current scope @@ -31,7 +31,7 @@ error[E0599]: no method named `take` found for type `Foo` in the current scope LL | pub struct Foo; | --------------- method `take` not found for this ... -LL | .take() //~ ERROR no method named `take` found for type `Foo` in the current scope +LL | .take() | ^^^^ | = note: the method `take` exists but the following trait bounds were not satisfied: diff --git a/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr b/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr index 25432177a859..67fd8d7a13eb 100644 --- a/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr +++ b/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr @@ -1,7 +1,7 @@ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/method-call-lifetime-args-unresolved.rs:2:15 | -LL | 0.clone::<'a>(); //~ ERROR use of undeclared lifetime name `'a` +LL | 0.clone::<'a>(); | ^^ undeclared lifetime error: aborting due to previous error diff --git a/src/test/ui/methods/method-call-type-binding.stderr b/src/test/ui/methods/method-call-type-binding.stderr index 27d6f93490bb..4b93082ace57 100644 --- a/src/test/ui/methods/method-call-type-binding.stderr +++ b/src/test/ui/methods/method-call-type-binding.stderr @@ -1,7 +1,7 @@ error[E0229]: associated type bindings are not allowed here --> $DIR/method-call-type-binding.rs:2:15 | -LL | 0.clone::(); //~ ERROR associated type bindings are not allowed here +LL | 0.clone::(); | ^^^^^^ associated type not allowed here error: aborting due to previous error diff --git a/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr b/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr index 2d8449b96de4..3c2e9b017671 100644 --- a/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr +++ b/src/test/ui/methods/method-deref-to-same-trait-object-with-separate-params.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:85:24 | -LL | let _seetype: () = z; //~ ERROR mismatched types +LL | let _seetype: () = z; | ^ expected (), found u32 | = note: expected type `()` @@ -10,7 +10,7 @@ LL | let _seetype: () = z; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:102:24 | -LL | let _seetype: () = z; //~ ERROR mismatched types +LL | let _seetype: () = z; | ^ expected (), found u64 | = note: expected type `()` @@ -19,7 +19,7 @@ LL | let _seetype: () = z; //~ ERROR mismatched types error[E0034]: multiple applicable items in scope --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:120:15 | -LL | let z = x.foo(); //~ ERROR multiple applicable items in scope +LL | let z = x.foo(); | ^^^ multiple `foo` found | note: candidate #1 is defined in an impl of the trait `internal::X` for the type `_` @@ -42,7 +42,7 @@ LL | fn foo(&self) -> u8; error[E0308]: mismatched types --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:137:24 | -LL | let _seetype: () = z; //~ ERROR mismatched types +LL | let _seetype: () = z; | ^ expected (), found u8 | = note: expected type `()` @@ -51,7 +51,7 @@ LL | let _seetype: () = z; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:155:24 | -LL | let _seetype: () = z; //~ ERROR mismatched types +LL | let _seetype: () = z; | ^ expected (), found u32 | = note: expected type `()` @@ -60,7 +60,7 @@ LL | let _seetype: () = z; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/method-deref-to-same-trait-object-with-separate-params.rs:172:24 | -LL | let _seetype: () = z; //~ ERROR mismatched types +LL | let _seetype: () = z; | ^ expected (), found u32 | = note: expected type `()` diff --git a/src/test/ui/methods/method-macro-backtrace.stderr b/src/test/ui/methods/method-macro-backtrace.stderr index 81098bbceb05..7860365476a3 100644 --- a/src/test/ui/methods/method-macro-backtrace.stderr +++ b/src/test/ui/methods/method-macro-backtrace.stderr @@ -3,7 +3,7 @@ error[E0201]: duplicate definitions with name `bar`: | LL | fn bar(&self) { } | ----------------- previous definition of `bar` here -LL | fn bar(&self) { } //~ ERROR duplicate definitions +LL | fn bar(&self) { } | ^^^^^^^^^^^^^^^^^ duplicate definition error: aborting due to previous error diff --git a/src/test/ui/methods/method-missing-call.stderr b/src/test/ui/methods/method-missing-call.stderr index 886d92aa9253..3ab5f66a0c3f 100644 --- a/src/test/ui/methods/method-missing-call.stderr +++ b/src/test/ui/methods/method-missing-call.stderr @@ -1,13 +1,13 @@ error[E0615]: attempted to take value of method `get_x` on type `Point` --> $DIR/method-missing-call.rs:22:26 | -LL | .get_x;//~ ERROR attempted to take value of method `get_x` on type `Point` +LL | .get_x; | ^^^^^ help: use parentheses to call the method: `get_x()` error[E0615]: attempted to take value of method `filter_map` on type `std::iter::Filter, [closure@$DIR/method-missing-call.rs:27:20: 27:25]>, [closure@$DIR/method-missing-call.rs:28:23: 28:35]>` --> $DIR/method-missing-call.rs:29:16 | -LL | .filter_map; //~ ERROR attempted to take value of method `filter_map` on type +LL | .filter_map; | ^^^^^^^^^^ help: use parentheses to call the method: `filter_map(...)` error: aborting due to 2 previous errors diff --git a/src/test/ui/methods/method-self-arg-1.stderr b/src/test/ui/methods/method-self-arg-1.stderr index 8c80d01b18cb..8485a5403ff8 100644 --- a/src/test/ui/methods/method-self-arg-1.stderr +++ b/src/test/ui/methods/method-self-arg-1.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/method-self-arg-1.rs:11:14 | -LL | Foo::bar(x); //~ ERROR mismatched types +LL | Foo::bar(x); | ^ | | | expected &Foo, found struct `Foo` @@ -13,7 +13,7 @@ LL | Foo::bar(x); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/method-self-arg-1.rs:15:14 | -LL | Foo::bar(&42); //~ ERROR mismatched types +LL | Foo::bar(&42); | ^^^ expected struct `Foo`, found integer | = note: expected type `&Foo` diff --git a/src/test/ui/methods/method-self-arg-2.nll.stderr b/src/test/ui/methods/method-self-arg-2.nll.stderr index 8cfecdba41c0..82092dd4c0f8 100644 --- a/src/test/ui/methods/method-self-arg-2.nll.stderr +++ b/src/test/ui/methods/method-self-arg-2.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta | LL | let y = &mut x; | ------ mutable borrow occurs here -LL | Foo::bar(&x); //~ERROR cannot borrow `x` +LL | Foo::bar(&x); | ^^ immutable borrow occurs here LL | y.use_mut(); | - mutable borrow later used here @@ -13,7 +13,7 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time | LL | let y = &mut x; | ------ first mutable borrow occurs here -LL | Foo::baz(&mut x); //~ERROR cannot borrow `x` +LL | Foo::baz(&mut x); | ^^^^^^ second mutable borrow occurs here LL | y.use_mut(); | - first borrow later used here diff --git a/src/test/ui/methods/method-self-arg-2.stderr b/src/test/ui/methods/method-self-arg-2.stderr index 9746ac316d92..56cc8c83fe14 100644 --- a/src/test/ui/methods/method-self-arg-2.stderr +++ b/src/test/ui/methods/method-self-arg-2.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta | LL | let y = &mut x; | - mutable borrow occurs here -LL | Foo::bar(&x); //~ERROR cannot borrow `x` +LL | Foo::bar(&x); | ^ immutable borrow occurs here ... LL | } @@ -14,7 +14,7 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time | LL | let y = &mut x; | - first mutable borrow occurs here -LL | Foo::baz(&mut x); //~ERROR cannot borrow `x` +LL | Foo::baz(&mut x); | ^ second mutable borrow occurs here LL | y.use_mut(); LL | } diff --git a/src/test/ui/mir-dataflow/def-inits-1.stderr b/src/test/ui/mir-dataflow/def-inits-1.stderr index 93debd6c15d5..6bc5f7dcb99f 100644 --- a/src/test/ui/mir-dataflow/def-inits-1.stderr +++ b/src/test/ui/mir-dataflow/def-inits-1.stderr @@ -1,25 +1,25 @@ error: rustc_peek: bit not set --> $DIR/def-inits-1.rs:15:14 | -LL | unsafe { rustc_peek(&ret); } //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&ret); } | ^^^^^^^^^^^^^^^^ error: rustc_peek: bit not set --> $DIR/def-inits-1.rs:31:14 | -LL | unsafe { rustc_peek(&z); } //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&z); } | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set --> $DIR/def-inits-1.rs:34:14 | -LL | unsafe { rustc_peek(&y); } //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&y); } | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set --> $DIR/def-inits-1.rs:42:14 | -LL | unsafe { rustc_peek(&x); } //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&x); } | ^^^^^^^^^^^^^^ error: stop_after_dataflow ended compilation diff --git a/src/test/ui/mir-dataflow/inits-1.stderr b/src/test/ui/mir-dataflow/inits-1.stderr index 7ee61e6be2c8..38a9c60b168d 100644 --- a/src/test/ui/mir-dataflow/inits-1.stderr +++ b/src/test/ui/mir-dataflow/inits-1.stderr @@ -1,19 +1,19 @@ error: rustc_peek: bit not set --> $DIR/inits-1.rs:15:14 | -LL | unsafe { rustc_peek(&ret); } //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&ret); } | ^^^^^^^^^^^^^^^^ error: rustc_peek: bit not set --> $DIR/inits-1.rs:35:14 | -LL | unsafe { rustc_peek(&y); } //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&y); } | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set --> $DIR/inits-1.rs:43:14 | -LL | unsafe { rustc_peek(&x); } //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&x); } | ^^^^^^^^^^^^^^ error: stop_after_dataflow ended compilation diff --git a/src/test/ui/mir-dataflow/uninits-1.stderr b/src/test/ui/mir-dataflow/uninits-1.stderr index 21ad0b3c2c16..c60987050e63 100644 --- a/src/test/ui/mir-dataflow/uninits-1.stderr +++ b/src/test/ui/mir-dataflow/uninits-1.stderr @@ -1,31 +1,31 @@ error: rustc_peek: bit not set --> $DIR/uninits-1.rs:19:14 | -LL | unsafe { rustc_peek(&x) }; //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&x) }; | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set --> $DIR/uninits-1.rs:20:14 | -LL | unsafe { rustc_peek(&y) }; //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&y) }; | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set --> $DIR/uninits-1.rs:21:14 | -LL | unsafe { rustc_peek(&z) }; //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&z) }; | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set --> $DIR/uninits-1.rs:37:14 | -LL | unsafe { rustc_peek(&x); } //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&x); } | ^^^^^^^^^^^^^^ error: rustc_peek: bit not set --> $DIR/uninits-1.rs:45:14 | -LL | unsafe { rustc_peek(&ret); } //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&ret); } | ^^^^^^^^^^^^^^^^ error: stop_after_dataflow ended compilation diff --git a/src/test/ui/mir-dataflow/uninits-2.stderr b/src/test/ui/mir-dataflow/uninits-2.stderr index 08959ce3b132..de3e58e52de4 100644 --- a/src/test/ui/mir-dataflow/uninits-2.stderr +++ b/src/test/ui/mir-dataflow/uninits-2.stderr @@ -1,7 +1,7 @@ error: rustc_peek: bit not set --> $DIR/uninits-2.rs:15:14 | -LL | unsafe { rustc_peek(&x) }; //~ ERROR rustc_peek: bit not set +LL | unsafe { rustc_peek(&x) }; | ^^^^^^^^^^^^^^ error: stop_after_dataflow ended compilation diff --git a/src/test/ui/mir-unpretty.stderr b/src/test/ui/mir-unpretty.stderr index 59e8c0bf0902..6e5dac226692 100644 --- a/src/test/ui/mir-unpretty.stderr +++ b/src/test/ui/mir-unpretty.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/mir-unpretty.rs:4:17 | -LL | let x: () = 0; //~ ERROR: mismatched types +LL | let x: () = 0; | ^ expected (), found integer | = note: expected type `()` diff --git a/src/test/ui/mismatched_types/E0409.stderr b/src/test/ui/mismatched_types/E0409.stderr index 08f132efd052..93115bfb998e 100644 --- a/src/test/ui/mismatched_types/E0409.stderr +++ b/src/test/ui/mismatched_types/E0409.stderr @@ -1,7 +1,7 @@ error[E0409]: variable `y` is bound in inconsistent ways within the same match arm --> $DIR/E0409.rs:5:23 | -LL | (0, ref y) | (y, 0) => {} //~ ERROR E0409 +LL | (0, ref y) | (y, 0) => {} | - ^ bound in different ways | | | first binding @@ -9,7 +9,7 @@ LL | (0, ref y) | (y, 0) => {} //~ ERROR E0409 error[E0308]: mismatched types --> $DIR/E0409.rs:5:23 | -LL | (0, ref y) | (y, 0) => {} //~ ERROR E0409 +LL | (0, ref y) | (y, 0) => {} | ^ expected &{integer}, found integer | = note: expected type `&{integer}` diff --git a/src/test/ui/mismatched_types/E0631.stderr b/src/test/ui/mismatched_types/E0631.stderr index df320a2059b8..f2bc6e1692f7 100644 --- a/src/test/ui/mismatched_types/E0631.stderr +++ b/src/test/ui/mismatched_types/E0631.stderr @@ -1,7 +1,7 @@ error[E0631]: type mismatch in closure arguments --> $DIR/E0631.rs:7:5 | -LL | foo(|_: isize| {}); //~ ERROR type mismatch +LL | foo(|_: isize| {}); | ^^^ ---------- found signature of `fn(isize) -> _` | | | expected signature of `fn(usize) -> _` @@ -15,7 +15,7 @@ LL | fn foo(_: F) {} error[E0631]: type mismatch in closure arguments --> $DIR/E0631.rs:8:5 | -LL | bar(|_: isize| {}); //~ ERROR type mismatch +LL | bar(|_: isize| {}); | ^^^ ---------- found signature of `fn(isize) -> _` | | | expected signature of `fn(usize) -> _` @@ -32,7 +32,7 @@ error[E0631]: type mismatch in function arguments LL | fn f(_: u64) {} | ------------ found signature of `fn(u64) -> _` ... -LL | foo(f); //~ ERROR type mismatch +LL | foo(f); | ^^^ expected signature of `fn(usize) -> _` | note: required by `foo` @@ -47,7 +47,7 @@ error[E0631]: type mismatch in function arguments LL | fn f(_: u64) {} | ------------ found signature of `fn(u64) -> _` ... -LL | bar(f); //~ ERROR type mismatch +LL | bar(f); | ^^^ expected signature of `fn(usize) -> _` | note: required by `bar` diff --git a/src/test/ui/mismatched_types/abridged.stderr b/src/test/ui/mismatched_types/abridged.stderr index 6a5cf7db4eed..b7f3b3dde8a9 100644 --- a/src/test/ui/mismatched_types/abridged.stderr +++ b/src/test/ui/mismatched_types/abridged.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | fn a() -> Foo { | --- expected `Foo` because of return type -LL | Some(Foo { bar: 1 }) //~ ERROR mismatched types +LL | Some(Foo { bar: 1 }) | ^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `std::option::Option` | = note: expected type `Foo` @@ -14,7 +14,7 @@ error[E0308]: mismatched types | LL | fn a2() -> Foo { | --- expected `Foo` because of return type -LL | Ok(Foo { bar: 1}) //~ ERROR mismatched types +LL | Ok(Foo { bar: 1}) | ^^^^^^^^^^^^^^^^^ expected struct `Foo`, found enum `std::result::Result` | = note: expected type `Foo` @@ -25,7 +25,7 @@ error[E0308]: mismatched types | LL | fn b() -> Option { | ----------- expected `std::option::Option` because of return type -LL | Foo { bar: 1 } //~ ERROR mismatched types +LL | Foo { bar: 1 } | ^^^^^^^^^^^^^^ expected enum `std::option::Option`, found struct `Foo` | = note: expected type `std::option::Option` @@ -36,7 +36,7 @@ error[E0308]: mismatched types | LL | fn c() -> Result { | ---------------- expected `std::result::Result` because of return type -LL | Foo { bar: 1 } //~ ERROR mismatched types +LL | Foo { bar: 1 } | ^^^^^^^^^^^^^^ expected enum `std::result::Result`, found struct `Foo` | = note: expected type `std::result::Result` @@ -48,7 +48,7 @@ error[E0308]: mismatched types LL | fn d() -> X, String> { | ---------------------------- expected `X, std::string::String>` because of return type ... -LL | x //~ ERROR mismatched types +LL | x | ^ expected struct `std::string::String`, found integer | = note: expected type `X, std::string::String>` @@ -60,7 +60,7 @@ error[E0308]: mismatched types LL | fn e() -> X, String> { | ---------------------------- expected `X, std::string::String>` because of return type ... -LL | x //~ ERROR mismatched types +LL | x | ^ expected struct `std::string::String`, found integer | = note: expected type `X, _>` diff --git a/src/test/ui/mismatched_types/binops.stderr b/src/test/ui/mismatched_types/binops.stderr index 76ea0ab54c3d..9dda44a85686 100644 --- a/src/test/ui/mismatched_types/binops.stderr +++ b/src/test/ui/mismatched_types/binops.stderr @@ -1,7 +1,7 @@ error[E0277]: cannot add `std::option::Option<{integer}>` to `{integer}` --> $DIR/binops.rs:2:7 | -LL | 1 + Some(1); //~ ERROR cannot add `std::option::Option<{integer}>` to `{integer}` +LL | 1 + Some(1); | ^ no implementation for `{integer} + std::option::Option<{integer}>` | = help: the trait `std::ops::Add>` is not implemented for `{integer}` @@ -9,7 +9,7 @@ LL | 1 + Some(1); //~ ERROR cannot add `std::option::Option<{integer}>` to ` error[E0277]: cannot subtract `std::option::Option<{integer}>` from `usize` --> $DIR/binops.rs:3:16 | -LL | 2 as usize - Some(1); //~ ERROR cannot subtract `std::option::Option<{integer}>` from `usize` +LL | 2 as usize - Some(1); | ^ no implementation for `usize - std::option::Option<{integer}>` | = help: the trait `std::ops::Sub>` is not implemented for `usize` @@ -17,7 +17,7 @@ LL | 2 as usize - Some(1); //~ ERROR cannot subtract `std::option::Option<{i error[E0277]: cannot multiply `()` to `{integer}` --> $DIR/binops.rs:4:7 | -LL | 3 * (); //~ ERROR cannot multiply `()` to `{integer}` +LL | 3 * (); | ^ no implementation for `{integer} * ()` | = help: the trait `std::ops::Mul<()>` is not implemented for `{integer}` @@ -25,7 +25,7 @@ LL | 3 * (); //~ ERROR cannot multiply `()` to `{integer}` error[E0277]: cannot divide `{integer}` by `&str` --> $DIR/binops.rs:5:7 | -LL | 4 / ""; //~ ERROR cannot divide `{integer}` by `&str` +LL | 4 / ""; | ^ no implementation for `{integer} / &str` | = help: the trait `std::ops::Div<&str>` is not implemented for `{integer}` @@ -33,7 +33,7 @@ LL | 4 / ""; //~ ERROR cannot divide `{integer}` by `&str` error[E0277]: can't compare `{integer}` with `std::string::String` --> $DIR/binops.rs:6:7 | -LL | 5 < String::new(); //~ ERROR can't compare `{integer}` with `std::string::String` +LL | 5 < String::new(); | ^ no implementation for `{integer} < std::string::String` and `{integer} > std::string::String` | = help: the trait `std::cmp::PartialOrd` is not implemented for `{integer}` @@ -41,7 +41,7 @@ LL | 5 < String::new(); //~ ERROR can't compare `{integer}` with `std::strin error[E0277]: can't compare `{integer}` with `std::result::Result<{integer}, _>` --> $DIR/binops.rs:7:7 | -LL | 6 == Ok(1); //~ ERROR can't compare `{integer}` with `std::result::Result<{integer}, _>` +LL | 6 == Ok(1); | ^^ no implementation for `{integer} == std::result::Result<{integer}, _>` | = help: the trait `std::cmp::PartialEq>` is not implemented for `{integer}` diff --git a/src/test/ui/mismatched_types/cast-rfc0401.stderr b/src/test/ui/mismatched_types/cast-rfc0401.stderr index 76091f2d09ed..c30f0acaa57d 100644 --- a/src/test/ui/mismatched_types/cast-rfc0401.stderr +++ b/src/test/ui/mismatched_types/cast-rfc0401.stderr @@ -1,7 +1,7 @@ error[E0606]: casting `*const U` as `*const V` is invalid --> $DIR/cast-rfc0401.rs:3:5 | -LL | u as *const V //~ ERROR is invalid +LL | u as *const V | ^^^^^^^^^^^^^ | = note: vtable kinds may not match @@ -9,7 +9,7 @@ LL | u as *const V //~ ERROR is invalid error[E0606]: casting `*const U` as `*const str` is invalid --> $DIR/cast-rfc0401.rs:8:5 | -LL | u as *const str //~ ERROR is invalid +LL | u as *const str | ^^^^^^^^^^^^^^^ | = note: vtable kinds may not match @@ -17,13 +17,13 @@ LL | u as *const str //~ ERROR is invalid error[E0609]: no field `f` on type `fn() {main}` --> $DIR/cast-rfc0401.rs:65:18 | -LL | let _ = main.f as *const u32; //~ ERROR no field +LL | let _ = main.f as *const u32; | ^ error[E0605]: non-primitive cast: `*const u8` as `&u8` --> $DIR/cast-rfc0401.rs:29:13 | -LL | let _ = v as &u8; //~ ERROR non-primitive cast +LL | let _ = v as &u8; | ^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait @@ -31,7 +31,7 @@ LL | let _ = v as &u8; //~ ERROR non-primitive cast error[E0605]: non-primitive cast: `*const u8` as `E` --> $DIR/cast-rfc0401.rs:30:13 | -LL | let _ = v as E; //~ ERROR non-primitive cast +LL | let _ = v as E; | ^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait @@ -39,7 +39,7 @@ LL | let _ = v as E; //~ ERROR non-primitive cast error[E0605]: non-primitive cast: `*const u8` as `fn()` --> $DIR/cast-rfc0401.rs:31:13 | -LL | let _ = v as fn(); //~ ERROR non-primitive cast +LL | let _ = v as fn(); | ^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait @@ -47,7 +47,7 @@ LL | let _ = v as fn(); //~ ERROR non-primitive cast error[E0605]: non-primitive cast: `*const u8` as `(u32,)` --> $DIR/cast-rfc0401.rs:32:13 | -LL | let _ = v as (u32,); //~ ERROR non-primitive cast +LL | let _ = v as (u32,); | ^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait @@ -55,7 +55,7 @@ LL | let _ = v as (u32,); //~ ERROR non-primitive cast error[E0605]: non-primitive cast: `std::option::Option<&*const u8>` as `*const u8` --> $DIR/cast-rfc0401.rs:33:13 | -LL | let _ = Some(&v) as *const u8; //~ ERROR non-primitive cast +LL | let _ = Some(&v) as *const u8; | ^^^^^^^^^^^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait @@ -63,19 +63,19 @@ LL | let _ = Some(&v) as *const u8; //~ ERROR non-primitive cast error[E0606]: casting `*const u8` as `f32` is invalid --> $DIR/cast-rfc0401.rs:35:13 | -LL | let _ = v as f32; //~ ERROR is invalid +LL | let _ = v as f32; | ^^^^^^^^ error[E0606]: casting `fn() {main}` as `f64` is invalid --> $DIR/cast-rfc0401.rs:36:13 | -LL | let _ = main as f64; //~ ERROR is invalid +LL | let _ = main as f64; | ^^^^^^^^^^^ error[E0606]: casting `&*const u8` as `usize` is invalid --> $DIR/cast-rfc0401.rs:37:13 | -LL | let _ = &v as usize; //~ ERROR is invalid +LL | let _ = &v as usize; | ^^^^^^^^^^^ | = help: cast through a raw pointer first @@ -83,31 +83,31 @@ LL | let _ = &v as usize; //~ ERROR is invalid error[E0606]: casting `f32` as `*const u8` is invalid --> $DIR/cast-rfc0401.rs:38:13 | -LL | let _ = f as *const u8; //~ ERROR is invalid +LL | let _ = f as *const u8; | ^^^^^^^^^^^^^^ error[E0054]: cannot cast as `bool` --> $DIR/cast-rfc0401.rs:39:13 | -LL | let _ = 3_i32 as bool; //~ ERROR cannot cast +LL | let _ = 3_i32 as bool; | ^^^^^^^^^^^^^ help: compare with zero instead: `3_i32 != 0` error[E0054]: cannot cast as `bool` --> $DIR/cast-rfc0401.rs:40:13 | -LL | let _ = E::A as bool; //~ ERROR cannot cast +LL | let _ = E::A as bool; | ^^^^^^^^^^^^ unsupported cast error[E0604]: only `u8` can be cast as `char`, not `u32` --> $DIR/cast-rfc0401.rs:41:13 | -LL | let _ = 0x61u32 as char; //~ ERROR can be cast as +LL | let _ = 0x61u32 as char; | ^^^^^^^^^^^^^^^ error[E0606]: casting `bool` as `f32` is invalid --> $DIR/cast-rfc0401.rs:43:13 | -LL | let _ = false as f32; //~ ERROR is invalid +LL | let _ = false as f32; | ^^^^^^^^^^^^ | = help: cast through an integer first @@ -115,7 +115,7 @@ LL | let _ = false as f32; //~ ERROR is invalid error[E0606]: casting `E` as `f32` is invalid --> $DIR/cast-rfc0401.rs:44:13 | -LL | let _ = E::A as f32; //~ ERROR is invalid +LL | let _ = E::A as f32; | ^^^^^^^^^^^ | = help: cast through an integer first @@ -123,7 +123,7 @@ LL | let _ = E::A as f32; //~ ERROR is invalid error[E0606]: casting `char` as `f32` is invalid --> $DIR/cast-rfc0401.rs:45:13 | -LL | let _ = 'a' as f32; //~ ERROR is invalid +LL | let _ = 'a' as f32; | ^^^^^^^^^^ | = help: cast through an integer first @@ -131,67 +131,67 @@ LL | let _ = 'a' as f32; //~ ERROR is invalid error[E0606]: casting `bool` as `*const u8` is invalid --> $DIR/cast-rfc0401.rs:47:13 | -LL | let _ = false as *const u8; //~ ERROR is invalid +LL | let _ = false as *const u8; | ^^^^^^^^^^^^^^^^^^ error[E0606]: casting `E` as `*const u8` is invalid --> $DIR/cast-rfc0401.rs:48:13 | -LL | let _ = E::A as *const u8; //~ ERROR is invalid +LL | let _ = E::A as *const u8; | ^^^^^^^^^^^^^^^^^ error[E0606]: casting `char` as `*const u8` is invalid --> $DIR/cast-rfc0401.rs:49:13 | -LL | let _ = 'a' as *const u8; //~ ERROR is invalid +LL | let _ = 'a' as *const u8; | ^^^^^^^^^^^^^^^^ error[E0606]: casting `usize` as `*const [u8]` is invalid --> $DIR/cast-rfc0401.rs:51:13 | -LL | let _ = 42usize as *const [u8]; //~ ERROR is invalid +LL | let _ = 42usize as *const [u8]; | ^^^^^^^^^^^^^^^^^^^^^^ error[E0607]: cannot cast thin pointer `*const u8` to fat pointer `*const [u8]` --> $DIR/cast-rfc0401.rs:52:13 | -LL | let _ = v as *const [u8]; //~ ERROR cannot cast +LL | let _ = v as *const [u8]; | ^^^^^^^^^^^^^^^^ error[E0606]: casting `&dyn Foo` as `*const str` is invalid --> $DIR/cast-rfc0401.rs:54:13 | -LL | let _ = foo as *const str; //~ ERROR is invalid +LL | let _ = foo as *const str; | ^^^^^^^^^^^^^^^^^ error[E0606]: casting `&dyn Foo` as `*mut str` is invalid --> $DIR/cast-rfc0401.rs:55:13 | -LL | let _ = foo as *mut str; //~ ERROR is invalid +LL | let _ = foo as *mut str; | ^^^^^^^^^^^^^^^ error[E0606]: casting `fn() {main}` as `*mut str` is invalid --> $DIR/cast-rfc0401.rs:56:13 | -LL | let _ = main as *mut str; //~ ERROR is invalid +LL | let _ = main as *mut str; | ^^^^^^^^^^^^^^^^ error[E0606]: casting `&f32` as `*mut f32` is invalid --> $DIR/cast-rfc0401.rs:57:13 | -LL | let _ = &f as *mut f32; //~ ERROR is invalid +LL | let _ = &f as *mut f32; | ^^^^^^^^^^^^^^ error[E0606]: casting `&f32` as `*const f64` is invalid --> $DIR/cast-rfc0401.rs:58:13 | -LL | let _ = &f as *const f64; //~ ERROR is invalid +LL | let _ = &f as *const f64; | ^^^^^^^^^^^^^^^^ error[E0606]: casting `*const [i8]` as `usize` is invalid --> $DIR/cast-rfc0401.rs:59:13 | -LL | let _ = fat_sv as usize; //~ ERROR is invalid +LL | let _ = fat_sv as usize; | ^^^^^^^^^^^^^^^ | = help: cast through a thin pointer first @@ -199,7 +199,7 @@ LL | let _ = fat_sv as usize; //~ ERROR is invalid error[E0606]: casting `*const dyn Foo` as `*const [u16]` is invalid --> $DIR/cast-rfc0401.rs:68:13 | -LL | let _ = cf as *const [u16]; //~ ERROR is invalid +LL | let _ = cf as *const [u16]; | ^^^^^^^^^^^^^^^^^^ | = note: vtable kinds may not match @@ -207,7 +207,7 @@ LL | let _ = cf as *const [u16]; //~ ERROR is invalid error[E0606]: casting `*const dyn Foo` as `*const dyn Bar` is invalid --> $DIR/cast-rfc0401.rs:69:13 | -LL | let _ = cf as *const Bar; //~ ERROR is invalid +LL | let _ = cf as *const Bar; | ^^^^^^^^^^^^^^^^ | = note: vtable kinds may not match @@ -215,7 +215,7 @@ LL | let _ = cf as *const Bar; //~ ERROR is invalid error[E0277]: the size for values of type `[u8]` cannot be known at compilation time --> $DIR/cast-rfc0401.rs:53:13 | -LL | let _ = fat_v as *const Foo; //~ ERROR the size for values of type +LL | let _ = fat_v as *const Foo; | ^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u8]` @@ -225,7 +225,7 @@ LL | let _ = fat_v as *const Foo; //~ ERROR the size for values of type error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/cast-rfc0401.rs:62:13 | -LL | let _ = a as *const Foo; //~ ERROR the size for values of type +LL | let _ = a as *const Foo; | ^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` @@ -235,7 +235,7 @@ LL | let _ = a as *const Foo; //~ ERROR the size for values of type error[E0606]: casting `&{float}` as `f32` is invalid --> $DIR/cast-rfc0401.rs:71:30 | -LL | vec![0.0].iter().map(|s| s as f32).collect::>(); //~ ERROR is invalid +LL | vec![0.0].iter().map(|s| s as f32).collect::>(); | -^^^^^^^ | | | cannot cast `&{float}` as `f32` diff --git a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr index 5dd6887005e8..cf392e1731b0 100644 --- a/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr +++ b/src/test/ui/mismatched_types/closure-arg-type-mismatch.stderr @@ -1,7 +1,7 @@ error[E0631]: type mismatch in closure arguments --> $DIR/closure-arg-type-mismatch.rs:3:14 | -LL | a.iter().map(|_: (u32, u32)| 45); //~ ERROR type mismatch +LL | a.iter().map(|_: (u32, u32)| 45); | ^^^ ------------------ found signature of `fn((u32, u32)) -> _` | | | expected signature of `fn(&(u32, u32)) -> _` @@ -9,7 +9,7 @@ LL | a.iter().map(|_: (u32, u32)| 45); //~ ERROR type mismatch error[E0631]: type mismatch in closure arguments --> $DIR/closure-arg-type-mismatch.rs:4:14 | -LL | a.iter().map(|_: &(u16, u16)| 45); //~ ERROR type mismatch +LL | a.iter().map(|_: &(u16, u16)| 45); | ^^^ ------------------- found signature of `for<'r> fn(&'r (u16, u16)) -> _` | | | expected signature of `fn(&(u32, u32)) -> _` @@ -17,7 +17,7 @@ LL | a.iter().map(|_: &(u16, u16)| 45); //~ ERROR type mismatch error[E0631]: type mismatch in closure arguments --> $DIR/closure-arg-type-mismatch.rs:5:14 | -LL | a.iter().map(|_: (u16, u16)| 45); //~ ERROR type mismatch +LL | a.iter().map(|_: (u16, u16)| 45); | ^^^ ------------------ found signature of `fn((u16, u16)) -> _` | | | expected signature of `fn(&(u32, u32)) -> _` @@ -25,7 +25,7 @@ LL | a.iter().map(|_: (u16, u16)| 45); //~ ERROR type mismatch error[E0631]: type mismatch in function arguments --> $DIR/closure-arg-type-mismatch.rs:10:5 | -LL | baz(f); //~ ERROR type mismatch +LL | baz(f); | ^^^ | | | expected signature of `for<'r> fn(*mut &'r u32) -> _` @@ -40,7 +40,7 @@ LL | fn baz(_: F) {} error[E0271]: type mismatch resolving `for<'r> >::Output == ()` --> $DIR/closure-arg-type-mismatch.rs:10:5 | -LL | baz(f); //~ ERROR type mismatch +LL | baz(f); | ^^^ expected bound lifetime parameter, found concrete lifetime | note: required by `baz` diff --git a/src/test/ui/mismatched_types/closure-mismatch.stderr b/src/test/ui/mismatched_types/closure-mismatch.stderr index e55047e96c29..6fbc92256125 100644 --- a/src/test/ui/mismatched_types/closure-mismatch.stderr +++ b/src/test/ui/mismatched_types/closure-mismatch.stderr @@ -1,7 +1,7 @@ error[E0271]: type mismatch resolving `for<'r> <[closure@$DIR/closure-mismatch.rs:8:9: 8:15] as std::ops::FnOnce<(&'r (),)>>::Output == ()` --> $DIR/closure-mismatch.rs:8:5 | -LL | baz(|_| ()); //~ ERROR type mismatch +LL | baz(|_| ()); | ^^^ expected bound lifetime parameter, found concrete lifetime | = note: required because of the requirements on the impl of `Foo` for `[closure@$DIR/closure-mismatch.rs:8:9: 8:15]` @@ -14,7 +14,7 @@ LL | fn baz(_: T) {} error[E0631]: type mismatch in closure arguments --> $DIR/closure-mismatch.rs:8:5 | -LL | baz(|_| ()); //~ ERROR type mismatch +LL | baz(|_| ()); | ^^^ ------ found signature of `fn(_) -> _` | | | expected signature of `for<'r> fn(&'r ()) -> _` diff --git a/src/test/ui/mismatched_types/const-fn-in-trait.stderr b/src/test/ui/mismatched_types/const-fn-in-trait.stderr index e1482d7c4507..ec1f36bf0877 100644 --- a/src/test/ui/mismatched_types/const-fn-in-trait.stderr +++ b/src/test/ui/mismatched_types/const-fn-in-trait.stderr @@ -1,13 +1,13 @@ error[E0379]: trait fns cannot be declared const --> $DIR/const-fn-in-trait.rs:7:5 | -LL | const fn g(); //~ ERROR cannot be declared const +LL | const fn g(); | ^^^^^ trait fns cannot be const error[E0379]: trait fns cannot be declared const --> $DIR/const-fn-in-trait.rs:11:5 | -LL | const fn f() -> u32 { 22 } //~ ERROR cannot be declared const +LL | const fn f() -> u32 { 22 } | ^^^^^ trait fns cannot be const error: aborting due to 2 previous errors diff --git a/src/test/ui/mismatched_types/for-loop-has-unit-body.stderr b/src/test/ui/mismatched_types/for-loop-has-unit-body.stderr index 25203d6f35d2..3c8ba8057c55 100644 --- a/src/test/ui/mismatched_types/for-loop-has-unit-body.stderr +++ b/src/test/ui/mismatched_types/for-loop-has-unit-body.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/for-loop-has-unit-body.rs:3:9 | -LL | x //~ ERROR mismatched types +LL | x | ^ expected (), found integer | = note: expected type `()` diff --git a/src/test/ui/mismatched_types/issue-26480.stderr b/src/test/ui/mismatched_types/issue-26480.stderr index 11aa6cd7c1ba..ef7a8d385374 100644 --- a/src/test/ui/mismatched_types/issue-26480.stderr +++ b/src/test/ui/mismatched_types/issue-26480.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-26480.rs:16:19 | -LL | $arr.len() * size_of($arr[0])); //~ ERROR mismatched types +LL | $arr.len() * size_of($arr[0])); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u64, found usize ... LL | write!(hello); @@ -10,7 +10,7 @@ LL | write!(hello); error[E0605]: non-primitive cast: `{integer}` as `()` --> $DIR/issue-26480.rs:22:19 | -LL | ($x:expr) => ($x as ()) //~ ERROR non-primitive cast +LL | ($x:expr) => ($x as ()) | ^^^^^^^^ ... LL | cast!(2); diff --git a/src/test/ui/mismatched_types/issue-35030.stderr b/src/test/ui/mismatched_types/issue-35030.stderr index 6a3e7d930cf2..f03067016134 100644 --- a/src/test/ui/mismatched_types/issue-35030.stderr +++ b/src/test/ui/mismatched_types/issue-35030.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-35030.rs:9:14 | -LL | Some(true) //~ ERROR mismatched types +LL | Some(true) | ^^^^ expected type parameter, found bool | = note: expected type `bool` (type parameter) diff --git a/src/test/ui/mismatched_types/issue-38371.stderr b/src/test/ui/mismatched_types/issue-38371.stderr index f702a4f47f10..d16869237302 100644 --- a/src/test/ui/mismatched_types/issue-38371.stderr +++ b/src/test/ui/mismatched_types/issue-38371.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/issue-38371.rs:4:8 | -LL | fn foo(&foo: Foo) { //~ ERROR mismatched types +LL | fn foo(&foo: Foo) { | ^^^^ expected struct `Foo`, found reference | = note: expected type `Foo` @@ -11,7 +11,7 @@ LL | fn foo(&foo: Foo) { //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/issue-38371.rs:18:9 | -LL | fn agh(&&bar: &u32) { //~ ERROR mismatched types +LL | fn agh(&&bar: &u32) { | ^^^^ expected u32, found reference | = note: expected type `u32` @@ -21,7 +21,7 @@ LL | fn agh(&&bar: &u32) { //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/issue-38371.rs:21:8 | -LL | fn bgh(&&bar: u32) { //~ ERROR mismatched types +LL | fn bgh(&&bar: u32) { | ^^^^^ expected u32, found reference | = note: expected type `u32` @@ -30,7 +30,7 @@ LL | fn bgh(&&bar: u32) { //~ ERROR mismatched types error[E0529]: expected an array or slice, found `u32` --> $DIR/issue-38371.rs:24:9 | -LL | fn ugh(&[bar]: &u32) { //~ ERROR expected an array or slice +LL | fn ugh(&[bar]: &u32) { | ^^^^^ pattern cannot match with input type `u32` error: aborting due to 4 previous errors diff --git a/src/test/ui/mismatched_types/main.stderr b/src/test/ui/mismatched_types/main.stderr index 57e95e413337..1d53cfdd2527 100644 --- a/src/test/ui/mismatched_types/main.stderr +++ b/src/test/ui/mismatched_types/main.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/main.rs:2:18 | -LL | let x: u32 = ( //~ ERROR mismatched types +LL | let x: u32 = ( | __________________^ LL | | ); | |_____^ expected u32, found () diff --git a/src/test/ui/mismatched_types/overloaded-calls-bad.stderr b/src/test/ui/mismatched_types/overloaded-calls-bad.stderr index 51975abd720f..3551e4105f8c 100644 --- a/src/test/ui/mismatched_types/overloaded-calls-bad.stderr +++ b/src/test/ui/mismatched_types/overloaded-calls-bad.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/overloaded-calls-bad.rs:28:17 | -LL | let ans = s("what"); //~ ERROR mismatched types +LL | let ans = s("what"); | ^^^^^^ expected isize, found reference | = note: expected type `isize` diff --git a/src/test/ui/mismatched_types/trait-bounds-cant-coerce.stderr b/src/test/ui/mismatched_types/trait-bounds-cant-coerce.stderr index a9b637c81a78..6475cce5aa62 100644 --- a/src/test/ui/mismatched_types/trait-bounds-cant-coerce.stderr +++ b/src/test/ui/mismatched_types/trait-bounds-cant-coerce.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/trait-bounds-cant-coerce.rs:13:7 | -LL | a(x); //~ ERROR mismatched types [E0308] +LL | a(x); | ^ expected trait `Foo + std::marker::Send`, found trait `Foo` | = note: expected type `std::boxed::Box<(dyn Foo + std::marker::Send + 'static)>` diff --git a/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr b/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr index 4e54b35029a5..8ea3567b948c 100644 --- a/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr +++ b/src/test/ui/mismatched_types/trait-impl-fn-incompatibility.stderr @@ -4,7 +4,7 @@ error[E0053]: method `foo` has an incompatible type for trait LL | fn foo(x: u16); | --- type in trait ... -LL | fn foo(x: i16) { } //~ ERROR incompatible type +LL | fn foo(x: i16) { } | ^^^ expected u16, found i16 | = note: expected type `fn(u16)` @@ -16,14 +16,14 @@ error[E0053]: method `bar` has an incompatible type for trait LL | fn bar(&mut self, bar: &mut Bar); | -------- type in trait ... -LL | fn bar(&mut self, bar: &Bar) { } //~ ERROR incompatible type +LL | fn bar(&mut self, bar: &Bar) { } | ^^^^ types differ in mutability | = note: expected type `fn(&mut Bar, &mut Bar)` found type `fn(&mut Bar, &Bar)` help: consider change the type to match the mutability in trait | -LL | fn bar(&mut self, bar: &mut Bar) { } //~ ERROR incompatible type +LL | fn bar(&mut self, bar: &mut Bar) { } | ^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr index 8db81a8c6835..ad0eefa27a10 100644 --- a/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr +++ b/src/test/ui/mismatched_types/unboxed-closures-vtable-mismatch.stderr @@ -3,7 +3,7 @@ error[E0631]: type mismatch in closure arguments | LL | let f = to_fn_mut(|x: usize, y: isize| -> isize { (x as isize) + y }); | ----------------------------- found signature of `fn(usize, isize) -> _` -LL | //~^ NOTE found signature of `fn(usize, isize) -> _` +LL | LL | let z = call_it(3, f); | ^^^^^^^ expected signature of `fn(isize, isize) -> _` | diff --git a/src/test/ui/missing/missing-block-hint.stderr b/src/test/ui/missing/missing-block-hint.stderr index 576a6268a99d..ee86a3241e82 100644 --- a/src/test/ui/missing/missing-block-hint.stderr +++ b/src/test/ui/missing/missing-block-hint.stderr @@ -1,7 +1,7 @@ error: expected `{`, found `=>` --> $DIR/missing-block-hint.rs:3:18 | -LL | if (foo) => {} //~ ERROR expected `{`, found `=>` +LL | if (foo) => {} | -- ^^ expected `{` | | | this `if` statement has a condition, but no block @@ -11,7 +11,7 @@ error: expected `{`, found `bar` | LL | if (foo) | -- this `if` statement has a condition, but no block -LL | bar; //~ ERROR expected `{`, found `bar` +LL | bar; | ^^^- | | | expected `{` diff --git a/src/test/ui/missing/missing-derivable-attr.stderr b/src/test/ui/missing/missing-derivable-attr.stderr index e3e61bcb391e..9b8c0c583a1c 100644 --- a/src/test/ui/missing/missing-derivable-attr.stderr +++ b/src/test/ui/missing/missing-derivable-attr.stderr @@ -4,7 +4,7 @@ error[E0046]: not all trait items implemented, missing: `eq` LL | fn eq(&self, other: &Self) -> bool; | ----------------------------------- `eq` from trait ... -LL | impl MyEq for A {} //~ ERROR not all trait items implemented, missing: `eq` +LL | impl MyEq for A {} | ^^^^^^^^^^^^^^^ missing `eq` in implementation error: aborting due to previous error diff --git a/src/test/ui/missing/missing-items/issue-40221.stderr b/src/test/ui/missing/missing-items/issue-40221.stderr index 437fb7bbc313..8e5286f21001 100644 --- a/src/test/ui/missing/missing-items/issue-40221.stderr +++ b/src/test/ui/missing/missing-items/issue-40221.stderr @@ -1,8 +1,16 @@ error[E0004]: non-exhaustive patterns: `C(QA)` not covered --> $DIR/issue-40221.rs:11:11 | -LL | match proto { //~ ERROR non-exhaustive patterns - | ^^^^^ pattern `C(QA)` not covered +LL | / enum P { +LL | | C(PC), + | | - not covered +LL | | } + | |_- `P` defined here +... +LL | match proto { + | ^^^^^ pattern `C(QA)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/missing/missing-items/m2.stderr b/src/test/ui/missing/missing-items/m2.stderr index b2245750518b..d2dac4ca6454 100644 --- a/src/test/ui/missing/missing-items/m2.stderr +++ b/src/test/ui/missing/missing-items/m2.stderr @@ -1,7 +1,7 @@ error[E0046]: not all trait items implemented, missing: `CONSTANT`, `Type`, `method` --> $DIR/m2.rs:9:1 | -LL | impl m1::X for X { //~ ERROR not all trait items implemented +LL | impl m1::X for X { | ^^^^^^^^^^^^^^^^ missing `CONSTANT`, `Type`, `method` in implementation | = note: `CONSTANT` from trait: `const CONSTANT: u32;` diff --git a/src/test/ui/missing/missing-items/missing-type-parameter.stderr b/src/test/ui/missing/missing-items/missing-type-parameter.stderr index 619377198e1f..dbb467d60f9e 100644 --- a/src/test/ui/missing/missing-items/missing-type-parameter.stderr +++ b/src/test/ui/missing/missing-items/missing-type-parameter.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/missing-type-parameter.rs:4:5 | -LL | foo(); //~ ERROR type annotations needed +LL | foo(); | ^^^ cannot infer type for `X` error: aborting due to previous error diff --git a/src/test/ui/missing/missing-semicolon-warning.stderr b/src/test/ui/missing/missing-semicolon-warning.stderr index 50627c3252dd..b3f3ebc855da 100644 --- a/src/test/ui/missing/missing-semicolon-warning.stderr +++ b/src/test/ui/missing/missing-semicolon-warning.stderr @@ -1,7 +1,7 @@ warning: expected `;`, found keyword `let` --> $DIR/missing-semicolon-warning.rs:6:12 | -LL | $( let x = $e1 )*; //~ WARN expected `;` +LL | $( let x = $e1 )*; | ^^^ ... LL | fn main() { m!(0, 0; 0, 0); } @@ -12,7 +12,7 @@ LL | fn main() { m!(0, 0; 0, 0); } warning: expected `;`, found `println` --> $DIR/missing-semicolon-warning.rs:7:12 | -LL | $( println!("{}", $e2) )*; //~ WARN expected `;` +LL | $( println!("{}", $e2) )*; | ^^^^^^^ ... LL | fn main() { m!(0, 0; 0, 0); } diff --git a/src/test/ui/missing/missing-stability.stderr b/src/test/ui/missing/missing-stability.stderr index 6c81f2bac578..659f8c78cae6 100644 --- a/src/test/ui/missing/missing-stability.stderr +++ b/src/test/ui/missing/missing-stability.stderr @@ -2,7 +2,7 @@ error: function has missing stability attribute --> $DIR/missing-stability.rs:8:1 | LL | / pub fn unmarked() { -LL | | //~^ ERROR function has missing stability attribute +LL | | LL | | () LL | | } | |_^ diff --git a/src/test/ui/missing_debug_impls.stderr b/src/test/ui/missing_debug_impls.stderr index cceab4b4c0bf..bb8390a8f313 100644 --- a/src/test/ui/missing_debug_impls.stderr +++ b/src/test/ui/missing_debug_impls.stderr @@ -1,7 +1,7 @@ error: type does not implement `fmt::Debug`; consider adding #[derive(Debug)] or a manual implementation --> $DIR/missing_debug_impls.rs:7:1 | -LL | pub enum A {} //~ ERROR type does not implement `fmt::Debug` +LL | pub enum A {} | ^^^^^^^^^^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(missing_debug_implementations)] error: type does not implement `fmt::Debug`; consider adding #[derive(Debug)] or a manual implementation --> $DIR/missing_debug_impls.rs:20:1 | -LL | pub struct Foo; //~ ERROR type does not implement `fmt::Debug` +LL | pub struct Foo; | ^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/mod/mod_file_disambig.stderr b/src/test/ui/mod/mod_file_disambig.stderr index 1720ca420ca2..2b77d866fb30 100644 --- a/src/test/ui/mod/mod_file_disambig.stderr +++ b/src/test/ui/mod/mod_file_disambig.stderr @@ -1,7 +1,7 @@ error[E0584]: file for module `mod_file_disambig_aux` found at both mod_file_disambig_aux.rs and mod_file_disambig_aux/mod.rs --> $DIR/mod_file_disambig.rs:1:5 | -LL | mod mod_file_disambig_aux; //~ ERROR file for module `mod_file_disambig_aux` found at both +LL | mod mod_file_disambig_aux; | ^^^^^^^^^^^^^^^^^^^^^ | = help: delete or rename one of them to remove the ambiguity diff --git a/src/test/ui/module-macro_use-arguments.stderr b/src/test/ui/module-macro_use-arguments.stderr index 4dc6df39a479..2a75736a2c69 100644 --- a/src/test/ui/module-macro_use-arguments.stderr +++ b/src/test/ui/module-macro_use-arguments.stderr @@ -1,7 +1,7 @@ error: arguments to macro_use are not allowed here --> $DIR/module-macro_use-arguments.rs:1:1 | -LL | #[macro_use(foo, bar)] //~ ERROR arguments to macro_use are not allowed here +LL | #[macro_use(foo, bar)] | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/moves/move-guard-same-consts.nll.stderr b/src/test/ui/moves/move-guard-same-consts.nll.stderr index 43f99cabcae9..0945fbe68a0f 100644 --- a/src/test/ui/moves/move-guard-same-consts.nll.stderr +++ b/src/test/ui/moves/move-guard-same-consts.nll.stderr @@ -6,7 +6,7 @@ LL | let x: Box<_> = box 1; ... LL | (1, 2) if take(x) => (), | - value moved here -LL | (1, 2) if take(x) => (), //~ ERROR use of moved value: `x` +LL | (1, 2) if take(x) => (), | ^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/moves/move-guard-same-consts.stderr b/src/test/ui/moves/move-guard-same-consts.stderr index 78a76a47b8a5..65f6f1239fe6 100644 --- a/src/test/ui/moves/move-guard-same-consts.stderr +++ b/src/test/ui/moves/move-guard-same-consts.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x` | LL | (1, 2) if take(x) => (), | - value moved here -LL | (1, 2) if take(x) => (), //~ ERROR use of moved value: `x` +LL | (1, 2) if take(x) => (), | ^ value used here after move | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/move-in-guard-1.nll.stderr b/src/test/ui/moves/move-in-guard-1.nll.stderr index 41abe6fa72a5..542fd1698637 100644 --- a/src/test/ui/moves/move-in-guard-1.nll.stderr +++ b/src/test/ui/moves/move-in-guard-1.nll.stderr @@ -6,7 +6,7 @@ LL | let x: Box<_> = box 1; ... LL | (1, _) if take(x) => (), | - value moved here -LL | (_, 2) if take(x) => (), //~ ERROR use of moved value: `x` +LL | (_, 2) if take(x) => (), | ^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/moves/move-in-guard-1.stderr b/src/test/ui/moves/move-in-guard-1.stderr index d4cb538e05d1..af49fa82b0f6 100644 --- a/src/test/ui/moves/move-in-guard-1.stderr +++ b/src/test/ui/moves/move-in-guard-1.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x` | LL | (1, _) if take(x) => (), | - value moved here -LL | (_, 2) if take(x) => (), //~ ERROR use of moved value: `x` +LL | (_, 2) if take(x) => (), | ^ value used here after move | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/move-in-guard-2.nll.stderr b/src/test/ui/moves/move-in-guard-2.nll.stderr index 0b14c1620d3c..8bd405279c52 100644 --- a/src/test/ui/moves/move-in-guard-2.nll.stderr +++ b/src/test/ui/moves/move-in-guard-2.nll.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `x` LL | let x: Box<_> = box 1; | - move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait ... -LL | (_, 2) if take(x) => (), //~ ERROR use of moved value: `x` +LL | (_, 2) if take(x) => (), | ^ value moved here, in previous iteration of loop error: aborting due to previous error diff --git a/src/test/ui/moves/move-in-guard-2.stderr b/src/test/ui/moves/move-in-guard-2.stderr index d4e747c9f61d..5228abe86efb 100644 --- a/src/test/ui/moves/move-in-guard-2.stderr +++ b/src/test/ui/moves/move-in-guard-2.stderr @@ -1,7 +1,7 @@ error[E0382]: use of moved value: `x` --> $DIR/move-in-guard-2.rs:10:24 | -LL | (_, 2) if take(x) => (), //~ ERROR use of moved value: `x` +LL | (_, 2) if take(x) => (), | ^ value moved here in previous iteration of loop | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/move-into-dead-array-1.nll.stderr b/src/test/ui/moves/move-into-dead-array-1.nll.stderr index e3a2a601246d..33da0e54a1e4 100644 --- a/src/test/ui/moves/move-into-dead-array-1.nll.stderr +++ b/src/test/ui/moves/move-into-dead-array-1.nll.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `a` --> $DIR/move-into-dead-array-1.rs:14:5 | -LL | a[i] = d(); //~ ERROR use of possibly uninitialized variable: `a` +LL | a[i] = d(); | ^^^^ use of possibly uninitialized `a` error: aborting due to previous error diff --git a/src/test/ui/moves/move-into-dead-array-1.stderr b/src/test/ui/moves/move-into-dead-array-1.stderr index 36f98a76b547..3a1bbe97d288 100644 --- a/src/test/ui/moves/move-into-dead-array-1.stderr +++ b/src/test/ui/moves/move-into-dead-array-1.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `a` --> $DIR/move-into-dead-array-1.rs:14:5 | -LL | a[i] = d(); //~ ERROR use of possibly uninitialized variable: `a` +LL | a[i] = d(); | ^^^^^^^^^^ use of possibly uninitialized `a` error: aborting due to previous error diff --git a/src/test/ui/moves/move-into-dead-array-2.nll.stderr b/src/test/ui/moves/move-into-dead-array-2.nll.stderr index 20bfdc2bbac7..19e476c04ea0 100644 --- a/src/test/ui/moves/move-into-dead-array-2.nll.stderr +++ b/src/test/ui/moves/move-into-dead-array-2.nll.stderr @@ -5,7 +5,7 @@ LL | fn foo(mut a: [D; 4], i: usize) { | ----- move occurs because `a` has type `[D; 4]`, which does not implement the `Copy` trait LL | drop(a); | - value moved here -LL | a[i] = d(); //~ ERROR use of moved value: `a` +LL | a[i] = d(); | ^^^^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/moves/move-into-dead-array-2.stderr b/src/test/ui/moves/move-into-dead-array-2.stderr index 417b1ab20540..4521fa9bcb01 100644 --- a/src/test/ui/moves/move-into-dead-array-2.stderr +++ b/src/test/ui/moves/move-into-dead-array-2.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `a` | LL | drop(a); | - value moved here -LL | a[i] = d(); //~ ERROR use of moved value: `a` +LL | a[i] = d(); | ^^^^^^^^^^ value used here after move | = note: move occurs because `a` has type `[D; 4]`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/move-out-of-array-1.stderr b/src/test/ui/moves/move-out-of-array-1.stderr index 677f0b42f5a2..fb191b89bda4 100644 --- a/src/test/ui/moves/move-out-of-array-1.stderr +++ b/src/test/ui/moves/move-out-of-array-1.stderr @@ -1,7 +1,7 @@ error[E0508]: cannot move out of type `[D; 4]`, a non-copy array --> $DIR/move-out-of-array-1.rs:17:5 | -LL | a[i] //~ ERROR cannot move out of type `[D; 4]`, a non-copy array +LL | a[i] | ^^^^ cannot move out of here error: aborting due to previous error diff --git a/src/test/ui/moves/move-out-of-slice-1.nll.stderr b/src/test/ui/moves/move-out-of-slice-1.nll.stderr index c8c09b31d36b..b4b1fe97ca9d 100644 --- a/src/test/ui/moves/move-out-of-slice-1.nll.stderr +++ b/src/test/ui/moves/move-out-of-slice-1.nll.stderr @@ -3,13 +3,13 @@ error[E0508]: cannot move out of type `[A]`, a non-copy slice | LL | match a { | ^ cannot move out of here -LL | box [a] => {}, //~ ERROR cannot move out of type `[A]`, a non-copy slice +LL | box [a] => {}, | - data moved here | note: move occurs because `a` has type `A`, which does not implement the `Copy` trait --> $DIR/move-out-of-slice-1.rs:8:14 | -LL | box [a] => {}, //~ ERROR cannot move out of type `[A]`, a non-copy slice +LL | box [a] => {}, | ^ error: aborting due to previous error diff --git a/src/test/ui/moves/move-out-of-slice-1.stderr b/src/test/ui/moves/move-out-of-slice-1.stderr index bfdf64198690..f84e3a3f3e31 100644 --- a/src/test/ui/moves/move-out-of-slice-1.stderr +++ b/src/test/ui/moves/move-out-of-slice-1.stderr @@ -1,7 +1,7 @@ error[E0508]: cannot move out of type `[A]`, a non-copy slice --> $DIR/move-out-of-slice-1.rs:8:13 | -LL | box [a] => {}, //~ ERROR cannot move out of type `[A]`, a non-copy slice +LL | box [a] => {}, | ^-^ | || | |hint: to prevent move, use `ref a` or `ref mut a` diff --git a/src/test/ui/moves/move-out-of-tuple-field.nll.stderr b/src/test/ui/moves/move-out-of-tuple-field.nll.stderr index 2efdc84ca37d..888ef3352e26 100644 --- a/src/test/ui/moves/move-out-of-tuple-field.nll.stderr +++ b/src/test/ui/moves/move-out-of-tuple-field.nll.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x.0` | LL | let y = x.0; | --- value moved here -LL | let z = x.0; //~ ERROR use of moved value: `x.0` +LL | let z = x.0; | ^^^ value used here after move | = note: move occurs because `x.0` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -13,7 +13,7 @@ error[E0382]: use of moved value: `x.0` | LL | let y = x.0; | --- value moved here -LL | let z = x.0; //~ ERROR use of moved value: `x.0` +LL | let z = x.0; | ^^^ value used here after move | = note: move occurs because `x.0` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/move-out-of-tuple-field.stderr b/src/test/ui/moves/move-out-of-tuple-field.stderr index 6839c49c8296..89662c8303da 100644 --- a/src/test/ui/moves/move-out-of-tuple-field.stderr +++ b/src/test/ui/moves/move-out-of-tuple-field.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x.0` | LL | let y = x.0; | - value moved here -LL | let z = x.0; //~ ERROR use of moved value: `x.0` +LL | let z = x.0; | ^ value used here after move | = note: move occurs because `x.0` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -13,7 +13,7 @@ error[E0382]: use of moved value: `x.0` | LL | let y = x.0; | - value moved here -LL | let z = x.0; //~ ERROR use of moved value: `x.0` +LL | let z = x.0; | ^ value used here after move | = note: move occurs because `x.0` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-based-on-type-access-to-field.nll.stderr b/src/test/ui/moves/moves-based-on-type-access-to-field.nll.stderr index 6ad9a2d414c7..71a3c4506eaf 100644 --- a/src/test/ui/moves/moves-based-on-type-access-to-field.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-access-to-field.nll.stderr @@ -5,7 +5,7 @@ LL | let x = vec!["hi".to_string()]; | - move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait LL | consume(x.into_iter().next().unwrap()); | - value moved here -LL | touch(&x[0]); //~ ERROR use of moved value: `x` +LL | touch(&x[0]); | ^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/moves/moves-based-on-type-access-to-field.stderr b/src/test/ui/moves/moves-based-on-type-access-to-field.stderr index 882c1fe1706d..ed4d69f838e9 100644 --- a/src/test/ui/moves/moves-based-on-type-access-to-field.stderr +++ b/src/test/ui/moves/moves-based-on-type-access-to-field.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x` | LL | consume(x.into_iter().next().unwrap()); | - value moved here -LL | touch(&x[0]); //~ ERROR use of moved value: `x` +LL | touch(&x[0]); | ^ value used here after move | = note: move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr b/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr index 6950a56a5335..b83a15c9d4da 100644 --- a/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/moves-based-on-type-block-bad.rs:24:19 | -LL | match hellothere.x { //~ ERROR cannot move out +LL | match hellothere.x { | ^^^^^^^^^^^^ | | | cannot move out of borrowed content diff --git a/src/test/ui/moves/moves-based-on-type-block-bad.stderr b/src/test/ui/moves/moves-based-on-type-block-bad.stderr index 4ecaed3b69b5..f5328edfcc20 100644 --- a/src/test/ui/moves/moves-based-on-type-block-bad.stderr +++ b/src/test/ui/moves/moves-based-on-type-block-bad.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/moves-based-on-type-block-bad.rs:24:19 | -LL | match hellothere.x { //~ ERROR cannot move out +LL | match hellothere.x { | ^^^^^^^^^^ cannot move out of borrowed content ... LL | box E::Bar(x) => println!("{}", x.to_string()), diff --git a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.nll.stderr b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.nll.stderr index bed0ae7275cc..3a05a1305bee 100644 --- a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.nll.stderr @@ -8,7 +8,7 @@ LL | thread::spawn(move|| { LL | println!("{}", x); | - variable moved due to use in closure LL | }); -LL | println!("{}", x); //~ ERROR use of moved value +LL | println!("{}", x); | ^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.stderr b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.stderr index 88e58fdf58bc..39119ff3aaad 100644 --- a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.stderr +++ b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `x` LL | thread::spawn(move|| { | ------ value moved (into closure) here ... -LL | println!("{}", x); //~ ERROR use of moved value +LL | println!("{}", x); | ^ value used here after move | = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr index 5f0d2b42671d..fb8562d00ead 100644 --- a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `node` LL | Some(right) => consume(right), | ----- value moved here ... -LL | consume(node) + r //~ ERROR use of partially moved value: `node` +LL | consume(node) + r | ^^^^ value used here after partial move | = note: move occurs because value has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.stderr b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.stderr index 7624ba5fe28d..8b904c7169bd 100644 --- a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.stderr +++ b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.stderr @@ -4,7 +4,7 @@ error[E0382]: use of partially moved value: `node` LL | Some(right) => consume(right), | ----- value moved here ... -LL | consume(node) + r //~ ERROR use of partially moved value: `node` +LL | consume(node) + r | ^^^^ value used here after move | = note: move occurs because the value has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.nll.stderr b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.nll.stderr index 07f40274f9e3..25f88fe157ae 100644 --- a/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.nll.stderr @@ -5,8 +5,8 @@ LL | let x = "hi".to_string(); | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = Foo { f:x }; | - value moved here -LL | //~^ NOTE value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -16,8 +16,8 @@ LL | let x = "hi".to_string(); | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = Foo { f:(((x))) }; | ------- value moved here -LL | //~^ NOTE value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | +LL | touch(&x); | ^^ value borrowed here after move error: aborting due to 2 previous errors diff --git a/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.stderr b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.stderr index 374ac61e7f5e..edf521a896fe 100644 --- a/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.stderr +++ b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.stderr @@ -3,8 +3,8 @@ error[E0382]: use of moved value: `x` | LL | let _y = Foo { f:x }; | - value moved here -LL | //~^ NOTE value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | +LL | touch(&x); | ^ value used here after move | = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait @@ -14,8 +14,8 @@ error[E0382]: use of moved value: `x` | LL | let _y = Foo { f:(((x))) }; | ------- value moved here -LL | //~^ NOTE value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | +LL | touch(&x); | ^ value used here after move | = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-based-on-type-exprs.nll.stderr b/src/test/ui/moves/moves-based-on-type-exprs.nll.stderr index 162aec45f5f5..67fae606c4e4 100644 --- a/src/test/ui/moves/moves-based-on-type-exprs.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-exprs.nll.stderr @@ -5,7 +5,7 @@ LL | let x = "hi".to_string(); | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = Foo { f:x }; | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -15,7 +15,7 @@ LL | let x = "hi".to_string(); | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = (x, 3); | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -27,7 +27,7 @@ LL | let x = "hi".to_string(); LL | x | - value moved here ... -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `y` @@ -39,7 +39,7 @@ LL | let y = "ho".to_string(); LL | y | - value moved here ... -LL | touch(&y); //~ ERROR use of moved value: `y` +LL | touch(&y); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -51,7 +51,7 @@ LL | let x = "hi".to_string(); LL | true => x, | - value moved here ... -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `y` @@ -63,7 +63,7 @@ LL | let y = "ho".to_string(); LL | false => y | - value moved here ... -LL | touch(&y); //~ ERROR use of moved value: `y` +LL | touch(&y); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -75,7 +75,7 @@ LL | let x = "hi".to_string(); LL | _ if guard(x) => 10, | - value moved here ... -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -85,7 +85,7 @@ LL | let x = "hi".to_string(); | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = [x]; | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -95,7 +95,7 @@ LL | let x = "hi".to_string(); | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = vec![x]; | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -105,7 +105,7 @@ LL | let x = vec!["hi".to_string()]; | - move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait LL | let _y = x.into_iter().next().unwrap(); | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -115,7 +115,7 @@ LL | let x = vec!["hi".to_string()]; | - move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait LL | let _y = [x.into_iter().next().unwrap(); 1]; | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^^ value borrowed here after move error: aborting due to 11 previous errors diff --git a/src/test/ui/moves/moves-based-on-type-exprs.stderr b/src/test/ui/moves/moves-based-on-type-exprs.stderr index e6177c6b6c83..6cb297cbd633 100644 --- a/src/test/ui/moves/moves-based-on-type-exprs.stderr +++ b/src/test/ui/moves/moves-based-on-type-exprs.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x` | LL | let _y = Foo { f:x }; | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^ value used here after move | = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait @@ -13,7 +13,7 @@ error[E0382]: use of moved value: `x` | LL | let _y = (x, 3); | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^ value used here after move | = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait @@ -24,7 +24,7 @@ error[E0382]: use of moved value: `x` LL | x | - value moved here ... -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^ value used here after move | = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait @@ -35,7 +35,7 @@ error[E0382]: use of moved value: `y` LL | y | - value moved here ... -LL | touch(&y); //~ ERROR use of moved value: `y` +LL | touch(&y); | ^ value used here after move | = note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait @@ -46,7 +46,7 @@ error[E0382]: use of moved value: `x` LL | true => x, | - value moved here ... -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^ value used here after move | = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait @@ -57,7 +57,7 @@ error[E0382]: use of moved value: `y` LL | false => y | - value moved here ... -LL | touch(&y); //~ ERROR use of moved value: `y` +LL | touch(&y); | ^ value used here after move | = note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait @@ -68,7 +68,7 @@ error[E0382]: use of moved value: `x` LL | _ if guard(x) => 10, | - value moved here ... -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^ value used here after move | = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait @@ -78,7 +78,7 @@ error[E0382]: use of moved value: `x` | LL | let _y = [x]; | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^ value used here after move | = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait @@ -88,7 +88,7 @@ error[E0382]: use of moved value: `x` | LL | let _y = vec![x]; | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^ value used here after move | = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait @@ -98,7 +98,7 @@ error[E0382]: use of moved value: `x` | LL | let _y = x.into_iter().next().unwrap(); | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^ value used here after move | = note: move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait @@ -108,7 +108,7 @@ error[E0382]: use of moved value: `x` | LL | let _y = [x.into_iter().next().unwrap(); 1]; | - value moved here -LL | touch(&x); //~ ERROR use of moved value: `x` +LL | touch(&x); | ^ value used here after move | = note: move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr b/src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr index 6d523fc09c08..322999a1f0ff 100644 --- a/src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr @@ -4,7 +4,7 @@ error[E0382]: borrow of moved value: `x` LL | Foo {f} => {} | - value moved here ... -LL | touch(&x); //~ ERROR use of partially moved value: `x` +LL | touch(&x); | ^^ value borrowed here after partial move | = note: move occurs because `x.f` has type `std::string::String`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-based-on-type-match-bindings.stderr b/src/test/ui/moves/moves-based-on-type-match-bindings.stderr index 41ced9dfd935..9174cfa122c3 100644 --- a/src/test/ui/moves/moves-based-on-type-match-bindings.stderr +++ b/src/test/ui/moves/moves-based-on-type-match-bindings.stderr @@ -4,7 +4,7 @@ error[E0382]: use of partially moved value: `x` LL | Foo {f} => {} | - value moved here ... -LL | touch(&x); //~ ERROR use of partially moved value: `x` +LL | touch(&x); | ^ value used here after move | = note: move occurs because `x.f` has type `std::string::String`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr index 7d410f6cabc8..0568a2e94a71 100644 --- a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr @@ -3,7 +3,7 @@ error[E0507]: cannot move out of captured variable in an `Fn` closure | LL | let i = box 3; | - captured outer variable -LL | let _f = to_fn(|| test(i)); //~ ERROR cannot move out +LL | let _f = to_fn(|| test(i)); | ^ cannot move out of captured variable in an `Fn` closure error: aborting due to previous error diff --git a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr index 49113a57d2fa..654881d25e68 100644 --- a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr +++ b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr @@ -3,7 +3,7 @@ error[E0507]: cannot move out of captured outer variable in an `Fn` closure | LL | let i = box 3; | - captured outer variable -LL | let _f = to_fn(|| test(i)); //~ ERROR cannot move out +LL | let _f = to_fn(|| test(i)); | ^ cannot move out of captured outer variable in an `Fn` closure error: aborting due to previous error diff --git a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.nll.stderr b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.nll.stderr index 391dd67dbf60..dde54eee83b6 100644 --- a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.nll.stderr @@ -16,7 +16,7 @@ LL | fn conspirator(mut f: F) where F: FnMut(&mut R, bool) { | consider adding a `Copy` constraint to this type argument LL | let mut r = R {c: Box::new(f)}; | - value moved here -LL | f(&mut r, false) //~ ERROR use of moved value +LL | f(&mut r, false) | ^ value borrowed here after move error: aborting due to 2 previous errors diff --git a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr index 05ced7f0107a..fe91a488d10d 100644 --- a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr +++ b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr @@ -12,7 +12,7 @@ error[E0382]: use of moved value: `f` | LL | let mut r = R {c: Box::new(f)}; | - value moved here -LL | f(&mut r, false) //~ ERROR use of moved value +LL | f(&mut r, false) | ^ value used here after move | = note: move occurs because `f` has type `F`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-sru-moved-field.nll.stderr b/src/test/ui/moves/moves-sru-moved-field.nll.stderr index e5daab36f6ee..a012c2d9b7b7 100644 --- a/src/test/ui/moves/moves-sru-moved-field.nll.stderr +++ b/src/test/ui/moves/moves-sru-moved-field.nll.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `f.moved` | LL | let _b = Foo {noncopyable: g, ..f}; | ------------------------- value moved here -LL | let _c = Foo {noncopyable: h, ..f}; //~ ERROR use of moved value: `f.moved` +LL | let _c = Foo {noncopyable: h, ..f}; | ^^^^^^^^^^^^^^^^^^^^^^^^^ value used here after move | = note: move occurs because `f.moved` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/moves/moves-sru-moved-field.stderr b/src/test/ui/moves/moves-sru-moved-field.stderr index 3d38faa20a1e..aac399ea4a15 100644 --- a/src/test/ui/moves/moves-sru-moved-field.stderr +++ b/src/test/ui/moves/moves-sru-moved-field.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `f.moved` | LL | let _b = Foo {noncopyable: g, ..f}; | - value moved here -LL | let _c = Foo {noncopyable: h, ..f}; //~ ERROR use of moved value: `f.moved` +LL | let _c = Foo {noncopyable: h, ..f}; | ^ value used here after move | = note: move occurs because `f.moved` has type `std::boxed::Box`, which does not implement the `Copy` trait diff --git a/src/test/ui/multiple-main-2.stderr b/src/test/ui/multiple-main-2.stderr index c761e74bb872..ae33e01cd26e 100644 --- a/src/test/ui/multiple-main-2.stderr +++ b/src/test/ui/multiple-main-2.stderr @@ -5,7 +5,7 @@ LL | / fn bar() { LL | | } | |_- first #[main] function ... -LL | / fn foo() { //~ ERROR multiple functions with a #[main] attribute +LL | / fn foo() { LL | | } | |_^ additional #[main] function diff --git a/src/test/ui/multiple-main-3.stderr b/src/test/ui/multiple-main-3.stderr index 2574f0ef6d81..b85637b8a56e 100644 --- a/src/test/ui/multiple-main-3.stderr +++ b/src/test/ui/multiple-main-3.stderr @@ -5,7 +5,7 @@ LL | / fn main1() { LL | | } | |_- first #[main] function ... -LL | / fn main2() { //~ ERROR multiple functions with a #[main] attribute +LL | / fn main2() { LL | | } | |_____^ additional #[main] function diff --git a/src/test/ui/mut/mut-cant-alias.nll.stderr b/src/test/ui/mut/mut-cant-alias.nll.stderr index 2d7104b39c4b..d56e45db13d0 100644 --- a/src/test/ui/mut/mut-cant-alias.nll.stderr +++ b/src/test/ui/mut/mut-cant-alias.nll.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `b` as mutable more than once at a time | LL | let b1 = &mut *b; | - first mutable borrow occurs here -LL | let b2 = &mut *b; //~ ERROR cannot borrow +LL | let b2 = &mut *b; | ^ second mutable borrow occurs here LL | b1.use_mut(); | -- first borrow later used here diff --git a/src/test/ui/mut/mut-cant-alias.stderr b/src/test/ui/mut/mut-cant-alias.stderr index ce942677bed6..5fc194bc3db6 100644 --- a/src/test/ui/mut/mut-cant-alias.stderr +++ b/src/test/ui/mut/mut-cant-alias.stderr @@ -3,7 +3,7 @@ error[E0499]: cannot borrow `b` as mutable more than once at a time | LL | let b1 = &mut *b; | - first mutable borrow occurs here -LL | let b2 = &mut *b; //~ ERROR cannot borrow +LL | let b2 = &mut *b; | ^ second mutable borrow occurs here LL | b1.use_mut(); LL | } diff --git a/src/test/ui/mut/mut-cross-borrowing.stderr b/src/test/ui/mut/mut-cross-borrowing.stderr index 8708a135360b..e2eea195dafb 100644 --- a/src/test/ui/mut/mut-cross-borrowing.stderr +++ b/src/test/ui/mut/mut-cross-borrowing.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/mut-cross-borrowing.rs:7:7 | -LL | f(x) //~ ERROR mismatched types +LL | f(x) | ^ | | | expected &mut isize, found struct `std::boxed::Box` diff --git a/src/test/ui/mut/mut-pattern-mismatched.stderr b/src/test/ui/mut/mut-pattern-mismatched.stderr index d50a1a8f273b..d1adc9915196 100644 --- a/src/test/ui/mut/mut-pattern-mismatched.stderr +++ b/src/test/ui/mut/mut-pattern-mismatched.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/mut-pattern-mismatched.rs:6:10 | -LL | let &_ //~ ERROR mismatched types +LL | let &_ | ^^ types differ in mutability | = note: expected type `&mut {integer}` @@ -10,7 +10,7 @@ LL | let &_ //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/mut-pattern-mismatched.rs:15:9 | -LL | let &mut _ //~ ERROR mismatched types +LL | let &mut _ | ^^^^^^ types differ in mutability | = note: expected type `&{integer}` diff --git a/src/test/ui/mut/mut-ref.stderr b/src/test/ui/mut/mut-ref.stderr index 339da7f8a020..e6d4901aafb1 100644 --- a/src/test/ui/mut/mut-ref.stderr +++ b/src/test/ui/mut/mut-ref.stderr @@ -1,7 +1,7 @@ error: the order of `mut` and `ref` is incorrect --> $DIR/mut-ref.rs:2:9 | -LL | let mut ref x = 10; //~ ERROR the order of `mut` and `ref` is incorrect +LL | let mut ref x = 10; | ^^^^^^^ help: try switching the order: `ref mut` error: aborting due to previous error diff --git a/src/test/ui/mut/mutable-class-fields-2.nll.stderr b/src/test/ui/mut/mutable-class-fields-2.nll.stderr index 53127922263c..15323ce9a975 100644 --- a/src/test/ui/mut/mutable-class-fields-2.nll.stderr +++ b/src/test/ui/mut/mutable-class-fields-2.nll.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `self.how_hungry` which is behind a `&` reference | LL | pub fn eat(&self) { | ----- help: consider changing this to be a mutable reference: `&mut self` -LL | self.how_hungry -= 5; //~ ERROR cannot assign +LL | self.how_hungry -= 5; | ^^^^^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be written error: aborting due to previous error diff --git a/src/test/ui/mut/mutable-class-fields-2.stderr b/src/test/ui/mut/mutable-class-fields-2.stderr index daeee1117bcc..b0dea3082dda 100644 --- a/src/test/ui/mut/mutable-class-fields-2.stderr +++ b/src/test/ui/mut/mutable-class-fields-2.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to field `self.how_hungry` of immutable binding | LL | pub fn eat(&self) { | ----- use `&mut self` here to make mutable -LL | self.how_hungry -= 5; //~ ERROR cannot assign +LL | self.how_hungry -= 5; | ^^^^^^^^^^^^^^^^^^^^ cannot mutably borrow field of immutable binding error: aborting due to previous error diff --git a/src/test/ui/namespace/namespace-mix.stderr b/src/test/ui/namespace/namespace-mix.stderr index 5ebb40e75b39..22c871dd3c04 100644 --- a/src/test/ui/namespace/namespace-mix.stderr +++ b/src/test/ui/namespace/namespace-mix.stderr @@ -1,13 +1,13 @@ error[E0423]: expected value, found type alias `m1::S` --> $DIR/namespace-mix.rs:34:11 | -LL | check(m1::S); //~ ERROR expected value, found type alias `m1::S` +LL | check(m1::S); | ^^^^^ | = note: can't use a type alias as a constructor help: a tuple struct with a similar name exists | -LL | check(m1::TS); //~ ERROR expected value, found type alias `m1::S` +LL | check(m1::TS); | ^^ help: possible better candidates are found in other modules, you can import them into scope | @@ -19,13 +19,13 @@ LL | use namespace_mix::xm2::S; error[E0423]: expected value, found type alias `xm1::S` --> $DIR/namespace-mix.rs:40:11 | -LL | check(xm1::S); //~ ERROR expected value, found type alias `xm1::S` +LL | check(xm1::S); | ^^^^^^ | = note: can't use a type alias as a constructor help: a tuple struct with a similar name exists | -LL | check(xm1::TS); //~ ERROR expected value, found type alias `xm1::S` +LL | check(xm1::TS); | ^^ help: possible better candidates are found in other modules, you can import them into scope | @@ -37,11 +37,11 @@ LL | use namespace_mix::xm2::S; error[E0423]: expected value, found struct variant `m7::V` --> $DIR/namespace-mix.rs:100:11 | -LL | check(m7::V); //~ ERROR expected value, found struct variant `m7::V` +LL | check(m7::V); | ^^^^^ did you mean `m7::V { /* fields */ }`? help: a tuple variant with a similar name exists | -LL | check(m7::TV); //~ ERROR expected value, found struct variant `m7::V` +LL | check(m7::TV); | ^^ help: possible better candidates are found in other modules, you can import them into scope | @@ -53,11 +53,11 @@ LL | use namespace_mix::xm8::V; error[E0423]: expected value, found struct variant `xm7::V` --> $DIR/namespace-mix.rs:106:11 | -LL | check(xm7::V); //~ ERROR expected value, found struct variant `xm7::V` +LL | check(xm7::V); | ^^^^^^ did you mean `xm7::V { /* fields */ }`? help: a tuple variant with a similar name exists | -LL | check(xm7::TV); //~ ERROR expected value, found struct variant `xm7::V` +LL | check(xm7::TV); | ^^ help: possible better candidates are found in other modules, you can import them into scope | @@ -69,7 +69,7 @@ LL | use namespace_mix::xm8::V; error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:33:5 | -LL | check(m1::S{}); //~ ERROR c::Item +LL | check(m1::S{}); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` @@ -81,7 +81,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::S: Impossible` is not satisfied --> $DIR/namespace-mix.rs:35:5 | -LL | check(m2::S{}); //~ ERROR c::S +LL | check(m2::S{}); | ^^^^^ the trait `Impossible` is not implemented for `c::S` | note: required by `check` @@ -93,7 +93,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:36:5 | -LL | check(m2::S); //~ ERROR c::Item +LL | check(m2::S); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` @@ -105,7 +105,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:39:5 | -LL | check(xm1::S{}); //~ ERROR c::Item +LL | check(xm1::S{}); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` @@ -117,7 +117,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::S: Impossible` is not satisfied --> $DIR/namespace-mix.rs:41:5 | -LL | check(xm2::S{}); //~ ERROR c::S +LL | check(xm2::S{}); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::S` | note: required by `check` @@ -129,7 +129,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:42:5 | -LL | check(xm2::S); //~ ERROR c::Item +LL | check(xm2::S); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` @@ -141,7 +141,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:55:5 | -LL | check(m3::TS{}); //~ ERROR c::Item +LL | check(m3::TS{}); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` @@ -153,7 +153,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `fn() -> c::TS {c::TS}: Impossible` is not satisfied --> $DIR/namespace-mix.rs:56:5 | -LL | check(m3::TS); //~ ERROR c::TS +LL | check(m3::TS); | ^^^^^ the trait `Impossible` is not implemented for `fn() -> c::TS {c::TS}` | note: required by `check` @@ -165,7 +165,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::TS: Impossible` is not satisfied --> $DIR/namespace-mix.rs:57:5 | -LL | check(m4::TS{}); //~ ERROR c::TS +LL | check(m4::TS{}); | ^^^^^ the trait `Impossible` is not implemented for `c::TS` | note: required by `check` @@ -177,7 +177,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:58:5 | -LL | check(m4::TS); //~ ERROR c::Item +LL | check(m4::TS); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` @@ -189,7 +189,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:61:5 | -LL | check(xm3::TS{}); //~ ERROR c::Item +LL | check(xm3::TS{}); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` @@ -201,7 +201,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `fn() -> namespace_mix::c::TS {namespace_mix::c::TS}: Impossible` is not satisfied --> $DIR/namespace-mix.rs:62:5 | -LL | check(xm3::TS); //~ ERROR c::TS +LL | check(xm3::TS); | ^^^^^ the trait `Impossible` is not implemented for `fn() -> namespace_mix::c::TS {namespace_mix::c::TS}` | note: required by `check` @@ -213,7 +213,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::TS: Impossible` is not satisfied --> $DIR/namespace-mix.rs:63:5 | -LL | check(xm4::TS{}); //~ ERROR c::TS +LL | check(xm4::TS{}); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::TS` | note: required by `check` @@ -225,7 +225,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:64:5 | -LL | check(xm4::TS); //~ ERROR c::Item +LL | check(xm4::TS); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` @@ -237,7 +237,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:77:5 | -LL | check(m5::US{}); //~ ERROR c::Item +LL | check(m5::US{}); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` @@ -249,7 +249,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::US: Impossible` is not satisfied --> $DIR/namespace-mix.rs:78:5 | -LL | check(m5::US); //~ ERROR c::US +LL | check(m5::US); | ^^^^^ the trait `Impossible` is not implemented for `c::US` | note: required by `check` @@ -261,7 +261,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::US: Impossible` is not satisfied --> $DIR/namespace-mix.rs:79:5 | -LL | check(m6::US{}); //~ ERROR c::US +LL | check(m6::US{}); | ^^^^^ the trait `Impossible` is not implemented for `c::US` | note: required by `check` @@ -273,7 +273,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:80:5 | -LL | check(m6::US); //~ ERROR c::Item +LL | check(m6::US); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` @@ -285,7 +285,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:83:5 | -LL | check(xm5::US{}); //~ ERROR c::Item +LL | check(xm5::US{}); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` @@ -297,7 +297,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::US: Impossible` is not satisfied --> $DIR/namespace-mix.rs:84:5 | -LL | check(xm5::US); //~ ERROR c::US +LL | check(xm5::US); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::US` | note: required by `check` @@ -309,7 +309,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::US: Impossible` is not satisfied --> $DIR/namespace-mix.rs:85:5 | -LL | check(xm6::US{}); //~ ERROR c::US +LL | check(xm6::US{}); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::US` | note: required by `check` @@ -321,7 +321,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:86:5 | -LL | check(xm6::US); //~ ERROR c::Item +LL | check(xm6::US); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` @@ -333,7 +333,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:99:5 | -LL | check(m7::V{}); //~ ERROR c::Item +LL | check(m7::V{}); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` @@ -345,7 +345,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:101:5 | -LL | check(m8::V{}); //~ ERROR c::E +LL | check(m8::V{}); | ^^^^^ the trait `Impossible` is not implemented for `c::E` | note: required by `check` @@ -357,7 +357,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:102:5 | -LL | check(m8::V); //~ ERROR c::Item +LL | check(m8::V); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` @@ -369,7 +369,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:105:5 | -LL | check(xm7::V{}); //~ ERROR c::Item +LL | check(xm7::V{}); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` @@ -381,7 +381,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:107:5 | -LL | check(xm8::V{}); //~ ERROR c::E +LL | check(xm8::V{}); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` | note: required by `check` @@ -393,7 +393,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:108:5 | -LL | check(xm8::V); //~ ERROR c::Item +LL | check(xm8::V); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` @@ -405,7 +405,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:121:5 | -LL | check(m9::TV{}); //~ ERROR c::Item +LL | check(m9::TV{}); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` @@ -417,7 +417,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `fn() -> c::E {c::E::TV}: Impossible` is not satisfied --> $DIR/namespace-mix.rs:122:5 | -LL | check(m9::TV); //~ ERROR c::E +LL | check(m9::TV); | ^^^^^ the trait `Impossible` is not implemented for `fn() -> c::E {c::E::TV}` | note: required by `check` @@ -429,7 +429,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:123:5 | -LL | check(mA::TV{}); //~ ERROR c::E +LL | check(mA::TV{}); | ^^^^^ the trait `Impossible` is not implemented for `c::E` | note: required by `check` @@ -441,7 +441,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:124:5 | -LL | check(mA::TV); //~ ERROR c::Item +LL | check(mA::TV); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` @@ -453,7 +453,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:127:5 | -LL | check(xm9::TV{}); //~ ERROR c::Item +LL | check(xm9::TV{}); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` @@ -465,7 +465,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `fn() -> namespace_mix::c::E {namespace_mix::c::E::TV}: Impossible` is not satisfied --> $DIR/namespace-mix.rs:128:5 | -LL | check(xm9::TV); //~ ERROR c::E +LL | check(xm9::TV); | ^^^^^ the trait `Impossible` is not implemented for `fn() -> namespace_mix::c::E {namespace_mix::c::E::TV}` | note: required by `check` @@ -477,7 +477,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:129:5 | -LL | check(xmA::TV{}); //~ ERROR c::E +LL | check(xmA::TV{}); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` | note: required by `check` @@ -489,7 +489,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:130:5 | -LL | check(xmA::TV); //~ ERROR c::Item +LL | check(xmA::TV); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` @@ -501,7 +501,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:143:5 | -LL | check(mB::UV{}); //~ ERROR c::Item +LL | check(mB::UV{}); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` @@ -513,7 +513,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:144:5 | -LL | check(mB::UV); //~ ERROR c::E +LL | check(mB::UV); | ^^^^^ the trait `Impossible` is not implemented for `c::E` | note: required by `check` @@ -525,7 +525,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:145:5 | -LL | check(mC::UV{}); //~ ERROR c::E +LL | check(mC::UV{}); | ^^^^^ the trait `Impossible` is not implemented for `c::E` | note: required by `check` @@ -537,7 +537,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:146:5 | -LL | check(mC::UV); //~ ERROR c::Item +LL | check(mC::UV); | ^^^^^ the trait `Impossible` is not implemented for `c::Item` | note: required by `check` @@ -549,7 +549,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:149:5 | -LL | check(xmB::UV{}); //~ ERROR c::Item +LL | check(xmB::UV{}); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` @@ -561,7 +561,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:150:5 | -LL | check(xmB::UV); //~ ERROR c::E +LL | check(xmB::UV); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` | note: required by `check` @@ -573,7 +573,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied --> $DIR/namespace-mix.rs:151:5 | -LL | check(xmC::UV{}); //~ ERROR c::E +LL | check(xmC::UV{}); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E` | note: required by `check` @@ -585,7 +585,7 @@ LL | fn check(_: T) {} error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied --> $DIR/namespace-mix.rs:152:5 | -LL | check(xmC::UV); //~ ERROR c::Item +LL | check(xmC::UV); | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item` | note: required by `check` diff --git a/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.stderr b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.stderr index 691061f05108..f3dbcc2d7b24 100644 --- a/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.stderr +++ b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.stderr @@ -1,25 +1,25 @@ error[E0425]: cannot find function `foo` in this scope --> $DIR/namespaced-enum-glob-import-no-impls-xcrate.rs:11:5 | -LL | foo(); //~ ERROR cannot find function `foo` in this scope +LL | foo(); | ^^^ not found in this scope error[E0425]: cannot find function `foo` in module `m` --> $DIR/namespaced-enum-glob-import-no-impls-xcrate.rs:12:8 | -LL | m::foo(); //~ ERROR cannot find function `foo` in module `m` +LL | m::foo(); | ^^^ not found in `m` error[E0425]: cannot find function `bar` in this scope --> $DIR/namespaced-enum-glob-import-no-impls-xcrate.rs:13:5 | -LL | bar(); //~ ERROR cannot find function `bar` in this scope +LL | bar(); | ^^^ not found in this scope error[E0425]: cannot find function `bar` in module `m` --> $DIR/namespaced-enum-glob-import-no-impls-xcrate.rs:14:8 | -LL | m::bar(); //~ ERROR cannot find function `bar` in module `m` +LL | m::bar(); | ^^^ not found in `m` error: aborting due to 4 previous errors diff --git a/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.stderr b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.stderr index f53f299fe4dc..98784de8e593 100644 --- a/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.stderr +++ b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.stderr @@ -1,25 +1,25 @@ error[E0425]: cannot find function `foo` in this scope --> $DIR/namespaced-enum-glob-import-no-impls.rs:21:5 | -LL | foo(); //~ ERROR cannot find function `foo` in this scope +LL | foo(); | ^^^ not found in this scope error[E0425]: cannot find function `foo` in module `m` --> $DIR/namespaced-enum-glob-import-no-impls.rs:22:8 | -LL | m::foo(); //~ ERROR cannot find function `foo` in module `m` +LL | m::foo(); | ^^^ not found in `m` error[E0425]: cannot find function `bar` in this scope --> $DIR/namespaced-enum-glob-import-no-impls.rs:23:5 | -LL | bar(); //~ ERROR cannot find function `bar` in this scope +LL | bar(); | ^^^ not found in this scope error[E0425]: cannot find function `bar` in module `m` --> $DIR/namespaced-enum-glob-import-no-impls.rs:24:8 | -LL | m::bar(); //~ ERROR cannot find function `bar` in module `m` +LL | m::bar(); | ^^^ not found in `m` error: aborting due to 4 previous errors diff --git a/src/test/ui/nested-cfg-attrs.stderr b/src/test/ui/nested-cfg-attrs.stderr index e7cd39114eda..f63888b2f8ad 100644 --- a/src/test/ui/nested-cfg-attrs.stderr +++ b/src/test/ui/nested-cfg-attrs.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find function `f` in this scope --> $DIR/nested-cfg-attrs.rs:4:13 | -LL | fn main() { f() } //~ ERROR cannot find function `f` in this scope +LL | fn main() { f() } | ^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/never-assign-dead-code.stderr b/src/test/ui/never-assign-dead-code.stderr index bcc20a0d703c..6735310da8b9 100644 --- a/src/test/ui/never-assign-dead-code.stderr +++ b/src/test/ui/never-assign-dead-code.stderr @@ -1,7 +1,7 @@ warning: unreachable statement --> $DIR/never-assign-dead-code.rs:10:5 | -LL | drop(x); //~ WARN unreachable +LL | drop(x); | ^^^^^^^^ | note: lint level defined here @@ -14,13 +14,13 @@ LL | #![warn(unused)] warning: unreachable expression --> $DIR/never-assign-dead-code.rs:10:5 | -LL | drop(x); //~ WARN unreachable +LL | drop(x); | ^^^^^^^ warning: unused variable: `x` --> $DIR/never-assign-dead-code.rs:9:9 | -LL | let x: ! = panic!("aah"); //~ WARN unused +LL | let x: ! = panic!("aah"); | ^ help: consider prefixing with an underscore: `_x` | note: lint level defined here diff --git a/src/test/ui/never-assign-wrong-type.stderr b/src/test/ui/never-assign-wrong-type.stderr index bc61996db99b..da2e77d023d1 100644 --- a/src/test/ui/never-assign-wrong-type.stderr +++ b/src/test/ui/never-assign-wrong-type.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/never-assign-wrong-type.rs:7:16 | -LL | let x: ! = "hello"; //~ ERROR mismatched types +LL | let x: ! = "hello"; | ^^^^^^^ expected !, found reference | = note: expected type `!` diff --git a/src/test/ui/nll/borrowed-local-error.stderr b/src/test/ui/nll/borrowed-local-error.stderr index 318b62a0fdb1..799eec9d3422 100644 --- a/src/test/ui/nll/borrowed-local-error.stderr +++ b/src/test/ui/nll/borrowed-local-error.stderr @@ -6,7 +6,7 @@ LL | let x = gimme({ LL | let v = (22,); LL | &v | ^^ borrowed value does not live long enough -LL | //~^ ERROR `v` does not live long enough [E0597] +LL | LL | }); | - `v` dropped here while still borrowed diff --git a/src/test/ui/nll/borrowed-referent-issue-38899.stderr b/src/test/ui/nll/borrowed-referent-issue-38899.stderr index 1b58b21fff05..5c9c48f5b1d8 100644 --- a/src/test/ui/nll/borrowed-referent-issue-38899.stderr +++ b/src/test/ui/nll/borrowed-referent-issue-38899.stderr @@ -6,7 +6,7 @@ LL | let x = &mut block; LL | println!("{}", x.current); LL | let p: &'a u8 = &*block.current; | ^^^^^^^^^^^^^^^ immutable borrow occurs here -LL | //~^ ERROR cannot borrow `*block.current` as immutable because it is also borrowed as mutable +LL | LL | drop(x); | - mutable borrow later used here diff --git a/src/test/ui/nll/borrowed-temporary-error.stderr b/src/test/ui/nll/borrowed-temporary-error.stderr index 31d1dfde1ce8..c0d42312eb1a 100644 --- a/src/test/ui/nll/borrowed-temporary-error.stderr +++ b/src/test/ui/nll/borrowed-temporary-error.stderr @@ -3,7 +3,7 @@ error[E0716]: temporary value dropped while borrowed | LL | &(v,) | ^^^^ creates a temporary which is freed while still in use -LL | //~^ ERROR temporary value dropped while borrowed [E0716] +LL | LL | }); | - temporary value is freed at the end of this statement LL | println!("{:?}", x); diff --git a/src/test/ui/nll/cannot-move-block-spans.nll.stderr b/src/test/ui/nll/cannot-move-block-spans.nll.stderr index 30b4bf75af69..5d50ed67e2f3 100644 --- a/src/test/ui/nll/cannot-move-block-spans.nll.stderr +++ b/src/test/ui/nll/cannot-move-block-spans.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:5:15 | -LL | let x = { *r }; //~ ERROR +LL | let x = { *r }; | ^^ | | | cannot move out of borrowed content @@ -10,7 +10,7 @@ LL | let x = { *r }; //~ ERROR error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:6:22 | -LL | let y = unsafe { *r }; //~ ERROR +LL | let y = unsafe { *r }; | ^^ | | | cannot move out of borrowed content @@ -19,7 +19,7 @@ LL | let y = unsafe { *r }; //~ ERROR error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:7:26 | -LL | let z = loop { break *r; }; //~ ERROR +LL | let z = loop { break *r; }; | ^^ | | | cannot move out of borrowed content @@ -28,7 +28,7 @@ LL | let z = loop { break *r; }; //~ ERROR error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array --> $DIR/cannot-move-block-spans.rs:11:15 | -LL | let x = { arr[0] }; //~ ERROR +LL | let x = { arr[0] }; | ^^^^^^ | | | cannot move out of here @@ -37,7 +37,7 @@ LL | let x = { arr[0] }; //~ ERROR error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array --> $DIR/cannot-move-block-spans.rs:12:22 | -LL | let y = unsafe { arr[0] }; //~ ERROR +LL | let y = unsafe { arr[0] }; | ^^^^^^ | | | cannot move out of here @@ -46,7 +46,7 @@ LL | let y = unsafe { arr[0] }; //~ ERROR error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array --> $DIR/cannot-move-block-spans.rs:13:26 | -LL | let z = loop { break arr[0]; }; //~ ERROR +LL | let z = loop { break arr[0]; }; | ^^^^^^ | | | cannot move out of here @@ -55,7 +55,7 @@ LL | let z = loop { break arr[0]; }; //~ ERROR error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:17:38 | -LL | let x = { let mut u = 0; u += 1; *r }; //~ ERROR +LL | let x = { let mut u = 0; u += 1; *r }; | ^^ | | | cannot move out of borrowed content @@ -64,7 +64,7 @@ LL | let x = { let mut u = 0; u += 1; *r }; //~ ERROR error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:18:45 | -LL | let y = unsafe { let mut u = 0; u += 1; *r }; //~ ERROR +LL | let y = unsafe { let mut u = 0; u += 1; *r }; | ^^ | | | cannot move out of borrowed content @@ -73,7 +73,7 @@ LL | let y = unsafe { let mut u = 0; u += 1; *r }; //~ ERROR error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:19:49 | -LL | let z = loop { let mut u = 0; u += 1; break *r; u += 2; }; //~ ERROR +LL | let z = loop { let mut u = 0; u += 1; break *r; u += 2; }; | ^^ | | | cannot move out of borrowed content diff --git a/src/test/ui/nll/cannot-move-block-spans.stderr b/src/test/ui/nll/cannot-move-block-spans.stderr index e37c6ff06f7e..6de67a45fb9a 100644 --- a/src/test/ui/nll/cannot-move-block-spans.stderr +++ b/src/test/ui/nll/cannot-move-block-spans.stderr @@ -1,55 +1,55 @@ error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:5:15 | -LL | let x = { *r }; //~ ERROR +LL | let x = { *r }; | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:6:22 | -LL | let y = unsafe { *r }; //~ ERROR +LL | let y = unsafe { *r }; | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:7:26 | -LL | let z = loop { break *r; }; //~ ERROR +LL | let z = loop { break *r; }; | ^^ cannot move out of borrowed content error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array --> $DIR/cannot-move-block-spans.rs:11:15 | -LL | let x = { arr[0] }; //~ ERROR +LL | let x = { arr[0] }; | ^^^^^^ cannot move out of here error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array --> $DIR/cannot-move-block-spans.rs:12:22 | -LL | let y = unsafe { arr[0] }; //~ ERROR +LL | let y = unsafe { arr[0] }; | ^^^^^^ cannot move out of here error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array --> $DIR/cannot-move-block-spans.rs:13:26 | -LL | let z = loop { break arr[0]; }; //~ ERROR +LL | let z = loop { break arr[0]; }; | ^^^^^^ cannot move out of here error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:17:38 | -LL | let x = { let mut u = 0; u += 1; *r }; //~ ERROR +LL | let x = { let mut u = 0; u += 1; *r }; | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:18:45 | -LL | let y = unsafe { let mut u = 0; u += 1; *r }; //~ ERROR +LL | let y = unsafe { let mut u = 0; u += 1; *r }; | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:19:49 | -LL | let z = loop { let mut u = 0; u += 1; break *r; u += 2; }; //~ ERROR +LL | let z = loop { let mut u = 0; u += 1; break *r; u += 2; }; | ^^ cannot move out of borrowed content error: aborting due to 9 previous errors diff --git a/src/test/ui/nll/closure-access-spans.stderr b/src/test/ui/nll/closure-access-spans.stderr index 3ca0aefb592e..6c4cad923b62 100644 --- a/src/test/ui/nll/closure-access-spans.stderr +++ b/src/test/ui/nll/closure-access-spans.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `x` as immutable because it is also borrowed as muta | LL | let r = &mut x; | ------ mutable borrow occurs here -LL | || x; //~ ERROR +LL | || x; | ^^ - second borrow occurs due to use of `x` in closure | | | immutable borrow occurs here @@ -15,7 +15,7 @@ error[E0499]: cannot borrow `x` as mutable more than once at a time | LL | let r = &mut x; | ------ first mutable borrow occurs here -LL | || x = 2; //~ ERROR +LL | || x = 2; | ^^ - second borrow occurs due to use of `x` in closure | | | second mutable borrow occurs here @@ -27,7 +27,7 @@ error[E0500]: closure requires unique access to `x` but it is already borrowed | LL | let r = &mut x; | ------ borrow occurs here -LL | || *x = 2; //~ ERROR +LL | || *x = 2; | ^^ - second borrow occurs due to use of `x` in closure | | | closure construction occurs here @@ -39,7 +39,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let r = &mut x; | ------ borrow of `x` occurs here -LL | move || x; //~ ERROR +LL | move || x; | ^ use of borrowed `x` LL | r.use_ref(); | - borrow later used here @@ -49,7 +49,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | let r = &x; | -- borrow of `x` occurs here -LL | || x; //~ ERROR +LL | || x; | ^^ - move occurs due to use in closure | | | move out of `x` occurs here @@ -63,7 +63,7 @@ LL | fn closure_imm_capture_moved(mut x: String) { | ----- move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let r = x; | - value moved here -LL | || x.len(); //~ ERROR +LL | || x.len(); | ^^ - borrow occurs due to use in closure | | | value borrowed here after move @@ -75,7 +75,7 @@ LL | fn closure_mut_capture_moved(mut x: String) { | ----- move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let r = x; | - value moved here -LL | || x = String::new(); //~ ERROR +LL | || x = String::new(); | ^^ - borrow occurs due to use in closure | | | value borrowed here after move @@ -87,7 +87,7 @@ LL | fn closure_unique_capture_moved(x: &mut String) { | - move occurs because `x` has type `&mut std::string::String`, which does not implement the `Copy` trait LL | let r = x; | - value moved here -LL | || *x = String::new(); //~ ERROR +LL | || *x = String::new(); | ^^ - borrow occurs due to use in closure | | | value borrowed here after move @@ -99,7 +99,7 @@ LL | fn closure_move_capture_moved(x: &mut String) { | - move occurs because `x` has type `&mut std::string::String`, which does not implement the `Copy` trait LL | let r = x; | - value moved here -LL | || x; //~ ERROR +LL | || x; | ^^ - use occurs due to use in closure | | | value used here after move diff --git a/src/test/ui/nll/closure-borrow-spans.stderr b/src/test/ui/nll/closure-borrow-spans.stderr index cf88b309f74d..fcb699a7562f 100644 --- a/src/test/ui/nll/closure-borrow-spans.stderr +++ b/src/test/ui/nll/closure-borrow-spans.stderr @@ -5,7 +5,7 @@ LL | let f = || x.len(); | -- - borrow occurs due to use in closure | | | borrow of `x` occurs here -LL | let y = x; //~ ERROR +LL | let y = x; | ^ move out of `x` occurs here LL | f.use_ref(); | - borrow later used here @@ -17,7 +17,7 @@ LL | let f = || x; | -- - first borrow occurs due to use of `x` in closure | | | immutable borrow occurs here -LL | let y = &mut x; //~ ERROR +LL | let y = &mut x; | ^^^^^^ mutable borrow occurs here LL | f.use_ref(); | - immutable borrow later used here @@ -25,7 +25,7 @@ LL | f.use_ref(); error[E0597]: `x` does not live long enough --> $DIR/closure-borrow-spans.rs:21:16 | -LL | f = || x; //~ ERROR +LL | f = || x; | -- ^ borrowed value does not live long enough | | | value captured here @@ -41,7 +41,7 @@ LL | let f = || x; | -- - borrow occurs due to use in closure | | | borrow of `x` occurs here -LL | x = 1; //~ ERROR +LL | x = 1; | ^^^^^ assignment to borrowed `x` occurs here LL | f.use_ref(); | - borrow later used here @@ -53,7 +53,7 @@ LL | let f = || x = 0; | -- - borrow occurs due to use of `x` in closure | | | borrow of `x` occurs here -LL | let y = x; //~ ERROR +LL | let y = x; | ^ use of borrowed `x` LL | f.use_ref(); | - borrow later used here @@ -65,7 +65,7 @@ LL | let f = || x = 0; | -- - first borrow occurs due to use of `x` in closure | | | mutable borrow occurs here -LL | let y = &x; //~ ERROR +LL | let y = &x; | ^^ immutable borrow occurs here LL | f.use_ref(); | - mutable borrow later used here @@ -77,7 +77,7 @@ LL | let f = || x = 0; | -- - first borrow occurs due to use of `x` in closure | | | first mutable borrow occurs here -LL | let y = &mut x; //~ ERROR +LL | let y = &mut x; | ^^^^^^ second mutable borrow occurs here LL | f.use_ref(); | - first borrow later used here @@ -85,7 +85,7 @@ LL | f.use_ref(); error[E0597]: `x` does not live long enough --> $DIR/closure-borrow-spans.rs:54:16 | -LL | f = || x = 0; //~ ERROR +LL | f = || x = 0; | -- ^ borrowed value does not live long enough | | | value captured here @@ -101,7 +101,7 @@ LL | let f = || x = 0; | -- - borrow occurs due to use in closure | | | borrow of `x` occurs here -LL | x = 1; //~ ERROR +LL | x = 1; | ^^^^^ assignment to borrowed `x` occurs here LL | f.use_ref(); | - borrow later used here @@ -113,7 +113,7 @@ LL | let f = || *x = 0; | -- - borrow occurs due to use in closure | | | borrow of `x` occurs here -LL | let y = x; //~ ERROR +LL | let y = x; | ^ move out of `x` occurs here LL | f.use_ref(); | - borrow later used here @@ -125,7 +125,7 @@ LL | let f = || *x = 0; | -- - first borrow occurs due to use of `x` in closure | | | closure construction occurs here -LL | let y = &x; //~ ERROR +LL | let y = &x; | ^^ second borrow occurs here LL | f.use_ref(); | - first borrow later used here @@ -137,7 +137,7 @@ LL | let f = || *x = 0; | -- - first borrow occurs due to use of `x` in closure | | | closure construction occurs here -LL | let y = &mut x; //~ ERROR +LL | let y = &mut x; | ^^^^^^ second borrow occurs here LL | f.use_ref(); | - first borrow later used here @@ -145,7 +145,7 @@ LL | f.use_ref(); error[E0597]: `x` does not live long enough --> $DIR/closure-borrow-spans.rs:88:17 | -LL | f = || *x = 0; //~ ERROR +LL | f = || *x = 0; | -- ^ borrowed value does not live long enough | | | value captured here @@ -161,7 +161,7 @@ LL | let f = || *x = 0; | -- - borrow occurs due to use in closure | | | borrow of `*x` occurs here -LL | *x = 1; //~ ERROR +LL | *x = 1; | ^^^^^^ assignment to borrowed `*x` occurs here LL | f.use_ref(); | - borrow later used here diff --git a/src/test/ui/nll/closure-captures.stderr b/src/test/ui/nll/closure-captures.stderr index cdc055f2a37a..7dc1c59cebe4 100644 --- a/src/test/ui/nll/closure-captures.stderr +++ b/src/test/ui/nll/closure-captures.stderr @@ -4,7 +4,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable LL | fn one_closure(x: i32) { | - help: consider changing this to be mutable: `mut x` LL | || -LL | x = 1; //~ ERROR +LL | x = 1; | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable @@ -13,7 +13,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable LL | fn one_closure(x: i32) { | - help: consider changing this to be mutable: `mut x` ... -LL | x = 1; //~ ERROR +LL | x = 1; | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable @@ -22,7 +22,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable LL | fn two_closures(x: i32) { | - help: consider changing this to be mutable: `mut x` ... -LL | x = 1; //~ ERROR +LL | x = 1; | ^^^^^ cannot assign error[E0594]: cannot assign to `x`, as it is not declared as mutable @@ -31,13 +31,13 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable LL | fn two_closures(x: i32) { | - help: consider changing this to be mutable: `mut x` ... -LL | x = 1; //~ ERROR +LL | x = 1; | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/closure-captures.rs:30:9 | -LL | || //~ ERROR +LL | || | ^^ cannot borrow as mutable LL | x = 1;} | - mutable borrow occurs due to use of `x` in closure @@ -47,14 +47,14 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(|| { | ____________^ -LL | | || //~ ERROR +LL | | || LL | | x = 1;} | |________________^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/closure-captures.rs:34:9 | -LL | || //~ ERROR +LL | || | ^^ cannot borrow as mutable LL | x = 1;}); | - mutable borrow occurs due to use of `x` in closure @@ -64,7 +64,7 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(move || { | ____________^ -LL | | || //~ ERROR +LL | | || LL | | x = 1;}); | |___________^ @@ -74,15 +74,15 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable LL | fn two_closures_ref(x: i32) { | - help: consider changing this to be mutable: `mut x` ... -LL | x = 1;} //~ ERROR +LL | x = 1;} | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/closure-captures.rs:41:9 | -LL | || //~ ERROR +LL | || | ^^ cannot borrow as mutable -LL | x = 1;} //~ ERROR +LL | x = 1;} | - mutable borrow occurs due to use of `x` in closure | help: consider changing this to accept closures that implement `FnMut` @@ -90,8 +90,8 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(|| { | ____________^ -LL | | || //~ ERROR -LL | | x = 1;} //~ ERROR +LL | | || +LL | | x = 1;} | |________________^ error[E0594]: cannot assign to `x`, as it is not declared as mutable @@ -100,15 +100,15 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable LL | fn two_closures_ref(x: i32) { | - help: consider changing this to be mutable: `mut x` ... -LL | x = 1;}); //~ ERROR +LL | x = 1;}); | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/closure-captures.rs:45:9 | -LL | || //~ ERROR +LL | || | ^^ cannot borrow as mutable -LL | x = 1;}); //~ ERROR +LL | x = 1;}); | - mutable borrow occurs due to use of `x` in closure | help: consider changing this to accept closures that implement `FnMut` @@ -116,14 +116,14 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(move || { | ____________^ -LL | | || //~ ERROR -LL | | x = 1;}); //~ ERROR +LL | | || +LL | | x = 1;}); | |___________^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/closure-captures.rs:51:9 | -LL | || //~ ERROR +LL | || | ^^ cannot borrow as mutable LL | *x = 1;}); | - mutable borrow occurs due to use of `x` in closure @@ -133,14 +133,14 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(|| { | ____________^ -LL | | || //~ ERROR +LL | | || LL | | *x = 1;}); | |________________^ error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure --> $DIR/closure-captures.rs:54:9 | -LL | || //~ ERROR +LL | || | ^^ cannot borrow as mutable LL | *x = 1;}); | - mutable borrow occurs due to use of `x` in closure @@ -150,7 +150,7 @@ help: consider changing this to accept closures that implement `FnMut` | LL | fn_ref(move || { | ____________^ -LL | | || //~ ERROR +LL | | || LL | | *x = 1;}); | |________________^ diff --git a/src/test/ui/nll/closure-move-spans.stderr b/src/test/ui/nll/closure-move-spans.stderr index 6750c4047601..1cc4ca85b9ff 100644 --- a/src/test/ui/nll/closure-move-spans.stderr +++ b/src/test/ui/nll/closure-move-spans.stderr @@ -7,7 +7,7 @@ LL | || x; | -- - variable moved due to use in closure | | | value moved into closure here -LL | let y = x; //~ ERROR +LL | let y = x; | ^ value used here after move error[E0382]: borrow of moved value: `x` @@ -19,7 +19,7 @@ LL | || x; | -- - variable moved due to use in closure | | | value moved into closure here -LL | let y = &x; //~ ERROR +LL | let y = &x; | ^^ value borrowed here after move error[E0382]: borrow of moved value: `x` @@ -31,7 +31,7 @@ LL | || x; | -- - variable moved due to use in closure | | | value moved into closure here -LL | let y = &mut x; //~ ERROR +LL | let y = &mut x; | ^^^^^^ value borrowed here after move error: aborting due to 3 previous errors diff --git a/src/test/ui/nll/closure-requirements/escape-argument.stderr b/src/test/ui/nll/closure-requirements/escape-argument.stderr index 9b66abc40f07..d47b326f48ed 100644 --- a/src/test/ui/nll/closure-requirements/escape-argument.stderr +++ b/src/test/ui/nll/closure-requirements/escape-argument.stderr @@ -28,7 +28,7 @@ error[E0597]: `y` does not live long enough | LL | closure(&mut p, &y); | ^^ borrowed value does not live long enough -LL | //~^ ERROR `y` does not live long enough [E0597] +LL | LL | } | - `y` dropped here while still borrowed LL | diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr b/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr index 8214ff1fcec1..dec4a6b811fc 100644 --- a/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr +++ b/src/test/ui/nll/closure-requirements/escape-upvar-nested.stderr @@ -1,7 +1,7 @@ note: External requirements --> $DIR/escape-upvar-nested.rs:21:32 | -LL | let mut closure1 = || p = &y; //~ ERROR `y` does not live long enough [E0597] +LL | let mut closure1 = || p = &y; | ^^^^^^^^^ | = note: defining type: DefId(0/1:10 ~ escape_upvar_nested[317d]::test[0]::{{closure}}[0]::{{closure}}[0]) with closure substs [ @@ -18,7 +18,7 @@ note: External requirements | LL | let mut closure = || { | ___________________________^ -LL | | let mut closure1 = || p = &y; //~ ERROR `y` does not live long enough [E0597] +LL | | let mut closure1 = || p = &y; LL | | closure1(); LL | | }; | |_________^ @@ -51,7 +51,7 @@ error[E0597]: `y` does not live long enough | LL | let mut closure = || { | -- value captured here -LL | let mut closure1 = || p = &y; //~ ERROR `y` does not live long enough [E0597] +LL | let mut closure1 = || p = &y; | ^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr index 55e4573e60bb..067bd08220df 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.stderr @@ -4,7 +4,7 @@ note: No external requirements LL | / |_outlives1, _outlives2, _outlives3, x, y| { LL | | // Only works if 'x: 'y: LL | | let p = x.get(); -LL | | demand_y(x, y, p) //~ ERROR +LL | | demand_y(x, y, p) LL | | }, | |_________^ | @@ -24,7 +24,7 @@ LL | |_outlives1, _outlives2, _outlives3, x, y| { | | | has type `std::cell::Cell<&&'1 u32>` ... -LL | demand_y(x, y, p) //~ ERROR +LL | demand_y(x, y, p) | ^^^^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2` note: No external requirements diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr index 5863b9bc8409..a1a1024bccd5 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr @@ -5,7 +5,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, | _______________________________________________^ LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) -LL | | //~^ ERROR lifetime may not live long enough +LL | | LL | | }); | |_____^ | @@ -25,7 +25,7 @@ LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { LL | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) -LL | | //~^ ERROR lifetime may not live long enough +LL | | LL | | }); LL | | } | |_^ diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr index a9aeee8a3190..ad2a5cae62e0 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr @@ -4,7 +4,7 @@ note: No external requirements LL | foo(cell, |cell_a, cell_x| { | _______________^ LL | | cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure -LL | | //~^ ERROR +LL | | LL | | }) | |_____^ | @@ -59,7 +59,7 @@ note: No external requirements LL | / fn case2() { LL | | let a = 0; LL | | let cell = Cell::new(&a); -LL | | //~^ ERROR `a` does not live long enough +LL | | ... | LL | | }) LL | | } diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr index daeb3b9ab5c5..f5167c2197b3 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr @@ -3,7 +3,7 @@ note: External requirements | LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { | _______________________________________________^ -LL | | //~^ ERROR borrowed data escapes outside of function +LL | | LL | | LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) @@ -24,7 +24,7 @@ note: No external requirements | LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { LL | | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { -LL | | //~^ ERROR borrowed data escapes outside of function +LL | | LL | | ... | LL | | }); @@ -39,7 +39,7 @@ error[E0521]: borrowed data escapes outside of function LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { | ------ `cell_a` is a reference that is only valid in the function body LL | / establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { -LL | | //~^ ERROR borrowed data escapes outside of function +LL | | LL | | LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr index 95e5ce0ae74c..b4e1b0d22476 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr @@ -3,7 +3,7 @@ note: External requirements | LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { | _______________________________________________^ -LL | | //~^ ERROR borrowed data escapes outside of function +LL | | LL | | LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) @@ -24,7 +24,7 @@ note: No external requirements | LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { LL | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { -LL | | //~^ ERROR borrowed data escapes outside of function +LL | | LL | | ... | LL | | }); @@ -39,7 +39,7 @@ error[E0521]: borrowed data escapes outside of function LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { | ------ `cell_a` is a reference that is only valid in the function body LL | / establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { -LL | | //~^ ERROR borrowed data escapes outside of function +LL | | LL | | LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr index b6d9d8529cf5..6ab2104a51c6 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr @@ -5,7 +5,7 @@ LL | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| | _____________________________________________^ LL | | // Only works if 'x: 'y: LL | | demand_y(outlives1, outlives2, x.get()) -LL | | //~^ ERROR lifetime may not live long enough +LL | | LL | | }); | |_____^ | @@ -25,7 +25,7 @@ LL | / fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { LL | | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { LL | | // Only works if 'x: 'y: LL | | demand_y(outlives1, outlives2, x.get()) -LL | | //~^ ERROR lifetime may not live long enough +LL | | LL | | }); LL | | } | |_^ diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr index 93eb93bdc063..5cf37bedb885 100644 --- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-no-bounds.stderr @@ -5,7 +5,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { | _______________________________________________^ LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) -LL | | //~^ ERROR +LL | | LL | | }); | |_____^ | @@ -34,7 +34,7 @@ LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { LL | | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) -LL | | //~^ ERROR +LL | | LL | | }); LL | | } | |_^ diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr index c7809de88b92..671a8b9a9357 100644 --- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.stderr @@ -5,7 +5,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, | _______________________________________________^ LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) -LL | | //~^ ERROR +LL | | LL | | }); | |_____^ | @@ -34,7 +34,7 @@ LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { LL | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) -LL | | //~^ ERROR +LL | | LL | | }); LL | | } | |_^ diff --git a/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr b/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr index 3bcd8e1e2568..c2bbd8138142 100644 --- a/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-from-trait-match.stderr @@ -3,7 +3,7 @@ note: External requirements | LL | establish_relationships(value, |value| { | ____________________________________^ -LL | | //~^ ERROR the parameter type `T` may not live long enough +LL | | LL | | LL | | // This function call requires that ... | @@ -42,7 +42,7 @@ error[E0309]: the parameter type `T` may not live long enough | LL | establish_relationships(value, |value| { | ____________________________________^ -LL | | //~^ ERROR the parameter type `T` may not live long enough +LL | | LL | | LL | | // This function call requires that ... | diff --git a/src/test/ui/nll/closure-requirements/propagate-multiple-requirements.stderr b/src/test/ui/nll/closure-requirements/propagate-multiple-requirements.stderr index 2ad4577869a5..332724daaa8b 100644 --- a/src/test/ui/nll/closure-requirements/propagate-multiple-requirements.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-multiple-requirements.stderr @@ -6,7 +6,7 @@ LL | let mut out: &mut &'static [i32] = &mut (&[1] as _); LL | once(|mut z: &[i32], mut out_val: &mut &[i32]| { | ----------------------------------------- value captured here ... -LL | z = &local_arr; //~ ERROR +LL | z = &local_arr; | ^^^^^^^^^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr index 4a035d0c9cd8..d5bfa3f9894d 100644 --- a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr +++ b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr @@ -23,7 +23,7 @@ note: No external requirements | LL | / fn test() { LL | | expect_sig(|a, b| b); // ought to return `a` -LL | | //~^ ERROR +LL | | LL | | } | |_^ | diff --git a/src/test/ui/nll/closure-use-spans.stderr b/src/test/ui/nll/closure-use-spans.stderr index b2abfcacd0ea..20696da3b8e8 100644 --- a/src/test/ui/nll/closure-use-spans.stderr +++ b/src/test/ui/nll/closure-use-spans.stderr @@ -3,7 +3,7 @@ error[E0506]: cannot assign to `x` because it is borrowed | LL | let y = &x; | -- borrow of `x` occurs here -LL | x = 0; //~ ERROR +LL | x = 0; | ^^^^^ assignment to borrowed `x` occurs here LL | || *y; | - borrow later captured here by closure @@ -13,7 +13,7 @@ error[E0506]: cannot assign to `x` because it is borrowed | LL | let y = &mut x; | ------ borrow of `x` occurs here -LL | x = 0; //~ ERROR +LL | x = 0; | ^^^^^ assignment to borrowed `x` occurs here LL | || *y = 1; | - borrow later captured here by closure @@ -23,7 +23,7 @@ error[E0506]: cannot assign to `x` because it is borrowed | LL | let y = &x; | -- borrow of `x` occurs here -LL | x = 0; //~ ERROR +LL | x = 0; | ^^^^^ assignment to borrowed `x` occurs here LL | move || *y; | - borrow later captured here by closure diff --git a/src/test/ui/nll/closures-in-loops.stderr b/src/test/ui/nll/closures-in-loops.stderr index 6c9e1639f88d..6408293aeea2 100644 --- a/src/test/ui/nll/closures-in-loops.stderr +++ b/src/test/ui/nll/closures-in-loops.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `x` LL | fn repreated_move(x: String) { | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | for i in 0..10 { -LL | || x; //~ ERROR +LL | || x; | ^^ - use occurs due to use in closure | | | value moved into closure here, in previous iteration of loop @@ -12,7 +12,7 @@ LL | || x; //~ ERROR error[E0499]: cannot borrow `x` as mutable more than once at a time --> $DIR/closures-in-loops.rs:15:16 | -LL | v.push(|| x = String::new()); //~ ERROR +LL | v.push(|| x = String::new()); | ^^ - borrows occur due to use of `x` in closure | | | mutable borrow starts here in previous iteration of loop @@ -20,7 +20,7 @@ LL | v.push(|| x = String::new()); //~ ERROR error[E0524]: two closures require unique access to `x` at the same time --> $DIR/closures-in-loops.rs:22:16 | -LL | v.push(|| *x = String::new()); //~ ERROR +LL | v.push(|| *x = String::new()); | ^^ - borrows occur due to use of `x` in closure | | | closures are constructed here in different iterations of loop diff --git a/src/test/ui/nll/constant-thread-locals-issue-47053.stderr b/src/test/ui/nll/constant-thread-locals-issue-47053.stderr index 77cffbfa72d2..ae056a978408 100644 --- a/src/test/ui/nll/constant-thread-locals-issue-47053.stderr +++ b/src/test/ui/nll/constant-thread-locals-issue-47053.stderr @@ -1,7 +1,7 @@ error[E0594]: cannot assign to immutable static item `FOO` --> $DIR/constant-thread-locals-issue-47053.rs:10:5 | -LL | FOO = 6; //~ ERROR cannot assign to immutable static item `FOO` [E0594] +LL | FOO = 6; | ^^^^^^^ cannot assign error: aborting due to previous error diff --git a/src/test/ui/nll/do-not-ignore-lifetime-bounds-in-copy.stderr b/src/test/ui/nll/do-not-ignore-lifetime-bounds-in-copy.stderr index db5a549106bf..bf5c571b455b 100644 --- a/src/test/ui/nll/do-not-ignore-lifetime-bounds-in-copy.stderr +++ b/src/test/ui/nll/do-not-ignore-lifetime-bounds-in-copy.stderr @@ -1,7 +1,7 @@ error[E0597]: `s` does not live long enough --> $DIR/do-not-ignore-lifetime-bounds-in-copy.rs:10:17 | -LL | let a = Foo(&s); //~ ERROR `s` does not live long enough [E0597] +LL | let a = Foo(&s); | ^^ borrowed value does not live long enough LL | drop(a); | - copying this value requires that `s` is borrowed for `'static` diff --git a/src/test/ui/nll/drop-no-may-dangle.stderr b/src/test/ui/nll/drop-no-may-dangle.stderr index efa825be295f..e1d2b038ec8b 100644 --- a/src/test/ui/nll/drop-no-may-dangle.stderr +++ b/src/test/ui/nll/drop-no-may-dangle.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `v[_]` because it is borrowed LL | let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] }; | ----- borrow of `v[_]` occurs here ... -LL | v[0] += 1; //~ ERROR cannot assign to `v[_]` because it is borrowed +LL | v[0] += 1; | ^^^^^^^^^ assignment to borrowed `v[_]` occurs here ... LL | } @@ -16,7 +16,7 @@ error[E0506]: cannot assign to `v[_]` because it is borrowed LL | let p: WrapMayNotDangle<&usize> = WrapMayNotDangle { value: &v[0] }; | ----- borrow of `v[_]` occurs here ... -LL | v[0] += 1; //~ ERROR cannot assign to `v[_]` because it is borrowed +LL | v[0] += 1; | ^^^^^^^^^ assignment to borrowed `v[_]` occurs here LL | } | - borrow might be used here, when `p` is dropped and runs the `Drop` code for type `WrapMayNotDangle` diff --git a/src/test/ui/nll/enum-drop-access.stderr b/src/test/ui/nll/enum-drop-access.stderr index da9c96f7bc2e..699179fd52fd 100644 --- a/src/test/ui/nll/enum-drop-access.stderr +++ b/src/test/ui/nll/enum-drop-access.stderr @@ -4,7 +4,7 @@ error[E0713]: borrow may still be in use when destructor runs LL | fn drop_enum(opt: DropOption<&mut i32>) -> Option<&mut i32> { | - let's call the lifetime of this reference `'1` LL | match opt { -LL | DropOption::Some(&mut ref mut r) => { //~ ERROR +LL | DropOption::Some(&mut ref mut r) => { | ^^^^^^^^^ LL | Some(r) | ------- returning this value requires that `*opt.0` is borrowed for `'1` @@ -18,7 +18,7 @@ error[E0713]: borrow may still be in use when destructor runs LL | fn optional_drop_enum(opt: Option>) -> Option<&mut i32> { | - let's call the lifetime of this reference `'1` LL | match opt { -LL | Some(DropOption::Some(&mut ref mut r)) => { //~ ERROR +LL | Some(DropOption::Some(&mut ref mut r)) => { | ^^^^^^^^^ LL | Some(r) | ------- returning this value requires that `*opt.0.0` is borrowed for `'1` diff --git a/src/test/ui/nll/guarantor-issue-46974.stderr b/src/test/ui/nll/guarantor-issue-46974.stderr index b2ed4c8fcab7..8486c7d48580 100644 --- a/src/test/ui/nll/guarantor-issue-46974.stderr +++ b/src/test/ui/nll/guarantor-issue-46974.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `*s` because it is borrowed LL | let t = &mut *s; // this borrow should last for the entire function | ------- borrow of `*s` occurs here LL | let x = &t.0; -LL | *s = (2,); //~ ERROR cannot assign to `*s` +LL | *s = (2,); | ^^^^^^^^^ assignment to borrowed `*s` occurs here LL | *x | -- borrow later used here @@ -15,7 +15,7 @@ error[E0621]: explicit lifetime required in the type of `s` LL | fn bar(s: &Box<(i32,)>) -> &'static i32 { | ------------ help: add explicit lifetime `'static` to the type of `s`: `&'static std::boxed::Box<(i32,)>` LL | // FIXME(#46983): error message should be better -LL | &s.0 //~ ERROR explicit lifetime required in the type of `s` [E0621] +LL | &s.0 | ^^^^ lifetime `'static` required error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/issue-21232-partial-init-and-use.stderr b/src/test/ui/nll/issue-21232-partial-init-and-use.stderr index 23da533252cb..ab85caabb316 100644 --- a/src/test/ui/nll/issue-21232-partial-init-and-use.stderr +++ b/src/test/ui/nll/issue-21232-partial-init-and-use.stderr @@ -158,7 +158,7 @@ LL | let mut c = (1, "".to_owned()); LL | match c { LL | c2 => { | -- value moved here -LL | c.0 = 2; //~ ERROR assign to part of moved value +LL | c.0 = 2; | ^^^^^^^ value partially assigned here after move error[E0382]: assign to part of moved value: `c` @@ -169,7 +169,7 @@ LL | let mut c = (1, (1, "".to_owned())); LL | match c { LL | c2 => { | -- value moved here -LL | (c.1).0 = 2; //~ ERROR assign to part of moved value +LL | (c.1).0 = 2; | ^^^^^^^^^^^ value partially assigned here after move error[E0382]: assign to part of moved value: `c.1` @@ -177,7 +177,7 @@ error[E0382]: assign to part of moved value: `c.1` | LL | c2 => { | -- value moved here -LL | ((c.1).1).0 = 3; //~ ERROR assign to part of moved value +LL | ((c.1).1).0 = 3; | ^^^^^^^^^^^^^^^ value partially assigned here after move | = note: move occurs because `c.1` has type `(i32, (i32, std::string::String))`, which does not implement the `Copy` trait diff --git a/src/test/ui/nll/issue-27868.stderr b/src/test/ui/nll/issue-27868.stderr index 4cbd74fe272d..c83cb0b300b2 100644 --- a/src/test/ui/nll/issue-27868.stderr +++ b/src/test/ui/nll/issue-27868.stderr @@ -8,7 +8,7 @@ LL | vecvec[0] += { | | LL | | vecvec = vec![]; | | ^^^^^^ assignment to borrowed `vecvec` occurs here -LL | | //~^ ERROR cannot assign to `vecvec` because it is borrowed [E0506] +LL | | LL | | 0 LL | | }; | |_____- borrow later used here diff --git a/src/test/ui/nll/issue-31567.stderr b/src/test/ui/nll/issue-31567.stderr index c76365095df3..d098ff82d34f 100644 --- a/src/test/ui/nll/issue-31567.stderr +++ b/src/test/ui/nll/issue-31567.stderr @@ -3,7 +3,7 @@ error[E0713]: borrow may still be in use when destructor runs | LL | fn get_dangling<'a>(v: VecWrapper<'a>) -> &'a u32 { | -- lifetime `'a` defined here -LL | let s_inner: &'a S = &*v.0; //~ ERROR borrow may still be in use when destructor runs [E0713] +LL | let s_inner: &'a S = &*v.0; | ----- ^^^^^ | | | type annotation requires that `*v.0` is borrowed for `'a` diff --git a/src/test/ui/nll/issue-47388.stderr b/src/test/ui/nll/issue-47388.stderr index dda324c2e989..91f758a60a57 100644 --- a/src/test/ui/nll/issue-47388.stderr +++ b/src/test/ui/nll/issue-47388.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `fancy_ref.num` which is behind a `&` reference | LL | let fancy_ref = &(&mut fancy); | ------------- help: consider changing this to be a mutable reference: `&mut (&mut fancy)` -LL | fancy_ref.num = 6; //~ ERROR E0594 +LL | fancy_ref.num = 6; | ^^^^^^^^^^^^^^^^^ `fancy_ref` is a `&` reference, so the data it refers to cannot be written error: aborting due to previous error diff --git a/src/test/ui/nll/issue-47470.stderr b/src/test/ui/nll/issue-47470.stderr index ff1f1e2c1f19..d23cee3fc7c4 100644 --- a/src/test/ui/nll/issue-47470.stderr +++ b/src/test/ui/nll/issue-47470.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return reference to local variable `local` --> $DIR/issue-47470.rs:17:9 | -LL | &local //~ ERROR cannot return reference to local variable `local` +LL | &local | ^^^^^^ returns a reference to data owned by the current function error: aborting due to previous error diff --git a/src/test/ui/nll/issue-48238.stderr b/src/test/ui/nll/issue-48238.stderr index 7cb5eb736c0e..05a90eec05c3 100644 --- a/src/test/ui/nll/issue-48238.stderr +++ b/src/test/ui/nll/issue-48238.stderr @@ -1,7 +1,7 @@ error: lifetime may not live long enough --> $DIR/issue-48238.rs:11:13 | -LL | move || use_val(&orig); //~ ERROR +LL | move || use_val(&orig); | ------- ^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` | | | | | return type of closure is &'2 u8 diff --git a/src/test/ui/nll/issue-48697.rs b/src/test/ui/nll/issue-48697.rs index c60c265b813b..ececd6fccd84 100644 --- a/src/test/ui/nll/issue-48697.rs +++ b/src/test/ui/nll/issue-48697.rs @@ -1,14 +1,12 @@ // Regression test for #48697 -// compile-pass - #![feature(nll)] fn foo(x: &i32) -> &i32 { let z = 4; let f = &|y| y; let k = f(&z); - f(x) + f(x) //~ cannot return value referencing local variable } fn main() {} diff --git a/src/test/ui/nll/issue-48697.stderr b/src/test/ui/nll/issue-48697.stderr new file mode 100644 index 000000000000..73832fd57879 --- /dev/null +++ b/src/test/ui/nll/issue-48697.stderr @@ -0,0 +1,11 @@ +error[E0515]: cannot return value referencing local variable `z` + --> $DIR/issue-48697.rs:9:5 + | +LL | let k = f(&z); + | -- `z` is borrowed here +LL | f(x) + | ^^^^ returns a value referencing data owned by the current function + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0515`. diff --git a/src/test/ui/nll/issue-50716.stderr b/src/test/ui/nll/issue-50716.stderr index 229bb1777cc5..7e5ffb515011 100644 --- a/src/test/ui/nll/issue-50716.stderr +++ b/src/test/ui/nll/issue-50716.stderr @@ -4,7 +4,7 @@ error: lifetime may not live long enough LL | fn foo<'a, T: 'static>(s: Box<<&'a T as A>::X>) | -- lifetime `'a` defined here ... -LL | let _x = *s; //~ ERROR +LL | let _x = *s; | ^^ proving this value is `Sized` requires that `'a` must outlive `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/issue-51191.stderr b/src/test/ui/nll/issue-51191.stderr index e2348d36d33e..e80cd873d5ac 100644 --- a/src/test/ui/nll/issue-51191.stderr +++ b/src/test/ui/nll/issue-51191.stderr @@ -3,7 +3,7 @@ warning: function cannot return without recursing | LL | fn bar(self: &mut Self) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing -LL | //~^ WARN function cannot return without recursing +LL | LL | (&mut self).bar(); | ----------------- recursive call site | diff --git a/src/test/ui/nll/issue-51268.stderr b/src/test/ui/nll/issue-51268.stderr index ce93d3787ef2..0be181745fde 100644 --- a/src/test/ui/nll/issue-51268.stderr +++ b/src/test/ui/nll/issue-51268.stderr @@ -6,7 +6,7 @@ LL | self.thing.bar(|| { | | | | _________| immutable borrow later used by call | | -LL | | //~^ ERROR cannot borrow `self.thing` as mutable because it is also borrowed as immutable [E0502] +LL | | LL | | &self.number; | | ---- first borrow occurs due to use of `self` in closure LL | | }); diff --git a/src/test/ui/nll/issue-52113.stderr b/src/test/ui/nll/issue-52113.stderr index ceae16185bbb..8638fe257698 100644 --- a/src/test/ui/nll/issue-52113.stderr +++ b/src/test/ui/nll/issue-52113.stderr @@ -6,7 +6,7 @@ LL | fn produce_err<'a, 'b: 'a>(data: &'b mut Vec<&'b u32>, value: &'a u32) -> i | | | lifetime `'a` defined here ... -LL | x //~ ERROR lifetime may not live long enough +LL | x | ^ returning this value requires that `'a` must outlive `'b` error: aborting due to previous error diff --git a/src/test/ui/nll/issue-52534-2.stderr b/src/test/ui/nll/issue-52534-2.stderr index a4396ae386dc..f98deaea7183 100644 --- a/src/test/ui/nll/issue-52534-2.stderr +++ b/src/test/ui/nll/issue-52534-2.stderr @@ -3,7 +3,7 @@ error[E0597]: `x` does not live long enough | LL | y = &x | ^^^^^^ borrowed value does not live long enough -LL | //~^ ERROR does not live long enough +LL | LL | } | - `x` dropped here while still borrowed LL | diff --git a/src/test/ui/nll/issue-52534.stderr b/src/test/ui/nll/issue-52534.stderr index e83374af3b06..9ac79eda1614 100644 --- a/src/test/ui/nll/issue-52534.stderr +++ b/src/test/ui/nll/issue-52534.stderr @@ -5,7 +5,7 @@ LL | foo(|a| &x) | - ^ `x` would have to be valid for `'0`... | | | has type `&'0 u32` -LL | //~^ ERROR does not live long enough +LL | LL | } | - ...but `x` will be dropped here, when the function `bar` returns | @@ -19,7 +19,7 @@ LL | baz(|first, second| &y) | ----- ^ `y` would have to be valid for `'0`... | | | has type `&'0 u32` -LL | //~^ ERROR does not live long enough +LL | LL | } | - ...but `y` will be dropped here, when the function `foobar` returns | diff --git a/src/test/ui/nll/issue-53773.stderr b/src/test/ui/nll/issue-53773.stderr index 92a9946068cf..1933ef7a2dbc 100644 --- a/src/test/ui/nll/issue-53773.stderr +++ b/src/test/ui/nll/issue-53773.stderr @@ -3,7 +3,7 @@ error[E0713]: borrow may still be in use when destructor runs | LL | members.push(child.raw); | ^^^^^^^^^ -LL | //~^ ERROR borrow may still be in use when destructor runs [E0713] +LL | LL | } | - here, drop of `child` needs exclusive access to `*child.raw`, because the type `C<'_>` implements the `Drop` trait LL | members.len(); diff --git a/src/test/ui/nll/issue-54556-niconii.nll.stderr b/src/test/ui/nll/issue-54556-niconii.nll.stderr index 58239fe6e888..40cd04de5ecc 100644 --- a/src/test/ui/nll/issue-54556-niconii.nll.stderr +++ b/src/test/ui/nll/issue-54556-niconii.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `counter` does not live long enough --> $DIR/issue-54556-niconii.rs:22:20 | -LL | if let Ok(_) = counter.lock() { } //~ ERROR does not live long enough +LL | if let Ok(_) = counter.lock() { } | ^^^^^^^------- | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/issue-54556-niconii.stderr b/src/test/ui/nll/issue-54556-niconii.stderr index 03a7b94d181b..2d0de26ab309 100644 --- a/src/test/ui/nll/issue-54556-niconii.stderr +++ b/src/test/ui/nll/issue-54556-niconii.stderr @@ -1,7 +1,7 @@ error[E0597]: `counter` does not live long enough --> $DIR/issue-54556-niconii.rs:22:20 | -LL | if let Ok(_) = counter.lock() { } //~ ERROR does not live long enough +LL | if let Ok(_) = counter.lock() { } | ^^^^^^^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/nll/issue-54556-stephaneyfx.nll.stderr b/src/test/ui/nll/issue-54556-stephaneyfx.nll.stderr index b58454427af8..0bf76485eef2 100644 --- a/src/test/ui/nll/issue-54556-stephaneyfx.nll.stderr +++ b/src/test/ui/nll/issue-54556-stephaneyfx.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `stmt` does not live long enough --> $DIR/issue-54556-stephaneyfx.rs:27:21 | -LL | let rows = Rows(&stmt); //~ ERROR does not live long enough +LL | let rows = Rows(&stmt); | ^^^^^ borrowed value does not live long enough LL | rows.map(|row| row).next() | ------------------- a temporary with access to the borrow is created here ... diff --git a/src/test/ui/nll/issue-54556-stephaneyfx.stderr b/src/test/ui/nll/issue-54556-stephaneyfx.stderr index bf3285a73c7c..4e581a516b2d 100644 --- a/src/test/ui/nll/issue-54556-stephaneyfx.stderr +++ b/src/test/ui/nll/issue-54556-stephaneyfx.stderr @@ -1,7 +1,7 @@ error[E0597]: `stmt` does not live long enough --> $DIR/issue-54556-stephaneyfx.rs:27:22 | -LL | let rows = Rows(&stmt); //~ ERROR does not live long enough +LL | let rows = Rows(&stmt); | ^^^^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.nll.stderr b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.nll.stderr index 1bc43017bc67..513dca7950af 100644 --- a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.nll.stderr +++ b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `_thing1` does not live long enough --> $DIR/issue-54556-temps-in-tail-diagnostic.rs:5:11 | -LL | D(&_thing1).end() //~ ERROR does not live long enough +LL | D(&_thing1).end() | --^^^^^^^^- | | | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr index ca636e761326..a74970f71182 100644 --- a/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr +++ b/src/test/ui/nll/issue-54556-temps-in-tail-diagnostic.stderr @@ -1,7 +1,7 @@ error[E0597]: `_thing1` does not live long enough --> $DIR/issue-54556-temps-in-tail-diagnostic.rs:5:12 | -LL | D(&_thing1).end() //~ ERROR does not live long enough +LL | D(&_thing1).end() | ^^^^^^^ borrowed value does not live long enough LL | } | - `_thing1` dropped here while still borrowed diff --git a/src/test/ui/nll/issue-54556-wrap-it-up.nll.stderr b/src/test/ui/nll/issue-54556-wrap-it-up.nll.stderr index a13e59fa48b5..9f27fac15a7f 100644 --- a/src/test/ui/nll/issue-54556-wrap-it-up.nll.stderr +++ b/src/test/ui/nll/issue-54556-wrap-it-up.nll.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `x` because it is borrowed LL | let wrap = Wrap { p: &mut x }; | ------ borrow of `x` occurs here ... -LL | x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] +LL | x = 1; | ^^^^^ assignment to borrowed `x` occurs here LL | } | - borrow might be used here, when `foo` is dropped and runs the destructor for type `Foo<'_>` diff --git a/src/test/ui/nll/issue-54556-wrap-it-up.stderr b/src/test/ui/nll/issue-54556-wrap-it-up.stderr index a0c19b963879..c98b3a9fafb2 100644 --- a/src/test/ui/nll/issue-54556-wrap-it-up.stderr +++ b/src/test/ui/nll/issue-54556-wrap-it-up.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `x` because it is borrowed LL | let wrap = Wrap { p: &mut x }; | - borrow of `x` occurs here ... -LL | x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] +LL | x = 1; | ^^^^^ assignment to borrowed `x` occurs here error: aborting due to previous error diff --git a/src/test/ui/nll/issue-55394.stderr b/src/test/ui/nll/issue-55394.stderr index bcdd78248eb4..e9a70fd6b161 100644 --- a/src/test/ui/nll/issue-55394.stderr +++ b/src/test/ui/nll/issue-55394.stderr @@ -5,7 +5,7 @@ LL | fn new(bar: &mut Bar) -> Self { | - ---- return type is Foo<'2> | | | let's call the lifetime of this reference `'1` -LL | Foo { bar } //~ERROR lifetime may not live long enough +LL | Foo { bar } | ^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2` error: aborting due to previous error diff --git a/src/test/ui/nll/issue-55401.stderr b/src/test/ui/nll/issue-55401.stderr index 952b5441f86f..622bc5a3f341 100644 --- a/src/test/ui/nll/issue-55401.stderr +++ b/src/test/ui/nll/issue-55401.stderr @@ -4,7 +4,7 @@ error: lifetime may not live long enough LL | fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here LL | let (ref y, _z): (&'a u32, u32) = (&22, 44); -LL | *y //~ ERROR +LL | *y | ^^ returning this value requires that `'a` must outlive `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/issue-55850.nll.stderr b/src/test/ui/nll/issue-55850.nll.stderr index e09711f74fd7..bf0c6986ef2c 100644 --- a/src/test/ui/nll/issue-55850.nll.stderr +++ b/src/test/ui/nll/issue-55850.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `s` does not live long enough --> $DIR/issue-55850.rs:28:16 | -LL | yield &s[..] //~ ERROR `s` does not live long enough [E0597] +LL | yield &s[..] | ^ borrowed value does not live long enough LL | }) | - `s` dropped here while still borrowed @@ -9,7 +9,7 @@ LL | }) error[E0626]: borrow may still be in use when generator yields --> $DIR/issue-55850.rs:28:16 | -LL | yield &s[..] //~ ERROR `s` does not live long enough [E0597] +LL | yield &s[..] | -------^---- possible yield occurs here error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/issue-55850.stderr b/src/test/ui/nll/issue-55850.stderr index 2a24cba1a684..7deee1d541ae 100644 --- a/src/test/ui/nll/issue-55850.stderr +++ b/src/test/ui/nll/issue-55850.stderr @@ -1,7 +1,7 @@ error[E0597]: `s` does not live long enough --> $DIR/issue-55850.rs:28:16 | -LL | yield &s[..] //~ ERROR `s` does not live long enough [E0597] +LL | yield &s[..] | ^ borrowed value does not live long enough LL | }) | - borrowed value only lives until here diff --git a/src/test/ui/nll/issue-57989.stderr b/src/test/ui/nll/issue-57989.stderr index 4561c99096f1..db28787a0468 100644 --- a/src/test/ui/nll/issue-57989.stderr +++ b/src/test/ui/nll/issue-57989.stderr @@ -4,7 +4,7 @@ error[E0594]: cannot assign to `*x` which is behind a `&` reference LL | fn f(x: &i32) { | ---- help: consider changing this to be a mutable reference: `&mut i32` LL | let g = &x; -LL | *x = 0; //~ ERROR cannot assign to `*x` which is behind a `&` reference +LL | *x = 0; | ^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written error[E0506]: cannot assign to `*x` because it is borrowed @@ -12,9 +12,9 @@ error[E0506]: cannot assign to `*x` because it is borrowed | LL | let g = &x; | -- borrow of `*x` occurs here -LL | *x = 0; //~ ERROR cannot assign to `*x` which is behind a `&` reference +LL | *x = 0; | ^^^^^^ assignment to borrowed `*x` occurs here -LL | //~| ERROR cannot assign to `*x` because it is borrowed +LL | LL | g; | - borrow later used here diff --git a/src/test/ui/nll/issue-58299.stderr b/src/test/ui/nll/issue-58299.stderr index b87d0de51a37..0c69b70a97c7 100644 --- a/src/test/ui/nll/issue-58299.stderr +++ b/src/test/ui/nll/issue-58299.stderr @@ -4,7 +4,7 @@ error: lifetime may not live long enough LL | fn foo<'a>(x: i32) { | -- lifetime `'a` defined here ... -LL | A::<'a>::X..=A::<'static>::X => (), //~ ERROR lifetime may not live long enough +LL | A::<'a>::X..=A::<'static>::X => (), | ^^^^^^^^^^ requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -13,7 +13,7 @@ error: lifetime may not live long enough LL | fn bar<'a>(x: i32) { | -- lifetime `'a` defined here ... -LL | A::<'static>::X..=A::<'a>::X => (), //~ ERROR lifetime may not live long enough +LL | A::<'static>::X..=A::<'a>::X => (), | ^^^^^^^^^^ requires that `'a` must outlive `'static` error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/loan_ends_mid_block_vec.stderr b/src/test/ui/nll/loan_ends_mid_block_vec.stderr index 18d4e010946b..a3f1391f0014 100644 --- a/src/test/ui/nll/loan_ends_mid_block_vec.stderr +++ b/src/test/ui/nll/loan_ends_mid_block_vec.stderr @@ -66,7 +66,7 @@ LL | let slice = &mut data; ... LL | data.push('f'); | ^^^^ second mutable borrow occurs here -LL | //~^ ERROR (Ast) [E0499] +LL | LL | } | - first borrow ends here diff --git a/src/test/ui/nll/match-cfg-fake-edges.stderr b/src/test/ui/nll/match-cfg-fake-edges.stderr index a855b28a978d..72c6a6cd4202 100644 --- a/src/test/ui/nll/match-cfg-fake-edges.stderr +++ b/src/test/ui/nll/match-cfg-fake-edges.stderr @@ -1,7 +1,7 @@ error[E0381]: use of possibly uninitialized variable: `x` --> $DIR/match-cfg-fake-edges.rs:23:13 | -LL | x; //~ ERROR use of possibly uninitialized variable: `x` +LL | x; | ^ use of possibly uninitialized `x` error[E0382]: use of moved value: `x` @@ -13,7 +13,7 @@ LL | let x = String::new(); LL | false if { drop(x); true } => 1, | - value moved here LL | true => { -LL | x; //~ ERROR use of moved value: `x` +LL | x; | ^ value used here after move error[E0503]: cannot use `y.1` because it was mutably borrowed @@ -22,7 +22,7 @@ error[E0503]: cannot use `y.1` because it was mutably borrowed LL | let r = &mut y.1; | -------- borrow of `y.1` occurs here ... -LL | (false, true) => 1, //~ ERROR cannot use `y.1` because it was mutably borrowed +LL | (false, true) => 1, | ^^^^ use of borrowed `y.1` LL | (true, _) => { LL | r; diff --git a/src/test/ui/nll/match-guards-partially-borrow.stderr b/src/test/ui/nll/match-guards-partially-borrow.stderr index baff2fda9f5d..a646b7d84bc0 100644 --- a/src/test/ui/nll/match-guards-partially-borrow.stderr +++ b/src/test/ui/nll/match-guards-partially-borrow.stderr @@ -4,7 +4,7 @@ error[E0510]: cannot assign `q` in match guard LL | match q { | - value is immutable in match guard ... -LL | q = true; //~ ERROR +LL | q = true; | ^^^^^^^^ cannot assign error[E0510]: cannot assign `r` in match guard @@ -13,7 +13,7 @@ error[E0510]: cannot assign `r` in match guard LL | match r { | - value is immutable in match guard ... -LL | r = true; //~ ERROR +LL | r = true; | ^^^^^^^^ cannot assign error[E0510]: cannot assign `t` in match guard @@ -22,7 +22,7 @@ error[E0510]: cannot assign `t` in match guard LL | match t { | - value is immutable in match guard ... -LL | t = true; //~ ERROR +LL | t = true; | ^^^^^^^^ cannot assign error[E0510]: cannot mutably borrow `x.0` in match guard @@ -31,7 +31,7 @@ error[E0510]: cannot mutably borrow `x.0` in match guard LL | match x { | - value is immutable in match guard ... -LL | Some(ref mut r) => *r = None, //~ ERROR +LL | Some(ref mut r) => *r = None, | ^^^^^^^^^ cannot mutably borrow error[E0506]: cannot assign to `t` because it is borrowed @@ -39,7 +39,7 @@ error[E0506]: cannot assign to `t` because it is borrowed | LL | s if { | - borrow of `t` occurs here -LL | t = !t; //~ ERROR +LL | t = !t; | ^^^^^^ assignment to borrowed `t` occurs here LL | false LL | } => (), // What value should `s` have in the arm? @@ -51,7 +51,7 @@ error[E0510]: cannot assign `y` in match guard LL | match *y { | -- value is immutable in match guard ... -LL | y = &true; //~ ERROR +LL | y = &true; | ^^^^^^^^^ cannot assign error[E0510]: cannot assign `z` in match guard @@ -60,7 +60,7 @@ error[E0510]: cannot assign `z` in match guard LL | match z { | - value is immutable in match guard ... -LL | z = &true; //~ ERROR +LL | z = &true; | ^^^^^^^^^ cannot assign error[E0510]: cannot assign `a` in match guard @@ -69,7 +69,7 @@ error[E0510]: cannot assign `a` in match guard LL | match a { | - value is immutable in match guard ... -LL | a = &true; //~ ERROR +LL | a = &true; | ^^^^^^^^^ cannot assign error[E0510]: cannot assign `b` in match guard @@ -78,7 +78,7 @@ error[E0510]: cannot assign `b` in match guard LL | match b { | - value is immutable in match guard ... -LL | b = &true; //~ ERROR +LL | b = &true; | ^^^^^^^^^ cannot assign error: aborting due to 9 previous errors diff --git a/src/test/ui/nll/match-on-borrowed.stderr b/src/test/ui/nll/match-on-borrowed.stderr index 2d34dd7805db..e8db0626a7ba 100644 --- a/src/test/ui/nll/match-on-borrowed.stderr +++ b/src/test/ui/nll/match-on-borrowed.stderr @@ -4,7 +4,7 @@ error[E0503]: cannot use `e` because it was mutably borrowed LL | E::V(ref mut x, _) => x, | --------- borrow of `e.0` occurs here ... -LL | E::V(_, r) => (), //~ ERROR +LL | E::V(_, r) => (), | ^^^^^^^^^^ use of borrowed `e.0` ... LL | x; @@ -16,7 +16,7 @@ error[E0503]: cannot use `*f` because it was mutably borrowed LL | E::V(ref mut x, _) => x, | --------- borrow of `f.0` occurs here ... -LL | E::V(_, r) => (), //~ ERROR +LL | E::V(_, r) => (), | ^^^^^^^^^^ use of borrowed `f.0` ... LL | x; @@ -28,7 +28,7 @@ error[E0503]: cannot use `t` because it was mutably borrowed LL | let x = &mut t; | ------ borrow of `t` occurs here LL | match t { -LL | true => (), //~ ERROR +LL | true => (), | ^^^^ use of borrowed `t` ... LL | x; @@ -37,7 +37,7 @@ LL | x; error[E0381]: use of possibly uninitialized variable: `n` --> $DIR/match-on-borrowed.rs:92:11 | -LL | match n {} //~ ERROR +LL | match n {} | ^ use of possibly uninitialized `n` error: aborting due to 4 previous errors diff --git a/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr b/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr index 3ff778675bcf..e7755bdb89cc 100644 --- a/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr +++ b/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `x` because it is borrowed LL | let wrap = Wrap { p: &mut x }; | ------ borrow of `x` occurs here ... -LL | x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] +LL | x = 1; | ^^^^^ assignment to borrowed `x` occurs here LL | // FIXME ^ Should not error in the future with implicit dtors, only manually implemented ones LL | } diff --git a/src/test/ui/nll/maybe-initialized-drop-with-fragment.stderr b/src/test/ui/nll/maybe-initialized-drop-with-fragment.stderr index 5585e69f090a..e4efd98253c0 100644 --- a/src/test/ui/nll/maybe-initialized-drop-with-fragment.stderr +++ b/src/test/ui/nll/maybe-initialized-drop-with-fragment.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `x` because it is borrowed LL | let wrap = Wrap { p: &mut x }; | ------ borrow of `x` occurs here ... -LL | x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] +LL | x = 1; | ^^^^^ assignment to borrowed `x` occurs here LL | } | - borrow might be used here, when `foo` is dropped and runs the destructor for type `Foo<'_>` diff --git a/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr b/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr index aa9544927f89..0e2be68c6d3a 100644 --- a/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr +++ b/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `x` because it is borrowed LL | let wrap = Wrap { p: &mut x }; | ------ borrow of `x` occurs here ... -LL | x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] +LL | x = 1; | ^^^^^ assignment to borrowed `x` occurs here LL | // FIXME ^ This currently errors and it should not. LL | } diff --git a/src/test/ui/nll/maybe-initialized-drop.stderr b/src/test/ui/nll/maybe-initialized-drop.stderr index 331f846dfd09..10b9a6dcf5a0 100644 --- a/src/test/ui/nll/maybe-initialized-drop.stderr +++ b/src/test/ui/nll/maybe-initialized-drop.stderr @@ -3,7 +3,7 @@ error[E0506]: cannot assign to `x` because it is borrowed | LL | let wrap = Wrap { p: &mut x }; | ------ borrow of `x` occurs here -LL | x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] +LL | x = 1; | ^^^^^ assignment to borrowed `x` occurs here LL | } | - borrow might be used here, when `wrap` is dropped and runs the `Drop` code for type `Wrap` diff --git a/src/test/ui/nll/move-errors.stderr b/src/test/ui/nll/move-errors.stderr index 86bb8e3a4b33..f329748139e5 100644 --- a/src/test/ui/nll/move-errors.stderr +++ b/src/test/ui/nll/move-errors.stderr @@ -87,7 +87,7 @@ LL | match x[0] { | | | cannot move out of here | help: consider borrowing here: `&x[0]` -LL | //~^ ERROR +LL | LL | B::U(d) => (), | - data moved here LL | B::V(s) => (), @@ -151,7 +151,7 @@ error[E0509]: cannot move out of type `F`, which implements the `Drop` trait | LL | match x { | ^ cannot move out of here -LL | //~^ ERROR +LL | LL | F(s, mut t) => (), | - ----- ...and here | | @@ -171,7 +171,7 @@ LL | match *x { | | | cannot move out of borrowed content | help: consider removing the `*`: `x` -LL | //~^ ERROR +LL | LL | Ok(s) | Err(s) => (), | - data moved here | diff --git a/src/test/ui/nll/move-subpaths-moves-root.stderr b/src/test/ui/nll/move-subpaths-moves-root.stderr index 8b52cc113ccc..bdbc25e9ee3d 100644 --- a/src/test/ui/nll/move-subpaths-moves-root.stderr +++ b/src/test/ui/nll/move-subpaths-moves-root.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x` | LL | drop(x.0); | --- value moved here -LL | drop(x); //~ ERROR use of moved value +LL | drop(x); | ^ value used here after partial move | = note: move occurs because `x.0` has type `std::vec::Vec`, which does not implement the `Copy` trait diff --git a/src/test/ui/nll/polonius-smoke-test.stderr b/src/test/ui/nll/polonius-smoke-test.stderr index c4aab0b8b1d6..fb3e9cfd2597 100644 --- a/src/test/ui/nll/polonius-smoke-test.stderr +++ b/src/test/ui/nll/polonius-smoke-test.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return reference to local variable `x` --> $DIR/polonius-smoke-test.rs:7:5 | -LL | &x //~ ERROR +LL | &x | ^^ returns a reference to data owned by the current function error[E0503]: cannot use `x` because it was mutably borrowed @@ -9,7 +9,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let y = &mut x; | ------ borrow of `x` occurs here -LL | let z = x; //~ ERROR +LL | let z = x; | ^ use of borrowed `x` LL | let w = y; | - borrow later used here @@ -19,7 +19,7 @@ error[E0505]: cannot move out of `x` because it is borrowed | LL | let y = &mut *x; | ------- borrow of `*x` occurs here -LL | let z = x; //~ ERROR +LL | let z = x; | ^ move out of `x` occurs here LL | y | - borrow later used here @@ -30,7 +30,7 @@ error[E0505]: cannot move out of `s` because it is borrowed LL | let r = &mut *s; | ------- borrow of `*s` occurs here LL | let tmp = foo(&r); -LL | s; //~ ERROR +LL | s; | ^ move out of `s` occurs here LL | tmp; | --- borrow later used here diff --git a/src/test/ui/nll/promoted-bounds.rs b/src/test/ui/nll/promoted-bounds.rs new file mode 100644 index 000000000000..59b21cf9ac2a --- /dev/null +++ b/src/test/ui/nll/promoted-bounds.rs @@ -0,0 +1,27 @@ +#![feature(nll)] + +fn shorten_lifetime<'a, 'b, 'min>(a: &'a i32, b: &'b i32) -> &'min i32 +where + 'a: 'min, + 'b: 'min, +{ + if *a < *b { + &a + } else { + &b + } +} + +fn main() { + let promoted_fn_item_ref = &shorten_lifetime; + + let a = &5; + let ptr = { + let l = 3; + let b = &l; //~ ERROR does not live long enough + let c = promoted_fn_item_ref(a, b); + c + }; + + println!("ptr = {:?}", ptr); +} diff --git a/src/test/ui/nll/promoted-bounds.stderr b/src/test/ui/nll/promoted-bounds.stderr new file mode 100644 index 000000000000..de185cc0d294 --- /dev/null +++ b/src/test/ui/nll/promoted-bounds.stderr @@ -0,0 +1,15 @@ +error[E0597]: `l` does not live long enough + --> $DIR/promoted-bounds.rs:21:17 + | +LL | let ptr = { + | --- borrow later stored here +LL | let l = 3; +LL | let b = &l; + | ^^ borrowed value does not live long enough +... +LL | }; + | - `l` dropped here while still borrowed + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/promoted-closure-pair.rs b/src/test/ui/nll/promoted-closure-pair.rs new file mode 100644 index 000000000000..7b3bbad4c1e0 --- /dev/null +++ b/src/test/ui/nll/promoted-closure-pair.rs @@ -0,0 +1,12 @@ +// Check that we handle multiple closures in the same promoted constant. + +#![feature(nll)] + +fn foo() -> &'static i32 { + let z = 0; + let p = &(|y| y, |y| y); + p.0(&z); + p.1(&z) //~ ERROR cannot return +} + +fn main() {} diff --git a/src/test/ui/nll/promoted-closure-pair.stderr b/src/test/ui/nll/promoted-closure-pair.stderr new file mode 100644 index 000000000000..b04d1a9ccba7 --- /dev/null +++ b/src/test/ui/nll/promoted-closure-pair.stderr @@ -0,0 +1,12 @@ +error[E0515]: cannot return value referencing local variable `z` + --> $DIR/promoted-closure-pair.rs:9:5 + | +LL | p.1(&z) + | ^^^^--^ + | | | + | | `z` is borrowed here + | returns a value referencing data owned by the current function + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0515`. diff --git a/src/test/ui/nll/relate_tys/universe-violation.stderr b/src/test/ui/nll/relate_tys/universe-violation.stderr index 0a2e0ed7b2db..6dc78789564c 100644 --- a/src/test/ui/nll/relate_tys/universe-violation.stderr +++ b/src/test/ui/nll/relate_tys/universe-violation.stderr @@ -1,7 +1,7 @@ error: higher-ranked subtype error --> $DIR/universe-violation.rs:15:31 | -LL | let b: fn(&u32) -> &u32 = a; //~ ERROR higher-ranked subtype error +LL | let b: fn(&u32) -> &u32 = a; | ^ error: aborting due to previous error diff --git a/src/test/ui/nll/relate_tys/var-appears-twice.stderr b/src/test/ui/nll/relate_tys/var-appears-twice.stderr index da6930455760..7c078d226dc0 100644 --- a/src/test/ui/nll/relate_tys/var-appears-twice.stderr +++ b/src/test/ui/nll/relate_tys/var-appears-twice.stderr @@ -1,7 +1,7 @@ error[E0597]: `b` does not live long enough --> $DIR/var-appears-twice.rs:23:38 | -LL | let x: DoubleCell<_> = make_cell(&b); //~ ERROR +LL | let x: DoubleCell<_> = make_cell(&b); | ------------- ^^ borrowed value does not live long enough | | | type annotation requires that `b` is borrowed for `'static` diff --git a/src/test/ui/nll/return-ref-mut-issue-46557.stderr b/src/test/ui/nll/return-ref-mut-issue-46557.stderr index 7603d8b5bb5c..cc201136ff21 100644 --- a/src/test/ui/nll/return-ref-mut-issue-46557.stderr +++ b/src/test/ui/nll/return-ref-mut-issue-46557.stderr @@ -3,7 +3,7 @@ error[E0515]: cannot return value referencing temporary value | LL | let ref mut x = 1234543; | ------- temporary value created here -LL | x //~ ERROR cannot return value referencing temporary value [E0515] +LL | x | ^ returns a value referencing data owned by the current function error: aborting due to previous error diff --git a/src/test/ui/nll/trait-associated-constant.rs b/src/test/ui/nll/trait-associated-constant.rs index 9d3e1a690f00..31dc58185e90 100644 --- a/src/test/ui/nll/trait-associated-constant.rs +++ b/src/test/ui/nll/trait-associated-constant.rs @@ -9,24 +9,23 @@ trait Anything<'a: 'b, 'b> { const AC: Option<&'b str>; } -struct OKStruct { } +struct OKStruct1 { } -impl<'a: 'b, 'b> Anything<'a, 'b> for OKStruct { +impl<'a: 'b, 'b> Anything<'a, 'b> for OKStruct1 { const AC: Option<&'b str> = None; } -struct FailStruct1 { } +struct FailStruct { } -impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct1 { +impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct { const AC: Option<&'c str> = None; //~^ ERROR: mismatched types } -struct FailStruct2 { } +struct OKStruct2 { } -impl<'a: 'b, 'b> Anything<'a, 'b> for FailStruct2 { +impl<'a: 'b, 'b> Anything<'a, 'b> for OKStruct2 { const AC: Option<&'a str> = None; - //~^ ERROR: mismatched types } fn main() {} diff --git a/src/test/ui/nll/trait-associated-constant.stderr b/src/test/ui/nll/trait-associated-constant.stderr index 78ef513f3eec..f39f668e2329 100644 --- a/src/test/ui/nll/trait-associated-constant.stderr +++ b/src/test/ui/nll/trait-associated-constant.stderr @@ -9,33 +9,14 @@ LL | const AC: Option<&'c str> = None; note: the lifetime 'c as defined on the impl at 20:18... --> $DIR/trait-associated-constant.rs:20:18 | -LL | impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct1 { +LL | impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct { | ^^ note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 20:14 --> $DIR/trait-associated-constant.rs:20:14 | -LL | impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct1 { +LL | impl<'a: 'b, 'b, 'c> Anything<'a, 'b> for FailStruct { | ^^ -error[E0308]: mismatched types - --> $DIR/trait-associated-constant.rs:28:5 - | -LL | const AC: Option<&'a str> = None; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch - | - = note: expected type `std::option::Option<&'b str>` - found type `std::option::Option<&'a str>` -note: the lifetime 'a as defined on the impl at 27:6... - --> $DIR/trait-associated-constant.rs:27:6 - | -LL | impl<'a: 'b, 'b> Anything<'a, 'b> for FailStruct2 { - | ^^ -note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 27:14 - --> $DIR/trait-associated-constant.rs:27:14 - | -LL | impl<'a: 'b, 'b> Anything<'a, 'b> for FailStruct2 { - | ^^ - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr index fc7a4570a180..a7679aac219f 100644 --- a/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-no-regions-closure.stderr @@ -21,7 +21,7 @@ LL | | where LL | | T: Iterator, LL | | { LL | | with_signature(x, |mut y| Box::new(y.next())) -LL | | //~^ ERROR the associated type `::Item` may not live long enough +LL | | LL | | } | |_^ | @@ -93,7 +93,7 @@ LL | | where LL | | T: 'b + Iterator, LL | | { LL | | with_signature(x, |mut y| Box::new(y.next())) -LL | | //~^ ERROR the associated type `::Item` may not live long enough +LL | | LL | | } | |_^ | diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr index e8283d1ab5da..7ba7164b35b8 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-closure.stderr @@ -23,7 +23,7 @@ LL | | where LL | | T: Anything<'b>, LL | | { ... | -LL | | //~| ERROR +LL | | LL | | } | |_^ | @@ -76,7 +76,7 @@ LL | | where LL | | T: Anything<'b>, LL | | 'a: 'a, ... | -LL | | //~| ERROR +LL | | LL | | } | |_^ | diff --git a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr index 78a8c803dd97..63ead49adfcb 100644 --- a/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-one-region-trait-bound-closure.stderr @@ -22,7 +22,7 @@ LL | | where LL | | T: Anything<'b>, LL | | { LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | //~^ ERROR +LL | | LL | | } | |_^ | @@ -66,7 +66,7 @@ LL | | where LL | | T: Anything<'b>, LL | | 'a: 'a, ... | -LL | | //~^ ERROR +LL | | LL | | } | |_^ | diff --git a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr index d8725dc4284f..f5daae286709 100644 --- a/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr +++ b/src/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr @@ -23,7 +23,7 @@ LL | | where LL | | T: Anything<'b, 'c>, LL | | { LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | //~^ ERROR associated type `>::AssocType` may not live long enough +LL | | LL | | } | |_^ | @@ -66,7 +66,7 @@ LL | | where LL | | T: Anything<'b, 'c>, LL | | 'a: 'a, ... | -LL | | //~^ ERROR associated type `>::AssocType` may not live long enough +LL | | LL | | } | |_^ | @@ -217,7 +217,7 @@ LL | | where LL | | T: Anything<'b, 'b>, LL | | { LL | | with_signature(cell, t, |cell, t| require(cell, t)); -LL | | //~^ ERROR lifetime may not live long enough +LL | | LL | | } | |_^ | diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr index 597b096dbe60..1aed0a545b47 100644 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr +++ b/src/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr @@ -1,7 +1,7 @@ error[E0309]: the associated type `>::Output` may not live long enough --> $DIR/projection-where-clause-env-wrong-bound.rs:17:5 | -LL | bar::() //~ ERROR may not live long enough +LL | bar::() | ^^^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `>::Output: 'a`... diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-none.stderr b/src/test/ui/nll/ty-outlives/projection-where-clause-none.stderr index 3c2ac474778f..8175c302155a 100644 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-none.stderr +++ b/src/test/ui/nll/ty-outlives/projection-where-clause-none.stderr @@ -1,7 +1,7 @@ error[E0309]: the parameter type `T` may not live long enough --> $DIR/projection-where-clause-none.rs:16:5 | -LL | bar::() //~ ERROR the parameter type `T` may not live long enough +LL | bar::() | ^^^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `T: 'a`... diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr index 24bd97f04691..41c2916dca3b 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-approximate-lower-bound.stderr @@ -45,7 +45,7 @@ note: No external requirements | LL | / fn generic_fail<'a, T>(cell: Cell<&'a ()>, value: T) { LL | | twice(cell, value, |a, b| invoke(a, b)); -LL | | //~^ ERROR the parameter type `T` may not live long enough +LL | | LL | | } | |_^ | diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr index 30c1dbc9027b..6a201b8523ad 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.stderr @@ -21,7 +21,7 @@ LL | | where LL | | T: Debug, LL | | { ... | -LL | | //~^ ERROR the parameter type `T` may not live long enough +LL | | LL | | } | |_^ | diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr index a76a9463cc80..4ddc54717fbb 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr @@ -3,7 +3,7 @@ note: External requirements | LL | with_signature(a, b, |x, y| { | __________________________^ -LL | | //~^ ERROR the parameter type `T` may not live long enough +LL | | LL | | // LL | | // See `correct_region`, which explains the point of this ... | @@ -25,7 +25,7 @@ note: No external requirements | LL | / fn no_region<'a, T>(a: Cell<&'a ()>, b: T) { LL | | with_signature(a, b, |x, y| { -LL | | //~^ ERROR the parameter type `T` may not live long enough +LL | | LL | | // ... | LL | | }) @@ -41,7 +41,7 @@ error[E0309]: the parameter type `T` may not live long enough | LL | with_signature(a, b, |x, y| { | __________________________^ -LL | | //~^ ERROR the parameter type `T` may not live long enough +LL | | LL | | // LL | | // See `correct_region`, which explains the point of this ... | @@ -95,7 +95,7 @@ note: External requirements | LL | with_signature(a, b, |x, y| { | __________________________^ -LL | | //~^ ERROR the parameter type `T` may not live long enough +LL | | LL | | // See `correct_region` LL | | require(&x, &y) LL | | }) @@ -133,7 +133,7 @@ error[E0309]: the parameter type `T` may not live long enough | LL | with_signature(a, b, |x, y| { | __________________________^ -LL | | //~^ ERROR the parameter type `T` may not live long enough +LL | | LL | | // See `correct_region` LL | | require(&x, &y) LL | | }) diff --git a/src/test/ui/nll/ty-outlives/wf-unreachable.stderr b/src/test/ui/nll/ty-outlives/wf-unreachable.stderr index 14642a1e615d..9128fd164795 100644 --- a/src/test/ui/nll/ty-outlives/wf-unreachable.stderr +++ b/src/test/ui/nll/ty-outlives/wf-unreachable.stderr @@ -4,7 +4,7 @@ error: lifetime may not live long enough LL | fn uninit<'a>() { | -- lifetime `'a` defined here LL | return; -LL | let x: &'static &'a (); //~ ERROR lifetime may not live long enough +LL | let x: &'static &'a (); | ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -13,7 +13,7 @@ error: lifetime may not live long enough LL | fn var_type<'a>() { | -- lifetime `'a` defined here LL | return; -LL | let x: &'static &'a () = &&(); //~ ERROR lifetime may not live long enough +LL | let x: &'static &'a () = &&(); | ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -21,7 +21,7 @@ error: lifetime may not live long enough | LL | fn uninit_infer<'a>() { | -- lifetime `'a` defined here -LL | let x: &'static &'a _; //~ ERROR lifetime may not live long enough +LL | let x: &'static &'a _; | ^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -30,7 +30,7 @@ error: lifetime may not live long enough LL | fn infer<'a>() { | -- lifetime `'a` defined here LL | return; -LL | let x: &'static &'a _ = &&(); //~ ERROR lifetime may not live long enough +LL | let x: &'static &'a _ = &&(); | ^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -39,7 +39,7 @@ error: lifetime may not live long enough LL | fn uninit_no_var<'a>() { | -- lifetime `'a` defined here LL | return; -LL | let _: &'static &'a (); //~ ERROR lifetime may not live long enough +LL | let _: &'static &'a (); | ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -48,7 +48,7 @@ error: lifetime may not live long enough LL | fn no_var<'a>() { | -- lifetime `'a` defined here LL | return; -LL | let _: &'static &'a () = &&(); //~ ERROR lifetime may not live long enough +LL | let _: &'static &'a () = &&(); | ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -57,7 +57,7 @@ error: lifetime may not live long enough LL | fn infer_no_var<'a>() { | -- lifetime `'a` defined here LL | return; -LL | let _: &'static &'a _ = &&(); //~ ERROR lifetime may not live long enough +LL | let _: &'static &'a _ = &&(); | ^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -66,7 +66,7 @@ error: lifetime may not live long enough LL | fn required_substs<'a>() { | -- lifetime `'a` defined here LL | return; -LL | let _: C<'static, 'a, _> = C((), &(), &()); //~ ERROR lifetime may not live long enough +LL | let _: C<'static, 'a, _> = C((), &(), &()); | ^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` error: aborting due to 8 previous errors diff --git a/src/test/ui/nll/type-alias-free-regions.stderr b/src/test/ui/nll/type-alias-free-regions.stderr index bcd141bb406b..4facc2d0da0e 100644 --- a/src/test/ui/nll/type-alias-free-regions.stderr +++ b/src/test/ui/nll/type-alias-free-regions.stderr @@ -5,7 +5,7 @@ LL | impl<'a> FromBox<'a> for C<'a> { | -- lifetime `'a` defined here LL | fn from_box(b: Box) -> Self { | - has type `std::boxed::Box>` -LL | C { f: b } //~ ERROR +LL | C { f: b } | ^^^^^^^^^^ returning this value requires that `'1` must outlive `'a` error: lifetime may not live long enough @@ -15,7 +15,7 @@ LL | impl<'a> FromTuple<'a> for C<'a> { | -- lifetime `'a` defined here LL | fn from_tuple(b: (B,)) -> Self { | - has type `(std::boxed::Box<&'1 isize>,)` -LL | C { f: Box::new(b.0) } //~ ERROR +LL | C { f: Box::new(b.0) } | ^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'a` error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/type-check-pointer-coercions.rs b/src/test/ui/nll/type-check-pointer-coercions.rs new file mode 100644 index 000000000000..b6a25eddb866 --- /dev/null +++ b/src/test/ui/nll/type-check-pointer-coercions.rs @@ -0,0 +1,39 @@ +#![feature(nll)] + +fn shared_to_const<'a, 'b>(x: &&'a i32) -> *const &'b i32 { + x //~ ERROR +} + +fn unique_to_const<'a, 'b>(x: &mut &'a i32) -> *const &'b i32 { + x //~ ERROR +} + +fn unique_to_mut<'a, 'b>(x: &mut &'a i32) -> *mut &'b i32 { + // Two errors because *mut is invariant + x //~ ERROR + //~| ERROR +} + +fn mut_to_const<'a, 'b>(x: *mut &'a i32) -> *const &'b i32 { + x //~ ERROR +} + +fn array_elem<'a, 'b>(x: &'a i32) -> *const &'b i32 { + let z = &[x; 3]; + let y = z as *const &i32; + y //~ ERROR +} + +fn array_coerce<'a, 'b>(x: &'a i32) -> *const [&'b i32; 3] { + let z = &[x; 3]; + let y = z as *const [&i32; 3]; + y //~ ERROR +} + +fn nested_array<'a, 'b>(x: &'a i32) -> *const [&'b i32; 2] { + let z = &[[x; 2]; 3]; + let y = z as *const [&i32; 2]; + y //~ ERROR +} + +fn main() {} diff --git a/src/test/ui/nll/type-check-pointer-coercions.stderr b/src/test/ui/nll/type-check-pointer-coercions.stderr new file mode 100644 index 000000000000..9aa78dfbd4ac --- /dev/null +++ b/src/test/ui/nll/type-check-pointer-coercions.stderr @@ -0,0 +1,87 @@ +error: lifetime may not live long enough + --> $DIR/type-check-pointer-coercions.rs:4:5 + | +LL | fn shared_to_const<'a, 'b>(x: &&'a i32) -> *const &'b i32 { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | x + | ^ returning this value requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/type-check-pointer-coercions.rs:8:5 + | +LL | fn unique_to_const<'a, 'b>(x: &mut &'a i32) -> *const &'b i32 { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | x + | ^ returning this value requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/type-check-pointer-coercions.rs:13:5 + | +LL | fn unique_to_mut<'a, 'b>(x: &mut &'a i32) -> *mut &'b i32 { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | // Two errors because *mut is invariant +LL | x + | ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b` + +error: lifetime may not live long enough + --> $DIR/type-check-pointer-coercions.rs:13:5 + | +LL | fn unique_to_mut<'a, 'b>(x: &mut &'a i32) -> *mut &'b i32 { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | // Two errors because *mut is invariant +LL | x + | ^ returning this value requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/type-check-pointer-coercions.rs:18:5 + | +LL | fn mut_to_const<'a, 'b>(x: *mut &'a i32) -> *const &'b i32 { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | x + | ^ returning this value requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/type-check-pointer-coercions.rs:24:5 + | +LL | fn array_elem<'a, 'b>(x: &'a i32) -> *const &'b i32 { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | y + | ^ returning this value requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/type-check-pointer-coercions.rs:30:5 + | +LL | fn array_coerce<'a, 'b>(x: &'a i32) -> *const [&'b i32; 3] { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | y + | ^ returning this value requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/type-check-pointer-coercions.rs:36:5 + | +LL | fn nested_array<'a, 'b>(x: &'a i32) -> *const [&'b i32; 2] { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +... +LL | y + | ^ returning this value requires that `'a` must outlive `'b` + +error: aborting due to 8 previous errors + diff --git a/src/test/ui/nll/type-check-pointer-comparisons.rs b/src/test/ui/nll/type-check-pointer-comparisons.rs new file mode 100644 index 000000000000..3c900356fab3 --- /dev/null +++ b/src/test/ui/nll/type-check-pointer-comparisons.rs @@ -0,0 +1,33 @@ +#![feature(nll)] + +// Check that we assert that pointers have a common subtype for comparisons + +fn compare_const<'a, 'b>(x: *const &mut &'a i32, y: *const &mut &'b i32) { + x == y; + //~^ ERROR lifetime may not live long enough + //~| ERROR lifetime may not live long enough +} + +fn compare_mut<'a, 'b>(x: *mut &'a i32, y: *mut &'b i32) { + x == y; + //~^ ERROR lifetime may not live long enough + //~| ERROR lifetime may not live long enough +} + +fn compare_fn_ptr<'a, 'b, 'c>(f: fn(&'c mut &'a i32), g: fn(&'c mut &'b i32)) { + f == g; + //~^ ERROR lifetime may not live long enough + //~| ERROR lifetime may not live long enough +} + +fn compare_hr_fn_ptr<'a>(f: fn(&'a i32), g: fn(&i32)) { + // Ideally this should compile with the operands swapped as well, but HIR + // type checking prevents it (and stops compilation) for now. + f == g; // OK +} + +fn compare_const_fn_ptr<'a>(f: *const fn(&'a i32), g: *const fn(&i32)) { + f == g; // OK +} + +fn main() {} diff --git a/src/test/ui/nll/type-check-pointer-comparisons.stderr b/src/test/ui/nll/type-check-pointer-comparisons.stderr new file mode 100644 index 000000000000..c0a994cfb638 --- /dev/null +++ b/src/test/ui/nll/type-check-pointer-comparisons.stderr @@ -0,0 +1,62 @@ +error: lifetime may not live long enough + --> $DIR/type-check-pointer-comparisons.rs:6:5 + | +LL | fn compare_const<'a, 'b>(x: *const &mut &'a i32, y: *const &mut &'b i32) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | x == y; + | ^ requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/type-check-pointer-comparisons.rs:6:10 + | +LL | fn compare_const<'a, 'b>(x: *const &mut &'a i32, y: *const &mut &'b i32) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | x == y; + | ^ requires that `'b` must outlive `'a` + +error: lifetime may not live long enough + --> $DIR/type-check-pointer-comparisons.rs:12:5 + | +LL | fn compare_mut<'a, 'b>(x: *mut &'a i32, y: *mut &'b i32) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | x == y; + | ^ requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/type-check-pointer-comparisons.rs:12:10 + | +LL | fn compare_mut<'a, 'b>(x: *mut &'a i32, y: *mut &'b i32) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | x == y; + | ^ requires that `'b` must outlive `'a` + +error: lifetime may not live long enough + --> $DIR/type-check-pointer-comparisons.rs:18:5 + | +LL | fn compare_fn_ptr<'a, 'b, 'c>(f: fn(&'c mut &'a i32), g: fn(&'c mut &'b i32)) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | f == g; + | ^ requires that `'a` must outlive `'b` + +error: lifetime may not live long enough + --> $DIR/type-check-pointer-comparisons.rs:18:10 + | +LL | fn compare_fn_ptr<'a, 'b, 'c>(f: fn(&'c mut &'a i32), g: fn(&'c mut &'b i32)) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | f == g; + | ^ requires that `'b` must outlive `'a` + +error: aborting due to 6 previous errors + diff --git a/src/test/ui/nll/user-annotations/adt-brace-enums.stderr b/src/test/ui/nll/user-annotations/adt-brace-enums.stderr index fd1a4b96fe34..38f068746a67 100644 --- a/src/test/ui/nll/user-annotations/adt-brace-enums.stderr +++ b/src/test/ui/nll/user-annotations/adt-brace-enums.stderr @@ -1,7 +1,7 @@ error[E0597]: `c` does not live long enough --> $DIR/adt-brace-enums.rs:27:48 | -LL | SomeEnum::SomeVariant::<&'static u32> { t: &c }; //~ ERROR +LL | SomeEnum::SomeVariant::<&'static u32> { t: &c }; | ^^ | | | borrowed value does not live long enough @@ -15,7 +15,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here LL | let c = 66; -LL | SomeEnum::SomeVariant::<&'a u32> { t: &c }; //~ ERROR +LL | SomeEnum::SomeVariant::<&'a u32> { t: &c }; | ^^ | | | borrowed value does not live long enough @@ -29,7 +29,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here ... -LL | SomeEnum::SomeVariant::<&'a u32> { t: &c }; //~ ERROR +LL | SomeEnum::SomeVariant::<&'a u32> { t: &c }; | ^^ | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/adt-brace-structs.stderr b/src/test/ui/nll/user-annotations/adt-brace-structs.stderr index e614e00ac00c..25a9de480b2c 100644 --- a/src/test/ui/nll/user-annotations/adt-brace-structs.stderr +++ b/src/test/ui/nll/user-annotations/adt-brace-structs.stderr @@ -1,7 +1,7 @@ error[E0597]: `c` does not live long enough --> $DIR/adt-brace-structs.rs:25:37 | -LL | SomeStruct::<&'static u32> { t: &c }; //~ ERROR +LL | SomeStruct::<&'static u32> { t: &c }; | ^^ | | | borrowed value does not live long enough @@ -15,7 +15,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here LL | let c = 66; -LL | SomeStruct::<&'a u32> { t: &c }; //~ ERROR +LL | SomeStruct::<&'a u32> { t: &c }; | ^^ | | | borrowed value does not live long enough @@ -29,7 +29,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here ... -LL | SomeStruct::<&'a u32> { t: &c }; //~ ERROR +LL | SomeStruct::<&'a u32> { t: &c }; | ^^ | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/adt-nullary-enums.stderr b/src/test/ui/nll/user-annotations/adt-nullary-enums.stderr index c72e56c619f3..1afbac7c4b2e 100644 --- a/src/test/ui/nll/user-annotations/adt-nullary-enums.stderr +++ b/src/test/ui/nll/user-annotations/adt-nullary-enums.stderr @@ -1,7 +1,7 @@ error[E0597]: `c` does not live long enough --> $DIR/adt-nullary-enums.rs:34:41 | -LL | SomeEnum::SomeVariant(Cell::new(&c)), //~ ERROR +LL | SomeEnum::SomeVariant(Cell::new(&c)), | ----------^^- | | | | | borrowed value does not live long enough @@ -16,7 +16,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here ... -LL | SomeEnum::SomeVariant(Cell::new(&c)), //~ ERROR +LL | SomeEnum::SomeVariant(Cell::new(&c)), | ----------^^- | | | | | borrowed value does not live long enough @@ -31,7 +31,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here ... -LL | SomeEnum::SomeVariant(Cell::new(&c)), //~ ERROR +LL | SomeEnum::SomeVariant(Cell::new(&c)), | ----------^^- | | | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/adt-tuple-enums.stderr b/src/test/ui/nll/user-annotations/adt-tuple-enums.stderr index dc5b5a0dd7fd..cd625653ace2 100644 --- a/src/test/ui/nll/user-annotations/adt-tuple-enums.stderr +++ b/src/test/ui/nll/user-annotations/adt-tuple-enums.stderr @@ -1,7 +1,7 @@ error[E0597]: `c` does not live long enough --> $DIR/adt-tuple-enums.rs:29:43 | -LL | SomeEnum::SomeVariant::<&'static u32>(&c); //~ ERROR +LL | SomeEnum::SomeVariant::<&'static u32>(&c); | ^^ | | | borrowed value does not live long enough @@ -15,7 +15,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here LL | let c = 66; -LL | SomeEnum::SomeVariant::<&'a u32>(&c); //~ ERROR +LL | SomeEnum::SomeVariant::<&'a u32>(&c); | ^^ | | | borrowed value does not live long enough @@ -29,7 +29,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here ... -LL | SomeEnum::SomeVariant::<&'a u32>(&c); //~ ERROR +LL | SomeEnum::SomeVariant::<&'a u32>(&c); | ^^ | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/adt-tuple-struct.stderr b/src/test/ui/nll/user-annotations/adt-tuple-struct.stderr index 38acfcb4b613..2bb58bb2590b 100644 --- a/src/test/ui/nll/user-annotations/adt-tuple-struct.stderr +++ b/src/test/ui/nll/user-annotations/adt-tuple-struct.stderr @@ -1,7 +1,7 @@ error[E0597]: `c` does not live long enough --> $DIR/adt-tuple-struct.rs:25:32 | -LL | SomeStruct::<&'static u32>(&c); //~ ERROR +LL | SomeStruct::<&'static u32>(&c); | ^^ | | | borrowed value does not live long enough @@ -15,7 +15,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here LL | let c = 66; -LL | SomeStruct::<&'a u32>(&c); //~ ERROR +LL | SomeStruct::<&'a u32>(&c); | ^^ | | | borrowed value does not live long enough @@ -29,7 +29,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here ... -LL | SomeStruct::<&'a u32>(&c); //~ ERROR +LL | SomeStruct::<&'a u32>(&c); | ^^ | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/cast_static_lifetime.stderr b/src/test/ui/nll/user-annotations/cast_static_lifetime.stderr index 7e795ce17a8d..0228b56d761f 100644 --- a/src/test/ui/nll/user-annotations/cast_static_lifetime.stderr +++ b/src/test/ui/nll/user-annotations/cast_static_lifetime.stderr @@ -1,7 +1,7 @@ error[E0597]: `x` does not live long enough --> $DIR/cast_static_lifetime.rs:6:19 | -LL | let y: &u32 = (&x) as &'static u32; //~ ERROR `x` does not live long enough +LL | let y: &u32 = (&x) as &'static u32; | ^^^^---------------- | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/closure-substs.stderr b/src/test/ui/nll/user-annotations/closure-substs.stderr index a46ab61418ef..55bb3a6090c0 100644 --- a/src/test/ui/nll/user-annotations/closure-substs.stderr +++ b/src/test/ui/nll/user-annotations/closure-substs.stderr @@ -4,7 +4,7 @@ error: lifetime may not live long enough LL | fn foo<'a>() { | -- lifetime `'a` defined here ... -LL | return x; //~ ERROR lifetime may not live long enough +LL | return x; | ^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -12,7 +12,7 @@ error: lifetime may not live long enough | LL | |x: &i32| -> &'static i32 { | - let's call the lifetime of this reference `'1` -LL | return x; //~ ERROR lifetime may not live long enough +LL | return x; | ^ returning this value requires that `'1` must outlive `'static` error: lifetime may not live long enough @@ -21,7 +21,7 @@ error: lifetime may not live long enough LL | fn bar<'a>() { | -- lifetime `'a` defined here ... -LL | b(x); //~ ERROR lifetime may not live long enough +LL | b(x); | ^^^^ argument requires that `'a` must outlive `'static` error[E0521]: borrowed data escapes outside of closure @@ -29,7 +29,7 @@ error[E0521]: borrowed data escapes outside of closure | LL | |x: &i32, b: fn(&'static i32)| { | - `x` is a reference that is only valid in the closure body -LL | b(x); //~ ERROR borrowed data escapes outside of closure +LL | b(x); | ^^^^ `x` escapes the closure body here error: aborting due to 4 previous errors diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr index 541a7113ec74..9a28fbd11339 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.stderr @@ -3,7 +3,7 @@ error: lifetime may not live long enough | LL | fn foo<'a>(_: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here -LL | >::C //~ ERROR +LL | >::C | ^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr index 57cfaa2db043..07e2e1e85cb7 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-2.stderr @@ -1,7 +1,7 @@ error[E0597]: `x` does not live long enough --> $DIR/constant-in-expr-inherent-2.rs:25:9 | -LL | FUN(&x); //~ ERROR `x` does not live long enough +LL | FUN(&x); | ----^^- | | | | | borrowed value does not live long enough @@ -13,7 +13,7 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/constant-in-expr-inherent-2.rs:26:23 | -LL | A::ASSOCIATED_FUN(&x); //~ ERROR `x` does not live long enough +LL | A::ASSOCIATED_FUN(&x); | ------------------^^- | | | | | borrowed value does not live long enough @@ -25,19 +25,19 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/constant-in-expr-inherent-2.rs:27:28 | -LL | B::ALSO_ASSOCIATED_FUN(&x); //~ ERROR `x` does not live long enough +LL | B::ALSO_ASSOCIATED_FUN(&x); | -----------------------^^- | | | | | borrowed value does not live long enough | argument requires that `x` is borrowed for `'static` -LL | <_>::TRAIT_ASSOCIATED_FUN(&x); //~ ERROR `x` does not live long enough +LL | <_>::TRAIT_ASSOCIATED_FUN(&x); LL | } | - `x` dropped here while still borrowed error[E0597]: `x` does not live long enough --> $DIR/constant-in-expr-inherent-2.rs:28:31 | -LL | <_>::TRAIT_ASSOCIATED_FUN(&x); //~ ERROR `x` does not live long enough +LL | <_>::TRAIT_ASSOCIATED_FUN(&x); | --------------------------^^- | | | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr index 5b97c12b626b..5e66a30d7c33 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.stderr @@ -3,7 +3,7 @@ error: lifetime may not live long enough | LL | fn foo<'a>(_: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here -LL | <() as Foo<'a>>::C //~ ERROR +LL | <() as Foo<'a>>::C | ^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr index 10e48b5bc348..c96838f259a8 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.stderr @@ -3,7 +3,7 @@ error: lifetime may not live long enough | LL | fn foo<'a>(_: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here -LL | <() as Foo<'a>>::C //~ ERROR +LL | <() as Foo<'a>>::C | ^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr index 5bfa32ec6449..fcc3c40e43f7 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.stderr @@ -3,7 +3,7 @@ error: lifetime may not live long enough | LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { | -- lifetime `'a` defined here -LL | >::C //~ ERROR +LL | >::C | ^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr index a1e60db05d08..c91370c810c8 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.stderr @@ -3,7 +3,7 @@ error: lifetime may not live long enough | LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { | -- lifetime `'a` defined here -LL | T::C //~ ERROR +LL | T::C | ^^^^ returning this value requires that `'a` must outlive `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/dump-adt-brace-struct.stderr b/src/test/ui/nll/user-annotations/dump-adt-brace-struct.stderr index 6e24da094e0d..ae123b8ab545 100644 --- a/src/test/ui/nll/user-annotations/dump-adt-brace-struct.stderr +++ b/src/test/ui/nll/user-annotations/dump-adt-brace-struct.stderr @@ -1,7 +1,7 @@ error: user substs: UserSubsts { substs: [&ReStatic u32], user_self_ty: None } --> $DIR/dump-adt-brace-struct.rs:20:5 | -LL | SomeStruct::<&'static u32> { t: &22 }; //~ ERROR [&ReStatic u32] +LL | SomeStruct::<&'static u32> { t: &22 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/dump-fn-method.stderr b/src/test/ui/nll/user-annotations/dump-fn-method.stderr index 04ceb8e5f849..631bcde4ee87 100644 --- a/src/test/ui/nll/user-annotations/dump-fn-method.stderr +++ b/src/test/ui/nll/user-annotations/dump-fn-method.stderr @@ -1,25 +1,25 @@ error: user substs: UserSubsts { substs: [&ReStatic u32], user_self_ty: None } --> $DIR/dump-fn-method.rs:30:13 | -LL | let x = foo::<&'static u32>; //~ ERROR [&ReStatic u32] +LL | let x = foo::<&'static u32>; | ^^^^^^^^^^^^^^^^^^^ error: user substs: UserSubsts { substs: [^0, u32, ^1], user_self_ty: None } --> $DIR/dump-fn-method.rs:36:13 | -LL | let x = <_ as Bazoom>::method::<_>; //~ ERROR [^0, u32, ^1] +LL | let x = <_ as Bazoom>::method::<_>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: user substs: UserSubsts { substs: [u8, &ReStatic u16, u32], user_self_ty: None } --> $DIR/dump-fn-method.rs:45:13 | -LL | let x = >::method::; //~ ERROR [u8, &ReStatic u16, u32] +LL | let x = >::method::; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: user substs: UserSubsts { substs: [^0, ^1, u32], user_self_ty: None } --> $DIR/dump-fn-method.rs:53:5 | -LL | y.method::(44, 66); //~ ERROR [^0, ^1, u32] +LL | y.method::(44, 66); | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/nll/user-annotations/fns.stderr b/src/test/ui/nll/user-annotations/fns.stderr index 65af2f68bcf8..dadce24159e8 100644 --- a/src/test/ui/nll/user-annotations/fns.stderr +++ b/src/test/ui/nll/user-annotations/fns.stderr @@ -1,7 +1,7 @@ error[E0597]: `c` does not live long enough --> $DIR/fns.rs:25:29 | -LL | some_fn::<&'static u32>(&c); //~ ERROR +LL | some_fn::<&'static u32>(&c); | ------------------------^^- | | | | | borrowed value does not live long enough @@ -15,7 +15,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here LL | let c = 66; -LL | some_fn::<&'a u32>(&c); //~ ERROR +LL | some_fn::<&'a u32>(&c); | -------------------^^- | | | | | borrowed value does not live long enough @@ -29,7 +29,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here ... -LL | some_fn::<&'a u32>(&c); //~ ERROR +LL | some_fn::<&'a u32>(&c); | -------------------^^- | | | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/inherent-associated-constants.stderr b/src/test/ui/nll/user-annotations/inherent-associated-constants.stderr index 785b39ec887a..768454698987 100644 --- a/src/test/ui/nll/user-annotations/inherent-associated-constants.stderr +++ b/src/test/ui/nll/user-annotations/inherent-associated-constants.stderr @@ -3,7 +3,7 @@ error: lifetime may not live long enough | LL | fn non_wf_associated_const<'a>(x: i32) { | -- lifetime `'a` defined here -LL | A::<'a>::IC; //~ ERROR lifetime may not live long enough +LL | A::<'a>::IC; | ^^^^^^^^^^^ requires that `'a` must outlive `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/issue-54124.stderr b/src/test/ui/nll/user-annotations/issue-54124.stderr index b1c2411e46c0..6cfccf7cb69c 100644 --- a/src/test/ui/nll/user-annotations/issue-54124.stderr +++ b/src/test/ui/nll/user-annotations/issue-54124.stderr @@ -3,7 +3,7 @@ error: lifetime may not live long enough | LL | fn test<'a>() { | -- lifetime `'a` defined here -LL | let _:fn(&()) = |_:&'a ()| {}; //~ ERROR lifetime may not live long enough +LL | let _:fn(&()) = |_:&'a ()| {}; | ^ - let's call the lifetime of this reference `'1` | | | requires that `'1` must outlive `'a` @@ -13,7 +13,7 @@ error: lifetime may not live long enough | LL | fn test<'a>() { | -- lifetime `'a` defined here -LL | let _:fn(&()) = |_:&'a ()| {}; //~ ERROR lifetime may not live long enough +LL | let _:fn(&()) = |_:&'a ()| {}; | ^ requires that `'a` must outlive `'static` error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr b/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr index 76be637220a1..c99f53c5aa4c 100644 --- a/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr +++ b/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr @@ -4,7 +4,7 @@ error: lifetime may not live long enough LL | fn coupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { | -- lifetime `'a` defined here LL | let ((y, _z),) = ((s, _x),): (PairCoupledTypes<_>,); -LL | y //~ ERROR lifetime may not live long enough +LL | y | ^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -13,7 +13,7 @@ error: lifetime may not live long enough LL | fn coupled_regions_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { | -- lifetime `'a` defined here LL | let ((y, _z),) = ((s, _x),): (PairCoupledRegions<_>,); -LL | y //~ ERROR lifetime may not live long enough +LL | y | ^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -22,7 +22,7 @@ error: lifetime may not live long enough LL | fn cast_coupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { | -- lifetime `'a` defined here LL | let ((y, _z),) = ((s, _x),) as (PairCoupledTypes<_>,); -LL | y //~ ERROR lifetime may not live long enough +LL | y | ^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -31,7 +31,7 @@ error: lifetime may not live long enough LL | fn cast_coupled_regions_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { | -- lifetime `'a` defined here LL | let ((y, _z),) = ((s, _x),) as (PairCoupledRegions<_>,); -LL | y //~ ERROR lifetime may not live long enough +LL | y | ^ returning this value requires that `'a` must outlive `'static` error: aborting due to 4 previous errors diff --git a/src/test/ui/nll/user-annotations/method-call.stderr b/src/test/ui/nll/user-annotations/method-call.stderr index 2e23e6e2a650..7e5314614f34 100644 --- a/src/test/ui/nll/user-annotations/method-call.stderr +++ b/src/test/ui/nll/user-annotations/method-call.stderr @@ -1,7 +1,7 @@ error[E0597]: `c` does not live long enough --> $DIR/method-call.rs:38:34 | -LL | a.method::<&'static u32>(b, &c); //~ ERROR +LL | a.method::<&'static u32>(b, &c); | -----------------------------^^- | | | | | borrowed value does not live long enough @@ -15,7 +15,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here ... -LL | a.method::<&'a u32>(b, &c); //~ ERROR +LL | a.method::<&'a u32>(b, &c); | ------------------------^^- | | | | | borrowed value does not live long enough @@ -29,7 +29,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here ... -LL | a.method::<&'a u32>(b, &c); //~ ERROR +LL | a.method::<&'a u32>(b, &c); | ------------------------^^- | | | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/method-ufcs-1.stderr b/src/test/ui/nll/user-annotations/method-ufcs-1.stderr index 30cf01f54bd1..12b02ba33f72 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-1.stderr +++ b/src/test/ui/nll/user-annotations/method-ufcs-1.stderr @@ -1,7 +1,7 @@ error[E0597]: `a` does not live long enough --> $DIR/method-ufcs-1.rs:32:7 | -LL | x(&a, b, c); //~ ERROR +LL | x(&a, b, c); | --^^------- | | | | | borrowed value does not live long enough @@ -15,7 +15,7 @@ error[E0597]: `a` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here ... -LL | <&'a u32 as Bazoom<_>>::method(&a, b, c); //~ ERROR +LL | <&'a u32 as Bazoom<_>>::method(&a, b, c); | -------------------------------^^------- | | | | | borrowed value does not live long enough @@ -32,7 +32,7 @@ LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { LL | let _closure = || { | -- value captured here LL | let c = 66; -LL | <&'a u32 as Bazoom<_>>::method(&a, b, c); //~ ERROR +LL | <&'a u32 as Bazoom<_>>::method(&a, b, c); | --------------------------------^------- | | | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/method-ufcs-2.stderr b/src/test/ui/nll/user-annotations/method-ufcs-2.stderr index 140bb750469b..a55ed1aa272a 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-2.stderr +++ b/src/test/ui/nll/user-annotations/method-ufcs-2.stderr @@ -1,7 +1,7 @@ error[E0597]: `a` does not live long enough --> $DIR/method-ufcs-2.rs:32:7 | -LL | x(&a, b, c); //~ ERROR +LL | x(&a, b, c); | --^^------- | | | | | borrowed value does not live long enough @@ -15,7 +15,7 @@ error[E0597]: `b` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here ... -LL | <_ as Bazoom<&'a u32>>::method(a, &b, c); //~ ERROR +LL | <_ as Bazoom<&'a u32>>::method(a, &b, c); | ----------------------------------^^---- | | | | | borrowed value does not live long enough @@ -32,7 +32,7 @@ LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { LL | let _closure = || { | -- value captured here LL | let c = 66; -LL | <_ as Bazoom<&'a u32>>::method(a, &b, c); //~ ERROR +LL | <_ as Bazoom<&'a u32>>::method(a, &b, c); | -----------------------------------^---- | | | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/method-ufcs-3.stderr b/src/test/ui/nll/user-annotations/method-ufcs-3.stderr index 12b9685bdb87..140bda2df414 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-3.stderr +++ b/src/test/ui/nll/user-annotations/method-ufcs-3.stderr @@ -1,7 +1,7 @@ error[E0597]: `c` does not live long enough --> $DIR/method-ufcs-3.rs:38:53 | -LL | <_ as Bazoom<_>>::method::<&'static u32>(&a, b, &c); //~ ERROR +LL | <_ as Bazoom<_>>::method::<&'static u32>(&a, b, &c); | ------------------------------------------------^^- | | | | | borrowed value does not live long enough @@ -15,7 +15,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime<'a>(_d: &'a u32) { | -- lifetime `'a` defined here ... -LL | <_ as Bazoom<_>>::method::<&'a u32>(&a, b, &c); //~ ERROR +LL | <_ as Bazoom<_>>::method::<&'a u32>(&a, b, &c); | -------------------------------------------^^- | | | | | borrowed value does not live long enough @@ -29,7 +29,7 @@ error[E0597]: `c` does not live long enough LL | fn annot_reference_named_lifetime_in_closure<'a>(_: &'a u32) { | -- lifetime `'a` defined here ... -LL | <_ as Bazoom<_>>::method::<&'a u32>(&a, b, &c); //~ ERROR +LL | <_ as Bazoom<_>>::method::<&'a u32>(&a, b, &c); | -------------------------------------------^^- | | | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/method-ufcs-inherent-1.stderr b/src/test/ui/nll/user-annotations/method-ufcs-inherent-1.stderr index cb6cc6479646..70e1cda004b0 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-inherent-1.stderr +++ b/src/test/ui/nll/user-annotations/method-ufcs-inherent-1.stderr @@ -9,7 +9,7 @@ LL | let x = A::<'a>::new(&v, 22); | | | | | borrowed value does not live long enough | argument requires that `v` is borrowed for `'a` -LL | //~^ ERROR +LL | LL | } | - `v` dropped here while still borrowed diff --git a/src/test/ui/nll/user-annotations/method-ufcs-inherent-3.stderr b/src/test/ui/nll/user-annotations/method-ufcs-inherent-3.stderr index 2f83283ef912..50e4fb259918 100644 --- a/src/test/ui/nll/user-annotations/method-ufcs-inherent-3.stderr +++ b/src/test/ui/nll/user-annotations/method-ufcs-inherent-3.stderr @@ -9,7 +9,7 @@ LL | let x = >::new(&v, 22); | | | | | borrowed value does not live long enough | argument requires that `v` is borrowed for `'a` -LL | //~^ ERROR +LL | LL | } | - `v` dropped here while still borrowed diff --git a/src/test/ui/nll/user-annotations/normalization.stderr b/src/test/ui/nll/user-annotations/normalization.stderr index 71bf8507a735..fe93c3edba87 100644 --- a/src/test/ui/nll/user-annotations/normalization.stderr +++ b/src/test/ui/nll/user-annotations/normalization.stderr @@ -1,7 +1,7 @@ error[E0597]: `a` does not live long enough --> $DIR/normalization.rs:11:31 | -LL | let b: <() as Foo>::Out = &a; //~ ERROR +LL | let b: <() as Foo>::Out = &a; | ---------------- ^^ borrowed value does not live long enough | | | type annotation requires that `a` is borrowed for `'static` diff --git a/src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr b/src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr index 800c822058d0..b483f219c900 100644 --- a/src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr +++ b/src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.stderr @@ -3,7 +3,7 @@ error[E0597]: `y` does not live long enough | LL | let foo = Foo::Bar { field: &y }; | ^^ borrowed value does not live long enough -LL | //~^ ERROR `y` does not live long enough +LL | LL | let Foo::Bar::<'static> { field: _z } = foo; | --------------------------------- type annotation requires that `y` is borrowed for `'static` LL | } diff --git a/src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr b/src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr index 8adadfb8b679..9c888b0bffe5 100644 --- a/src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr +++ b/src/test/ui/nll/user-annotations/pattern_substs_on_brace_struct.stderr @@ -3,7 +3,7 @@ error[E0597]: `y` does not live long enough | LL | let foo = Foo { field: &y }; | ^^ borrowed value does not live long enough -LL | //~^ ERROR `y` does not live long enough +LL | LL | let Foo::<'static> { field: _z } = foo; | ---------------------------- type annotation requires that `y` is borrowed for `'static` LL | } diff --git a/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr b/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr index 0fd5fc3578d5..698cff51126f 100644 --- a/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr +++ b/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_enum_variant.stderr @@ -3,7 +3,7 @@ error[E0597]: `y` does not live long enough | LL | let foo = Foo::Bar(&y); | ^^ borrowed value does not live long enough -LL | //~^ ERROR `y` does not live long enough +LL | LL | let Foo::Bar::<'static>(_z) = foo; | ----------------------- type annotation requires that `y` is borrowed for `'static` LL | } diff --git a/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr b/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr index 3d114fa5d753..b5f2cb8e321a 100644 --- a/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr +++ b/src/test/ui/nll/user-annotations/pattern_substs_on_tuple_struct.stderr @@ -3,7 +3,7 @@ error[E0597]: `y` does not live long enough | LL | let foo = Foo(&y); | ^^ borrowed value does not live long enough -LL | //~^ ERROR `y` does not live long enough +LL | LL | let Foo::<'static>(_z) = foo; | ------------------ type annotation requires that `y` is borrowed for `'static` LL | } diff --git a/src/test/ui/nll/user-annotations/patterns.stderr b/src/test/ui/nll/user-annotations/patterns.stderr index 476578e074da..1ac62832315d 100644 --- a/src/test/ui/nll/user-annotations/patterns.stderr +++ b/src/test/ui/nll/user-annotations/patterns.stderr @@ -3,7 +3,7 @@ error[E0597]: `x` does not live long enough | LL | let y: &'static u32; | ------------ type annotation requires that `x` is borrowed for `'static` -LL | y = &x; //~ ERROR +LL | y = &x; | ^^ borrowed value does not live long enough LL | } | - `x` dropped here while still borrowed @@ -13,7 +13,7 @@ error[E0597]: `x` does not live long enough | LL | let (y, z): (&'static u32, &'static u32); | ---------------------------- type annotation requires that `x` is borrowed for `'static` -LL | y = &x; //~ ERROR +LL | y = &x; | ^^ borrowed value does not live long enough LL | } | - `x` dropped here while still borrowed @@ -21,7 +21,7 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:22:13 | -LL | let y = &x; //~ ERROR +LL | let y = &x; | ^^ borrowed value does not live long enough LL | let ref z: &'static u32 = y; | ------------ type annotation requires that `x` is borrowed for `'static` @@ -34,7 +34,7 @@ error[E0597]: `x` does not live long enough | LL | let Single { value: y }: Single<&'static u32>; | -------------------- type annotation requires that `x` is borrowed for `'static` -LL | y = &x; //~ ERROR +LL | y = &x; | ^^ borrowed value does not live long enough LL | } | - `x` dropped here while still borrowed @@ -44,7 +44,7 @@ error[E0597]: `x` does not live long enough | LL | let Single2 { value: mut _y }: Single2; | ------------------ type annotation requires that `x` is borrowed for `'static` -LL | _y = &x; //~ ERROR +LL | _y = &x; | ^^ borrowed value does not live long enough LL | } | - `x` dropped here while still borrowed @@ -52,7 +52,7 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:58:27 | -LL | let y: &'static u32 = &x; //~ ERROR +LL | let y: &'static u32 = &x; | ------------ ^^ borrowed value does not live long enough | | | type annotation requires that `x` is borrowed for `'static` @@ -62,7 +62,7 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:63:27 | -LL | let _: &'static u32 = &x; //~ ERROR +LL | let _: &'static u32 = &x; | ------------ ^^ borrowed value does not live long enough | | | type annotation requires that `x` is borrowed for `'static` @@ -100,7 +100,7 @@ LL | let (_a, b): (Vec<&'static String>, _) = (vec![&String::new()], 44); error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:77:40 | -LL | let (_, _): (&'static u32, u32) = (&x, 44); //~ ERROR +LL | let (_, _): (&'static u32, u32) = (&x, 44); | ------------------- ^^ borrowed value does not live long enough | | | type annotation requires that `x` is borrowed for `'static` @@ -110,7 +110,7 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:82:40 | -LL | let (y, _): (&'static u32, u32) = (&x, 44); //~ ERROR +LL | let (y, _): (&'static u32, u32) = (&x, 44); | ------------------- ^^ borrowed value does not live long enough | | | type annotation requires that `x` is borrowed for `'static` @@ -120,7 +120,7 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:87:69 | -LL | let Single { value: y }: Single<&'static u32> = Single { value: &x }; //~ ERROR +LL | let Single { value: y }: Single<&'static u32> = Single { value: &x }; | -------------------- ^^ borrowed value does not live long enough | | | type annotation requires that `x` is borrowed for `'static` @@ -130,7 +130,7 @@ LL | } error[E0597]: `x` does not live long enough --> $DIR/patterns.rs:92:69 | -LL | let Single { value: _ }: Single<&'static u32> = Single { value: &x }; //~ ERROR +LL | let Single { value: _ }: Single<&'static u32> = Single { value: &x }; | -------------------- ^^ borrowed value does not live long enough | | | type annotation requires that `x` is borrowed for `'static` @@ -142,7 +142,7 @@ error[E0597]: `x` does not live long enough | LL | let Double { value1: _, value2: _ }: Double<&'static u32> = Double { | -------------------- type annotation requires that `x` is borrowed for `'static` -LL | value1: &x, //~ ERROR +LL | value1: &x, | ^^ borrowed value does not live long enough ... LL | } @@ -154,7 +154,7 @@ error: lifetime may not live long enough LL | fn static_to_a_to_static_through_variable<'a>(x: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here ... -LL | y //~ ERROR +LL | y | ^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -163,7 +163,7 @@ error: lifetime may not live long enough LL | fn static_to_a_to_static_through_tuple<'a>(x: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here ... -LL | y //~ ERROR +LL | y | ^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -172,7 +172,7 @@ error: lifetime may not live long enough LL | fn static_to_a_to_static_through_struct<'a>(_x: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here LL | let Single { value: y }: Single<&'a u32> = Single { value: &22 }; -LL | y //~ ERROR +LL | y | ^ returning this value requires that `'a` must outlive `'static` error: lifetime may not live long enough @@ -180,7 +180,7 @@ error: lifetime may not live long enough | LL | fn a_to_static_then_static<'a>(x: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here -LL | let (y, _z): (&'static u32, u32) = (x, 44); //~ ERROR +LL | let (y, _z): (&'static u32, u32) = (x, 44); | ^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` error: aborting due to 19 previous errors diff --git a/src/test/ui/nll/user-annotations/promoted-annotation.rs b/src/test/ui/nll/user-annotations/promoted-annotation.rs new file mode 100644 index 000000000000..fa2d2fb81183 --- /dev/null +++ b/src/test/ui/nll/user-annotations/promoted-annotation.rs @@ -0,0 +1,12 @@ +// Test that type annotations are checked in promoted constants correctly. + +#![feature(nll)] + +fn foo<'a>() { + let x = 0; + let f = &drop::<&'a i32>; + f(&x); + //~^ ERROR `x` does not live long enough +} + +fn main() {} diff --git a/src/test/ui/nll/user-annotations/promoted-annotation.stderr b/src/test/ui/nll/user-annotations/promoted-annotation.stderr new file mode 100644 index 000000000000..d8b01f22145d --- /dev/null +++ b/src/test/ui/nll/user-annotations/promoted-annotation.stderr @@ -0,0 +1,17 @@ +error[E0597]: `x` does not live long enough + --> $DIR/promoted-annotation.rs:8:7 + | +LL | fn foo<'a>() { + | -- lifetime `'a` defined here +LL | let x = 0; +LL | let f = &drop::<&'a i32>; + | ---------------- assignment requires that `x` is borrowed for `'a` +LL | f(&x); + | ^^ borrowed value does not live long enough +LL | +LL | } + | - `x` dropped here while still borrowed + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr b/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr index a88ff6df3d79..93dbf7cb1b31 100644 --- a/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr +++ b/src/test/ui/nll/user-annotations/type_ascription_static_lifetime.stderr @@ -1,7 +1,7 @@ error[E0597]: `x` does not live long enough --> $DIR/type_ascription_static_lifetime.rs:7:19 | -LL | let y: &u32 = &x: &'static u32; //~ ERROR E0597 +LL | let y: &u32 = &x: &'static u32; | ^^-------------- | | | borrowed value does not live long enough diff --git a/src/test/ui/nll/user-annotations/wf-self-type.stderr b/src/test/ui/nll/user-annotations/wf-self-type.stderr index 00500c8d6541..8f8e1bc28f6f 100644 --- a/src/test/ui/nll/user-annotations/wf-self-type.stderr +++ b/src/test/ui/nll/user-annotations/wf-self-type.stderr @@ -5,7 +5,7 @@ LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () { | -- -- lifetime `'b` defined here | | | lifetime `'a` defined here -LL | Foo::xmute(u) //~ ERROR lifetime may not live long enough +LL | Foo::xmute(u) | ^^^^^^^^^^^^^ returning this value requires that `'b` must outlive `'a` error: aborting due to previous error diff --git a/src/test/ui/no-implicit-prelude-nested.stderr b/src/test/ui/no-implicit-prelude-nested.stderr index 7ef4bfbaf992..521ed8f2cf3b 100644 --- a/src/test/ui/no-implicit-prelude-nested.stderr +++ b/src/test/ui/no-implicit-prelude-nested.stderr @@ -1,7 +1,7 @@ error[E0405]: cannot find trait `Add` in this scope --> $DIR/no-implicit-prelude-nested.rs:11:14 | -LL | impl Add for Test {} //~ ERROR cannot find trait `Add` in this scope +LL | impl Add for Test {} | ^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -11,7 +11,7 @@ LL | use std::ops::Add; error[E0405]: cannot find trait `Clone` in this scope --> $DIR/no-implicit-prelude-nested.rs:12:14 | -LL | impl Clone for Test {} //~ ERROR cannot find trait `Clone` in this scope +LL | impl Clone for Test {} | ^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -23,7 +23,7 @@ LL | use std::prelude::v1::Clone; error[E0405]: cannot find trait `Iterator` in this scope --> $DIR/no-implicit-prelude-nested.rs:13:14 | -LL | impl Iterator for Test {} //~ ERROR cannot find trait `Iterator` in this scope +LL | impl Iterator for Test {} | ^^^^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -35,7 +35,7 @@ LL | use std::prelude::v1::Iterator; error[E0405]: cannot find trait `ToString` in this scope --> $DIR/no-implicit-prelude-nested.rs:14:14 | -LL | impl ToString for Test {} //~ ERROR cannot find trait `ToString` in this scope +LL | impl ToString for Test {} | ^^^^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -47,13 +47,13 @@ LL | use std::string::ToString; error[E0405]: cannot find trait `Writer` in this scope --> $DIR/no-implicit-prelude-nested.rs:15:14 | -LL | impl Writer for Test {} //~ ERROR cannot find trait `Writer` in this scope +LL | impl Writer for Test {} | ^^^^^^ not found in this scope error[E0425]: cannot find function `drop` in this scope --> $DIR/no-implicit-prelude-nested.rs:18:13 | -LL | drop(2) //~ ERROR cannot find function `drop` in this scope +LL | drop(2) | ^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -65,7 +65,7 @@ LL | use std::prelude::v1::drop; error[E0405]: cannot find trait `Add` in this scope --> $DIR/no-implicit-prelude-nested.rs:23:10 | -LL | impl Add for Test {} //~ ERROR cannot find trait `Add` in this scope +LL | impl Add for Test {} | ^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -75,7 +75,7 @@ LL | use std::ops::Add; error[E0405]: cannot find trait `Clone` in this scope --> $DIR/no-implicit-prelude-nested.rs:24:10 | -LL | impl Clone for Test {} //~ ERROR cannot find trait `Clone` in this scope +LL | impl Clone for Test {} | ^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -87,7 +87,7 @@ LL | use std::prelude::v1::Clone; error[E0405]: cannot find trait `Iterator` in this scope --> $DIR/no-implicit-prelude-nested.rs:25:10 | -LL | impl Iterator for Test {} //~ ERROR cannot find trait `Iterator` in this scope +LL | impl Iterator for Test {} | ^^^^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -99,7 +99,7 @@ LL | use std::prelude::v1::Iterator; error[E0405]: cannot find trait `ToString` in this scope --> $DIR/no-implicit-prelude-nested.rs:26:10 | -LL | impl ToString for Test {} //~ ERROR cannot find trait `ToString` in this scope +LL | impl ToString for Test {} | ^^^^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -111,13 +111,13 @@ LL | use std::string::ToString; error[E0405]: cannot find trait `Writer` in this scope --> $DIR/no-implicit-prelude-nested.rs:27:10 | -LL | impl Writer for Test {} //~ ERROR cannot find trait `Writer` in this scope +LL | impl Writer for Test {} | ^^^^^^ not found in this scope error[E0425]: cannot find function `drop` in this scope --> $DIR/no-implicit-prelude-nested.rs:30:9 | -LL | drop(2) //~ ERROR cannot find function `drop` in this scope +LL | drop(2) | ^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -129,7 +129,7 @@ LL | use std::prelude::v1::drop; error[E0405]: cannot find trait `Add` in this scope --> $DIR/no-implicit-prelude-nested.rs:38:14 | -LL | impl Add for Test {} //~ ERROR cannot find trait `Add` in this scope +LL | impl Add for Test {} | ^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -139,7 +139,7 @@ LL | use std::ops::Add; error[E0405]: cannot find trait `Clone` in this scope --> $DIR/no-implicit-prelude-nested.rs:39:14 | -LL | impl Clone for Test {} //~ ERROR cannot find trait `Clone` in this scope +LL | impl Clone for Test {} | ^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -151,7 +151,7 @@ LL | use std::prelude::v1::Clone; error[E0405]: cannot find trait `Iterator` in this scope --> $DIR/no-implicit-prelude-nested.rs:40:14 | -LL | impl Iterator for Test {} //~ ERROR cannot find trait `Iterator` in this scope +LL | impl Iterator for Test {} | ^^^^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -163,7 +163,7 @@ LL | use std::prelude::v1::Iterator; error[E0405]: cannot find trait `ToString` in this scope --> $DIR/no-implicit-prelude-nested.rs:41:14 | -LL | impl ToString for Test {} //~ ERROR cannot find trait `ToString` in this scope +LL | impl ToString for Test {} | ^^^^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -175,13 +175,13 @@ LL | use std::string::ToString; error[E0405]: cannot find trait `Writer` in this scope --> $DIR/no-implicit-prelude-nested.rs:42:14 | -LL | impl Writer for Test {} //~ ERROR cannot find trait `Writer` in this scope +LL | impl Writer for Test {} | ^^^^^^ not found in this scope error[E0425]: cannot find function `drop` in this scope --> $DIR/no-implicit-prelude-nested.rs:45:13 | -LL | drop(2) //~ ERROR cannot find function `drop` in this scope +LL | drop(2) | ^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | diff --git a/src/test/ui/no-implicit-prelude.stderr b/src/test/ui/no-implicit-prelude.stderr index fa82ac6cbe72..e5c54ddd1035 100644 --- a/src/test/ui/no-implicit-prelude.stderr +++ b/src/test/ui/no-implicit-prelude.stderr @@ -1,7 +1,7 @@ error[E0405]: cannot find trait `Add` in this scope --> $DIR/no-implicit-prelude.rs:10:6 | -LL | impl Add for Test {} //~ ERROR cannot find trait `Add` in this scope +LL | impl Add for Test {} | ^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -11,7 +11,7 @@ LL | use std::ops::Add; error[E0405]: cannot find trait `Clone` in this scope --> $DIR/no-implicit-prelude.rs:11:6 | -LL | impl Clone for Test {} //~ ERROR cannot find trait `Clone` in this scope +LL | impl Clone for Test {} | ^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -23,7 +23,7 @@ LL | use std::prelude::v1::Clone; error[E0405]: cannot find trait `Iterator` in this scope --> $DIR/no-implicit-prelude.rs:12:6 | -LL | impl Iterator for Test {} //~ ERROR cannot find trait `Iterator` in this scope +LL | impl Iterator for Test {} | ^^^^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -35,7 +35,7 @@ LL | use std::prelude::v1::Iterator; error[E0405]: cannot find trait `ToString` in this scope --> $DIR/no-implicit-prelude.rs:13:6 | -LL | impl ToString for Test {} //~ ERROR cannot find trait `ToString` in this scope +LL | impl ToString for Test {} | ^^^^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | @@ -47,13 +47,13 @@ LL | use std::string::ToString; error[E0405]: cannot find trait `Writer` in this scope --> $DIR/no-implicit-prelude.rs:14:6 | -LL | impl Writer for Test {} //~ ERROR cannot find trait `Writer` in this scope +LL | impl Writer for Test {} | ^^^^^^ not found in this scope error[E0425]: cannot find function `drop` in this scope --> $DIR/no-implicit-prelude.rs:17:5 | -LL | drop(2) //~ ERROR cannot find function `drop` in this scope +LL | drop(2) | ^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | diff --git a/src/test/ui/no-link-unknown-crate.stderr b/src/test/ui/no-link-unknown-crate.stderr index db76b74fdad0..068c7139ed9e 100644 --- a/src/test/ui/no-link-unknown-crate.stderr +++ b/src/test/ui/no-link-unknown-crate.stderr @@ -1,7 +1,7 @@ error[E0463]: can't find crate for `doesnt_exist` --> $DIR/no-link-unknown-crate.rs:2:1 | -LL | extern crate doesnt_exist; //~ ERROR can't find crate +LL | extern crate doesnt_exist; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate error: aborting due to previous error diff --git a/src/test/ui/no-link.stderr b/src/test/ui/no-link.stderr index 928ad4232024..c9c8468eba43 100644 --- a/src/test/ui/no-link.stderr +++ b/src/test/ui/no-link.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `XEmpty1` in module `empty_struct` --> $DIR/no-link.rs:7:19 | -LL | empty_struct::XEmpty1; //~ ERROR cannot find value `XEmpty1` in module `empty_struct` +LL | empty_struct::XEmpty1; | ^^^^^^^ not found in `empty_struct` error: aborting due to previous error diff --git a/src/test/ui/no-patterns-in-args-2.stderr b/src/test/ui/no-patterns-in-args-2.stderr index 161e7bb4b005..ec7d2d9f0d11 100644 --- a/src/test/ui/no-patterns-in-args-2.stderr +++ b/src/test/ui/no-patterns-in-args-2.stderr @@ -1,13 +1,13 @@ error[E0642]: patterns aren't allowed in methods without bodies --> $DIR/no-patterns-in-args-2.rs:6:11 | -LL | fn f2(&arg: u8); //~ ERROR patterns aren't allowed in methods without bodies +LL | fn f2(&arg: u8); | ^^^^ error: patterns aren't allowed in methods without bodies --> $DIR/no-patterns-in-args-2.rs:4:11 | -LL | fn f1(mut arg: u8); //~ ERROR patterns aren't allowed in methods without bodies +LL | fn f1(mut arg: u8); | ^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/no-patterns-in-args.stderr b/src/test/ui/no-patterns-in-args.stderr index 3fd476c4d720..0768c3f4de8b 100644 --- a/src/test/ui/no-patterns-in-args.stderr +++ b/src/test/ui/no-patterns-in-args.stderr @@ -1,31 +1,31 @@ error[E0130]: patterns aren't allowed in foreign function declarations --> $DIR/no-patterns-in-args.rs:2:11 | -LL | fn f1(mut arg: u8); //~ ERROR patterns aren't allowed in foreign function declarations +LL | fn f1(mut arg: u8); | ^^^^^^^ pattern not allowed in foreign function error[E0130]: patterns aren't allowed in foreign function declarations --> $DIR/no-patterns-in-args.rs:3:11 | -LL | fn f2(&arg: u8); //~ ERROR patterns aren't allowed in foreign function declarations +LL | fn f2(&arg: u8); | ^^^^ pattern not allowed in foreign function error[E0130]: patterns aren't allowed in foreign function declarations --> $DIR/no-patterns-in-args.rs:4:11 | -LL | fn f3(arg @ _: u8); //~ ERROR patterns aren't allowed in foreign function declarations +LL | fn f3(arg @ _: u8); | ^^^^^^^ pattern not allowed in foreign function error[E0561]: patterns aren't allowed in function pointer types --> $DIR/no-patterns-in-args.rs:10:14 | -LL | type A1 = fn(mut arg: u8); //~ ERROR patterns aren't allowed in function pointer types +LL | type A1 = fn(mut arg: u8); | ^^^^^^^ error[E0561]: patterns aren't allowed in function pointer types --> $DIR/no-patterns-in-args.rs:11:14 | -LL | type A2 = fn(&arg: u8); //~ ERROR patterns aren't allowed in function pointer types +LL | type A2 = fn(&arg: u8); | ^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/no-reuse-move-arc.nll.stderr b/src/test/ui/no-reuse-move-arc.nll.stderr index 0b14f65a7707..3f7169e6fcbb 100644 --- a/src/test/ui/no-reuse-move-arc.nll.stderr +++ b/src/test/ui/no-reuse-move-arc.nll.stderr @@ -9,7 +9,7 @@ LL | thread::spawn(move|| { LL | assert_eq!((*arc_v)[3], 4); | ----- variable moved due to use in closure ... -LL | assert_eq!((*arc_v)[2], 3); //~ ERROR use of moved value: `arc_v` +LL | assert_eq!((*arc_v)[2], 3); | ^^^^^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/no-reuse-move-arc.stderr b/src/test/ui/no-reuse-move-arc.stderr index d8ab314e7625..d71233147868 100644 --- a/src/test/ui/no-reuse-move-arc.stderr +++ b/src/test/ui/no-reuse-move-arc.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `arc_v` LL | thread::spawn(move|| { | ------ value moved (into closure) here ... -LL | assert_eq!((*arc_v)[2], 3); //~ ERROR use of moved value: `arc_v` +LL | assert_eq!((*arc_v)[2], 3); | ^^^^^ value used here after move | = note: move occurs because `arc_v` has type `std::sync::Arc>`, which does not implement the `Copy` trait @@ -15,7 +15,7 @@ error[E0382]: use of moved value: `arc_v` LL | thread::spawn(move|| { | ------ value moved (into closure) here ... -LL | println!("{:?}", *arc_v); //~ ERROR use of moved value: `arc_v` +LL | println!("{:?}", *arc_v); | ^^^^^ value used here after move | = note: move occurs because `arc_v` has type `std::sync::Arc>`, which does not implement the `Copy` trait diff --git a/src/test/ui/no-std-inject.stderr b/src/test/ui/no-std-inject.stderr index 0ccd567e7a95..975f5c2f50c5 100644 --- a/src/test/ui/no-std-inject.stderr +++ b/src/test/ui/no-std-inject.stderr @@ -1,13 +1,13 @@ error[E0259]: the name `core` is defined multiple times --> $DIR/no-std-inject.rs:4:1 | -LL | extern crate core; //~ ERROR: the name `core` is defined multiple times +LL | extern crate core; | ^^^^^^^^^^^^^^^^^^ `core` reimported here | = note: `core` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | extern crate core as other_core; //~ ERROR: the name `core` is defined multiple times +LL | extern crate core as other_core; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/no-type-for-node-ice.stderr b/src/test/ui/no-type-for-node-ice.stderr index cd1a7ee6fe53..b50241fb1a05 100644 --- a/src/test/ui/no-type-for-node-ice.stderr +++ b/src/test/ui/no-type-for-node-ice.stderr @@ -1,7 +1,7 @@ error[E0609]: no field `homura` on type `&'static str` --> $DIR/no-type-for-node-ice.rs:4:8 | -LL | "".homura[""]; //~ no field `homura` on type `&'static str` +LL | "".homura[""]; | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/no_crate_type.stderr b/src/test/ui/no_crate_type.stderr index 6b76ab68658c..ec79420d4dd4 100644 --- a/src/test/ui/no_crate_type.stderr +++ b/src/test/ui/no_crate_type.stderr @@ -1,7 +1,7 @@ error: attribute must be of the form `#[crate_type = "bin|lib|..."]` --> $DIR/no_crate_type.rs:2:1 | -LL | #![crate_type] //~ ERROR attribute must be of the form +LL | #![crate_type] | ^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/non-exhaustive/non-exhaustive-float-range-match.stderr b/src/test/ui/non-exhaustive/non-exhaustive-float-range-match.stderr index 2e285afb3804..6de615c3de4f 100644 --- a/src/test/ui/non-exhaustive/non-exhaustive-float-range-match.stderr +++ b/src/test/ui/non-exhaustive/non-exhaustive-float-range-match.stderr @@ -1,8 +1,10 @@ error[E0004]: non-exhaustive patterns: `_` not covered --> $DIR/non-exhaustive-float-range-match.rs:10:11 | -LL | match 0.0 { //~ ERROR non-exhaustive patterns +LL | match 0.0 { | ^^^ pattern `_` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/non-exhaustive/non-exhaustive-match-nested.stderr b/src/test/ui/non-exhaustive/non-exhaustive-match-nested.stderr index b2551c8dcf2a..67c818e19cbd 100644 --- a/src/test/ui/non-exhaustive/non-exhaustive-match-nested.stderr +++ b/src/test/ui/non-exhaustive/non-exhaustive-match-nested.stderr @@ -1,14 +1,24 @@ error[E0004]: non-exhaustive patterns: `(Some(&[]), Err(_))` not covered --> $DIR/non-exhaustive-match-nested.rs:7:11 | -LL | match (l1, l2) { //~ ERROR non-exhaustive patterns: `(Some(&[]), Err(_))` not covered +LL | match (l1, l2) { | ^^^^^^^^ pattern `(Some(&[]), Err(_))` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `A(C)` not covered --> $DIR/non-exhaustive-match-nested.rs:17:11 | -LL | match x { //~ ERROR non-exhaustive patterns: `A(C)` not covered +LL | enum T { A(U), B } + | ------------------ + | | | + | | not covered + | `T` defined here +... +LL | match x { | ^ pattern `A(C)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to 2 previous errors diff --git a/src/test/ui/non-exhaustive/non-exhaustive-match.stderr b/src/test/ui/non-exhaustive/non-exhaustive-match.stderr index 8d2a73b2c6dc..58e3309fd267 100644 --- a/src/test/ui/non-exhaustive/non-exhaustive-match.stderr +++ b/src/test/ui/non-exhaustive/non-exhaustive-match.stderr @@ -1,50 +1,78 @@ error[E0004]: non-exhaustive patterns: `A` not covered --> $DIR/non-exhaustive-match.rs:8:11 | -LL | match x { T::B => { } } //~ ERROR non-exhaustive patterns: `A` not covered +LL | enum T { A, B } + | --------------- + | | | + | | not covered + | `T` defined here +... +LL | match x { T::B => { } } | ^ pattern `A` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `false` not covered --> $DIR/non-exhaustive-match.rs:9:11 | -LL | match true { //~ ERROR non-exhaustive patterns: `false` not covered +LL | match true { | ^^^^ pattern `false` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `Some(_)` not covered --> $DIR/non-exhaustive-match.rs:12:11 | -LL | match Some(10) { //~ ERROR non-exhaustive patterns: `Some(_)` not covered +LL | match Some(10) { | ^^^^^^^^ pattern `Some(_)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `(_, _, -2147483648i32..=3i32)` and `(_, _, 5i32..=2147483647i32)` not covered --> $DIR/non-exhaustive-match.rs:15:11 | -LL | match (2, 3, 4) { //~ ERROR non-exhaustive patterns: `(_, _, -2147483648i32..=3i32)` +LL | match (2, 3, 4) { | ^^^^^^^^^ patterns `(_, _, -2147483648i32..=3i32)` and `(_, _, 5i32..=2147483647i32)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `(A, A)` not covered --> $DIR/non-exhaustive-match.rs:19:11 | -LL | match (T::A, T::A) { //~ ERROR non-exhaustive patterns: `(A, A)` not covered +LL | match (T::A, T::A) { | ^^^^^^^^^^^^ pattern `(A, A)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `B` not covered --> $DIR/non-exhaustive-match.rs:23:11 | -LL | match T::A { //~ ERROR non-exhaustive patterns: `B` not covered +LL | enum T { A, B } + | --------------- + | | | + | | not covered + | `T` defined here +... +LL | match T::A { | ^^^^ pattern `B` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `[]` not covered --> $DIR/non-exhaustive-match.rs:34:11 | -LL | match *vec { //~ ERROR non-exhaustive patterns: `[]` not covered +LL | match *vec { | ^^^^ pattern `[]` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `[_, _, _, _]` not covered --> $DIR/non-exhaustive-match.rs:47:11 | -LL | match *vec { //~ ERROR non-exhaustive patterns: `[_, _, _, _]` not covered +LL | match *vec { | ^^^^ pattern `[_, _, _, _]` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to 8 previous errors diff --git a/src/test/ui/non-exhaustive/non-exhaustive-pattern-witness.stderr b/src/test/ui/non-exhaustive/non-exhaustive-pattern-witness.stderr index d3a06e7b4b6f..a0b497dd4c0b 100644 --- a/src/test/ui/non-exhaustive/non-exhaustive-pattern-witness.stderr +++ b/src/test/ui/non-exhaustive/non-exhaustive-pattern-witness.stderr @@ -1,44 +1,94 @@ error[E0004]: non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered --> $DIR/non-exhaustive-pattern-witness.rs:9:11 | -LL | match (Foo { first: true, second: None }) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { first: false, second: Some([_, _, _, _]) }` not covered +LL | / struct Foo { +LL | | first: bool, +LL | | second: Option<[usize; 4]> +LL | | } + | |_- `Foo` defined here +... +LL | match (Foo { first: true, second: None }) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { first: false, second: Some([_, _, _, _]) }` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `Red` not covered --> $DIR/non-exhaustive-pattern-witness.rs:25:11 | -LL | match Color::Red { - | ^^^^^^^^^^ pattern `Red` not covered +LL | / enum Color { +LL | | Red, + | | --- not covered +LL | | Green, +LL | | CustomRGBA { a: bool, r: u8, g: u8, b: u8 } +LL | | } + | |_- `Color` defined here +... +LL | match Color::Red { + | ^^^^^^^^^^ pattern `Red` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `East`, `South` and `West` not covered --> $DIR/non-exhaustive-pattern-witness.rs:37:11 | -LL | match Direction::North { - | ^^^^^^^^^^^^^^^^ patterns `East`, `South` and `West` not covered +LL | / enum Direction { +LL | | North, East, South, West + | | ---- ----- ---- not covered + | | | | + | | | not covered + | | not covered +LL | | } + | |_- `Direction` defined here +... +LL | match Direction::North { + | ^^^^^^^^^^^^^^^^ patterns `East`, `South` and `West` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `Second`, `Third`, `Fourth` and 8 more not covered --> $DIR/non-exhaustive-pattern-witness.rs:48:11 | -LL | match ExcessiveEnum::First { - | ^^^^^^^^^^^^^^^^^^^^ patterns `Second`, `Third`, `Fourth` and 8 more not covered +LL | / enum ExcessiveEnum { +LL | | First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth, Eleventh, Twelfth +LL | | } + | |_- `ExcessiveEnum` defined here +... +LL | match ExcessiveEnum::First { + | ^^^^^^^^^^^^^^^^^^^^ patterns `Second`, `Third`, `Fourth` and 8 more not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `CustomRGBA { a: true, .. }` not covered --> $DIR/non-exhaustive-pattern-witness.rs:56:11 | -LL | match Color::Red { - | ^^^^^^^^^^ pattern `CustomRGBA { a: true, .. }` not covered +LL | / enum Color { +LL | | Red, +LL | | Green, +LL | | CustomRGBA { a: bool, r: u8, g: u8, b: u8 } + | | ---------- not covered +LL | | } + | |_- `Color` defined here +... +LL | match Color::Red { + | ^^^^^^^^^^ pattern `CustomRGBA { a: true, .. }` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `[Second(true), Second(false)]` not covered --> $DIR/non-exhaustive-pattern-witness.rs:72:11 | LL | match *x { | ^^ pattern `[Second(true), Second(false)]` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `((), false)` not covered --> $DIR/non-exhaustive-pattern-witness.rs:85:11 | LL | match ((), false) { | ^^^^^^^^^^^ pattern `((), false)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to 7 previous errors diff --git a/src/test/ui/noncopyable-class.stderr b/src/test/ui/noncopyable-class.stderr index 1876de873627..eb47a33a7292 100644 --- a/src/test/ui/noncopyable-class.stderr +++ b/src/test/ui/noncopyable-class.stderr @@ -4,7 +4,7 @@ error[E0599]: no method named `clone` found for type `Foo` in the current scope LL | struct Foo { | ---------- method `clone` not found for this ... -LL | let _y = x.clone(); //~ ERROR no method named `clone` found +LL | let _y = x.clone(); | ^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope diff --git a/src/test/ui/nonscalar-cast.stderr b/src/test/ui/nonscalar-cast.stderr index eb482b337e64..9338688b037f 100644 --- a/src/test/ui/nonscalar-cast.stderr +++ b/src/test/ui/nonscalar-cast.stderr @@ -1,7 +1,7 @@ error[E0605]: non-primitive cast: `Foo` as `isize` --> $DIR/nonscalar-cast.rs:7:20 | -LL | println!("{}", Foo { x: 1 } as isize); //~ non-primitive cast: `Foo` as `isize` [E0605] +LL | println!("{}", Foo { x: 1 } as isize); | ^^^^^^^^^^^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait diff --git a/src/test/ui/not-clone-closure.stderr b/src/test/ui/not-clone-closure.stderr index b583db1e4ba2..b66391b83b8d 100644 --- a/src/test/ui/not-clone-closure.stderr +++ b/src/test/ui/not-clone-closure.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `S: std::clone::Clone` is not satisfied in `[closure@$DIR/not-clone-closure.rs:7:17: 9:6 a:S]` --> $DIR/not-clone-closure.rs:11:23 | -LL | let hello = hello.clone(); //~ ERROR the trait bound `S: std::clone::Clone` is not satisfied +LL | let hello = hello.clone(); | ^^^^^ within `[closure@$DIR/not-clone-closure.rs:7:17: 9:6 a:S]`, the trait `std::clone::Clone` is not implemented for `S` | = note: required because it appears within the type `[closure@$DIR/not-clone-closure.rs:7:17: 9:6 a:S]` diff --git a/src/test/ui/not-copy-closure.nll.stderr b/src/test/ui/not-copy-closure.nll.stderr index 1a65bcf44731..10bf570727fa 100644 --- a/src/test/ui/not-copy-closure.nll.stderr +++ b/src/test/ui/not-copy-closure.nll.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `hello` | LL | let b = hello; | ----- value moved here -LL | let c = hello; //~ ERROR use of moved value: `hello` [E0382] +LL | let c = hello; | ^^^^^ value used here after move | note: closure cannot be moved more than once as it is not `Copy` due to moving the variable `a` out of its environment diff --git a/src/test/ui/not-copy-closure.stderr b/src/test/ui/not-copy-closure.stderr index bdae06d3a66c..41447537978b 100644 --- a/src/test/ui/not-copy-closure.stderr +++ b/src/test/ui/not-copy-closure.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `hello` | LL | let b = hello; | - value moved here -LL | let c = hello; //~ ERROR use of moved value: `hello` [E0382] +LL | let c = hello; | ^ value used here after move | note: closure cannot be invoked more than once because it moves the variable `a` out of its environment diff --git a/src/test/ui/not-panic/not-panic-safe-5.stderr b/src/test/ui/not-panic/not-panic-safe-5.stderr index 46400a4b03c1..a603acb2f1fe 100644 --- a/src/test/ui/not-panic/not-panic-safe-5.stderr +++ b/src/test/ui/not-panic/not-panic-safe-5.stderr @@ -1,7 +1,7 @@ error[E0277]: the type `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary --> $DIR/not-panic-safe-5.rs:9:5 | -LL | assert::<*const UnsafeCell>(); //~ ERROR E0277 +LL | assert::<*const UnsafeCell>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary | = help: the trait `std::panic::RefUnwindSafe` is not implemented for `std::cell::UnsafeCell` diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr index a7cb32ec7b8b..0077c95139f4 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr @@ -4,7 +4,7 @@ error[E0621]: explicit lifetime required in the type of `ss` LL | fn load(ss: &mut SomeStruct) -> Box { | --------------- help: add explicit lifetime `'static` to the type of `ss`: `&mut SomeStruct<'static>` ... -LL | ss.r //~ ERROR explicit lifetime required in the type of `ss` [E0621] +LL | ss.r | ^^^^ lifetime `'static` required error[E0621]: explicit lifetime required in the type of `ss` @@ -13,7 +13,7 @@ error[E0621]: explicit lifetime required in the type of `ss` LL | fn store1<'b>(ss: &mut SomeStruct, b: Box) { | --------------- help: add explicit lifetime `'b` to the type of `ss`: `&mut SomeStruct<'b>` ... -LL | ss.r = b; //~ ERROR explicit lifetime required in the type of `ss` [E0621] +LL | ss.r = b; | ^ lifetime `'b` required error: aborting due to 2 previous errors diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr index 165f6311ffdf..d7e3a171333e 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/object-lifetime-default-from-rptr-box-error.rs:15:12 | -LL | ss.t = t; //~ ERROR mismatched types +LL | ss.t = t; | ^ lifetime mismatch | = note: expected type `&'a std::boxed::Box<(dyn Test + 'static)>` diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr index 2f042c05f25b..4d082530dc52 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/object-lifetime-default-from-rptr-struct-error.rs:21:12 | -LL | ss.t = t; //~ ERROR mismatched types +LL | ss.t = t; | ^ lifetime mismatch | = note: expected type `&'a MyBox<(dyn Test + 'static)>` diff --git a/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr b/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr index 1a21096741cb..402448cde311 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr @@ -7,13 +7,13 @@ LL | b: &'b MyBox) LL | -> &'b MyBox | -------------------- LL | { -LL | a //~ ERROR lifetime mismatch +LL | a | ^ ...but data from `a` is returned here error[E0308]: mismatched types --> $DIR/object-lifetime-default-mybox.rs:31:11 | -LL | load0(ss) //~ ERROR mismatched types +LL | load0(ss) | ^^ lifetime mismatch | = note: expected type `&MyBox<(dyn SomeTrait + 'static)>` diff --git a/src/test/ui/object-lifetime/object-lifetime-default.stderr b/src/test/ui/object-lifetime/object-lifetime-default.stderr index 443d4ff6537e..2642cdff2bf6 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default.stderr @@ -1,43 +1,43 @@ error: 'a,Ambiguous --> $DIR/object-lifetime-default.rs:24:1 | -LL | struct G<'a,'b,T:'a,U:'a+'b>(&'a T, &'b U); //~ ERROR 'a,Ambiguous +LL | struct G<'a,'b,T:'a,U:'a+'b>(&'a T, &'b U); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: 'a,'b --> $DIR/object-lifetime-default.rs:21:1 | -LL | struct F<'a,'b,T:'a,U:'b>(&'a T, &'b U); //~ ERROR 'a,'b +LL | struct F<'a,'b,T:'a,U:'b>(&'a T, &'b U); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: 'b --> $DIR/object-lifetime-default.rs:18:1 | -LL | struct E<'a,'b:'a,T:'b>(&'a T, &'b T); //~ ERROR 'b +LL | struct E<'a,'b:'a,T:'b>(&'a T, &'b T); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: Ambiguous --> $DIR/object-lifetime-default.rs:15:1 | -LL | struct D<'a,'b,T:'a+'b>(&'a T, &'b T); //~ ERROR Ambiguous +LL | struct D<'a,'b,T:'a+'b>(&'a T, &'b T); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: 'a --> $DIR/object-lifetime-default.rs:12:1 | -LL | struct C<'a,T:'a>(&'a T); //~ ERROR 'a +LL | struct C<'a,T:'a>(&'a T); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: BaseDefault --> $DIR/object-lifetime-default.rs:9:1 | -LL | struct B<'a,T>(&'a (), T); //~ ERROR BaseDefault +LL | struct B<'a,T>(&'a (), T); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: BaseDefault --> $DIR/object-lifetime-default.rs:6:1 | -LL | struct A(T); //~ ERROR BaseDefault +LL | struct A(T); | ^^^^^^^^^^^^^^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/object-pointer-types.stderr b/src/test/ui/object-pointer-types.stderr index c5738edb6cf0..0c7e4e991a51 100644 --- a/src/test/ui/object-pointer-types.stderr +++ b/src/test/ui/object-pointer-types.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `owned` found for type `&dyn Foo` in the current scope --> $DIR/object-pointer-types.rs:11:7 | -LL | x.owned(); //~ ERROR no method named `owned` found +LL | x.owned(); | ^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -11,7 +11,7 @@ LL | x.owned(); //~ ERROR no method named `owned` found error[E0599]: no method named `owned` found for type `&mut dyn Foo` in the current scope --> $DIR/object-pointer-types.rs:17:7 | -LL | x.owned(); //~ ERROR no method named `owned` found +LL | x.owned(); | ^^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -21,7 +21,7 @@ LL | x.owned(); //~ ERROR no method named `owned` found error[E0599]: no method named `managed` found for type `std::boxed::Box<(dyn Foo + 'static)>` in the current scope --> $DIR/object-pointer-types.rs:23:7 | -LL | x.managed(); //~ ERROR no method named `managed` found +LL | x.managed(); | ^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/object-safety/object-safety-by-value-self-use.nll.stderr b/src/test/ui/object-safety/object-safety-by-value-self-use.nll.stderr index 0dd50b280267..1497aa42082d 100644 --- a/src/test/ui/object-safety/object-safety-by-value-self-use.nll.stderr +++ b/src/test/ui/object-safety/object-safety-by-value-self-use.nll.stderr @@ -1,7 +1,7 @@ error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be statically determined --> $DIR/object-safety-by-value-self-use.rs:15:5 | -LL | t.bar() //~ ERROR cannot move a value of type (dyn Bar + 'static) +LL | t.bar() | ^ error: aborting due to previous error diff --git a/src/test/ui/object-safety/object-safety-by-value-self-use.stderr b/src/test/ui/object-safety/object-safety-by-value-self-use.stderr index 0711981a5215..0ab881687e91 100644 --- a/src/test/ui/object-safety/object-safety-by-value-self-use.stderr +++ b/src/test/ui/object-safety/object-safety-by-value-self-use.stderr @@ -1,7 +1,7 @@ error[E0161]: cannot move a value of type (dyn Bar + 'static): the size of (dyn Bar + 'static) cannot be statically determined --> $DIR/object-safety-by-value-self-use.rs:15:5 | -LL | t.bar() //~ ERROR cannot move a value of type (dyn Bar + 'static) +LL | t.bar() | ^ error: aborting due to previous error diff --git a/src/test/ui/obsolete-syntax-impl-for-dotdot.stderr b/src/test/ui/obsolete-syntax-impl-for-dotdot.stderr index 793ed26ca688..b7108ced0d76 100644 --- a/src/test/ui/obsolete-syntax-impl-for-dotdot.stderr +++ b/src/test/ui/obsolete-syntax-impl-for-dotdot.stderr @@ -1,7 +1,7 @@ error: `impl Trait for .. {}` is an obsolete syntax --> $DIR/obsolete-syntax-impl-for-dotdot.rs:7:1 | -LL | impl Trait2 for .. {} //~ ERROR `impl Trait for .. {}` is an obsolete syntax +LL | impl Trait2 for .. {} | ^^^^^^^^^^^^^^^^^^^^^ | = help: use `auto trait Trait {}` instead diff --git a/src/test/ui/old-suffixes-are-really-forbidden.stderr b/src/test/ui/old-suffixes-are-really-forbidden.stderr index c54b72a3585d..9d1e8d071f06 100644 --- a/src/test/ui/old-suffixes-are-really-forbidden.stderr +++ b/src/test/ui/old-suffixes-are-really-forbidden.stderr @@ -1,7 +1,7 @@ error: invalid suffix `is` for numeric literal --> $DIR/old-suffixes-are-really-forbidden.rs:2:13 | -LL | let a = 1_is; //~ ERROR invalid suffix +LL | let a = 1_is; | ^^^^ invalid suffix `is` | = help: the suffix must be one of the integral types (`u32`, `isize`, etc) @@ -9,7 +9,7 @@ LL | let a = 1_is; //~ ERROR invalid suffix error: invalid suffix `us` for numeric literal --> $DIR/old-suffixes-are-really-forbidden.rs:3:13 | -LL | let b = 2_us; //~ ERROR invalid suffix +LL | let b = 2_us; | ^^^^ invalid suffix `us` | = help: the suffix must be one of the integral types (`u32`, `isize`, etc) diff --git a/src/test/ui/on-unimplemented/expected-comma-found-token.stderr b/src/test/ui/on-unimplemented/expected-comma-found-token.stderr index 1e0808e1d840..5bbdbe29416c 100644 --- a/src/test/ui/on-unimplemented/expected-comma-found-token.stderr +++ b/src/test/ui/on-unimplemented/expected-comma-found-token.stderr @@ -3,7 +3,7 @@ error: expected one of `)` or `,`, found `label` | LL | message="the message" | - expected one of `)` or `,` here -LL | label="the label" //~ ERROR expected one of `)` or `,`, found `label` +LL | label="the label" | ^^^^^ unexpected token error: aborting due to previous error diff --git a/src/test/ui/on-unimplemented/on-trait.stderr b/src/test/ui/on-unimplemented/on-trait.stderr index 939c2725cc47..ece8dee0afe9 100644 --- a/src/test/ui/on-unimplemented/on-trait.stderr +++ b/src/test/ui/on-unimplemented/on-trait.stderr @@ -14,7 +14,7 @@ LL | fn collect, B: MyFromIterator>(it: I) -> B { error[E0277]: the trait bound `std::string::String: Bar::Foo` is not satisfied --> $DIR/on-trait.rs:31:21 | -LL | let x: String = foobar(); //~ ERROR +LL | let x: String = foobar(); | ^^^^^^ test error `std::string::String` with `u8` `_` `u32` in `Bar::Foo` | = help: the trait `Bar::Foo` is not implemented for `std::string::String` diff --git a/src/test/ui/on-unimplemented/slice-index.stderr b/src/test/ui/on-unimplemented/slice-index.stderr index 7b45d848c97b..c1d884929a0c 100644 --- a/src/test/ui/on-unimplemented/slice-index.stderr +++ b/src/test/ui/on-unimplemented/slice-index.stderr @@ -1,7 +1,7 @@ error[E0277]: the type `[i32]` cannot be indexed by `i32` --> $DIR/slice-index.rs:11:5 | -LL | x[1i32]; //~ ERROR E0277 +LL | x[1i32]; | ^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[i32]>` is not implemented for `i32` @@ -10,7 +10,7 @@ LL | x[1i32]; //~ ERROR E0277 error[E0277]: the type `[i32]` cannot be indexed by `std::ops::RangeTo` --> $DIR/slice-index.rs:12:5 | -LL | x[..1i32]; //~ ERROR E0277 +LL | x[..1i32]; | ^^^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `std::slice::SliceIndex<[i32]>` is not implemented for `std::ops::RangeTo` diff --git a/src/test/ui/once-cant-call-twice-on-heap.nll.stderr b/src/test/ui/once-cant-call-twice-on-heap.nll.stderr index ea53abc1b0f2..f98d3d838453 100644 --- a/src/test/ui/once-cant-call-twice-on-heap.nll.stderr +++ b/src/test/ui/once-cant-call-twice-on-heap.nll.stderr @@ -7,7 +7,7 @@ LL | fn foo(blk: F) { | consider adding a `Copy` constraint to this type argument LL | blk(); | --- value moved here -LL | blk(); //~ ERROR use of moved value +LL | blk(); | ^^^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/once-cant-call-twice-on-heap.stderr b/src/test/ui/once-cant-call-twice-on-heap.stderr index 4559425e5be0..40034dae5bcd 100644 --- a/src/test/ui/once-cant-call-twice-on-heap.stderr +++ b/src/test/ui/once-cant-call-twice-on-heap.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `blk` | LL | blk(); | --- value moved here -LL | blk(); //~ ERROR use of moved value +LL | blk(); | ^^^ value used here after move | = note: move occurs because `blk` has type `F`, which does not implement the `Copy` trait diff --git a/src/test/ui/out-of-order-shadowing.stderr b/src/test/ui/out-of-order-shadowing.stderr index 17bda18f8f63..2a120dee482d 100644 --- a/src/test/ui/out-of-order-shadowing.stderr +++ b/src/test/ui/out-of-order-shadowing.stderr @@ -1,7 +1,7 @@ error[E0659]: `bar` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) --> $DIR/out-of-order-shadowing.rs:5:1 | -LL | bar!(); //~ ERROR `bar` is ambiguous +LL | bar!(); | ^^^ ambiguous name | note: `bar` could refer to the macro defined here diff --git a/src/test/ui/overlap-marker-trait.stderr b/src/test/ui/overlap-marker-trait.stderr index 21ba2367901c..a59af8dcdbcf 100644 --- a/src/test/ui/overlap-marker-trait.stderr +++ b/src/test/ui/overlap-marker-trait.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `NotDebugOrDisplay: Marker` is not satisfied --> $DIR/overlap-marker-trait.rs:30:5 | -LL | is_marker::(); //~ ERROR +LL | is_marker::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Marker` is not implemented for `NotDebugOrDisplay` | note: required by `is_marker` diff --git a/src/test/ui/overloaded-calls-nontuple.stderr b/src/test/ui/overloaded-calls-nontuple.stderr index 31b5697addaf..82c12c4b6e19 100644 --- a/src/test/ui/overloaded-calls-nontuple.stderr +++ b/src/test/ui/overloaded-calls-nontuple.stderr @@ -1,7 +1,7 @@ error[E0059]: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit --> $DIR/overloaded-calls-nontuple.rs:26:10 | -LL | drop(s(3)) //~ ERROR cannot use call notation +LL | drop(s(3)) | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-1.stderr b/src/test/ui/panic-handler/panic-handler-bad-signature-1.stderr index e36644895492..8b044f7669c7 100644 --- a/src/test/ui/panic-handler/panic-handler-bad-signature-1.stderr +++ b/src/test/ui/panic-handler/panic-handler-bad-signature-1.stderr @@ -1,13 +1,13 @@ error: return type should be `!` --> $DIR/panic-handler-bad-signature-1.rs:11:6 | -LL | ) -> () //~ ERROR return type should be `!` +LL | ) -> () | ^^ error: argument should be `&PanicInfo` --> $DIR/panic-handler-bad-signature-1.rs:10:11 | -LL | info: PanicInfo, //~ ERROR argument should be `&PanicInfo` +LL | info: PanicInfo, | ^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-2.stderr b/src/test/ui/panic-handler/panic-handler-bad-signature-2.stderr index 737ff313d0be..5ab6934202e9 100644 --- a/src/test/ui/panic-handler/panic-handler-bad-signature-2.stderr +++ b/src/test/ui/panic-handler/panic-handler-bad-signature-2.stderr @@ -1,7 +1,7 @@ error: argument should be `&PanicInfo` --> $DIR/panic-handler-bad-signature-2.rs:10:11 | -LL | info: &'static PanicInfo, //~ ERROR argument should be `&PanicInfo` +LL | info: &'static PanicInfo, | ^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-3.stderr b/src/test/ui/panic-handler/panic-handler-bad-signature-3.stderr index c0b39769a49b..0a70181fdace 100644 --- a/src/test/ui/panic-handler/panic-handler-bad-signature-3.stderr +++ b/src/test/ui/panic-handler/panic-handler-bad-signature-3.stderr @@ -1,7 +1,7 @@ error: function should have one argument --> $DIR/panic-handler-bad-signature-3.rs:9:1 | -LL | fn panic() -> ! { //~ ERROR function should have one argument +LL | fn panic() -> ! { | ^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-4.stderr b/src/test/ui/panic-handler/panic-handler-bad-signature-4.stderr index bd25c8b02f80..3a5fc76efbbd 100644 --- a/src/test/ui/panic-handler/panic-handler-bad-signature-4.stderr +++ b/src/test/ui/panic-handler/panic-handler-bad-signature-4.stderr @@ -2,7 +2,7 @@ error: should have no type parameters --> $DIR/panic-handler-bad-signature-4.rs:9:1 | LL | / fn panic(pi: &PanicInfo) -> ! { -LL | | //~^ ERROR should have no type parameters +LL | | LL | | loop {} LL | | } | |_^ diff --git a/src/test/ui/panic-handler/panic-handler-duplicate.stderr b/src/test/ui/panic-handler/panic-handler-duplicate.stderr index 80deff23a87d..e9b194536437 100644 --- a/src/test/ui/panic-handler/panic-handler-duplicate.stderr +++ b/src/test/ui/panic-handler/panic-handler-duplicate.stderr @@ -1,7 +1,7 @@ error[E0152]: duplicate lang item found: `panic_impl`. --> $DIR/panic-handler-duplicate.rs:15:1 | -LL | / fn panic2(info: &PanicInfo) -> ! { //~ ERROR duplicate lang item found: `panic_impl`. +LL | / fn panic2(info: &PanicInfo) -> ! { LL | | loop {} LL | | } | |_^ diff --git a/src/test/ui/panic-handler/panic-handler-wrong-location.stderr b/src/test/ui/panic-handler/panic-handler-wrong-location.stderr index cab45d8bfad6..ae3ed5ab12b4 100644 --- a/src/test/ui/panic-handler/panic-handler-wrong-location.stderr +++ b/src/test/ui/panic-handler/panic-handler-wrong-location.stderr @@ -1,7 +1,7 @@ error[E0718]: `panic_impl` language item must be applied to a function --> $DIR/panic-handler-wrong-location.rs:6:1 | -LL | #[panic_handler] //~ ERROR `panic_impl` language item must be applied to a function +LL | #[panic_handler] | ^^^^^^^^^^^^^^^^ attribute should be applied to a function, not a static item error: `#[panic_handler]` function required, but not found diff --git a/src/test/ui/panic-runtime/needs-gate.stderr b/src/test/ui/panic-runtime/needs-gate.stderr index 75ddda79b2d0..5b8ff82d1fd8 100644 --- a/src/test/ui/panic-runtime/needs-gate.stderr +++ b/src/test/ui/panic-runtime/needs-gate.stderr @@ -1,7 +1,7 @@ error[E0658]: the `#[panic_runtime]` attribute is an experimental feature (see issue #32837) --> $DIR/needs-gate.rs:4:1 | -LL | #![panic_runtime] //~ ERROR: is an experimental feature +LL | #![panic_runtime] | ^^^^^^^^^^^^^^^^^ | = help: add #![feature(panic_runtime)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #![panic_runtime] //~ ERROR: is an experimental feature error[E0658]: the `#[needs_panic_runtime]` attribute is an experimental feature (see issue #32837) --> $DIR/needs-gate.rs:5:1 | -LL | #![needs_panic_runtime] //~ ERROR: is an experimental feature +LL | #![needs_panic_runtime] | ^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(needs_panic_runtime)] to the crate attributes to enable diff --git a/src/test/ui/paren-span.stderr b/src/test/ui/paren-span.stderr index 23e6ade04695..141378752d6f 100644 --- a/src/test/ui/paren-span.stderr +++ b/src/test/ui/paren-span.stderr @@ -1,7 +1,7 @@ error[E0616]: field `x` of struct `m::S` is private --> $DIR/paren-span.rs:19:12 | -LL | paren!(s.x); //~ ERROR field `x` of struct `m::S` is private +LL | paren!(s.x); | ^^^ error: aborting due to previous error diff --git a/src/test/ui/parenthesized-deref-suggestion.stderr b/src/test/ui/parenthesized-deref-suggestion.stderr index fd9b0e8216b4..a16510055f54 100644 --- a/src/test/ui/parenthesized-deref-suggestion.stderr +++ b/src/test/ui/parenthesized-deref-suggestion.stderr @@ -1,17 +1,17 @@ error[E0609]: no field `opts` on type `*const Session` --> $DIR/parenthesized-deref-suggestion.rs:7:30 | -LL | (sess as *const Session).opts; //~ ERROR no field `opts` on type `*const Session` +LL | (sess as *const Session).opts; | ^^^^ help: `(sess as *const Session)` is a raw pointer; try dereferencing it | -LL | (*(sess as *const Session)).opts; //~ ERROR no field `opts` on type `*const Session` +LL | (*(sess as *const Session)).opts; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0609]: no field `0` on type `[u32; 1]` --> $DIR/parenthesized-deref-suggestion.rs:10:21 | -LL | (x as [u32; 1]).0; //~ ERROR no field `0` on type `[u32; 1]` +LL | (x as [u32; 1]).0; | ----------------^ | | | help: instead of using tuple indexing, use array indexing: `(x as [u32; 1])[0]` diff --git a/src/test/ui/parse-error-correct.stderr b/src/test/ui/parse-error-correct.stderr index 529a93cf3042..b0d2b2d0c0a1 100644 --- a/src/test/ui/parse-error-correct.stderr +++ b/src/test/ui/parse-error-correct.stderr @@ -1,13 +1,13 @@ error: unexpected token: `;` --> $DIR/parse-error-correct.rs:8:15 | -LL | let x = y.; //~ ERROR unexpected token +LL | let x = y.; | ^ error: unexpected token: `(` --> $DIR/parse-error-correct.rs:9:15 | -LL | let x = y.(); //~ ERROR unexpected token +LL | let x = y.(); | ^ error[E0618]: expected function, found `{integer}` @@ -15,8 +15,8 @@ error[E0618]: expected function, found `{integer}` | LL | let y = 42; | - `{integer}` defined here -LL | let x = y.; //~ ERROR unexpected token -LL | let x = y.(); //~ ERROR unexpected token +LL | let x = y.; +LL | let x = y.(); | ^--- | | | call expression requires function @@ -24,7 +24,7 @@ LL | let x = y.(); //~ ERROR unexpected token error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/parse-error-correct.rs:11:15 | -LL | let x = y.foo; //~ ERROR `{integer}` is a primitive type and therefore doesn't have fields [E061 +LL | let x = y.foo; | ^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/parser-recovery-1.stderr b/src/test/ui/parser-recovery-1.stderr index 28505a8a0565..cd02710c40b7 100644 --- a/src/test/ui/parser-recovery-1.stderr +++ b/src/test/ui/parser-recovery-1.stderr @@ -9,7 +9,7 @@ LL | fn bar() { LL | } | - ...as it matches this but it has different indentation ... -LL | } //~ ERROR this file contains an un-closed delimiter +LL | } | ^ error: unexpected token: `;` diff --git a/src/test/ui/parser-recovery-2.stderr b/src/test/ui/parser-recovery-2.stderr index 76f7af38e776..c246fa80b0a0 100644 --- a/src/test/ui/parser-recovery-2.stderr +++ b/src/test/ui/parser-recovery-2.stderr @@ -1,7 +1,7 @@ error: unexpected token: `;` --> $DIR/parser-recovery-2.rs:12:15 | -LL | let x = y.; //~ ERROR unexpected token +LL | let x = y.; | ^ error: incorrect close delimiter: `)` @@ -9,20 +9,20 @@ error: incorrect close delimiter: `)` | LL | fn bar() { | - un-closed delimiter -LL | let x = foo(); //~ ERROR cannot find function `foo` in this scope -LL | ) //~ ERROR incorrect close delimiter: `)` +LL | let x = foo(); +LL | ) | ^ incorrect close delimiter error[E0425]: cannot find function `foo` in this scope --> $DIR/parser-recovery-2.rs:7:17 | -LL | let x = foo(); //~ ERROR cannot find function `foo` in this scope +LL | let x = foo(); | ^^^ not found in this scope error[E0425]: cannot find value `y` in this scope --> $DIR/parser-recovery-2.rs:12:13 | -LL | let x = y.; //~ ERROR unexpected token +LL | let x = y.; | ^ not found in this scope error: aborting due to 4 previous errors diff --git a/src/test/ui/parser/ascii-only-character-escape.stderr b/src/test/ui/parser/ascii-only-character-escape.stderr index d3330a405c06..7524c4eccd98 100644 --- a/src/test/ui/parser/ascii-only-character-escape.stderr +++ b/src/test/ui/parser/ascii-only-character-escape.stderr @@ -1,19 +1,19 @@ error: this form of character escape may only be used with characters in the range [/x00-/x7f] --> $DIR/ascii-only-character-escape.rs:4:16 | -LL | let x = "/x80"; //~ ERROR may only be used +LL | let x = "/x80"; | ^^ error: this form of character escape may only be used with characters in the range [/x00-/x7f] --> $DIR/ascii-only-character-escape.rs:5:16 | -LL | let y = "/xff"; //~ ERROR may only be used +LL | let y = "/xff"; | ^^ error: this form of character escape may only be used with characters in the range [/x00-/x7f] --> $DIR/ascii-only-character-escape.rs:6:16 | -LL | let z = "/xe2"; //~ ERROR may only be used +LL | let z = "/xe2"; | ^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/parser/assoc-oddities-1.stderr b/src/test/ui/parser/assoc-oddities-1.stderr index 076bca0fc3a2..376ddf4d68b7 100644 --- a/src/test/ui/parser/assoc-oddities-1.stderr +++ b/src/test/ui/parser/assoc-oddities-1.stderr @@ -1,7 +1,7 @@ error: expected one of `.`, `;`, `?`, or `}`, found `[` --> $DIR/assoc-oddities-1.rs:10:28 | -LL | ..if c { a } else { b }[n]; //~ ERROR expected one of +LL | ..if c { a } else { b }[n]; | ^ expected one of `.`, `;`, `?`, or `}` here error: aborting due to previous error diff --git a/src/test/ui/parser/assoc-oddities-2.stderr b/src/test/ui/parser/assoc-oddities-2.stderr index 568102912521..4b3893d2c17d 100644 --- a/src/test/ui/parser/assoc-oddities-2.stderr +++ b/src/test/ui/parser/assoc-oddities-2.stderr @@ -1,7 +1,7 @@ error: expected one of `.`, `;`, `?`, or `}`, found `[` --> $DIR/assoc-oddities-2.rs:5:29 | -LL | x..if c { a } else { b }[n]; //~ ERROR expected one of +LL | x..if c { a } else { b }[n]; | ^ expected one of `.`, `;`, `?`, or `}` here error: aborting due to previous error diff --git a/src/test/ui/parser/attr-bad-meta-2.stderr b/src/test/ui/parser/attr-bad-meta-2.stderr index ddc7a4b034b7..ffbfc583e8a7 100644 --- a/src/test/ui/parser/attr-bad-meta-2.stderr +++ b/src/test/ui/parser/attr-bad-meta-2.stderr @@ -1,8 +1,8 @@ error: unexpected token: `]` - --> $DIR/attr-bad-meta-2.rs:1:9 + --> $DIR/attr-bad-meta-2.rs:1:8 | -LL | #[path =] //~ ERROR unexpected token: `]` - | ^ unexpected token after this +LL | #[path =] + | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/attr-bad-meta-3.stderr b/src/test/ui/parser/attr-bad-meta-3.stderr index 863a2d2069fc..4fa420c79fcc 100644 --- a/src/test/ui/parser/attr-bad-meta-3.stderr +++ b/src/test/ui/parser/attr-bad-meta-3.stderr @@ -1,7 +1,7 @@ error: expected `]`, found `token` --> $DIR/attr-bad-meta-3.rs:1:10 | -LL | #[path() token] //~ ERROR expected `]`, found `token` +LL | #[path() token] | ^^^^^ expected `]` error: aborting due to previous error diff --git a/src/test/ui/parser/attr-bad-meta.rs b/src/test/ui/parser/attr-bad-meta.rs index 7fe542724914..8001977f5a39 100644 --- a/src/test/ui/parser/attr-bad-meta.rs +++ b/src/test/ui/parser/attr-bad-meta.rs @@ -1,4 +1,2 @@ -#![feature(unrestricted_attribute_tokens)] - #[path*] //~ ERROR expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found `*` mod m {} diff --git a/src/test/ui/parser/attr-bad-meta.stderr b/src/test/ui/parser/attr-bad-meta.stderr index 7351702ec9dc..a452df5e90cb 100644 --- a/src/test/ui/parser/attr-bad-meta.stderr +++ b/src/test/ui/parser/attr-bad-meta.stderr @@ -1,7 +1,7 @@ error: expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found `*` - --> $DIR/attr-bad-meta.rs:3:7 + --> $DIR/attr-bad-meta.rs:1:7 | -LL | #[path*] //~ ERROR expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found `*` +LL | #[path*] | ^ expected one of `(`, `::`, `=`, `[`, `]`, or `{` here error: aborting due to previous error diff --git a/src/test/ui/parser/attr-before-eof.stderr b/src/test/ui/parser/attr-before-eof.stderr index a81dc52417a4..eb5daf849811 100644 --- a/src/test/ui/parser/attr-before-eof.stderr +++ b/src/test/ui/parser/attr-before-eof.stderr @@ -1,7 +1,7 @@ error: expected item after attributes --> $DIR/attr-before-eof.rs:3:16 | -LL | #[derive(Debug)] //~ERROR expected item after attributes +LL | #[derive(Debug)] | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/attr.stderr b/src/test/ui/parser/attr.stderr index 8151bd7cdd7b..5111b40603c4 100644 --- a/src/test/ui/parser/attr.stderr +++ b/src/test/ui/parser/attr.stderr @@ -1,7 +1,7 @@ error: an inner attribute is not permitted in this context --> $DIR/attr.rs:5:3 | -LL | #![lang = "foo"] //~ ERROR an inner attribute is not permitted in this context +LL | #![lang = "foo"] | ^ | = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. @@ -9,7 +9,7 @@ LL | #![lang = "foo"] //~ ERROR an inner attribute is not permitted in this cont error[E0522]: definition of an unknown language item: `foo` --> $DIR/attr.rs:5:1 | -LL | #![lang = "foo"] //~ ERROR an inner attribute is not permitted in this context +LL | #![lang = "foo"] | ^^^^^^^^^^^^^^^^ definition of unknown language item `foo` error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/attrs-after-extern-mod.stderr b/src/test/ui/parser/attrs-after-extern-mod.stderr index 067c4192ce6a..cecdab4d6319 100644 --- a/src/test/ui/parser/attrs-after-extern-mod.stderr +++ b/src/test/ui/parser/attrs-after-extern-mod.stderr @@ -1,7 +1,7 @@ error: expected item after attributes --> $DIR/attrs-after-extern-mod.rs:10:19 | -LL | #[cfg(stage37)] //~ ERROR expected item after attributes +LL | #[cfg(stage37)] | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/bad-char-literals.stderr b/src/test/ui/parser/bad-char-literals.stderr index 0335a4b83eab..eb048b08c71b 100644 --- a/src/test/ui/parser/bad-char-literals.stderr +++ b/src/test/ui/parser/bad-char-literals.stderr @@ -15,7 +15,7 @@ LL | | '; error: character constant must be escaped: /r --> $DIR/bad-char-literals.rs:16:6 | -LL | ' '; //~ ERROR: character constant must be escaped: /r +LL | ' '; | ^ error: character constant must be escaped: /t diff --git a/src/test/ui/parser/bad-lit-suffixes.stderr b/src/test/ui/parser/bad-lit-suffixes.stderr index 608c5fda2482..3d4d7b4a78b4 100644 --- a/src/test/ui/parser/bad-lit-suffixes.stderr +++ b/src/test/ui/parser/bad-lit-suffixes.stderr @@ -1,55 +1,55 @@ error: ABI spec with a suffix is invalid --> $DIR/bad-lit-suffixes.rs:5:5 | -LL | "C"suffix //~ ERROR ABI spec with a suffix is invalid +LL | "C"suffix | ^^^^^^^^^ ABI spec with a suffix is invalid error: ABI spec with a suffix is invalid --> $DIR/bad-lit-suffixes.rs:9:5 | -LL | "C"suffix //~ ERROR ABI spec with a suffix is invalid +LL | "C"suffix | ^^^^^^^^^ ABI spec with a suffix is invalid error: string literal with a suffix is invalid --> $DIR/bad-lit-suffixes.rs:13:5 | -LL | ""suffix; //~ ERROR string literal with a suffix is invalid +LL | ""suffix; | ^^^^^^^^ string literal with a suffix is invalid error: byte string literal with a suffix is invalid --> $DIR/bad-lit-suffixes.rs:14:5 | -LL | b""suffix; //~ ERROR byte string literal with a suffix is invalid +LL | b""suffix; | ^^^^^^^^^ byte string literal with a suffix is invalid error: string literal with a suffix is invalid --> $DIR/bad-lit-suffixes.rs:15:5 | -LL | r#""#suffix; //~ ERROR string literal with a suffix is invalid +LL | r#""#suffix; | ^^^^^^^^^^^ string literal with a suffix is invalid error: byte string literal with a suffix is invalid --> $DIR/bad-lit-suffixes.rs:16:5 | -LL | br#""#suffix; //~ ERROR byte string literal with a suffix is invalid +LL | br#""#suffix; | ^^^^^^^^^^^^ byte string literal with a suffix is invalid error: char literal with a suffix is invalid --> $DIR/bad-lit-suffixes.rs:17:5 | -LL | 'a'suffix; //~ ERROR char literal with a suffix is invalid +LL | 'a'suffix; | ^^^^^^^^^ char literal with a suffix is invalid error: byte literal with a suffix is invalid --> $DIR/bad-lit-suffixes.rs:18:5 | -LL | b'a'suffix; //~ ERROR byte literal with a suffix is invalid +LL | b'a'suffix; | ^^^^^^^^^^ byte literal with a suffix is invalid error: invalid width `1024` for integer literal --> $DIR/bad-lit-suffixes.rs:20:5 | -LL | 1234u1024; //~ ERROR invalid width `1024` for integer literal +LL | 1234u1024; | ^^^^^^^^^ | = help: valid widths are 8, 16, 32, 64 and 128 @@ -57,7 +57,7 @@ LL | 1234u1024; //~ ERROR invalid width `1024` for integer literal error: invalid width `1024` for integer literal --> $DIR/bad-lit-suffixes.rs:21:5 | -LL | 1234i1024; //~ ERROR invalid width `1024` for integer literal +LL | 1234i1024; | ^^^^^^^^^ | = help: valid widths are 8, 16, 32, 64 and 128 @@ -65,7 +65,7 @@ LL | 1234i1024; //~ ERROR invalid width `1024` for integer literal error: invalid width `1024` for float literal --> $DIR/bad-lit-suffixes.rs:22:5 | -LL | 1234f1024; //~ ERROR invalid width `1024` for float literal +LL | 1234f1024; | ^^^^^^^^^ | = help: valid widths are 32 and 64 @@ -73,7 +73,7 @@ LL | 1234f1024; //~ ERROR invalid width `1024` for float literal error: invalid width `1024` for float literal --> $DIR/bad-lit-suffixes.rs:23:5 | -LL | 1234.5f1024; //~ ERROR invalid width `1024` for float literal +LL | 1234.5f1024; | ^^^^^^^^^^^ | = help: valid widths are 32 and 64 @@ -81,7 +81,7 @@ LL | 1234.5f1024; //~ ERROR invalid width `1024` for float literal error: invalid suffix `suffix` for numeric literal --> $DIR/bad-lit-suffixes.rs:25:5 | -LL | 1234suffix; //~ ERROR invalid suffix `suffix` for numeric literal +LL | 1234suffix; | ^^^^^^^^^^ invalid suffix `suffix` | = help: the suffix must be one of the integral types (`u32`, `isize`, etc) @@ -89,7 +89,7 @@ LL | 1234suffix; //~ ERROR invalid suffix `suffix` for numeric literal error: invalid suffix `suffix` for numeric literal --> $DIR/bad-lit-suffixes.rs:26:5 | -LL | 0b101suffix; //~ ERROR invalid suffix `suffix` for numeric literal +LL | 0b101suffix; | ^^^^^^^^^^^ invalid suffix `suffix` | = help: the suffix must be one of the integral types (`u32`, `isize`, etc) @@ -97,7 +97,7 @@ LL | 0b101suffix; //~ ERROR invalid suffix `suffix` for numeric literal error: invalid suffix `suffix` for float literal --> $DIR/bad-lit-suffixes.rs:27:5 | -LL | 1.0suffix; //~ ERROR invalid suffix `suffix` for float literal +LL | 1.0suffix; | ^^^^^^^^^ invalid suffix `suffix` | = help: valid suffixes are `f32` and `f64` @@ -105,7 +105,7 @@ LL | 1.0suffix; //~ ERROR invalid suffix `suffix` for float literal error: invalid suffix `suffix` for float literal --> $DIR/bad-lit-suffixes.rs:28:5 | -LL | 1.0e10suffix; //~ ERROR invalid suffix `suffix` for float literal +LL | 1.0e10suffix; | ^^^^^^^^^^^^ invalid suffix `suffix` | = help: valid suffixes are `f32` and `f64` diff --git a/src/test/ui/parser/bad-match.stderr b/src/test/ui/parser/bad-match.stderr index dd3a2d2a27a0..2f29b978e9c9 100644 --- a/src/test/ui/parser/bad-match.stderr +++ b/src/test/ui/parser/bad-match.stderr @@ -1,7 +1,7 @@ error: expected one of `:`, `;`, `=`, or `@`, found `x` --> $DIR/bad-match.rs:2:13 | -LL | let isize x = 5; //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `x` +LL | let isize x = 5; | ^ expected one of `:`, `;`, `=`, or `@` here error: aborting due to previous error diff --git a/src/test/ui/parser/bad-value-ident-false.stderr b/src/test/ui/parser/bad-value-ident-false.stderr index 69a496f3a0c3..9ddca101567f 100644 --- a/src/test/ui/parser/bad-value-ident-false.stderr +++ b/src/test/ui/parser/bad-value-ident-false.stderr @@ -1,11 +1,11 @@ error: expected identifier, found keyword `false` --> $DIR/bad-value-ident-false.rs:1:4 | -LL | fn false() { } //~ ERROR expected identifier, found keyword `false` +LL | fn false() { } | ^^^^^ expected identifier, found keyword help: you can escape reserved keywords to use them as identifiers | -LL | fn r#false() { } //~ ERROR expected identifier, found keyword `false` +LL | fn r#false() { } | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/parser/bad-value-ident-true.stderr b/src/test/ui/parser/bad-value-ident-true.stderr index 2606b7450aef..ec497dbe4073 100644 --- a/src/test/ui/parser/bad-value-ident-true.stderr +++ b/src/test/ui/parser/bad-value-ident-true.stderr @@ -1,11 +1,11 @@ error: expected identifier, found keyword `true` --> $DIR/bad-value-ident-true.rs:1:4 | -LL | fn true() { } //~ ERROR expected identifier, found keyword `true` +LL | fn true() { } | ^^^^ expected identifier, found keyword help: you can escape reserved keywords to use them as identifiers | -LL | fn r#true() { } //~ ERROR expected identifier, found keyword `true` +LL | fn r#true() { } | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/parser/better-expected.stderr b/src/test/ui/parser/better-expected.stderr index 3495353c6f90..d100d01e78ff 100644 --- a/src/test/ui/parser/better-expected.stderr +++ b/src/test/ui/parser/better-expected.stderr @@ -1,7 +1,7 @@ error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `3` --> $DIR/better-expected.rs:2:19 | -LL | let x: [isize 3]; //~ ERROR expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `3` +LL | let x: [isize 3]; | - ^ expected one of 7 possible tokens here | | | while parsing the type for `x` diff --git a/src/test/ui/parser/bind-struct-early-modifiers.stderr b/src/test/ui/parser/bind-struct-early-modifiers.stderr index 618e577e4e22..50c95b8cf402 100644 --- a/src/test/ui/parser/bind-struct-early-modifiers.stderr +++ b/src/test/ui/parser/bind-struct-early-modifiers.stderr @@ -1,13 +1,13 @@ error: expected `,` --> $DIR/bind-struct-early-modifiers.rs:4:19 | -LL | Foo { ref x: ref x } => {}, //~ ERROR expected `,` +LL | Foo { ref x: ref x } => {}, | ^ error[E0027]: pattern does not mention field `x` --> $DIR/bind-struct-early-modifiers.rs:4:9 | -LL | Foo { ref x: ref x } => {}, //~ ERROR expected `,` +LL | Foo { ref x: ref x } => {}, | ^^^^^^^^^^^^^^^^^^^^ missing field `x` error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/bound-single-question-mark.stderr b/src/test/ui/parser/bound-single-question-mark.stderr index e30b32f41b41..82937a517b5e 100644 --- a/src/test/ui/parser/bound-single-question-mark.stderr +++ b/src/test/ui/parser/bound-single-question-mark.stderr @@ -1,7 +1,7 @@ error: expected identifier, found `>` --> $DIR/bound-single-question-mark.rs:1:10 | -LL | fn f() {} //~ ERROR expected identifier, found `>` +LL | fn f() {} | ^ expected identifier error: aborting due to previous error diff --git a/src/test/ui/parser/bounds-lifetime-1.stderr b/src/test/ui/parser/bounds-lifetime-1.stderr index 33bba35f692d..17d65314d962 100644 --- a/src/test/ui/parser/bounds-lifetime-1.stderr +++ b/src/test/ui/parser/bounds-lifetime-1.stderr @@ -1,7 +1,7 @@ error: expected one of `,`, `:`, or `>`, found `'b` --> $DIR/bounds-lifetime-1.rs:1:17 | -LL | type A = for<'a 'b> fn(); //~ ERROR expected one of `,`, `:`, or `>`, found `'b` +LL | type A = for<'a 'b> fn(); | ^^ expected one of `,`, `:`, or `>` here error: aborting due to previous error diff --git a/src/test/ui/parser/bounds-lifetime-2.stderr b/src/test/ui/parser/bounds-lifetime-2.stderr index a8a22aaafce3..587e527f0a85 100644 --- a/src/test/ui/parser/bounds-lifetime-2.stderr +++ b/src/test/ui/parser/bounds-lifetime-2.stderr @@ -1,7 +1,7 @@ error: expected one of `,`, `:`, or `>`, found `+` --> $DIR/bounds-lifetime-2.rs:1:17 | -LL | type A = for<'a + 'b> fn(); //~ ERROR expected one of `,`, `:`, or `>`, found `+` +LL | type A = for<'a + 'b> fn(); | ^ expected one of `,`, `:`, or `>` here error: aborting due to previous error diff --git a/src/test/ui/parser/bounds-lifetime-where-1.stderr b/src/test/ui/parser/bounds-lifetime-where-1.stderr index 0300fe989101..b6bd866938be 100644 --- a/src/test/ui/parser/bounds-lifetime-where-1.stderr +++ b/src/test/ui/parser/bounds-lifetime-where-1.stderr @@ -1,7 +1,7 @@ error: expected `:`, found `;` --> $DIR/bounds-lifetime-where-1.rs:1:16 | -LL | type A where 'a; //~ ERROR expected `:`, found `;` +LL | type A where 'a; | ^ expected `:` error: aborting due to previous error diff --git a/src/test/ui/parser/bounds-lifetime-where.stderr b/src/test/ui/parser/bounds-lifetime-where.stderr index 6a8d7e9d4a16..9507a4598581 100644 --- a/src/test/ui/parser/bounds-lifetime-where.stderr +++ b/src/test/ui/parser/bounds-lifetime-where.stderr @@ -1,7 +1,7 @@ error: expected one of `=`, lifetime, or type, found `,` --> $DIR/bounds-lifetime-where.rs:8:14 | -LL | type A where , = u8; //~ ERROR expected one of `=`, lifetime, or type, found `,` +LL | type A where , = u8; | ^ expected one of `=`, lifetime, or type here error: aborting due to previous error diff --git a/src/test/ui/parser/bounds-lifetime.stderr b/src/test/ui/parser/bounds-lifetime.stderr index 191ea3ebd070..facbd2800709 100644 --- a/src/test/ui/parser/bounds-lifetime.stderr +++ b/src/test/ui/parser/bounds-lifetime.stderr @@ -1,7 +1,7 @@ error: expected one of `>`, `const`, identifier, or lifetime, found `,` --> $DIR/bounds-lifetime.rs:9:14 | -LL | type A = for<,> fn(); //~ ERROR expected one of `>`, `const`, identifier, or lifetime, found `,` +LL | type A = for<,> fn(); | ^ expected one of `>`, `const`, identifier, or lifetime here error: aborting due to previous error diff --git a/src/test/ui/parser/bounds-type.stderr b/src/test/ui/parser/bounds-type.stderr index 046e0ce8c7ab..0b714e40a101 100644 --- a/src/test/ui/parser/bounds-type.stderr +++ b/src/test/ui/parser/bounds-type.stderr @@ -1,7 +1,7 @@ error: `?` may only modify trait bounds, not lifetime bounds --> $DIR/bounds-type.rs:10:8 | -LL | T: ?'a, //~ ERROR `?` may only modify trait bounds, not lifetime bounds +LL | T: ?'a, | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/byte-literals.stderr b/src/test/ui/parser/byte-literals.stderr index ab14eeede663..36cb0170a140 100644 --- a/src/test/ui/parser/byte-literals.stderr +++ b/src/test/ui/parser/byte-literals.stderr @@ -1,43 +1,43 @@ error: unknown byte escape: f --> $DIR/byte-literals.rs:6:21 | -LL | static FOO: u8 = b'/f'; //~ ERROR unknown byte escape +LL | static FOO: u8 = b'/f'; | ^ error: unknown byte escape: f --> $DIR/byte-literals.rs:9:8 | -LL | b'/f'; //~ ERROR unknown byte escape +LL | b'/f'; | ^ error: invalid character in numeric character escape: Z --> $DIR/byte-literals.rs:10:10 | -LL | b'/x0Z'; //~ ERROR invalid character in numeric character escape: Z +LL | b'/x0Z'; | ^ error: byte constant must be escaped: /t --> $DIR/byte-literals.rs:11:7 | -LL | b' '; //~ ERROR byte constant must be escaped +LL | b' '; | ^^^^ error: byte constant must be escaped: ' --> $DIR/byte-literals.rs:12:7 | -LL | b'''; //~ ERROR byte constant must be escaped +LL | b'''; | ^ error: byte constant must be ASCII. Use a /xHH escape for a non-ASCII byte --> $DIR/byte-literals.rs:13:7 | -LL | b'Γ©'; //~ ERROR byte constant must be ASCII +LL | b'Γ©'; | ^ error: unterminated byte constant: b'a --> $DIR/byte-literals.rs:14:5 | -LL | b'a //~ ERROR unterminated byte constant +LL | b'a | ^^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/parser/byte-string-literals.stderr b/src/test/ui/parser/byte-string-literals.stderr index 669f5585cb24..2e9b13b933e2 100644 --- a/src/test/ui/parser/byte-string-literals.stderr +++ b/src/test/ui/parser/byte-string-literals.stderr @@ -1,31 +1,31 @@ error: unknown byte escape: f --> $DIR/byte-string-literals.rs:6:32 | -LL | static FOO: &'static [u8] = b"/f"; //~ ERROR unknown byte escape +LL | static FOO: &'static [u8] = b"/f"; | ^ error: unknown byte escape: f --> $DIR/byte-string-literals.rs:9:8 | -LL | b"/f"; //~ ERROR unknown byte escape +LL | b"/f"; | ^ error: invalid character in numeric character escape: Z --> $DIR/byte-string-literals.rs:10:10 | -LL | b"/x0Z"; //~ ERROR invalid character in numeric character escape: Z +LL | b"/x0Z"; | ^ error: byte constant must be ASCII. Use a /xHH escape for a non-ASCII byte --> $DIR/byte-string-literals.rs:11:7 | -LL | b"Γ©"; //~ ERROR byte constant must be ASCII +LL | b"Γ©"; | ^ error: unterminated double quote byte string --> $DIR/byte-string-literals.rs:12:7 | -LL | b"a //~ ERROR unterminated double quote byte string +LL | b"a | _______^ LL | | } | |__^ diff --git a/src/test/ui/parser/circular_modules_main.stderr b/src/test/ui/parser/circular_modules_main.stderr index 7751a8c0f38a..33865fb7bca9 100644 --- a/src/test/ui/parser/circular_modules_main.stderr +++ b/src/test/ui/parser/circular_modules_main.stderr @@ -1,7 +1,7 @@ error: circular modules: $DIR/circular_modules_hello.rs -> $DIR/circular_modules_main.rs -> $DIR/circular_modules_hello.rs --> $DIR/circular_modules_main.rs:2:5 | -LL | mod circular_modules_hello; //~ ERROR: circular modules +LL | mod circular_modules_hello; | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/parser/column-offset-1-based.stderr b/src/test/ui/parser/column-offset-1-based.stderr index b12b47b67ce1..5cbf3d3e9596 100644 --- a/src/test/ui/parser/column-offset-1-based.stderr +++ b/src/test/ui/parser/column-offset-1-based.stderr @@ -1,7 +1,7 @@ error: expected `[`, found `` --> $DIR/column-offset-1-based.rs:1:1 | -LL | # //~ ERROR expected `[`, found `` +LL | # | ^ expected `[` error: aborting due to previous error diff --git a/src/test/ui/parser/default.stderr b/src/test/ui/parser/default.stderr index 27193672903a..c43fffd58af2 100644 --- a/src/test/ui/parser/default.stderr +++ b/src/test/ui/parser/default.stderr @@ -1,13 +1,13 @@ error: expected one of `async`, `const`, `existential`, `extern`, `fn`, `type`, or `unsafe`, found `pub` --> $DIR/default.rs:22:13 | -LL | default pub fn foo() -> T { T::default() } //~ ERROR expected one of +LL | default pub fn foo() -> T { T::default() } | ^^^ expected one of 7 possible tokens here error[E0449]: unnecessary visibility qualifier --> $DIR/default.rs:16:5 | -LL | pub default fn foo() -> T { //~ ERROR unnecessary visibility qualifier +LL | pub default fn foo() -> T { | ^^^ `pub` not permitted here because it's implied error[E0046]: not all trait items implemented, missing: `foo` @@ -16,7 +16,7 @@ error[E0046]: not all trait items implemented, missing: `foo` LL | fn foo() -> T; | -------------------------- `foo` from trait ... -LL | impl Foo for u32 { //~ ERROR not all trait items implemented, missing: `foo` +LL | impl Foo for u32 { | ^^^^^^^^^^^^^^^^ missing `foo` in implementation error: aborting due to 3 previous errors diff --git a/src/test/ui/parser/doc-before-attr.stderr b/src/test/ui/parser/doc-before-attr.stderr index 0cd6aa81ec5f..0fae44ce5c80 100644 --- a/src/test/ui/parser/doc-before-attr.stderr +++ b/src/test/ui/parser/doc-before-attr.stderr @@ -1,7 +1,7 @@ error: expected item after attributes --> $DIR/doc-before-attr.rs:4:16 | -LL | #[derive(Debug)] //~ERROR expected item after attributes +LL | #[derive(Debug)] | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/doc-before-eof.stderr b/src/test/ui/parser/doc-before-eof.stderr index 5809d64e8067..82756626765b 100644 --- a/src/test/ui/parser/doc-before-eof.stderr +++ b/src/test/ui/parser/doc-before-eof.stderr @@ -1,7 +1,7 @@ error: expected item after doc comment --> $DIR/doc-before-eof.rs:3:1 | -LL | /// hi //~ERROR expected item after doc comment +LL | /// hi | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this doc comment doesn't document anything error: aborting due to previous error diff --git a/src/test/ui/parser/empty-impl-semicolon.stderr b/src/test/ui/parser/empty-impl-semicolon.stderr index 965a8a45aede..46f2393cd832 100644 --- a/src/test/ui/parser/empty-impl-semicolon.stderr +++ b/src/test/ui/parser/empty-impl-semicolon.stderr @@ -1,7 +1,7 @@ error: expected one of `!`, `(`, `+`, `::`, `<`, `for`, `where`, or `{`, found `;` --> $DIR/empty-impl-semicolon.rs:1:9 | -LL | impl Foo; //~ ERROR expected one of `!`, `(`, `+`, `::`, `<`, `for`, `where`, or `{`, found `;` +LL | impl Foo; | ^ expected one of 8 possible tokens here error: aborting due to previous error diff --git a/src/test/ui/parser/extern-crate-unexpected-token.stderr b/src/test/ui/parser/extern-crate-unexpected-token.stderr index ed888eb1a8ea..04edd46936a6 100644 --- a/src/test/ui/parser/extern-crate-unexpected-token.stderr +++ b/src/test/ui/parser/extern-crate-unexpected-token.stderr @@ -1,7 +1,7 @@ error: expected one of `crate`, `fn`, or `{`, found `crte` --> $DIR/extern-crate-unexpected-token.rs:1:8 | -LL | extern crte foo; //~ ERROR expected one of `crate`, `fn`, or `{`, found `crte` +LL | extern crte foo; | ^^^^ expected one of `crate`, `fn`, or `{` here error: aborting due to previous error diff --git a/src/test/ui/parser/extern-expected-fn-or-brace.stderr b/src/test/ui/parser/extern-expected-fn-or-brace.stderr index 94b2d1d7b7e8..0fb993553417 100644 --- a/src/test/ui/parser/extern-expected-fn-or-brace.stderr +++ b/src/test/ui/parser/extern-expected-fn-or-brace.stderr @@ -1,7 +1,7 @@ error: expected one of `fn` or `{`, found `mod` --> $DIR/extern-expected-fn-or-brace.rs:4:12 | -LL | extern "C" mod foo; //~ERROR expected one of `fn` or `{`, found `mod` +LL | extern "C" mod foo; | ^^^ expected one of `fn` or `{` here error: aborting due to previous error diff --git a/src/test/ui/parser/extern-foreign-crate.stderr b/src/test/ui/parser/extern-foreign-crate.stderr index d2fe8b77ce66..de9f0c932327 100644 --- a/src/test/ui/parser/extern-foreign-crate.stderr +++ b/src/test/ui/parser/extern-foreign-crate.stderr @@ -1,7 +1,7 @@ error: expected one of `;` or `as`, found `{` --> $DIR/extern-foreign-crate.rs:4:18 | -LL | extern crate foo {} //~ERROR expected one of `;` or `as`, found `{` +LL | extern crate foo {} | ^ expected one of `;` or `as` here error: aborting due to previous error diff --git a/src/test/ui/parser/extern-no-fn.stderr b/src/test/ui/parser/extern-no-fn.stderr index e764cd084019..d2d5e3c46874 100644 --- a/src/test/ui/parser/extern-no-fn.stderr +++ b/src/test/ui/parser/extern-no-fn.stderr @@ -1,7 +1,7 @@ error: missing `fn`, `type`, or `static` for extern-item declaration --> $DIR/extern-no-fn.rs:1:9 | -LL | extern { //~ ERROR missing `fn`, `type`, or `static` for extern-item declaration +LL | extern { | _________^ LL | | f(); | |____^ missing `fn`, `type`, or `static` diff --git a/src/test/ui/parser/if-in-in.stderr b/src/test/ui/parser/if-in-in.stderr index 2938bba77d71..9926fcc0858e 100644 --- a/src/test/ui/parser/if-in-in.stderr +++ b/src/test/ui/parser/if-in-in.stderr @@ -1,7 +1,7 @@ error: expected iterable, found keyword `in` --> $DIR/if-in-in.rs:2:14 | -LL | for i in in 1..2 { //~ ERROR expected iterable, found keyword `in` +LL | for i in in 1..2 { | ---^^ | | | help: remove the duplicated `in` diff --git a/src/test/ui/parser/impl-parsing.stderr b/src/test/ui/parser/impl-parsing.stderr index 353f5e21ee64..935e93963e1e 100644 --- a/src/test/ui/parser/impl-parsing.stderr +++ b/src/test/ui/parser/impl-parsing.stderr @@ -1,31 +1,31 @@ error: missing `for` in a trait impl --> $DIR/impl-parsing.rs:6:11 | -LL | impl Trait Type {} //~ ERROR missing `for` in a trait impl +LL | impl Trait Type {} | ^ help: add `for` here error: missing `for` in a trait impl --> $DIR/impl-parsing.rs:7:11 | -LL | impl Trait .. {} //~ ERROR missing `for` in a trait impl +LL | impl Trait .. {} | ^ help: add `for` here error: expected a trait, found type --> $DIR/impl-parsing.rs:8:6 | -LL | impl ?Sized for Type {} //~ ERROR expected a trait, found type +LL | impl ?Sized for Type {} | ^^^^^^ error: expected a trait, found type --> $DIR/impl-parsing.rs:9:6 | -LL | impl ?Sized for .. {} //~ ERROR expected a trait, found type +LL | impl ?Sized for .. {} | ^^^^^^ error: expected `impl`, found `FAIL` --> $DIR/impl-parsing.rs:11:16 | -LL | default unsafe FAIL //~ ERROR expected `impl`, found `FAIL` +LL | default unsafe FAIL | ^^^^ expected `impl` here error: aborting due to 5 previous errors diff --git a/src/test/ui/parser/inner-attr.stderr b/src/test/ui/parser/inner-attr.stderr index 001eab226dc2..11a37bc139b3 100644 --- a/src/test/ui/parser/inner-attr.stderr +++ b/src/test/ui/parser/inner-attr.stderr @@ -1,7 +1,7 @@ error: an inner attribute is not permitted following an outer attribute --> $DIR/inner-attr.rs:3:3 | -LL | #![recursion_limit="100"] //~ ERROR an inner attribute is not permitted following an outer attribute +LL | #![recursion_limit="100"] | ^ | = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them. diff --git a/src/test/ui/parser/issue-10392-2.stderr b/src/test/ui/parser/issue-10392-2.stderr index 47e1f7adf25e..ccc5dd938b5f 100644 --- a/src/test/ui/parser/issue-10392-2.stderr +++ b/src/test/ui/parser/issue-10392-2.stderr @@ -1,7 +1,7 @@ error: expected `}`, found `,` --> $DIR/issue-10392-2.rs:6:15 | -LL | let A { .., } = a(); //~ ERROR: expected `}` +LL | let A { .., } = a(); | --^ | | | | | expected `}` diff --git a/src/test/ui/parser/issue-10392.stderr b/src/test/ui/parser/issue-10392.stderr index 9c9858aa26cb..7bf5aa93f0a5 100644 --- a/src/test/ui/parser/issue-10392.stderr +++ b/src/test/ui/parser/issue-10392.stderr @@ -1,13 +1,13 @@ error: expected identifier, found `,` --> $DIR/issue-10392.rs:6:13 | -LL | let A { , } = a(); //~ ERROR expected ident +LL | let A { , } = a(); | ^ expected identifier error[E0027]: pattern does not mention field `foo` --> $DIR/issue-10392.rs:6:9 | -LL | let A { , } = a(); //~ ERROR expected ident +LL | let A { , } = a(); | ^^^^^^^ missing field `foo` error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/issue-15914.stderr b/src/test/ui/parser/issue-15914.stderr index 3a886c4c481f..ea26453f8089 100644 --- a/src/test/ui/parser/issue-15914.stderr +++ b/src/test/ui/parser/issue-15914.stderr @@ -1,7 +1,7 @@ error: expected identifier, found `(` --> $DIR/issue-15914.rs:3:9 | -LL | (); //~ ERROR expected identifier, found `(` +LL | (); | ^ expected identifier error: aborting due to previous error diff --git a/src/test/ui/parser/issue-15980.stderr b/src/test/ui/parser/issue-15980.stderr index c91595208c86..879bcb2b4a1f 100644 --- a/src/test/ui/parser/issue-15980.stderr +++ b/src/test/ui/parser/issue-15980.stderr @@ -3,7 +3,7 @@ error: expected identifier, found keyword `return` | LL | Err(ref e) if e.kind == io::EndOfFile { | ------------- while parsing this struct -LL | //~^ NOTE while parsing this struct +LL | LL | return | ^^^^^^ expected identifier, found keyword help: you can escape reserved keywords to use them as identifiers @@ -16,7 +16,7 @@ error: expected one of `.`, `=>`, `?`, or an operator, found `_` | LL | } | - expected one of `.`, `=>`, `?`, or an operator here -LL | //~^ NOTE expected one of `.`, `=>`, `?`, or an operator here +LL | LL | _ => {} | ^ unexpected token diff --git a/src/test/ui/parser/issue-17718-const-mut.stderr b/src/test/ui/parser/issue-17718-const-mut.stderr index 19f9fe19ef5a..8251ce9993fa 100644 --- a/src/test/ui/parser/issue-17718-const-mut.stderr +++ b/src/test/ui/parser/issue-17718-const-mut.stderr @@ -3,7 +3,7 @@ error: const globals cannot be mutable | LL | const | ----- help: you might want to declare a static instead: `static` -LL | mut //~ ERROR: const globals cannot be mutable +LL | mut | ^^^ cannot be mutable error: aborting due to previous error diff --git a/src/test/ui/parser/issue-17904-2.stderr b/src/test/ui/parser/issue-17904-2.stderr index 8322dc00cade..03e556da268f 100644 --- a/src/test/ui/parser/issue-17904-2.stderr +++ b/src/test/ui/parser/issue-17904-2.stderr @@ -1,7 +1,7 @@ error: expected item, found keyword `where` --> $DIR/issue-17904-2.rs:3:24 | -LL | struct Bar { x: T } where T: Copy //~ ERROR expected item, found keyword `where` +LL | struct Bar { x: T } where T: Copy | ^^^^^ expected item error: aborting due to previous error diff --git a/src/test/ui/parser/issue-17904.stderr b/src/test/ui/parser/issue-17904.stderr index f2f0b411e9ad..a44700936200 100644 --- a/src/test/ui/parser/issue-17904.stderr +++ b/src/test/ui/parser/issue-17904.stderr @@ -1,7 +1,7 @@ error: expected one of `:`, `==`, or `=`, found `;` --> $DIR/issue-17904.rs:6:33 | -LL | struct Foo where T: Copy, (T); //~ ERROR expected one of `:`, `==`, or `=`, found `;` +LL | struct Foo where T: Copy, (T); | ^ expected one of `:`, `==`, or `=` here error: aborting due to previous error diff --git a/src/test/ui/parser/issue-19096.stderr b/src/test/ui/parser/issue-19096.stderr index f92604d0067c..6aa97add7b0f 100644 --- a/src/test/ui/parser/issue-19096.stderr +++ b/src/test/ui/parser/issue-19096.stderr @@ -1,7 +1,7 @@ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `::` --> $DIR/issue-19096.rs:3:8 | -LL | t.0::; //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `::` +LL | t.0::; | ^^ expected one of `.`, `;`, `?`, `}`, or an operator here error[E0308]: mismatched types @@ -10,7 +10,7 @@ error[E0308]: mismatched types LL | fn main() { | - expected `()` because of default return type LL | let t = (42, 42); -LL | t.0::; //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `::` +LL | t.0::; | ^^^ expected (), found integer | = note: expected type `()` diff --git a/src/test/ui/parser/issue-19398.stderr b/src/test/ui/parser/issue-19398.stderr index 627b74ff8f7b..d5f1f972d553 100644 --- a/src/test/ui/parser/issue-19398.stderr +++ b/src/test/ui/parser/issue-19398.stderr @@ -1,7 +1,7 @@ error: expected `fn`, found `unsafe` --> $DIR/issue-19398.rs:2:19 | -LL | extern "Rust" unsafe fn foo(); //~ ERROR expected `fn`, found `unsafe` +LL | extern "Rust" unsafe fn foo(); | ^^^^^^ expected `fn` here error: aborting due to previous error diff --git a/src/test/ui/parser/issue-20711-2.stderr b/src/test/ui/parser/issue-20711-2.stderr index e06eb7a9846e..f67dfa09aca8 100644 --- a/src/test/ui/parser/issue-20711-2.stderr +++ b/src/test/ui/parser/issue-20711-2.stderr @@ -3,7 +3,7 @@ error: expected one of `async`, `const`, `crate`, `default`, `existential`, `ext | LL | #[stable(feature = "rust1", since = "1.0.0")] | - expected one of 10 possible tokens here -LL | } //~ ERROR expected one of `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`, `pub`, `type`, or +LL | } | ^ unexpected token error: aborting due to previous error diff --git a/src/test/ui/parser/issue-20711.stderr b/src/test/ui/parser/issue-20711.stderr index 6cf39608fcc9..26b819fa2984 100644 --- a/src/test/ui/parser/issue-20711.stderr +++ b/src/test/ui/parser/issue-20711.stderr @@ -3,7 +3,7 @@ error: expected one of `async`, `const`, `crate`, `default`, `existential`, `ext | LL | #[stable(feature = "rust1", since = "1.0.0")] | - expected one of 10 possible tokens here -LL | } //~ ERROR expected one of `async`, `const`, `crate`, `default`, `existential`, `extern`, `fn`, `pub`, `type`, or +LL | } | ^ unexpected token error: aborting due to previous error diff --git a/src/test/ui/parser/issue-21153.stderr b/src/test/ui/parser/issue-21153.stderr index 1e0244c2e1d3..70f55f0aeb9f 100644 --- a/src/test/ui/parser/issue-21153.stderr +++ b/src/test/ui/parser/issue-21153.stderr @@ -1,7 +1,7 @@ error: missing `fn`, `type`, or `const` for trait-item declaration --> $DIR/issue-21153.rs:1:29 | -LL | trait MyTrait: Iterator { //~ ERROR missing `fn`, `type`, or `const` +LL | trait MyTrait: Iterator { | _____________________________^ LL | | Item = T; | |____^ missing `fn`, `type`, or `const` diff --git a/src/test/ui/parser/issue-22647.stderr b/src/test/ui/parser/issue-22647.stderr index 8935ea9c6c12..2dc56a5eca3a 100644 --- a/src/test/ui/parser/issue-22647.stderr +++ b/src/test/ui/parser/issue-22647.stderr @@ -1,7 +1,7 @@ error: expected one of `:`, `;`, `=`, or `@`, found `<` --> $DIR/issue-22647.rs:2:15 | -LL | let caller = |f: F| //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `<` +LL | let caller = |f: F| | ^ expected one of `:`, `;`, `=`, or `@` here error: aborting due to previous error diff --git a/src/test/ui/parser/issue-22712.stderr b/src/test/ui/parser/issue-22712.stderr index 3a4fa9a5e7ba..167eaf962e0f 100644 --- a/src/test/ui/parser/issue-22712.stderr +++ b/src/test/ui/parser/issue-22712.stderr @@ -1,7 +1,7 @@ error: expected one of `:`, `;`, `=`, or `@`, found `<` --> $DIR/issue-22712.rs:6:12 | -LL | let Foo> //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `<` +LL | let Foo> | ^ expected one of `:`, `;`, `=`, or `@` here error: aborting due to previous error diff --git a/src/test/ui/parser/issue-2354-1.stderr b/src/test/ui/parser/issue-2354-1.stderr index da25aac486e3..7c083751228b 100644 --- a/src/test/ui/parser/issue-2354-1.stderr +++ b/src/test/ui/parser/issue-2354-1.stderr @@ -1,7 +1,7 @@ error: unexpected close delimiter: `}` --> $DIR/issue-2354-1.rs:1:24 | -LL | static foo: isize = 2; } //~ ERROR unexpected close delimiter: +LL | static foo: isize = 2; } | ^ unexpected close delimiter error: aborting due to previous error diff --git a/src/test/ui/parser/issue-2354.stderr b/src/test/ui/parser/issue-2354.stderr index 0f4cd5724ce1..7098da738b8d 100644 --- a/src/test/ui/parser/issue-2354.stderr +++ b/src/test/ui/parser/issue-2354.stderr @@ -1,7 +1,7 @@ error: this file contains an un-closed delimiter --> $DIR/issue-2354.rs:15:66 | -LL | fn foo() { //~ NOTE un-closed delimiter +LL | fn foo() { | - un-closed delimiter LL | match Some(10) { | - this delimiter might not be properly closed... @@ -9,7 +9,7 @@ LL | match Some(10) { LL | } | - ...as it matches this but it has different indentation ... -LL | //~ ERROR this file contains an un-closed delimiter +LL | | ^ error[E0601]: `main` function not found in crate `issue_2354` @@ -18,7 +18,7 @@ error[E0601]: `main` function not found in crate `issue_2354` note: here is a function named 'main' --> $DIR/issue-2354.rs:14:1 | -LL | fn main() {} //~ NOTE here is a function named 'main' +LL | fn main() {} | ^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/issue-24197.stderr b/src/test/ui/parser/issue-24197.stderr index 4e073d8c58aa..2dfb31432bc9 100644 --- a/src/test/ui/parser/issue-24197.stderr +++ b/src/test/ui/parser/issue-24197.stderr @@ -1,7 +1,7 @@ error: expected one of `:`, `;`, `=`, or `@`, found `[` --> $DIR/issue-24197.rs:2:12 | -LL | let buf[0] = 0; //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `[` +LL | let buf[0] = 0; | ^ expected one of `:`, `;`, `=`, or `@` here error: aborting due to previous error diff --git a/src/test/ui/parser/issue-24375.stderr b/src/test/ui/parser/issue-24375.stderr index f773a7df4fed..e45b08be9ab6 100644 --- a/src/test/ui/parser/issue-24375.stderr +++ b/src/test/ui/parser/issue-24375.stderr @@ -1,7 +1,7 @@ error: expected one of `=>`, `@`, `if`, or `|`, found `[` --> $DIR/issue-24375.rs:6:12 | -LL | tmp[0] => {} //~ ERROR expected one of `=>`, `@`, `if`, or `|`, found `[` +LL | tmp[0] => {} | ^ expected one of `=>`, `@`, `if`, or `|` here error: aborting due to previous error diff --git a/src/test/ui/parser/issue-3036.stderr b/src/test/ui/parser/issue-3036.stderr index eadf5546d850..18947b8fa401 100644 --- a/src/test/ui/parser/issue-3036.stderr +++ b/src/test/ui/parser/issue-3036.stderr @@ -3,7 +3,7 @@ error: expected one of `.`, `;`, `?`, or an operator, found `}` | LL | let x = 3 | - expected one of `.`, `;`, `?`, or an operator here -LL | } //~ ERROR: expected one of `.`, `;`, `?`, or an operator, found `}` +LL | } | ^ unexpected token error: aborting due to previous error diff --git a/src/test/ui/parser/issue-32446.stderr b/src/test/ui/parser/issue-32446.stderr index 07eafdde9071..b0c18f4ec5a4 100644 --- a/src/test/ui/parser/issue-32446.stderr +++ b/src/test/ui/parser/issue-32446.stderr @@ -1,7 +1,7 @@ error: expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `...` --> $DIR/issue-32446.rs:4:11 | -LL | trait T { ... } //~ ERROR +LL | trait T { ... } | ^^^ expected one of 7 possible tokens here error: aborting due to previous error diff --git a/src/test/ui/parser/issue-32501.stderr b/src/test/ui/parser/issue-32501.stderr index d74c539abfe5..97efb8959357 100644 --- a/src/test/ui/parser/issue-32501.stderr +++ b/src/test/ui/parser/issue-32501.stderr @@ -1,7 +1,7 @@ error: expected identifier, found reserved identifier `_` --> $DIR/issue-32501.rs:7:13 | -LL | let mut _ = 0; //~ ERROR expected identifier, found reserved identifier `_` +LL | let mut _ = 0; | ^ expected identifier, found reserved identifier error: aborting due to previous error diff --git a/src/test/ui/parser/issue-32505.stderr b/src/test/ui/parser/issue-32505.stderr index 1ea4c36a5255..f812646ca588 100644 --- a/src/test/ui/parser/issue-32505.stderr +++ b/src/test/ui/parser/issue-32505.stderr @@ -1,7 +1,7 @@ error: expected expression, found `)` --> $DIR/issue-32505.rs:4:12 | -LL | foo(|_|) //~ ERROR expected expression, found `)` +LL | foo(|_|) | ^ expected expression error: aborting due to previous error diff --git a/src/test/ui/parser/issue-33418.stderr b/src/test/ui/parser/issue-33418.stderr index bfe44588a5b0..acbe597ef31a 100644 --- a/src/test/ui/parser/issue-33418.stderr +++ b/src/test/ui/parser/issue-33418.stderr @@ -1,13 +1,13 @@ error: negative trait bounds are not supported --> $DIR/issue-33418.rs:3:9 | -LL | trait Tr: !SuperA {} //~ ERROR negative trait bounds are not supported +LL | trait Tr: !SuperA {} | ^^^^^^^^^ help: remove the trait bound error: negative trait bounds are not supported --> $DIR/issue-33418.rs:4:19 | -LL | trait Tr2: SuperA + !SuperB {} //~ ERROR negative trait bounds are not supported +LL | trait Tr2: SuperA + !SuperB {} | ---------^^^^^^^^^ | | | help: remove the trait bound @@ -15,7 +15,7 @@ LL | trait Tr2: SuperA + !SuperB {} //~ ERROR negative trait bounds are not supp error: negative trait bounds are not supported --> $DIR/issue-33418.rs:5:10 | -LL | trait Tr3: !SuperA + SuperB {} //~ ERROR negative trait bounds are not supported +LL | trait Tr3: !SuperA + SuperB {} | ^^^^^^^^^--------- | | | help: remove the trait bound @@ -23,7 +23,7 @@ LL | trait Tr3: !SuperA + SuperB {} //~ ERROR negative trait bounds are not supp error: negative trait bounds are not supported --> $DIR/issue-33418.rs:6:10 | -LL | trait Tr4: !SuperA + SuperB //~ ERROR negative trait bounds are not supported +LL | trait Tr4: !SuperA + SuperB | __________-^^^^^^^^ LL | | + !SuperC + SuperD {} | |_____^^^^^^^^^________- help: remove the trait bounds @@ -31,7 +31,7 @@ LL | | + !SuperC + SuperD {} error: negative trait bounds are not supported --> $DIR/issue-33418.rs:8:10 | -LL | trait Tr5: !SuperA //~ ERROR negative trait bounds are not supported +LL | trait Tr5: !SuperA | __________-^^^^^^^^ LL | | + !SuperB {} | | ^^^^^^^^- diff --git a/src/test/ui/parser/issue-33455.stderr b/src/test/ui/parser/issue-33455.stderr index 38d00a0ea0b4..4516c388afcb 100644 --- a/src/test/ui/parser/issue-33455.stderr +++ b/src/test/ui/parser/issue-33455.stderr @@ -1,7 +1,7 @@ error: expected one of `::`, `;`, or `as`, found `.` --> $DIR/issue-33455.rs:1:8 | -LL | use foo.bar; //~ ERROR expected one of `::`, `;`, or `as`, found `.` +LL | use foo.bar; | ^ expected one of `::`, `;`, or `as` here error: aborting due to previous error diff --git a/src/test/ui/parser/issue-41155.stderr b/src/test/ui/parser/issue-41155.stderr index ac75829f2e35..719845e69993 100644 --- a/src/test/ui/parser/issue-41155.stderr +++ b/src/test/ui/parser/issue-41155.stderr @@ -3,7 +3,7 @@ error: expected one of `(`, `async`, `const`, `default`, `existential`, `extern` | LL | pub | - expected one of 9 possible tokens here -LL | } //~ ERROR expected one of +LL | } | ^ unexpected token error: aborting due to previous error diff --git a/src/test/ui/parser/issue-43692.stderr b/src/test/ui/parser/issue-43692.stderr index 780f63a66386..9408182f9527 100644 --- a/src/test/ui/parser/issue-43692.stderr +++ b/src/test/ui/parser/issue-43692.stderr @@ -1,7 +1,7 @@ error: invalid start of unicode escape --> $DIR/issue-43692.rs:2:9 | -LL | '/u{_10FFFF}'; //~ ERROR invalid start of unicode escape +LL | '/u{_10FFFF}'; | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/issue-5806.stderr b/src/test/ui/parser/issue-5806.stderr index f9f00f70f0b9..6cf902ca86e7 100644 --- a/src/test/ui/parser/issue-5806.stderr +++ b/src/test/ui/parser/issue-5806.stderr @@ -1,7 +1,7 @@ error: couldn't read $DIR/../parser: $ACCESS_DENIED_MSG (os error $ACCESS_DENIED_CODE) --> $DIR/issue-5806.rs:5:5 | -LL | mod foo; //~ ERROR couldn't read +LL | mod foo; | ^^^ error: aborting due to previous error diff --git a/src/test/ui/parser/issue-6610.stderr b/src/test/ui/parser/issue-6610.stderr index b4760161a62a..22d93bffeade 100644 --- a/src/test/ui/parser/issue-6610.stderr +++ b/src/test/ui/parser/issue-6610.stderr @@ -1,7 +1,7 @@ error: expected `;` or `{`, found `}` --> $DIR/issue-6610.rs:1:20 | -LL | trait Foo { fn a() } //~ ERROR expected `;` or `{`, found `}` +LL | trait Foo { fn a() } | ^ expected `;` or `{` error: aborting due to previous error diff --git a/src/test/ui/parser/issue-8537.stderr b/src/test/ui/parser/issue-8537.stderr index 4442cd0ff011..82ca61421543 100644 --- a/src/test/ui/parser/issue-8537.stderr +++ b/src/test/ui/parser/issue-8537.stderr @@ -1,7 +1,7 @@ error[E0703]: invalid ABI: found `invalid-ab_isize` --> $DIR/issue-8537.rs:2:3 | -LL | "invalid-ab_isize" //~ ERROR invalid ABI +LL | "invalid-ab_isize" | ^^^^^^^^^^^^^^^^^^ invalid ABI | = help: valid ABIs: cdecl, stdcall, fastcall, vectorcall, thiscall, aapcs, win64, sysv64, ptx-kernel, msp430-interrupt, x86-interrupt, amdgpu-kernel, Rust, C, system, rust-intrinsic, rust-call, platform-intrinsic, unadjusted diff --git a/src/test/ui/parser/keyword-abstract.stderr b/src/test/ui/parser/keyword-abstract.stderr index 4185ae034b50..2c79598a81b1 100644 --- a/src/test/ui/parser/keyword-abstract.stderr +++ b/src/test/ui/parser/keyword-abstract.stderr @@ -1,7 +1,7 @@ error: expected pattern, found reserved keyword `abstract` --> $DIR/keyword-abstract.rs:2:9 | -LL | let abstract = (); //~ ERROR expected pattern, found reserved keyword `abstract` +LL | let abstract = (); | ^^^^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-as-as-identifier.stderr b/src/test/ui/parser/keyword-as-as-identifier.stderr index 6eaf5e2ed93e..ef466488ad06 100644 --- a/src/test/ui/parser/keyword-as-as-identifier.stderr +++ b/src/test/ui/parser/keyword-as-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `as` --> $DIR/keyword-as-as-identifier.rs:4:9 | -LL | let as = "foo"; //~ error: expected pattern, found keyword `as` +LL | let as = "foo"; | ^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-box-as-identifier.stderr b/src/test/ui/parser/keyword-box-as-identifier.stderr index 07a134442b8d..8b185948498d 100644 --- a/src/test/ui/parser/keyword-box-as-identifier.stderr +++ b/src/test/ui/parser/keyword-box-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found `=` --> $DIR/keyword-box-as-identifier.rs:2:13 | -LL | let box = "foo"; //~ error: expected pattern, found `=` +LL | let box = "foo"; | ^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-break-as-identifier.stderr b/src/test/ui/parser/keyword-break-as-identifier.stderr index 69af97374455..690bd84221a9 100644 --- a/src/test/ui/parser/keyword-break-as-identifier.stderr +++ b/src/test/ui/parser/keyword-break-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `break` --> $DIR/keyword-break-as-identifier.rs:4:9 | -LL | let break = "foo"; //~ error: expected pattern, found keyword `break` +LL | let break = "foo"; | ^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-const-as-identifier.stderr b/src/test/ui/parser/keyword-const-as-identifier.stderr index c727f1754c77..6da47f88d04e 100644 --- a/src/test/ui/parser/keyword-const-as-identifier.stderr +++ b/src/test/ui/parser/keyword-const-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `const` --> $DIR/keyword-const-as-identifier.rs:4:9 | -LL | let const = "foo"; //~ error: expected pattern, found keyword `const` +LL | let const = "foo"; | ^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-continue-as-identifier.stderr b/src/test/ui/parser/keyword-continue-as-identifier.stderr index 7fd2761884f7..4b0a659f9ad7 100644 --- a/src/test/ui/parser/keyword-continue-as-identifier.stderr +++ b/src/test/ui/parser/keyword-continue-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `continue` --> $DIR/keyword-continue-as-identifier.rs:4:9 | -LL | let continue = "foo"; //~ error: expected pattern, found keyword `continue` +LL | let continue = "foo"; | ^^^^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-else-as-identifier.stderr b/src/test/ui/parser/keyword-else-as-identifier.stderr index 6d180bb56da5..bec7b7ba01e1 100644 --- a/src/test/ui/parser/keyword-else-as-identifier.stderr +++ b/src/test/ui/parser/keyword-else-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `else` --> $DIR/keyword-else-as-identifier.rs:4:9 | -LL | let else = "foo"; //~ error: expected pattern, found keyword `else` +LL | let else = "foo"; | ^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-enum-as-identifier.stderr b/src/test/ui/parser/keyword-enum-as-identifier.stderr index dc7e37824dc6..51a834f797c3 100644 --- a/src/test/ui/parser/keyword-enum-as-identifier.stderr +++ b/src/test/ui/parser/keyword-enum-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `enum` --> $DIR/keyword-enum-as-identifier.rs:4:9 | -LL | let enum = "foo"; //~ error: expected pattern, found keyword `enum` +LL | let enum = "foo"; | ^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-final.stderr b/src/test/ui/parser/keyword-final.stderr index 897624279e5e..e8372643be6b 100644 --- a/src/test/ui/parser/keyword-final.stderr +++ b/src/test/ui/parser/keyword-final.stderr @@ -1,7 +1,7 @@ error: expected pattern, found reserved keyword `final` --> $DIR/keyword-final.rs:2:9 | -LL | let final = (); //~ ERROR expected pattern, found reserved keyword `final` +LL | let final = (); | ^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-fn-as-identifier.stderr b/src/test/ui/parser/keyword-fn-as-identifier.stderr index 945fc77c3102..a071a40a70e0 100644 --- a/src/test/ui/parser/keyword-fn-as-identifier.stderr +++ b/src/test/ui/parser/keyword-fn-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `fn` --> $DIR/keyword-fn-as-identifier.rs:4:9 | -LL | let fn = "foo"; //~ error: expected pattern, found keyword `fn` +LL | let fn = "foo"; | ^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-for-as-identifier.stderr b/src/test/ui/parser/keyword-for-as-identifier.stderr index 32263e9f6e20..090046cebdc5 100644 --- a/src/test/ui/parser/keyword-for-as-identifier.stderr +++ b/src/test/ui/parser/keyword-for-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `for` --> $DIR/keyword-for-as-identifier.rs:4:9 | -LL | let for = "foo"; //~ error: expected pattern, found keyword `for` +LL | let for = "foo"; | ^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-if-as-identifier.stderr b/src/test/ui/parser/keyword-if-as-identifier.stderr index 11ba41015cbd..98bfdb46e977 100644 --- a/src/test/ui/parser/keyword-if-as-identifier.stderr +++ b/src/test/ui/parser/keyword-if-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `if` --> $DIR/keyword-if-as-identifier.rs:4:9 | -LL | let if = "foo"; //~ error: expected pattern, found keyword `if` +LL | let if = "foo"; | ^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-impl-as-identifier.stderr b/src/test/ui/parser/keyword-impl-as-identifier.stderr index 960a42df429e..2672959b7c68 100644 --- a/src/test/ui/parser/keyword-impl-as-identifier.stderr +++ b/src/test/ui/parser/keyword-impl-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `impl` --> $DIR/keyword-impl-as-identifier.rs:4:9 | -LL | let impl = "foo"; //~ error: expected pattern, found keyword `impl` +LL | let impl = "foo"; | ^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-in-as-identifier.stderr b/src/test/ui/parser/keyword-in-as-identifier.stderr index 2300a257a02b..98332b723f27 100644 --- a/src/test/ui/parser/keyword-in-as-identifier.stderr +++ b/src/test/ui/parser/keyword-in-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `in` --> $DIR/keyword-in-as-identifier.rs:4:9 | -LL | let in = "foo"; //~ error: expected pattern, found keyword `in` +LL | let in = "foo"; | ^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-let-as-identifier.stderr b/src/test/ui/parser/keyword-let-as-identifier.stderr index ed2c8a4eb9c4..99dbc0530f3f 100644 --- a/src/test/ui/parser/keyword-let-as-identifier.stderr +++ b/src/test/ui/parser/keyword-let-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `let` --> $DIR/keyword-let-as-identifier.rs:4:9 | -LL | let let = "foo"; //~ error: expected pattern, found keyword `let` +LL | let let = "foo"; | ^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-loop-as-identifier.stderr b/src/test/ui/parser/keyword-loop-as-identifier.stderr index f91cab029533..783507eb35cd 100644 --- a/src/test/ui/parser/keyword-loop-as-identifier.stderr +++ b/src/test/ui/parser/keyword-loop-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `loop` --> $DIR/keyword-loop-as-identifier.rs:4:9 | -LL | let loop = "foo"; //~ error: expected pattern, found keyword `loop` +LL | let loop = "foo"; | ^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-match-as-identifier.stderr b/src/test/ui/parser/keyword-match-as-identifier.stderr index 4c8e76695bc8..e56a115c9163 100644 --- a/src/test/ui/parser/keyword-match-as-identifier.stderr +++ b/src/test/ui/parser/keyword-match-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `match` --> $DIR/keyword-match-as-identifier.rs:4:9 | -LL | let match = "foo"; //~ error: expected pattern, found keyword `match` +LL | let match = "foo"; | ^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-mod-as-identifier.stderr b/src/test/ui/parser/keyword-mod-as-identifier.stderr index 8aeebcebec95..a8be2ceb037d 100644 --- a/src/test/ui/parser/keyword-mod-as-identifier.stderr +++ b/src/test/ui/parser/keyword-mod-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `mod` --> $DIR/keyword-mod-as-identifier.rs:4:9 | -LL | let mod = "foo"; //~ error: expected pattern, found keyword `mod` +LL | let mod = "foo"; | ^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-move-as-identifier.stderr b/src/test/ui/parser/keyword-move-as-identifier.stderr index 37e06708e25f..e0687e27eb58 100644 --- a/src/test/ui/parser/keyword-move-as-identifier.stderr +++ b/src/test/ui/parser/keyword-move-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `move` --> $DIR/keyword-move-as-identifier.rs:4:9 | -LL | let move = "foo"; //~ error: expected pattern, found keyword `move` +LL | let move = "foo"; | ^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-mut-as-identifier.stderr b/src/test/ui/parser/keyword-mut-as-identifier.stderr index b0266060903c..040960835d81 100644 --- a/src/test/ui/parser/keyword-mut-as-identifier.stderr +++ b/src/test/ui/parser/keyword-mut-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected identifier, found `=` --> $DIR/keyword-mut-as-identifier.rs:2:13 | -LL | let mut = "foo"; //~ error: expected identifier, found `=` +LL | let mut = "foo"; | ^ expected identifier error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-override.stderr b/src/test/ui/parser/keyword-override.stderr index 69a6415908c2..1bfc6c9b3858 100644 --- a/src/test/ui/parser/keyword-override.stderr +++ b/src/test/ui/parser/keyword-override.stderr @@ -1,7 +1,7 @@ error: expected pattern, found reserved keyword `override` --> $DIR/keyword-override.rs:2:9 | -LL | let override = (); //~ ERROR expected pattern, found reserved keyword `override` +LL | let override = (); | ^^^^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-pub-as-identifier.stderr b/src/test/ui/parser/keyword-pub-as-identifier.stderr index 8b595673ec4c..526ddcd6ee0f 100644 --- a/src/test/ui/parser/keyword-pub-as-identifier.stderr +++ b/src/test/ui/parser/keyword-pub-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `pub` --> $DIR/keyword-pub-as-identifier.rs:4:9 | -LL | let pub = "foo"; //~ error: expected pattern, found keyword `pub` +LL | let pub = "foo"; | ^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-ref-as-identifier.stderr b/src/test/ui/parser/keyword-ref-as-identifier.stderr index 656df196f09b..618043d89ffa 100644 --- a/src/test/ui/parser/keyword-ref-as-identifier.stderr +++ b/src/test/ui/parser/keyword-ref-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected identifier, found `=` --> $DIR/keyword-ref-as-identifier.rs:2:13 | -LL | let ref = "foo"; //~ error: expected identifier, found `=` +LL | let ref = "foo"; | ^ expected identifier error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-return-as-identifier.stderr b/src/test/ui/parser/keyword-return-as-identifier.stderr index 903137542d6f..c0156a63fa9d 100644 --- a/src/test/ui/parser/keyword-return-as-identifier.stderr +++ b/src/test/ui/parser/keyword-return-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `return` --> $DIR/keyword-return-as-identifier.rs:4:9 | -LL | let return = "foo"; //~ error: expected pattern, found keyword `return` +LL | let return = "foo"; | ^^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-static-as-identifier.stderr b/src/test/ui/parser/keyword-static-as-identifier.stderr index 4830e6f1bef4..00a65977732f 100644 --- a/src/test/ui/parser/keyword-static-as-identifier.stderr +++ b/src/test/ui/parser/keyword-static-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `static` --> $DIR/keyword-static-as-identifier.rs:4:9 | -LL | let static = "foo"; //~ error: expected pattern, found keyword `static` +LL | let static = "foo"; | ^^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-struct-as-identifier.stderr b/src/test/ui/parser/keyword-struct-as-identifier.stderr index 50ac690e425a..b2d6639e72ec 100644 --- a/src/test/ui/parser/keyword-struct-as-identifier.stderr +++ b/src/test/ui/parser/keyword-struct-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `struct` --> $DIR/keyword-struct-as-identifier.rs:4:9 | -LL | let struct = "foo"; //~ error: expected pattern, found keyword `struct` +LL | let struct = "foo"; | ^^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-trait-as-identifier.stderr b/src/test/ui/parser/keyword-trait-as-identifier.stderr index 3736f366cbd4..b31c0df28c00 100644 --- a/src/test/ui/parser/keyword-trait-as-identifier.stderr +++ b/src/test/ui/parser/keyword-trait-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `trait` --> $DIR/keyword-trait-as-identifier.rs:4:9 | -LL | let trait = "foo"; //~ error: expected pattern, found keyword `trait` +LL | let trait = "foo"; | ^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-try-as-identifier-edition2018.stderr b/src/test/ui/parser/keyword-try-as-identifier-edition2018.stderr index 73e8d64b56c1..c342e3a76fbb 100644 --- a/src/test/ui/parser/keyword-try-as-identifier-edition2018.stderr +++ b/src/test/ui/parser/keyword-try-as-identifier-edition2018.stderr @@ -1,7 +1,7 @@ error: expected pattern, found reserved keyword `try` --> $DIR/keyword-try-as-identifier-edition2018.rs:4:9 | -LL | let try = "foo"; //~ error: expected pattern, found reserved keyword `try` +LL | let try = "foo"; | ^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-type-as-identifier.stderr b/src/test/ui/parser/keyword-type-as-identifier.stderr index f7db20034a10..b749c708d441 100644 --- a/src/test/ui/parser/keyword-type-as-identifier.stderr +++ b/src/test/ui/parser/keyword-type-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `type` --> $DIR/keyword-type-as-identifier.rs:4:9 | -LL | let type = "foo"; //~ error: expected pattern, found keyword `type` +LL | let type = "foo"; | ^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-typeof.stderr b/src/test/ui/parser/keyword-typeof.stderr index 07c9f883b60f..e7b18023e61a 100644 --- a/src/test/ui/parser/keyword-typeof.stderr +++ b/src/test/ui/parser/keyword-typeof.stderr @@ -1,7 +1,7 @@ error: expected pattern, found reserved keyword `typeof` --> $DIR/keyword-typeof.rs:2:9 | -LL | let typeof = (); //~ ERROR expected pattern, found reserved keyword `typeof` +LL | let typeof = (); | ^^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-unsafe-as-identifier.stderr b/src/test/ui/parser/keyword-unsafe-as-identifier.stderr index ddd5e4d7b115..67935ce43ba0 100644 --- a/src/test/ui/parser/keyword-unsafe-as-identifier.stderr +++ b/src/test/ui/parser/keyword-unsafe-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `unsafe` --> $DIR/keyword-unsafe-as-identifier.rs:4:9 | -LL | let unsafe = "foo"; //~ error: expected pattern, found keyword `unsafe` +LL | let unsafe = "foo"; | ^^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-use-as-identifier.stderr b/src/test/ui/parser/keyword-use-as-identifier.stderr index 7e798a3f0b9d..2c69d0a8744a 100644 --- a/src/test/ui/parser/keyword-use-as-identifier.stderr +++ b/src/test/ui/parser/keyword-use-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `use` --> $DIR/keyword-use-as-identifier.rs:4:9 | -LL | let use = "foo"; //~ error: expected pattern, found keyword `use` +LL | let use = "foo"; | ^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-where-as-identifier.stderr b/src/test/ui/parser/keyword-where-as-identifier.stderr index 5285520cc20c..fc01183ca046 100644 --- a/src/test/ui/parser/keyword-where-as-identifier.stderr +++ b/src/test/ui/parser/keyword-where-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `where` --> $DIR/keyword-where-as-identifier.rs:4:9 | -LL | let where = "foo"; //~ error: expected pattern, found keyword `where` +LL | let where = "foo"; | ^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/keyword-while-as-identifier.stderr b/src/test/ui/parser/keyword-while-as-identifier.stderr index b84a652dc5c8..f72ac8774209 100644 --- a/src/test/ui/parser/keyword-while-as-identifier.stderr +++ b/src/test/ui/parser/keyword-while-as-identifier.stderr @@ -1,7 +1,7 @@ error: expected pattern, found keyword `while` --> $DIR/keyword-while-as-identifier.rs:4:9 | -LL | let while = "foo"; //~ error: expected pattern, found keyword `while` +LL | let while = "foo"; | ^^^^^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/lex-bad-binary-literal.stderr b/src/test/ui/parser/lex-bad-binary-literal.stderr index 9750906aaf21..15959f671b63 100644 --- a/src/test/ui/parser/lex-bad-binary-literal.stderr +++ b/src/test/ui/parser/lex-bad-binary-literal.stderr @@ -1,55 +1,55 @@ error: invalid digit for a base 2 literal --> $DIR/lex-bad-binary-literal.rs:4:8 | -LL | 0b121; //~ ERROR invalid digit for a base 2 literal +LL | 0b121; | ^ error: invalid digit for a base 2 literal --> $DIR/lex-bad-binary-literal.rs:5:12 | -LL | 0b10_10301; //~ ERROR invalid digit for a base 2 literal +LL | 0b10_10301; | ^ error: invalid digit for a base 2 literal --> $DIR/lex-bad-binary-literal.rs:6:7 | -LL | 0b30; //~ ERROR invalid digit for a base 2 literal +LL | 0b30; | ^ error: invalid digit for a base 2 literal --> $DIR/lex-bad-binary-literal.rs:7:7 | -LL | 0b41; //~ ERROR invalid digit for a base 2 literal +LL | 0b41; | ^ error: invalid digit for a base 2 literal --> $DIR/lex-bad-binary-literal.rs:8:7 | -LL | 0b5; //~ ERROR invalid digit for a base 2 literal +LL | 0b5; | ^ error: invalid digit for a base 2 literal --> $DIR/lex-bad-binary-literal.rs:9:7 | -LL | 0b6; //~ ERROR invalid digit for a base 2 literal +LL | 0b6; | ^ error: invalid digit for a base 2 literal --> $DIR/lex-bad-binary-literal.rs:10:7 | -LL | 0b7; //~ ERROR invalid digit for a base 2 literal +LL | 0b7; | ^ error: invalid digit for a base 2 literal --> $DIR/lex-bad-binary-literal.rs:11:7 | -LL | 0b8; //~ ERROR invalid digit for a base 2 literal +LL | 0b8; | ^ error: invalid digit for a base 2 literal --> $DIR/lex-bad-binary-literal.rs:12:7 | -LL | 0b9; //~ ERROR invalid digit for a base 2 literal +LL | 0b9; | ^ error: aborting due to 9 previous errors diff --git a/src/test/ui/parser/lex-bad-char-literals-1.stderr b/src/test/ui/parser/lex-bad-char-literals-1.stderr index c22bf7d00109..3c8550e3dbe6 100644 --- a/src/test/ui/parser/lex-bad-char-literals-1.stderr +++ b/src/test/ui/parser/lex-bad-char-literals-1.stderr @@ -1,25 +1,25 @@ error: numeric character escape is too short --> $DIR/lex-bad-char-literals-1.rs:3:8 | -LL | '/x1' //~ ERROR: numeric character escape is too short +LL | '/x1' | ^ error: numeric character escape is too short --> $DIR/lex-bad-char-literals-1.rs:7:8 | -LL | "/x1" //~ ERROR: numeric character escape is too short +LL | "/x1" | ^ error: unknown character escape: /u{25cf} --> $DIR/lex-bad-char-literals-1.rs:11:7 | -LL | '/●' //~ ERROR: unknown character escape +LL | '/●' | ^ error: unknown character escape: /u{25cf} --> $DIR/lex-bad-char-literals-1.rs:15:7 | -LL | "/●" //~ ERROR: unknown character escape +LL | "/●" | ^ error: aborting due to 4 previous errors diff --git a/src/test/ui/parser/lex-bad-char-literals-2.stderr b/src/test/ui/parser/lex-bad-char-literals-2.stderr index 7eadb8ebfe06..4c1c5c29f472 100644 --- a/src/test/ui/parser/lex-bad-char-literals-2.stderr +++ b/src/test/ui/parser/lex-bad-char-literals-2.stderr @@ -1,7 +1,7 @@ error: character literal may only contain one codepoint --> $DIR/lex-bad-char-literals-2.rs:3:5 | -LL | 'nope' //~ ERROR: character literal may only contain one codepoint +LL | 'nope' | ^^^^^^ error[E0601]: `main` function not found in crate `lex_bad_char_literals_2` diff --git a/src/test/ui/parser/lex-bad-char-literals-4.stderr b/src/test/ui/parser/lex-bad-char-literals-4.stderr index 881e3d5276bb..7bcca3761fc6 100644 --- a/src/test/ui/parser/lex-bad-char-literals-4.stderr +++ b/src/test/ui/parser/lex-bad-char-literals-4.stderr @@ -1,7 +1,7 @@ error: character literal may only contain one codepoint: '● --> $DIR/lex-bad-char-literals-4.rs:4:5 | -LL | '● //~ ERROR: character literal may only contain one codepoint +LL | '● | ^^ error: aborting due to previous error diff --git a/src/test/ui/parser/lex-bad-numeric-literals.stderr b/src/test/ui/parser/lex-bad-numeric-literals.stderr index 1fa23b8b73c9..466d7af1bda4 100644 --- a/src/test/ui/parser/lex-bad-numeric-literals.stderr +++ b/src/test/ui/parser/lex-bad-numeric-literals.stderr @@ -1,139 +1,139 @@ error: octal float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:4:5 | -LL | 0o1.0; //~ ERROR: octal float literal is not supported +LL | 0o1.0; | ^^^^^ error: octal float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:6:5 | -LL | 0o3.0f32; //~ ERROR: octal float literal is not supported +LL | 0o3.0f32; | ^^^^^ error: octal float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:7:5 | -LL | 0o4e4; //~ ERROR: octal float literal is not supported +LL | 0o4e4; | ^^^^^ error: octal float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:8:5 | -LL | 0o5.0e5; //~ ERROR: octal float literal is not supported +LL | 0o5.0e5; | ^^^^^^^ error: octal float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:9:5 | -LL | 0o6e6f32; //~ ERROR: octal float literal is not supported +LL | 0o6e6f32; | ^^^^^ error: octal float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:10:5 | -LL | 0o7.0e7f64; //~ ERROR: octal float literal is not supported +LL | 0o7.0e7f64; | ^^^^^^^ error: hexadecimal float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:11:5 | -LL | 0x8.0e+9; //~ ERROR: hexadecimal float literal is not supported +LL | 0x8.0e+9; | ^^^^^^^^ error: hexadecimal float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:12:5 | -LL | 0x9.0e-9; //~ ERROR: hexadecimal float literal is not supported +LL | 0x9.0e-9; | ^^^^^^^^ error: no valid digits found for number --> $DIR/lex-bad-numeric-literals.rs:13:5 | -LL | 0o; //~ ERROR: no valid digits +LL | 0o; | ^^ error: expected at least one digit in exponent --> $DIR/lex-bad-numeric-literals.rs:14:8 | -LL | 1e+; //~ ERROR: expected at least one digit in exponent +LL | 1e+; | ^ error: hexadecimal float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:15:5 | -LL | 0x539.0; //~ ERROR: hexadecimal float literal is not supported +LL | 0x539.0; | ^^^^^^^ error: no valid digits found for number --> $DIR/lex-bad-numeric-literals.rs:18:5 | -LL | 0x; //~ ERROR: no valid digits +LL | 0x; | ^^ error: no valid digits found for number --> $DIR/lex-bad-numeric-literals.rs:19:5 | -LL | 0xu32; //~ ERROR: no valid digits +LL | 0xu32; | ^^ error: no valid digits found for number --> $DIR/lex-bad-numeric-literals.rs:20:5 | -LL | 0ou32; //~ ERROR: no valid digits +LL | 0ou32; | ^^ error: no valid digits found for number --> $DIR/lex-bad-numeric-literals.rs:21:5 | -LL | 0bu32; //~ ERROR: no valid digits +LL | 0bu32; | ^^ error: no valid digits found for number --> $DIR/lex-bad-numeric-literals.rs:22:5 | -LL | 0b; //~ ERROR: no valid digits +LL | 0b; | ^^ error: octal float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:24:5 | -LL | 0o123.456; //~ ERROR: octal float literal is not supported +LL | 0o123.456; | ^^^^^^^^^ error: binary float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:26:5 | -LL | 0b111.101; //~ ERROR: binary float literal is not supported +LL | 0b111.101; | ^^^^^^^^^ error: octal float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:5:5 | -LL | 0o2f32; //~ ERROR: octal float literal is not supported +LL | 0o2f32; | ^^^^^^ not supported error: int literal is too large --> $DIR/lex-bad-numeric-literals.rs:16:5 | -LL | 9900000000000000000000000000999999999999999999999999999999; //~ ERROR: int literal is too large +LL | 9900000000000000000000000000999999999999999999999999999999; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: int literal is too large --> $DIR/lex-bad-numeric-literals.rs:17:5 | -LL | 9900000000000000000000000000999999999999999999999999999999; //~ ERROR: int literal is too large +LL | 9900000000000000000000000000999999999999999999999999999999; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: octal float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:23:5 | -LL | 0o123f64; //~ ERROR: octal float literal is not supported +LL | 0o123f64; | ^^^^^^^^ not supported error: binary float literal is not supported --> $DIR/lex-bad-numeric-literals.rs:25:5 | -LL | 0b101f64; //~ ERROR: binary float literal is not supported +LL | 0b101f64; | ^^^^^^^^ not supported error: aborting due to 23 previous errors diff --git a/src/test/ui/parser/lex-bad-octal-literal.stderr b/src/test/ui/parser/lex-bad-octal-literal.stderr index 542247d69df6..01f4c236c9f3 100644 --- a/src/test/ui/parser/lex-bad-octal-literal.stderr +++ b/src/test/ui/parser/lex-bad-octal-literal.stderr @@ -1,13 +1,13 @@ error: invalid digit for a base 8 literal --> $DIR/lex-bad-octal-literal.rs:4:8 | -LL | 0o18; //~ ERROR invalid digit for a base 8 literal +LL | 0o18; | ^ error: invalid digit for a base 8 literal --> $DIR/lex-bad-octal-literal.rs:5:12 | -LL | 0o1234_9_5670; //~ ERROR invalid digit for a base 8 literal +LL | 0o1234_9_5670; | ^ error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/lex-bad-token.stderr b/src/test/ui/parser/lex-bad-token.stderr index 284ffde9efbe..c0c2e542058b 100644 --- a/src/test/ui/parser/lex-bad-token.stderr +++ b/src/test/ui/parser/lex-bad-token.stderr @@ -1,7 +1,7 @@ error: unknown start of token: /u{25cf} --> $DIR/lex-bad-token.rs:1:1 | -LL | ● //~ ERROR: unknown start of token +LL | ● | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr b/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr index e9f3537ab743..19117bfa9c97 100644 --- a/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr +++ b/src/test/ui/parser/lex-bare-cr-string-literal-doc-comment.stderr @@ -25,25 +25,25 @@ LL | /*! block doc comment with bare CR: ' ' */ error: bare CR not allowed in string, use /r instead --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:21:18 | -LL | let _s = "foo bar"; //~ ERROR: bare CR not allowed in string +LL | let _s = "foo bar"; | ^ error: bare CR not allowed in raw string, use /r instead --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:24:14 | -LL | let _s = r"bar foo"; //~ ERROR: bare CR not allowed in raw string +LL | let _s = r"bar foo"; | ^^^^^ error: unknown character escape: /r --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:27:19 | -LL | let _s = "foo/ bar"; //~ ERROR: unknown character escape: /r +LL | let _s = "foo/ bar"; | ^ | help: this is an isolated carriage return; consider checking your editor and version control settings --> $DIR/lex-bare-cr-string-literal-doc-comment.rs:27:19 | -LL | let _s = "foo/ bar"; //~ ERROR: unknown character escape: /r +LL | let _s = "foo/ bar"; | ^ error: aborting due to 7 previous errors diff --git a/src/test/ui/parser/lex-stray-backslash.stderr b/src/test/ui/parser/lex-stray-backslash.stderr index 40e0cc1d786d..7ce061b8be07 100644 --- a/src/test/ui/parser/lex-stray-backslash.stderr +++ b/src/test/ui/parser/lex-stray-backslash.stderr @@ -1,7 +1,7 @@ error: unknown start of token: / --> $DIR/lex-stray-backslash.rs:1:1 | -LL | / //~ ERROR: unknown start of token: / +LL | / | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/macro-bad-delimiter-ident.stderr b/src/test/ui/parser/macro-bad-delimiter-ident.stderr index 59762e021652..6a17d39e8bfe 100644 --- a/src/test/ui/parser/macro-bad-delimiter-ident.stderr +++ b/src/test/ui/parser/macro-bad-delimiter-ident.stderr @@ -1,7 +1,7 @@ error: expected `(` or `{`, found `<` --> $DIR/macro-bad-delimiter-ident.rs:2:14 | -LL | foo! bar < //~ ERROR expected `(` or `{`, found `<` +LL | foo! bar < | ^ expected `(` or `{` error: aborting due to previous error diff --git a/src/test/ui/parser/macro-keyword.stderr b/src/test/ui/parser/macro-keyword.stderr index 4a10dd50b234..f74c8aa57e70 100644 --- a/src/test/ui/parser/macro-keyword.stderr +++ b/src/test/ui/parser/macro-keyword.stderr @@ -1,11 +1,11 @@ error: expected identifier, found reserved keyword `macro` --> $DIR/macro-keyword.rs:1:4 | -LL | fn macro() { //~ ERROR expected identifier, found reserved keyword `macro` +LL | fn macro() { | ^^^^^ expected identifier, found reserved keyword help: you can escape reserved keywords to use them as identifiers | -LL | fn r#macro() { //~ ERROR expected identifier, found reserved keyword `macro` +LL | fn r#macro() { | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/parser/macro-mismatched-delim-brace-paren.stderr b/src/test/ui/parser/macro-mismatched-delim-brace-paren.stderr index 21c3d1771aad..f411ee8ce2cc 100644 --- a/src/test/ui/parser/macro-mismatched-delim-brace-paren.stderr +++ b/src/test/ui/parser/macro-mismatched-delim-brace-paren.stderr @@ -4,7 +4,7 @@ error: incorrect close delimiter: `)` LL | foo! { | - un-closed delimiter LL | bar, "baz", 1, 2.0 -LL | ) //~ ERROR incorrect close delimiter +LL | ) | ^ incorrect close delimiter error: aborting due to previous error diff --git a/src/test/ui/parser/macro-mismatched-delim-paren-brace.stderr b/src/test/ui/parser/macro-mismatched-delim-paren-brace.stderr index abb082097953..b68433936117 100644 --- a/src/test/ui/parser/macro-mismatched-delim-paren-brace.stderr +++ b/src/test/ui/parser/macro-mismatched-delim-paren-brace.stderr @@ -1,7 +1,7 @@ error: unexpected close delimiter: `}` --> $DIR/macro-mismatched-delim-paren-brace.rs:5:1 | -LL | } //~ ERROR unexpected close delimiter: `}` +LL | } | ^ unexpected close delimiter error: incorrect close delimiter: `}` @@ -10,7 +10,7 @@ error: incorrect close delimiter: `}` LL | foo! ( | - un-closed delimiter LL | bar, "baz", 1, 2.0 -LL | } //~ ERROR incorrect close delimiter +LL | } | ^ incorrect close delimiter error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/macro/issue-33569.stderr b/src/test/ui/parser/macro/issue-33569.stderr index 213d72363f59..8ba72fc88862 100644 --- a/src/test/ui/parser/macro/issue-33569.stderr +++ b/src/test/ui/parser/macro/issue-33569.stderr @@ -1,19 +1,19 @@ error: expected identifier, found `+` --> $DIR/issue-33569.rs:2:8 | -LL | { $+ } => { //~ ERROR expected identifier, found `+` +LL | { $+ } => { | ^ error: expected `*` or `+` --> $DIR/issue-33569.rs:4:13 | -LL | $(x)(y) //~ ERROR expected `*` or `+` +LL | $(x)(y) | ^^^ error: missing fragment specifier --> $DIR/issue-33569.rs:2:8 | -LL | { $+ } => { //~ ERROR expected identifier, found `+` +LL | { $+ } => { | ^ error: aborting due to 3 previous errors diff --git a/src/test/ui/parser/macro/issue-37113.stderr b/src/test/ui/parser/macro/issue-37113.stderr index 36589667c4bc..7aadc0aa4b5c 100644 --- a/src/test/ui/parser/macro/issue-37113.stderr +++ b/src/test/ui/parser/macro/issue-37113.stderr @@ -1,7 +1,7 @@ error: expected identifier, found `String` --> $DIR/issue-37113.rs:4:16 | -LL | $( $t, )* //~ ERROR expected identifier, found `String` +LL | $( $t, )* | ^^ expected identifier ... LL | test_macro!(String,); diff --git a/src/test/ui/parser/macro/issue-37234.stderr b/src/test/ui/parser/macro/issue-37234.stderr index dcc24fca5cc4..004de9d905f1 100644 --- a/src/test/ui/parser/macro/issue-37234.stderr +++ b/src/test/ui/parser/macro/issue-37234.stderr @@ -1,7 +1,7 @@ error: expected one of `.`, `;`, `?`, or an operator, found `""` --> $DIR/issue-37234.rs:3:19 | -LL | let x = 5 ""; //~ ERROR found `""` +LL | let x = 5 ""; | ^^ expected one of `.`, `;`, `?`, or an operator here ... LL | failed!(); diff --git a/src/test/ui/parser/macro/macro-incomplete-parse.stderr b/src/test/ui/parser/macro/macro-incomplete-parse.stderr index 3fcc8e08520d..b37bd583060c 100644 --- a/src/test/ui/parser/macro/macro-incomplete-parse.stderr +++ b/src/test/ui/parser/macro/macro-incomplete-parse.stderr @@ -1,7 +1,7 @@ error: macro expansion ignores token `,` and any following --> $DIR/macro-incomplete-parse.rs:7:9 | -LL | , //~ ERROR macro expansion ignores token `,` +LL | , | ^ ... LL | ignored_item!(); @@ -12,7 +12,7 @@ LL | ignored_item!(); error: expected one of `.`, `;`, `?`, `}`, or an operator, found `,` --> $DIR/macro-incomplete-parse.rs:12:14 | -LL | () => ( 1, //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `,` +LL | () => ( 1, | ^ expected one of `.`, `;`, `?`, `}`, or an operator here ... LL | ignored_expr!(); @@ -21,7 +21,7 @@ LL | ignored_expr!(); error: macro expansion ignores token `,` and any following --> $DIR/macro-incomplete-parse.rs:18:14 | -LL | () => ( 1, 2 ) //~ ERROR macro expansion ignores token `,` +LL | () => ( 1, 2 ) | ^ ... LL | ignored_pat!() => (), diff --git a/src/test/ui/parser/macro/macro-repeat.stderr b/src/test/ui/parser/macro/macro-repeat.stderr index 310d60c8dbda..c86684de7443 100644 --- a/src/test/ui/parser/macro/macro-repeat.stderr +++ b/src/test/ui/parser/macro/macro-repeat.stderr @@ -1,7 +1,7 @@ error: variable 'v' is still repeating at this depth --> $DIR/macro-repeat.rs:3:9 | -LL | $v //~ ERROR still repeating at this depth +LL | $v | ^^ error: aborting due to previous error diff --git a/src/test/ui/parser/macro/pub-item-macro.stderr b/src/test/ui/parser/macro/pub-item-macro.stderr index a624d574c456..fa25161ab50b 100644 --- a/src/test/ui/parser/macro/pub-item-macro.stderr +++ b/src/test/ui/parser/macro/pub-item-macro.stderr @@ -1,7 +1,7 @@ error: can't qualify macro invocation with `pub` --> $DIR/pub-item-macro.rs:8:5 | -LL | pub priv_x!(); //~ ERROR can't qualify macro invocation with `pub` +LL | pub priv_x!(); | ^^^ ... LL | pub_x!(); @@ -12,7 +12,7 @@ LL | pub_x!(); error[E0603]: static `x` is private --> $DIR/pub-item-macro.rs:17:23 | -LL | let y: u32 = foo::x; //~ ERROR static `x` is private +LL | let y: u32 = foo::x; | ^ error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/macro/trait-object-macro-matcher.stderr b/src/test/ui/parser/macro/trait-object-macro-matcher.stderr index 185a9e718098..19c5c82f82cd 100644 --- a/src/test/ui/parser/macro/trait-object-macro-matcher.stderr +++ b/src/test/ui/parser/macro/trait-object-macro-matcher.stderr @@ -1,7 +1,7 @@ error: expected type, found `'static` --> $DIR/trait-object-macro-matcher.rs:9:8 | -LL | m!('static); //~ ERROR expected type, found `'static` +LL | m!('static); | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/parser/macros-no-semicolon-items.stderr b/src/test/ui/parser/macros-no-semicolon-items.stderr index 84dd302b4a8e..a869a53c1eee 100644 --- a/src/test/ui/parser/macros-no-semicolon-items.stderr +++ b/src/test/ui/parser/macros-no-semicolon-items.stderr @@ -1,7 +1,7 @@ error: macros that expand to items must either be surrounded with braces or followed by a semicolon --> $DIR/macros-no-semicolon-items.rs:1:17 | -LL | macro_rules! foo() //~ ERROR semicolon +LL | macro_rules! foo() | ^^ error: aborting due to previous error diff --git a/src/test/ui/parser/macros-no-semicolon.stderr b/src/test/ui/parser/macros-no-semicolon.stderr index 4f9e7fb5de85..09925eae51d2 100644 --- a/src/test/ui/parser/macros-no-semicolon.stderr +++ b/src/test/ui/parser/macros-no-semicolon.stderr @@ -3,7 +3,7 @@ error: expected one of `.`, `;`, `?`, `}`, or an operator, found `assert_eq` | LL | assert_eq!(1, 2) | - expected one of `.`, `;`, `?`, `}`, or an operator here -LL | assert_eq!(3, 4) //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `assert_eq` +LL | assert_eq!(3, 4) | ^^^^^^^^^ unexpected token error: aborting due to previous error diff --git a/src/test/ui/parser/match-arrows-block-then-binop.stderr b/src/test/ui/parser/match-arrows-block-then-binop.stderr index 2782af49e66b..a844cac189aa 100644 --- a/src/test/ui/parser/match-arrows-block-then-binop.stderr +++ b/src/test/ui/parser/match-arrows-block-then-binop.stderr @@ -1,7 +1,7 @@ error: expected pattern, found `+` --> $DIR/match-arrows-block-then-binop.rs:5:9 | -LL | } + 5 //~ ERROR expected pattern, found `+` +LL | } + 5 | ^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/match-refactor-to-expr.stderr b/src/test/ui/parser/match-refactor-to-expr.stderr index 692b116123a6..bf20bc935002 100644 --- a/src/test/ui/parser/match-refactor-to-expr.stderr +++ b/src/test/ui/parser/match-refactor-to-expr.stderr @@ -1,15 +1,15 @@ error: expected one of `.`, `?`, `{`, or an operator, found `;` --> $DIR/match-refactor-to-expr.rs:6:9 | -LL | match //~ NOTE while parsing this match expression +LL | match | ----- | | | while parsing this match expression | help: try removing this `match` LL | Some(4).unwrap_or_else(5) | - expected one of `.`, `?`, `{`, or an operator here -LL | //~^ NOTE expected one of `.`, `?`, `{`, or an operator here -LL | ; //~ NOTE unexpected token +LL | +LL | ; | ^ unexpected token error: aborting due to previous error diff --git a/src/test/ui/parser/match-vec-invalid.stderr b/src/test/ui/parser/match-vec-invalid.stderr index 5a5fc9c45098..fee8d248dcf0 100644 --- a/src/test/ui/parser/match-vec-invalid.stderr +++ b/src/test/ui/parser/match-vec-invalid.stderr @@ -1,7 +1,7 @@ error: expected one of `,` or `@`, found `..` --> $DIR/match-vec-invalid.rs:4:25 | -LL | [1, tail.., tail..] => {}, //~ ERROR: expected one of `,` or `@`, found `..` +LL | [1, tail.., tail..] => {}, | ^^ expected one of `,` or `@` here error: aborting due to previous error diff --git a/src/test/ui/parser/mod_file_not_exist.stderr b/src/test/ui/parser/mod_file_not_exist.stderr index f7f0e2d2d116..dadf4b29dcf3 100644 --- a/src/test/ui/parser/mod_file_not_exist.stderr +++ b/src/test/ui/parser/mod_file_not_exist.stderr @@ -1,7 +1,7 @@ error[E0583]: file not found for module `not_a_real_file` --> $DIR/mod_file_not_exist.rs:3:5 | -LL | mod not_a_real_file; //~ ERROR file not found for module `not_a_real_file` +LL | mod not_a_real_file; | ^^^^^^^^^^^^^^^ | = help: name the file either not_a_real_file.rs or not_a_real_file/mod.rs inside the directory "$DIR" diff --git a/src/test/ui/parser/mod_file_not_exist_windows.stderr b/src/test/ui/parser/mod_file_not_exist_windows.stderr index 67abd6304d51..60ae00abab1e 100644 --- a/src/test/ui/parser/mod_file_not_exist_windows.stderr +++ b/src/test/ui/parser/mod_file_not_exist_windows.stderr @@ -1,7 +1,7 @@ error[E0583]: file not found for module `not_a_real_file` --> $DIR/mod_file_not_exist_windows.rs:3:5 | -LL | mod not_a_real_file; //~ ERROR file not found for module `not_a_real_file` +LL | mod not_a_real_file; | ^^^^^^^^^^^^^^^ | = help: name the file either not_a_real_file.rs or not_a_real_file/mod.rs inside the directory "$DIR" diff --git a/src/test/ui/parser/mod_file_with_path_attr.stderr b/src/test/ui/parser/mod_file_with_path_attr.stderr index a3a3486dd9e3..004b5d7963a1 100644 --- a/src/test/ui/parser/mod_file_with_path_attr.stderr +++ b/src/test/ui/parser/mod_file_with_path_attr.stderr @@ -1,7 +1,7 @@ error: couldn't read $DIR/not_a_real_file.rs: $FILE_NOT_FOUND_MSG (os error 2) --> $DIR/mod_file_with_path_attr.rs:4:5 | -LL | mod m; //~ ERROR not_a_real_file.rs +LL | mod m; | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/multiline-comment-line-tracking.stderr b/src/test/ui/parser/multiline-comment-line-tracking.stderr index c9404d8b9e4d..cac0c801a599 100644 --- a/src/test/ui/parser/multiline-comment-line-tracking.stderr +++ b/src/test/ui/parser/multiline-comment-line-tracking.stderr @@ -1,7 +1,7 @@ error: expected expression, found `%` --> $DIR/multiline-comment-line-tracking.rs:8:3 | -LL | %; //~ ERROR expected expression, found `%` +LL | %; | ^ expected expression error: aborting due to previous error diff --git a/src/test/ui/parser/mut-patterns.stderr b/src/test/ui/parser/mut-patterns.stderr index 5bbb4ce569f0..286956440ec3 100644 --- a/src/test/ui/parser/mut-patterns.stderr +++ b/src/test/ui/parser/mut-patterns.stderr @@ -1,7 +1,7 @@ error: expected one of `:`, `;`, `=`, or `@`, found `{` --> $DIR/mut-patterns.rs:5:17 | -LL | let mut Foo { x: x } = Foo { x: 3 }; //~ ERROR: expected one of `:`, `;`, `=`, or `@`, found `{` +LL | let mut Foo { x: x } = Foo { x: 3 }; | ^ expected one of `:`, `;`, `=`, or `@` here error: aborting due to previous error diff --git a/src/test/ui/parser/new-unicode-escapes-1.stderr b/src/test/ui/parser/new-unicode-escapes-1.stderr index 828e72e56eac..5a191735307a 100644 --- a/src/test/ui/parser/new-unicode-escapes-1.stderr +++ b/src/test/ui/parser/new-unicode-escapes-1.stderr @@ -1,7 +1,7 @@ error: unterminated unicode escape (needed a `}`) --> $DIR/new-unicode-escapes-1.rs:2:21 | -LL | let s = "/u{2603"; //~ ERROR unterminated unicode escape (needed a `}`) +LL | let s = "/u{2603"; | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/new-unicode-escapes-2.stderr b/src/test/ui/parser/new-unicode-escapes-2.stderr index 97ba3fb2cb66..0fb8befa45b0 100644 --- a/src/test/ui/parser/new-unicode-escapes-2.stderr +++ b/src/test/ui/parser/new-unicode-escapes-2.stderr @@ -1,7 +1,7 @@ error: overlong unicode escape (must have at most 6 hex digits) --> $DIR/new-unicode-escapes-2.rs:2:17 | -LL | let s = "/u{260311111111}"; //~ ERROR overlong unicode escape (must have at most 6 hex digits) +LL | let s = "/u{260311111111}"; | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/parser/new-unicode-escapes-3.stderr b/src/test/ui/parser/new-unicode-escapes-3.stderr index 038002ae05e5..427426788f6f 100644 --- a/src/test/ui/parser/new-unicode-escapes-3.stderr +++ b/src/test/ui/parser/new-unicode-escapes-3.stderr @@ -1,7 +1,7 @@ error: invalid unicode character escape --> $DIR/new-unicode-escapes-3.rs:2:14 | -LL | let s1 = "/u{d805}"; //~ ERROR invalid unicode character escape +LL | let s1 = "/u{d805}"; | ^^^^^^^^^^ | = help: unicode escape must not be a surrogate @@ -9,7 +9,7 @@ LL | let s1 = "/u{d805}"; //~ ERROR invalid unicode character escape error: invalid unicode character escape --> $DIR/new-unicode-escapes-3.rs:3:14 | -LL | let s2 = "/u{ffffff}"; //~ ERROR invalid unicode character escape +LL | let s2 = "/u{ffffff}"; | ^^^^^^^^^^^^ | = help: unicode escape must be at most 10FFFF diff --git a/src/test/ui/parser/no-unsafe-self.stderr b/src/test/ui/parser/no-unsafe-self.stderr index 84779b09dc7c..96d8b56bf9ac 100644 --- a/src/test/ui/parser/no-unsafe-self.stderr +++ b/src/test/ui/parser/no-unsafe-self.stderr @@ -1,37 +1,37 @@ error: cannot pass `self` by raw pointer --> $DIR/no-unsafe-self.rs:4:17 | -LL | fn foo(*mut self); //~ ERROR cannot pass `self` by raw pointer +LL | fn foo(*mut self); | ^^^^ cannot pass `self` by raw pointer error: cannot pass `self` by raw pointer --> $DIR/no-unsafe-self.rs:5:19 | -LL | fn baz(*const self); //~ ERROR cannot pass `self` by raw pointer +LL | fn baz(*const self); | ^^^^ cannot pass `self` by raw pointer error: cannot pass `self` by raw pointer --> $DIR/no-unsafe-self.rs:6:13 | -LL | fn bar(*self); //~ ERROR cannot pass `self` by raw pointer +LL | fn bar(*self); | ^^^^ cannot pass `self` by raw pointer error: cannot pass `self` by raw pointer --> $DIR/no-unsafe-self.rs:11:17 | -LL | fn foo(*mut self) { } //~ ERROR cannot pass `self` by raw pointer +LL | fn foo(*mut self) { } | ^^^^ cannot pass `self` by raw pointer error: cannot pass `self` by raw pointer --> $DIR/no-unsafe-self.rs:12:19 | -LL | fn baz(*const self) { } //~ ERROR cannot pass `self` by raw pointer +LL | fn baz(*const self) { } | ^^^^ cannot pass `self` by raw pointer error: cannot pass `self` by raw pointer --> $DIR/no-unsafe-self.rs:13:13 | -LL | fn bar(*self) { } //~ ERROR cannot pass `self` by raw pointer +LL | fn bar(*self) { } | ^^^^ cannot pass `self` by raw pointer error: aborting due to 6 previous errors diff --git a/src/test/ui/parser/numeric-lifetime.rs b/src/test/ui/parser/numeric-lifetime.rs new file mode 100644 index 000000000000..2d82354c62cc --- /dev/null +++ b/src/test/ui/parser/numeric-lifetime.rs @@ -0,0 +1,8 @@ +struct S<'1> { s: &'1 usize } +//~^ ERROR lifetimes cannot start with a number +//~| ERROR lifetimes cannot start with a number +fn main() { + // verify that the parse error doesn't stop type checking + let x: usize = ""; + //~^ ERROR mismatched types +} diff --git a/src/test/ui/parser/numeric-lifetime.stderr b/src/test/ui/parser/numeric-lifetime.stderr new file mode 100644 index 000000000000..4018b24aac17 --- /dev/null +++ b/src/test/ui/parser/numeric-lifetime.stderr @@ -0,0 +1,24 @@ +error: lifetimes cannot start with a number + --> $DIR/numeric-lifetime.rs:1:10 + | +LL | struct S<'1> { s: &'1 usize } + | ^^ + +error: lifetimes cannot start with a number + --> $DIR/numeric-lifetime.rs:1:20 + | +LL | struct S<'1> { s: &'1 usize } + | ^^ + +error[E0308]: mismatched types + --> $DIR/numeric-lifetime.rs:6:20 + | +LL | let x: usize = ""; + | ^^ expected usize, found reference + | + = note: expected type `usize` + found type `&'static str` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/parser/omitted-arg-in-item-fn.stderr b/src/test/ui/parser/omitted-arg-in-item-fn.stderr index b21a1bd08315..4f2a76d2d256 100644 --- a/src/test/ui/parser/omitted-arg-in-item-fn.stderr +++ b/src/test/ui/parser/omitted-arg-in-item-fn.stderr @@ -1,7 +1,7 @@ error: expected one of `:` or `@`, found `)` --> $DIR/omitted-arg-in-item-fn.rs:1:9 | -LL | fn foo(x) { //~ ERROR expected one of `:` or `@`, found `)` +LL | fn foo(x) { | ^ expected one of `:` or `@` here error: aborting due to previous error diff --git a/src/test/ui/parser/paamayim-nekudotayim.stderr b/src/test/ui/parser/paamayim-nekudotayim.stderr index 6423aa2dc2fd..6ceba07f4691 100644 --- a/src/test/ui/parser/paamayim-nekudotayim.stderr +++ b/src/test/ui/parser/paamayim-nekudotayim.stderr @@ -1,7 +1,7 @@ error: expected identifier, found `;` --> $DIR/paamayim-nekudotayim.rs:4:7 | -LL | ::; //~ ERROR expected identifier, found `;` +LL | ::; | ^ expected identifier error: aborting due to previous error diff --git a/src/test/ui/parser/pat-lt-bracket-4.stderr b/src/test/ui/parser/pat-lt-bracket-4.stderr index 18e0e9e8f0c4..d14702acee6e 100644 --- a/src/test/ui/parser/pat-lt-bracket-4.stderr +++ b/src/test/ui/parser/pat-lt-bracket-4.stderr @@ -1,7 +1,7 @@ error: expected one of `=>`, `@`, `if`, or `|`, found `<` --> $DIR/pat-lt-bracket-4.rs:8:12 | -LL | Foo::A(value) => value, //~ error: expected one of `=>`, `@`, `if`, or `|`, found `<` +LL | Foo::A(value) => value, | ^ expected one of `=>`, `@`, `if`, or `|` here error: aborting due to previous error diff --git a/src/test/ui/parser/pat-lt-bracket-5.stderr b/src/test/ui/parser/pat-lt-bracket-5.stderr index 7e76a04ce6f5..ce4cc05db19b 100644 --- a/src/test/ui/parser/pat-lt-bracket-5.stderr +++ b/src/test/ui/parser/pat-lt-bracket-5.stderr @@ -1,7 +1,7 @@ error: expected one of `:`, `;`, `=`, or `@`, found `[` --> $DIR/pat-lt-bracket-5.rs:2:10 | -LL | let v[0] = v[1]; //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `[` +LL | let v[0] = v[1]; | ^ expected one of `:`, `;`, `=`, or `@` here error: aborting due to previous error diff --git a/src/test/ui/parser/pat-lt-bracket-6.stderr b/src/test/ui/parser/pat-lt-bracket-6.stderr index bf5b61907614..2ee4bdb20fe8 100644 --- a/src/test/ui/parser/pat-lt-bracket-6.stderr +++ b/src/test/ui/parser/pat-lt-bracket-6.stderr @@ -1,7 +1,7 @@ error: expected one of `)`, `,`, or `@`, found `[` --> $DIR/pat-lt-bracket-6.rs:2:19 | -LL | let Test(&desc[..]) = x; //~ ERROR: expected one of `)`, `,`, or `@`, found `[` +LL | let Test(&desc[..]) = x; | ^ expected one of `)`, `,`, or `@` here error: aborting due to previous error diff --git a/src/test/ui/parser/pat-lt-bracket-7.stderr b/src/test/ui/parser/pat-lt-bracket-7.stderr index 44394c300215..5552ea46d9b9 100644 --- a/src/test/ui/parser/pat-lt-bracket-7.stderr +++ b/src/test/ui/parser/pat-lt-bracket-7.stderr @@ -1,7 +1,7 @@ error: expected one of `)`, `,`, or `@`, found `[` --> $DIR/pat-lt-bracket-7.rs:2:16 | -LL | for thing(x[]) in foo {} //~ ERROR: expected one of `)`, `,`, or `@`, found `[` +LL | for thing(x[]) in foo {} | ^ expected one of `)`, `,`, or `@` here error: aborting due to previous error diff --git a/src/test/ui/parser/pat-ranges-1.stderr b/src/test/ui/parser/pat-ranges-1.stderr index 378caf630005..6e0deccab8ca 100644 --- a/src/test/ui/parser/pat-ranges-1.stderr +++ b/src/test/ui/parser/pat-ranges-1.stderr @@ -1,7 +1,7 @@ error: expected one of `:`, `;`, or `=`, found `..=` --> $DIR/pat-ranges-1.rs:4:21 | -LL | let macropus!() ..= 11 = 12; //~ error: expected one of `:`, `;`, or `=`, found `..=` +LL | let macropus!() ..= 11 = 12; | ^^^ expected one of `:`, `;`, or `=` here error: aborting due to previous error diff --git a/src/test/ui/parser/pat-ranges-2.stderr b/src/test/ui/parser/pat-ranges-2.stderr index ef8b4f94ef49..d180bb429110 100644 --- a/src/test/ui/parser/pat-ranges-2.stderr +++ b/src/test/ui/parser/pat-ranges-2.stderr @@ -1,7 +1,7 @@ error: expected one of `::`, `:`, `;`, or `=`, found `!` --> $DIR/pat-ranges-2.rs:4:26 | -LL | let 10 ..= makropulos!() = 12; //~ error: expected one of `::`, `:`, `;`, or `=`, found `!` +LL | let 10 ..= makropulos!() = 12; | ^ expected one of `::`, `:`, `;`, or `=` here error: aborting due to previous error diff --git a/src/test/ui/parser/pat-ranges-3.stderr b/src/test/ui/parser/pat-ranges-3.stderr index f923228710bf..aaa85e3c2ddd 100644 --- a/src/test/ui/parser/pat-ranges-3.stderr +++ b/src/test/ui/parser/pat-ranges-3.stderr @@ -1,7 +1,7 @@ error: expected one of `:`, `;`, or `=`, found `+` --> $DIR/pat-ranges-3.rs:4:19 | -LL | let 10 ..= 10 + 3 = 12; //~ expected one of `:`, `;`, or `=`, found `+` +LL | let 10 ..= 10 + 3 = 12; | ^ expected one of `:`, `;`, or `=` here error: aborting due to previous error diff --git a/src/test/ui/parser/pat-ref-enum.stderr b/src/test/ui/parser/pat-ref-enum.stderr index 8729e8c5854f..a3bce3372646 100644 --- a/src/test/ui/parser/pat-ref-enum.stderr +++ b/src/test/ui/parser/pat-ref-enum.stderr @@ -1,7 +1,7 @@ error: expected identifier, found enum pattern --> $DIR/pat-ref-enum.rs:3:11 | -LL | ref Some(i) => {} //~ ERROR expected identifier, found enum pattern +LL | ref Some(i) => {} | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/parser/pat-tuple-1.stderr b/src/test/ui/parser/pat-tuple-1.stderr index 33c69deda42c..391f2c428bf2 100644 --- a/src/test/ui/parser/pat-tuple-1.stderr +++ b/src/test/ui/parser/pat-tuple-1.stderr @@ -1,7 +1,7 @@ error: expected pattern, found `,` --> $DIR/pat-tuple-1.rs:3:10 | -LL | (, ..) => {} //~ ERROR expected pattern, found `,` +LL | (, ..) => {} | ^ expected pattern error: aborting due to previous error diff --git a/src/test/ui/parser/pat-tuple-4.stderr b/src/test/ui/parser/pat-tuple-4.stderr index fe4b4deaa60d..26b92fae3139 100644 --- a/src/test/ui/parser/pat-tuple-4.stderr +++ b/src/test/ui/parser/pat-tuple-4.stderr @@ -1,7 +1,7 @@ error: expected one of `)` or `,`, found `pat` --> $DIR/pat-tuple-4.rs:3:13 | -LL | (.. pat) => {} //~ ERROR expected one of `)` or `,`, found `pat` +LL | (.. pat) => {} | ^^^ expected one of `)` or `,` here error: aborting due to previous error diff --git a/src/test/ui/parser/pat-tuple-5.stderr b/src/test/ui/parser/pat-tuple-5.stderr index 2ca10f697604..61ae40b355d3 100644 --- a/src/test/ui/parser/pat-tuple-5.stderr +++ b/src/test/ui/parser/pat-tuple-5.stderr @@ -1,7 +1,7 @@ error: unexpected token: `)` --> $DIR/pat-tuple-5.rs:3:14 | -LL | (pat ..) => {} //~ ERROR unexpected token: `)` +LL | (pat ..) => {} | ^^ error: aborting due to previous error diff --git a/src/test/ui/parser/pub-method-macro.stderr b/src/test/ui/parser/pub-method-macro.stderr index 2b4920a792f0..7b0fe4934610 100644 --- a/src/test/ui/parser/pub-method-macro.stderr +++ b/src/test/ui/parser/pub-method-macro.stderr @@ -1,7 +1,7 @@ error: can't qualify macro invocation with `pub` --> $DIR/pub-method-macro.rs:17:9 | -LL | pub defn!(f); //~ ERROR can't qualify macro invocation with `pub` +LL | pub defn!(f); | ^^^ | = help: try adjusting the macro to put `pub` inside the invocation diff --git a/src/test/ui/parser/range_inclusive.stderr b/src/test/ui/parser/range_inclusive.stderr index f50b2fa49fb0..12b7edae79f5 100644 --- a/src/test/ui/parser/range_inclusive.stderr +++ b/src/test/ui/parser/range_inclusive.stderr @@ -1,7 +1,7 @@ error[E0586]: inclusive range with no end --> $DIR/range_inclusive.rs:4:19 | -LL | for _ in 1..= {} //~ERROR inclusive range with no end +LL | for _ in 1..= {} | ^ | = help: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) diff --git a/src/test/ui/parser/range_inclusive_dotdotdot.stderr b/src/test/ui/parser/range_inclusive_dotdotdot.stderr index 9fad20848a63..21ad26d8d255 100644 --- a/src/test/ui/parser/range_inclusive_dotdotdot.stderr +++ b/src/test/ui/parser/range_inclusive_dotdotdot.stderr @@ -1,57 +1,57 @@ error: unexpected token: `...` --> $DIR/range_inclusive_dotdotdot.rs:8:12 | -LL | return ...1; //~ERROR unexpected token: `...` +LL | return ...1; | ^^^ help: use `..` for an exclusive range | -LL | return ..1; //~ERROR unexpected token: `...` +LL | return ..1; | ^^ help: or `..=` for an inclusive range | -LL | return ..=1; //~ERROR unexpected token: `...` +LL | return ..=1; | ^^^ error: unexpected token: `...` --> $DIR/range_inclusive_dotdotdot.rs:14:13 | -LL | let x = ...0; //~ERROR unexpected token: `...` +LL | let x = ...0; | ^^^ help: use `..` for an exclusive range | -LL | let x = ..0; //~ERROR unexpected token: `...` +LL | let x = ..0; | ^^ help: or `..=` for an inclusive range | -LL | let x = ..=0; //~ERROR unexpected token: `...` +LL | let x = ..=0; | ^^^ error: unexpected token: `...` --> $DIR/range_inclusive_dotdotdot.rs:18:14 | -LL | let x = 5...5; //~ERROR unexpected token: `...` +LL | let x = 5...5; | ^^^ help: use `..` for an exclusive range | -LL | let x = 5..5; //~ERROR unexpected token: `...` +LL | let x = 5..5; | ^^ help: or `..=` for an inclusive range | -LL | let x = 5..=5; //~ERROR unexpected token: `...` +LL | let x = 5..=5; | ^^^ error: unexpected token: `...` --> $DIR/range_inclusive_dotdotdot.rs:22:15 | -LL | for _ in 0...1 {} //~ERROR unexpected token: `...` +LL | for _ in 0...1 {} | ^^^ help: use `..` for an exclusive range | -LL | for _ in 0..1 {} //~ERROR unexpected token: `...` +LL | for _ in 0..1 {} | ^^ help: or `..=` for an inclusive range | -LL | for _ in 0..=1 {} //~ERROR unexpected token: `...` +LL | for _ in 0..=1 {} | ^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/parser/raw-byte-string-eof.stderr b/src/test/ui/parser/raw-byte-string-eof.stderr index 071cd6241da2..2ba50e8fb2a3 100644 --- a/src/test/ui/parser/raw-byte-string-eof.stderr +++ b/src/test/ui/parser/raw-byte-string-eof.stderr @@ -1,7 +1,7 @@ error: unterminated raw string --> $DIR/raw-byte-string-eof.rs:2:6 | -LL | br##"a"#; //~ unterminated raw string +LL | br##"a"#; | ^ unterminated raw string | = note: this raw string should be terminated with `"##` diff --git a/src/test/ui/parser/raw-byte-string-literals.stderr b/src/test/ui/parser/raw-byte-string-literals.stderr index 1131e0015bb5..5670ed6590a1 100644 --- a/src/test/ui/parser/raw-byte-string-literals.stderr +++ b/src/test/ui/parser/raw-byte-string-literals.stderr @@ -1,13 +1,13 @@ error: raw byte string must be ASCII: /u{e9} --> $DIR/raw-byte-string-literals.rs:5:8 | -LL | br"Γ©"; //~ ERROR raw byte string must be ASCII +LL | br"Γ©"; | ^ error: found invalid character; only `#` is allowed in raw string delimitation: ~ --> $DIR/raw-byte-string-literals.rs:6:6 | -LL | br##~"a"~##; //~ ERROR only `#` is allowed in raw string delimitation +LL | br##~"a"~##; | ^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/raw-str-delim.stderr b/src/test/ui/parser/raw-str-delim.stderr index 47fd331969df..b86b9e90e73a 100644 --- a/src/test/ui/parser/raw-str-delim.stderr +++ b/src/test/ui/parser/raw-str-delim.stderr @@ -1,7 +1,7 @@ error: found invalid character; only `#` is allowed in raw string delimitation: ~ --> $DIR/raw-str-delim.rs:2:5 | -LL | r#~"#"~# //~ ERROR found invalid character; only `#` is allowed in raw string delimitation +LL | r#~"#"~# | ^^ error: aborting due to previous error diff --git a/src/test/ui/parser/raw-str-unbalanced.stderr b/src/test/ui/parser/raw-str-unbalanced.stderr index 6dedcfb6a0aa..26910ff64f57 100644 --- a/src/test/ui/parser/raw-str-unbalanced.stderr +++ b/src/test/ui/parser/raw-str-unbalanced.stderr @@ -1,7 +1,7 @@ error: expected one of `.`, `;`, `?`, or an operator, found `#` --> $DIR/raw-str-unbalanced.rs:3:9 | -LL | "## //~ ERROR expected one of `.`, `;`, `?`, or an operator, found `#` +LL | "## | ^ expected one of `.`, `;`, `?`, or an operator here error: aborting due to previous error diff --git a/src/test/ui/parser/raw/raw-literal-keywords.stderr b/src/test/ui/parser/raw/raw-literal-keywords.stderr index 8465b6a6e849..8b8b71373b50 100644 --- a/src/test/ui/parser/raw/raw-literal-keywords.stderr +++ b/src/test/ui/parser/raw/raw-literal-keywords.stderr @@ -1,37 +1,37 @@ error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `true` --> $DIR/raw-literal-keywords.rs:2:10 | -LL | r#if true { } //~ ERROR found `true` +LL | r#if true { } | ^^^^ expected one of 8 possible tokens here error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `Test` --> $DIR/raw-literal-keywords.rs:7:14 | -LL | r#struct Test; //~ ERROR found `Test` +LL | r#struct Test; | ^^^^ expected one of 8 possible tokens here error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `Test` --> $DIR/raw-literal-keywords.rs:12:13 | -LL | r#union Test; //~ ERROR found `Test` +LL | r#union Test; | ^^^^ expected one of 8 possible tokens here error[E0425]: cannot find value `if` in this scope --> $DIR/raw-literal-keywords.rs:2:5 | -LL | r#if true { } //~ ERROR found `true` +LL | r#if true { } | ^^^^ not found in this scope error[E0425]: cannot find value `struct` in this scope --> $DIR/raw-literal-keywords.rs:7:5 | -LL | r#struct Test; //~ ERROR found `Test` +LL | r#struct Test; | ^^^^^^^^ not found in this scope error[E0425]: cannot find value `union` in this scope --> $DIR/raw-literal-keywords.rs:12:5 | -LL | r#union Test; //~ ERROR found `Test` +LL | r#union Test; | ^^^^^^^ not found in this scope error: aborting due to 6 previous errors diff --git a/src/test/ui/parser/recover-enum.stderr b/src/test/ui/parser/recover-enum.stderr index 81e292939b02..8c3448d6fbe4 100644 --- a/src/test/ui/parser/recover-enum.stderr +++ b/src/test/ui/parser/recover-enum.stderr @@ -3,7 +3,7 @@ error: expected one of `(`, `,`, `=`, `{`, or `}`, found `Bad` | LL | Very | - expected one of `(`, `,`, `=`, `{`, or `}` here -LL | Bad //~ ERROR found `Bad` +LL | Bad | ^^^ unexpected token error: aborting due to previous error diff --git a/src/test/ui/parser/recover-enum2.rs b/src/test/ui/parser/recover-enum2.rs index 65a187737879..7f2f2cc7ab03 100644 --- a/src/test/ui/parser/recover-enum2.rs +++ b/src/test/ui/parser/recover-enum2.rs @@ -25,9 +25,6 @@ fn main() { // fail again enum Test4 { Nope(i32 {}) //~ ERROR: found `{` - //~^ ERROR: found `{` } } - // still recover later - let bad_syntax = _; //~ ERROR: expected expression, found reserved identifier `_` } diff --git a/src/test/ui/parser/recover-enum2.stderr b/src/test/ui/parser/recover-enum2.stderr index 2473420a7793..d1984a54e2f0 100644 --- a/src/test/ui/parser/recover-enum2.stderr +++ b/src/test/ui/parser/recover-enum2.stderr @@ -1,26 +1,14 @@ error: expected type, found `{` --> $DIR/recover-enum2.rs:8:18 | -LL | abc: {}, //~ ERROR: expected type, found `{` +LL | abc: {}, | ^ error: expected one of `!`, `(`, `)`, `+`, `,`, `::`, or `<`, found `{` --> $DIR/recover-enum2.rs:27:22 | -LL | Nope(i32 {}) //~ ERROR: found `{` +LL | Nope(i32 {}) | ^ expected one of 7 possible tokens here -error: expected one of `!`, `&&`, `&`, `(`, `)`, `*`, `+`, `,`, `::`, `<`, `?`, `[`, `_`, `crate`, `dyn`, `extern`, `fn`, `for`, `impl`, `pub`, `unsafe`, `}`, or lifetime, found `{` - --> $DIR/recover-enum2.rs:27:22 - | -LL | Nope(i32 {}) //~ ERROR: found `{` - | ^ expected one of 23 possible tokens here - -error: expected expression, found reserved identifier `_` - --> $DIR/recover-enum2.rs:32:22 - | -LL | let bad_syntax = _; //~ ERROR: expected expression, found reserved identifier `_` - | ^ expected expression - -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/recover-struct.stderr b/src/test/ui/parser/recover-struct.stderr index edb3cb95cab2..8e11d6b29a58 100644 --- a/src/test/ui/parser/recover-struct.stderr +++ b/src/test/ui/parser/recover-struct.stderr @@ -3,7 +3,7 @@ error: expected `:`, found `Bad` | LL | Very | - expected `:` -LL | Bad //~ ERROR found `Bad` +LL | Bad | ^^^ unexpected token error: aborting due to previous error diff --git a/src/test/ui/parser/regions-out-of-scope-slice.stderr b/src/test/ui/parser/regions-out-of-scope-slice.stderr index cd56dfa6aeb7..8d9bf0b7a044 100644 --- a/src/test/ui/parser/regions-out-of-scope-slice.stderr +++ b/src/test/ui/parser/regions-out-of-scope-slice.stderr @@ -1,7 +1,7 @@ error: expected `:`, found `[` --> $DIR/regions-out-of-scope-slice.rs:7:19 | -LL | x = &'blk [1,2,3]; //~ ERROR expected `:`, found `[` +LL | x = &'blk [1,2,3]; | ^ expected `:` error: aborting due to previous error diff --git a/src/test/ui/parser/removed-syntax-enum-newtype.stderr b/src/test/ui/parser/removed-syntax-enum-newtype.stderr index 4c710dec5ba3..a6d0ff4eaf2a 100644 --- a/src/test/ui/parser/removed-syntax-enum-newtype.stderr +++ b/src/test/ui/parser/removed-syntax-enum-newtype.stderr @@ -1,7 +1,7 @@ error: expected one of `<`, `where`, or `{`, found `=` --> $DIR/removed-syntax-enum-newtype.rs:1:8 | -LL | enum e = isize; //~ ERROR expected one of `<`, `where`, or `{`, found `=` +LL | enum e = isize; | ^ expected one of `<`, `where`, or `{` here error: aborting due to previous error diff --git a/src/test/ui/parser/removed-syntax-fixed-vec.stderr b/src/test/ui/parser/removed-syntax-fixed-vec.stderr index 318591e5cc0a..ca6969d1e873 100644 --- a/src/test/ui/parser/removed-syntax-fixed-vec.stderr +++ b/src/test/ui/parser/removed-syntax-fixed-vec.stderr @@ -1,7 +1,7 @@ error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `*` --> $DIR/removed-syntax-fixed-vec.rs:1:17 | -LL | type v = [isize * 3]; //~ ERROR expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `*` +LL | type v = [isize * 3]; | ^ expected one of 7 possible tokens here error: aborting due to previous error diff --git a/src/test/ui/parser/removed-syntax-fn-sigil.stderr b/src/test/ui/parser/removed-syntax-fn-sigil.stderr index 9303a67a8cc7..196a5af47293 100644 --- a/src/test/ui/parser/removed-syntax-fn-sigil.stderr +++ b/src/test/ui/parser/removed-syntax-fn-sigil.stderr @@ -1,7 +1,7 @@ error: expected `(`, found `~` --> $DIR/removed-syntax-fn-sigil.rs:2:14 | -LL | let x: fn~() = || (); //~ ERROR expected `(`, found `~` +LL | let x: fn~() = || (); | - ^ expected `(` | | | while parsing the type for `x` diff --git a/src/test/ui/parser/removed-syntax-mut-vec-expr.stderr b/src/test/ui/parser/removed-syntax-mut-vec-expr.stderr index 8164645b01b7..313420fb9a4f 100644 --- a/src/test/ui/parser/removed-syntax-mut-vec-expr.stderr +++ b/src/test/ui/parser/removed-syntax-mut-vec-expr.stderr @@ -1,7 +1,7 @@ error: expected expression, found keyword `mut` --> $DIR/removed-syntax-mut-vec-expr.rs:2:14 | -LL | let v = [mut 1, 2, 3, 4]; //~ ERROR expected expression, found keyword `mut` +LL | let v = [mut 1, 2, 3, 4]; | ^^^ expected expression error: aborting due to previous error diff --git a/src/test/ui/parser/removed-syntax-mut-vec-ty.stderr b/src/test/ui/parser/removed-syntax-mut-vec-ty.stderr index f0eafa3d00a6..a759716b5a96 100644 --- a/src/test/ui/parser/removed-syntax-mut-vec-ty.stderr +++ b/src/test/ui/parser/removed-syntax-mut-vec-ty.stderr @@ -1,7 +1,7 @@ error: expected type, found keyword `mut` --> $DIR/removed-syntax-mut-vec-ty.rs:1:11 | -LL | type v = [mut isize]; //~ ERROR expected type, found keyword `mut` +LL | type v = [mut isize]; | ^^^ error: aborting due to previous error diff --git a/src/test/ui/parser/removed-syntax-ptr-lifetime.stderr b/src/test/ui/parser/removed-syntax-ptr-lifetime.stderr index 689ed35668ec..7beef9883bd7 100644 --- a/src/test/ui/parser/removed-syntax-ptr-lifetime.stderr +++ b/src/test/ui/parser/removed-syntax-ptr-lifetime.stderr @@ -1,7 +1,7 @@ error: expected one of `!`, `(`, `::`, `;`, or `<`, found `/` --> $DIR/removed-syntax-ptr-lifetime.rs:1:22 | -LL | type bptr = &lifetime/isize; //~ ERROR expected one of `!`, `(`, `::`, `;`, or `<`, found `/` +LL | type bptr = &lifetime/isize; | ^ expected one of `!`, `(`, `::`, `;`, or `<` here error: aborting due to previous error diff --git a/src/test/ui/parser/removed-syntax-record.stderr b/src/test/ui/parser/removed-syntax-record.stderr index f9b98596ae39..730d5e2712b9 100644 --- a/src/test/ui/parser/removed-syntax-record.stderr +++ b/src/test/ui/parser/removed-syntax-record.stderr @@ -1,7 +1,7 @@ error: expected type, found `{` --> $DIR/removed-syntax-record.rs:1:10 | -LL | type t = { f: () }; //~ ERROR expected type, found `{` +LL | type t = { f: () }; | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/removed-syntax-uniq-mut-expr.stderr b/src/test/ui/parser/removed-syntax-uniq-mut-expr.stderr index 90d0764def0b..63d2fdb8cd4a 100644 --- a/src/test/ui/parser/removed-syntax-uniq-mut-expr.stderr +++ b/src/test/ui/parser/removed-syntax-uniq-mut-expr.stderr @@ -1,7 +1,7 @@ error: expected expression, found keyword `mut` --> $DIR/removed-syntax-uniq-mut-expr.rs:2:21 | -LL | let a_box = box mut 42; //~ ERROR expected expression, found keyword `mut` +LL | let a_box = box mut 42; | ^^^ expected expression error: aborting due to previous error diff --git a/src/test/ui/parser/removed-syntax-uniq-mut-ty.stderr b/src/test/ui/parser/removed-syntax-uniq-mut-ty.stderr index b2759778d031..b6c5749c031e 100644 --- a/src/test/ui/parser/removed-syntax-uniq-mut-ty.stderr +++ b/src/test/ui/parser/removed-syntax-uniq-mut-ty.stderr @@ -1,7 +1,7 @@ error: expected one of `>`, const, lifetime, or type, found `mut` --> $DIR/removed-syntax-uniq-mut-ty.rs:1:20 | -LL | type mut_box = Box; //~ ERROR expected one of `>`, const, lifetime, or type, found `mut` +LL | type mut_box = Box; | ^^^ expected one of `>`, const, lifetime, or type here error: aborting due to previous error diff --git a/src/test/ui/parser/struct-literal-in-for.stderr b/src/test/ui/parser/struct-literal-in-for.stderr index 38a5e22e3f7b..b319c64f406f 100644 --- a/src/test/ui/parser/struct-literal-in-for.stderr +++ b/src/test/ui/parser/struct-literal-in-for.stderr @@ -1,19 +1,19 @@ error: expected type, found `3` --> $DIR/struct-literal-in-for.rs:13:12 | -LL | x: 3 //~ ERROR expected type, found `3` +LL | x: 3 | ^ expecting a type here because of type ascription error: expected one of `.`, `;`, `?`, `}`, or an operator, found `{` --> $DIR/struct-literal-in-for.rs:14:12 | -LL | }.hi() { //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `{` +LL | }.hi() { | ^ expected one of `.`, `;`, `?`, `}`, or an operator here error[E0423]: expected value, found struct `Foo` --> $DIR/struct-literal-in-for.rs:12:14 | -LL | for x in Foo { //~ ERROR expected value, found struct `Foo` +LL | for x in Foo { | ^^^ did you mean `(Foo { /* fields */ })`? error: aborting due to 3 previous errors diff --git a/src/test/ui/parser/struct-literal-in-if.stderr b/src/test/ui/parser/struct-literal-in-if.stderr index 49b9a52aff91..27672eeda830 100644 --- a/src/test/ui/parser/struct-literal-in-if.stderr +++ b/src/test/ui/parser/struct-literal-in-if.stderr @@ -1,19 +1,19 @@ error: expected type, found `3` --> $DIR/struct-literal-in-if.rs:13:12 | -LL | x: 3 //~ ERROR expected type, found `3` +LL | x: 3 | ^ expecting a type here because of type ascription error: expected one of `.`, `;`, `?`, `}`, or an operator, found `{` --> $DIR/struct-literal-in-if.rs:14:12 | -LL | }.hi() { //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `{` +LL | }.hi() { | ^ expected one of `.`, `;`, `?`, `}`, or an operator here error[E0423]: expected value, found struct `Foo` --> $DIR/struct-literal-in-if.rs:12:8 | -LL | if Foo { //~ ERROR expected value, found struct `Foo` +LL | if Foo { | ^^^ did you mean `(Foo { /* fields */ })`? error: aborting due to 3 previous errors diff --git a/src/test/ui/parser/struct-literal-in-match-discriminant.stderr b/src/test/ui/parser/struct-literal-in-match-discriminant.stderr index 64ddde0e9e97..94a758eb5268 100644 --- a/src/test/ui/parser/struct-literal-in-match-discriminant.stderr +++ b/src/test/ui/parser/struct-literal-in-match-discriminant.stderr @@ -1,25 +1,25 @@ error: expected one of `=>`, `@`, `if`, or `|`, found `:` --> $DIR/struct-literal-in-match-discriminant.rs:7:10 | -LL | x: 3 //~ ERROR expected one of `=>`, `@`, `if`, or `|`, found `:` +LL | x: 3 | ^ expected one of `=>`, `@`, `if`, or `|` here error: expected one of `.`, `;`, `?`, `}`, or an operator, found `=>` --> $DIR/struct-literal-in-match-discriminant.rs:11:11 | -LL | } => {} //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `=>` +LL | } => {} | ^^ expected one of `.`, `;`, `?`, `}`, or an operator here error[E0423]: expected value, found struct `Foo` --> $DIR/struct-literal-in-match-discriminant.rs:6:11 | -LL | match Foo { //~ ERROR expected value, found struct `Foo` +LL | match Foo { | ^^^ did you mean `(Foo { /* fields */ })`? error[E0425]: cannot find value `x` in this scope --> $DIR/struct-literal-in-match-discriminant.rs:10:16 | -LL | x: x //~ ERROR cannot find value `x` in this scope +LL | x: x | ^ not found in this scope error[E0308]: mismatched types @@ -28,9 +28,9 @@ error[E0308]: mismatched types LL | fn main() { | - expected `()` because of default return type ... -LL | / Foo { //~ ERROR mismatched types -LL | | x: x //~ ERROR cannot find value `x` in this scope -LL | | } => {} //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `=>` +LL | / Foo { +LL | | x: x +LL | | } => {} | |_________^ expected (), found struct `Foo` | = note: expected type `()` diff --git a/src/test/ui/parser/struct-literal-in-while.stderr b/src/test/ui/parser/struct-literal-in-while.stderr index 9a6ab81e7c02..8a130f441a3e 100644 --- a/src/test/ui/parser/struct-literal-in-while.stderr +++ b/src/test/ui/parser/struct-literal-in-while.stderr @@ -1,25 +1,25 @@ error: expected type, found `3` --> $DIR/struct-literal-in-while.rs:13:12 | -LL | x: 3 //~ ERROR expected type, found `3` +LL | x: 3 | ^ expecting a type here because of type ascription error: expected one of `.`, `;`, `?`, `}`, or an operator, found `{` --> $DIR/struct-literal-in-while.rs:14:12 | -LL | }.hi() { //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `{` +LL | }.hi() { | ^ expected one of `.`, `;`, `?`, `}`, or an operator here error[E0423]: expected value, found struct `Foo` --> $DIR/struct-literal-in-while.rs:12:11 | -LL | while Foo { //~ ERROR expected value, found struct `Foo` +LL | while Foo { | ^^^ did you mean `(Foo { /* fields */ })`? error[E0599]: no method named `hi` found for type `()` in the current scope --> $DIR/struct-literal-in-while.rs:14:7 | -LL | }.hi() { //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `{` +LL | }.hi() { | ^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/parser/struct-literal-restrictions-in-lamda.stderr b/src/test/ui/parser/struct-literal-restrictions-in-lamda.stderr index 2303df93810c..3505d00b64b7 100644 --- a/src/test/ui/parser/struct-literal-restrictions-in-lamda.stderr +++ b/src/test/ui/parser/struct-literal-restrictions-in-lamda.stderr @@ -1,25 +1,25 @@ error: expected type, found `3` --> $DIR/struct-literal-restrictions-in-lamda.rs:13:12 | -LL | x: 3 //~ ERROR expected type, found `3` +LL | x: 3 | ^ expecting a type here because of type ascription error: expected one of `.`, `;`, `?`, `}`, or an operator, found `{` --> $DIR/struct-literal-restrictions-in-lamda.rs:14:12 | -LL | }.hi() { //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `{` +LL | }.hi() { | ^ expected one of `.`, `;`, `?`, `}`, or an operator here error[E0423]: expected value, found struct `Foo` --> $DIR/struct-literal-restrictions-in-lamda.rs:12:14 | -LL | while || Foo { //~ ERROR expected value, found struct `Foo` +LL | while || Foo { | ^^^ did you mean `(Foo { /* fields */ })`? error[E0599]: no method named `hi` found for type `()` in the current scope --> $DIR/struct-literal-restrictions-in-lamda.rs:14:7 | -LL | }.hi() { //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `{` +LL | }.hi() { | ^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/parser/tag-variant-disr-non-nullary.stderr b/src/test/ui/parser/tag-variant-disr-non-nullary.stderr index cc6312b45455..884e9672cb12 100644 --- a/src/test/ui/parser/tag-variant-disr-non-nullary.stderr +++ b/src/test/ui/parser/tag-variant-disr-non-nullary.stderr @@ -3,7 +3,7 @@ error: discriminator values can only be used with a field-less enum | LL | Red = 0xff0000, | ^^^^^^^^ only valid in field-less enums -LL | //~^ ERROR discriminator values can only be used with a field-less enum +LL | LL | Green = 0x00ff00, | ^^^^^^^^ only valid in field-less enums LL | Blue = 0x0000ff, diff --git a/src/test/ui/parser/trait-bounds-not-on-impl.stderr b/src/test/ui/parser/trait-bounds-not-on-impl.stderr index 3c0346c96b28..a712f68044ec 100644 --- a/src/test/ui/parser/trait-bounds-not-on-impl.stderr +++ b/src/test/ui/parser/trait-bounds-not-on-impl.stderr @@ -1,7 +1,7 @@ error: expected a trait, found type --> $DIR/trait-bounds-not-on-impl.rs:8:6 | -LL | impl Foo + Owned for Bar { //~ ERROR expected a trait, found type +LL | impl Foo + Owned for Bar { | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/parser/trait-object-lifetime-parens.stderr b/src/test/ui/parser/trait-object-lifetime-parens.stderr index 94ca66aef729..084e6d5b11fc 100644 --- a/src/test/ui/parser/trait-object-lifetime-parens.stderr +++ b/src/test/ui/parser/trait-object-lifetime-parens.stderr @@ -1,19 +1,19 @@ error: parenthesized lifetime bounds are not supported --> $DIR/trait-object-lifetime-parens.rs:5:21 | -LL | fn f<'a, T: Trait + ('a)>() {} //~ ERROR parenthesized lifetime bounds are not supported +LL | fn f<'a, T: Trait + ('a)>() {} | ^^^^ help: remove the parentheses error: parenthesized lifetime bounds are not supported --> $DIR/trait-object-lifetime-parens.rs:8:24 | -LL | let _: Box; //~ ERROR parenthesized lifetime bounds are not supported +LL | let _: Box; | ^^^^ help: remove the parentheses error: expected type, found `'a` --> $DIR/trait-object-lifetime-parens.rs:9:17 | -LL | let _: Box<('a) + Trait>; //~ ERROR expected type, found `'a` +LL | let _: Box<('a) + Trait>; | - ^^ | | | while parsing the type for `_` diff --git a/src/test/ui/parser/unclosed-braces.stderr b/src/test/ui/parser/unclosed-braces.stderr index 3ab366446d86..44c7e930a3a4 100644 --- a/src/test/ui/parser/unclosed-braces.stderr +++ b/src/test/ui/parser/unclosed-braces.stderr @@ -10,7 +10,7 @@ LL | { LL | } | - ...as it matches this but it has different indentation ... -LL | //~ ERROR this file contains an un-closed delimiter +LL | | ^ error: aborting due to previous error diff --git a/src/test/ui/parser/unclosed-delimiter-in-dep.rs b/src/test/ui/parser/unclosed-delimiter-in-dep.rs new file mode 100644 index 000000000000..6db1b66e9f78 --- /dev/null +++ b/src/test/ui/parser/unclosed-delimiter-in-dep.rs @@ -0,0 +1,6 @@ +mod unclosed_delim_mod; + +fn main() { + let _: usize = unclosed_delim_mod::new(); + //~^ ERROR mismatched types +} diff --git a/src/test/ui/parser/unclosed-delimiter-in-dep.stderr b/src/test/ui/parser/unclosed-delimiter-in-dep.stderr new file mode 100644 index 000000000000..633c63bea910 --- /dev/null +++ b/src/test/ui/parser/unclosed-delimiter-in-dep.stderr @@ -0,0 +1,23 @@ +error: incorrect close delimiter: `}` + --> $DIR/unclosed_delim_mod.rs:5:1 + | +LL | pub fn new() -> Result { + | - close delimiter possibly meant for this +LL | Ok(Value { + | - un-closed delimiter +LL | } +LL | } + | ^ incorrect close delimiter + +error[E0308]: mismatched types + --> $DIR/unclosed-delimiter-in-dep.rs:4:20 + | +LL | let _: usize = unclosed_delim_mod::new(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected usize, found enum `std::result::Result` + | + = note: expected type `usize` + found type `std::result::Result` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/parser/unclosed_delim_mod.rs b/src/test/ui/parser/unclosed_delim_mod.rs new file mode 100644 index 000000000000..b1664f49dc59 --- /dev/null +++ b/src/test/ui/parser/unclosed_delim_mod.rs @@ -0,0 +1,6 @@ +pub struct Value {} +pub fn new() -> Result { + Ok(Value { + } +} +//~^ ERROR incorrect close delimiter diff --git a/src/test/ui/parser/unclosed_delim_mod.stderr b/src/test/ui/parser/unclosed_delim_mod.stderr new file mode 100644 index 000000000000..cc04eb531cbe --- /dev/null +++ b/src/test/ui/parser/unclosed_delim_mod.stderr @@ -0,0 +1,18 @@ +error: incorrect close delimiter: `}` + --> $DIR/unclosed_delim_mod.rs:5:1 + | +LL | pub fn new() -> Result { + | - close delimiter possibly meant for this +LL | Ok(Value { + | - un-closed delimiter +LL | } +LL | } + | ^ incorrect close delimiter + +error[E0601]: `main` function not found in crate `unclosed_delim_mod` + | + = note: consider adding a `main` function to `$DIR/unclosed_delim_mod.rs` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0601`. diff --git a/src/test/ui/parser/underscore-suffix-for-float.stderr b/src/test/ui/parser/underscore-suffix-for-float.stderr index 58adcbbba76b..a5f3b6551aa2 100644 --- a/src/test/ui/parser/underscore-suffix-for-float.stderr +++ b/src/test/ui/parser/underscore-suffix-for-float.stderr @@ -1,13 +1,13 @@ error: expected identifier, found reserved identifier `_` --> $DIR/underscore-suffix-for-float.rs:2:16 | -LL | let a = 42._; //~ ERROR expected identifier, found reserved identifier `_` +LL | let a = 42._; | ^ expected identifier, found reserved identifier error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/underscore-suffix-for-float.rs:2:16 | -LL | let a = 42._; //~ ERROR expected identifier, found reserved identifier `_` +LL | let a = 42._; | ^ error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/underscore_static.stderr b/src/test/ui/parser/underscore_static.stderr index 3bf3ce88a63c..4c41afdc3f09 100644 --- a/src/test/ui/parser/underscore_static.stderr +++ b/src/test/ui/parser/underscore_static.stderr @@ -1,7 +1,7 @@ error: expected identifier, found reserved identifier `_` --> $DIR/underscore_static.rs:1:8 | -LL | static _: () = (); //~ ERROR expected identifier, found reserved identifier `_` +LL | static _: () = (); | ^ expected identifier, found reserved identifier error: aborting due to previous error diff --git a/src/test/ui/parser/unmatched-delimiter-at-end-of-file.stderr b/src/test/ui/parser/unmatched-delimiter-at-end-of-file.stderr index 442837e58080..bfbdb0363ef6 100644 --- a/src/test/ui/parser/unmatched-delimiter-at-end-of-file.stderr +++ b/src/test/ui/parser/unmatched-delimiter-at-end-of-file.stderr @@ -1,7 +1,7 @@ error: this file contains an un-closed delimiter --> $DIR/unmatched-delimiter-at-end-of-file.rs:11:64 | -LL | fn foo() { //~ ERROR this file contains an un-closed delimiter +LL | fn foo() { | - un-closed delimiter ^ error: aborting due to previous error diff --git a/src/test/ui/parser/unsized2.stderr b/src/test/ui/parser/unsized2.stderr index fd12d86144c9..17e39b292005 100644 --- a/src/test/ui/parser/unsized2.stderr +++ b/src/test/ui/parser/unsized2.stderr @@ -1,7 +1,7 @@ error: expected expression, found keyword `type` --> $DIR/unsized2.rs:6:7 | -LL | f(); //~ ERROR expected expression, found keyword `type` +LL | f(); | ^^^^ expected expression error: aborting due to previous error diff --git a/src/test/ui/parser/use-as-where-use-ends-with-mod-sep.stderr b/src/test/ui/parser/use-as-where-use-ends-with-mod-sep.stderr index 51e1a02cbd76..36917523555b 100644 --- a/src/test/ui/parser/use-as-where-use-ends-with-mod-sep.stderr +++ b/src/test/ui/parser/use-as-where-use-ends-with-mod-sep.stderr @@ -1,17 +1,17 @@ error: expected identifier, found keyword `as` --> $DIR/use-as-where-use-ends-with-mod-sep.rs:3:16 | -LL | use std::any:: as foo; //~ ERROR expected identifier, found keyword `as` +LL | use std::any:: as foo; | ^^ expected identifier, found keyword help: you can escape reserved keywords to use them as identifiers | -LL | use std::any:: r#as foo; //~ ERROR expected identifier, found keyword `as` +LL | use std::any:: r#as foo; | ^^^^ error: expected one of `::`, `;`, or `as`, found `foo` --> $DIR/use-as-where-use-ends-with-mod-sep.rs:3:19 | -LL | use std::any:: as foo; //~ ERROR expected identifier, found keyword `as` +LL | use std::any:: as foo; | ^^^ expected one of `::`, `;`, or `as` here error: aborting due to 2 previous errors diff --git a/src/test/ui/parser/use-ends-with-mod-sep.stderr b/src/test/ui/parser/use-ends-with-mod-sep.stderr index 4a2b95ada6d2..bd0d881a06c3 100644 --- a/src/test/ui/parser/use-ends-with-mod-sep.stderr +++ b/src/test/ui/parser/use-ends-with-mod-sep.stderr @@ -1,7 +1,7 @@ error: expected identifier, found `;` --> $DIR/use-ends-with-mod-sep.rs:1:15 | -LL | use std::any::; //~ ERROR expected identifier, found `;` +LL | use std::any::; | ^ expected identifier error: aborting due to previous error diff --git a/src/test/ui/parser/variadic-ffi-3.rs b/src/test/ui/parser/variadic-ffi-3.rs index 13bce27bb834..ce83cc87abe0 100644 --- a/src/test/ui/parser/variadic-ffi-3.rs +++ b/src/test/ui/parser/variadic-ffi-3.rs @@ -1,5 +1,5 @@ fn foo(x: isize, ...) { - //~^ ERROR: only foreign functions are allowed to be variadic + //~^ ERROR: only foreign functions are allowed to be C-variadic } fn main() {} diff --git a/src/test/ui/parser/variadic-ffi-3.stderr b/src/test/ui/parser/variadic-ffi-3.stderr index 150de9e63d39..8ea4d194396f 100644 --- a/src/test/ui/parser/variadic-ffi-3.stderr +++ b/src/test/ui/parser/variadic-ffi-3.stderr @@ -1,4 +1,4 @@ -error: only foreign functions are allowed to be variadic +error: only foreign functions are allowed to be C-variadic --> $DIR/variadic-ffi-3.rs:1:18 | LL | fn foo(x: isize, ...) { diff --git a/src/test/ui/parser/variadic-ffi-4.rs b/src/test/ui/parser/variadic-ffi-4.rs index 812ed256a5d3..5f8b3f8f539b 100644 --- a/src/test/ui/parser/variadic-ffi-4.rs +++ b/src/test/ui/parser/variadic-ffi-4.rs @@ -1,5 +1,5 @@ extern "C" fn foo(x: isize, ...) { - //~^ ERROR: only foreign functions are allowed to be variadic + //~^ ERROR: only foreign functions are allowed to be C-variadic } fn main() {} diff --git a/src/test/ui/parser/variadic-ffi-4.stderr b/src/test/ui/parser/variadic-ffi-4.stderr index 2d036b0cf379..69fbf84869c1 100644 --- a/src/test/ui/parser/variadic-ffi-4.stderr +++ b/src/test/ui/parser/variadic-ffi-4.stderr @@ -1,4 +1,4 @@ -error: only foreign functions are allowed to be variadic +error: only foreign functions are allowed to be C-variadic --> $DIR/variadic-ffi-4.rs:1:29 | LL | extern "C" fn foo(x: isize, ...) { diff --git a/src/test/ui/partialeq_help.stderr b/src/test/ui/partialeq_help.stderr index 04eb9770c468..9021bd30a778 100644 --- a/src/test/ui/partialeq_help.stderr +++ b/src/test/ui/partialeq_help.stderr @@ -1,7 +1,7 @@ error[E0277]: can't compare `&T` with `T` --> $DIR/partialeq_help.rs:2:7 | -LL | a == b; //~ ERROR E0277 +LL | a == b; | ^^ no implementation for `&T == T` | = help: the trait `std::cmp::PartialEq` is not implemented for `&T` diff --git a/src/test/ui/path-lookahead.stderr b/src/test/ui/path-lookahead.stderr index 73c6884679dd..50593e45230b 100644 --- a/src/test/ui/path-lookahead.stderr +++ b/src/test/ui/path-lookahead.stderr @@ -1,7 +1,7 @@ warning: unnecessary parentheses around `return` value --> $DIR/path-lookahead.rs:8:10 | -LL | return (::to_string(&arg)); //~WARN unnecessary parentheses around `return` value +LL | return (::to_string(&arg)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses | note: lint level defined here @@ -14,7 +14,7 @@ LL | #![warn(unused)] warning: function is never used: `with_parens` --> $DIR/path-lookahead.rs:7:1 | -LL | fn with_parens(arg: T) -> String { //~WARN function is never used: `with_parens` +LL | fn with_parens(arg: T) -> String { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -27,6 +27,6 @@ LL | #![warn(unused)] warning: function is never used: `no_parens` --> $DIR/path-lookahead.rs:11:1 | -LL | fn no_parens(arg: T) -> String { //~WARN function is never used: `no_parens` +LL | fn no_parens(arg: T) -> String { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/pattern/deny-irrefutable-let-patterns.stderr b/src/test/ui/pattern/deny-irrefutable-let-patterns.stderr index ad8cc2ef8973..b32cf8cbb0ef 100644 --- a/src/test/ui/pattern/deny-irrefutable-let-patterns.stderr +++ b/src/test/ui/pattern/deny-irrefutable-let-patterns.stderr @@ -1,7 +1,7 @@ error: irrefutable if-let pattern --> $DIR/deny-irrefutable-let-patterns.rs:4:5 | -LL | if let _ = 5 {} //~ ERROR irrefutable if-let pattern +LL | if let _ = 5 {} | ^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(irrefutable_let_patterns)] error: irrefutable while-let pattern --> $DIR/deny-irrefutable-let-patterns.rs:6:5 | -LL | / while let _ = 5 { //~ ERROR irrefutable while-let pattern +LL | / while let _ = 5 { LL | | break; LL | | } | |_____^ diff --git a/src/test/ui/pattern/pat-shadow-in-nested-binding.stderr b/src/test/ui/pattern/pat-shadow-in-nested-binding.stderr index 7dbe23a8f283..0c5824be95df 100644 --- a/src/test/ui/pattern/pat-shadow-in-nested-binding.stderr +++ b/src/test/ui/pattern/pat-shadow-in-nested-binding.stderr @@ -4,7 +4,7 @@ error[E0530]: let bindings cannot shadow tuple structs LL | struct foo(usize); | ------------------ the tuple struct `foo` is defined here ... -LL | let (foo, _) = (2, 3); //~ ERROR let bindings cannot shadow tuple structs +LL | let (foo, _) = (2, 3); | ^^^ cannot be named the same as a tuple struct error: aborting due to previous error diff --git a/src/test/ui/pattern/pat-tuple-bad-type.stderr b/src/test/ui/pattern/pat-tuple-bad-type.stderr index 28aa52856c55..84b9a622431e 100644 --- a/src/test/ui/pattern/pat-tuple-bad-type.stderr +++ b/src/test/ui/pattern/pat-tuple-bad-type.stderr @@ -4,7 +4,7 @@ error[E0282]: type annotations needed LL | let x; | - consider giving `x` a type ... -LL | (..) => {} //~ ERROR type annotations needed +LL | (..) => {} | ^^^^ cannot infer type | = note: type must be known at this point @@ -12,7 +12,7 @@ LL | (..) => {} //~ ERROR type annotations needed error[E0308]: mismatched types --> $DIR/pat-tuple-bad-type.rs:10:9 | -LL | (..) => {} //~ ERROR mismatched types +LL | (..) => {} | ^^^^ expected u8, found () | = note: expected type `u8` diff --git a/src/test/ui/pattern/pat-tuple-overfield.stderr b/src/test/ui/pattern/pat-tuple-overfield.stderr index 4bd374affb36..9bf14e15fcea 100644 --- a/src/test/ui/pattern/pat-tuple-overfield.stderr +++ b/src/test/ui/pattern/pat-tuple-overfield.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/pat-tuple-overfield.rs:5:9 | -LL | (1, 2, 3, 4) => {} //~ ERROR mismatched types +LL | (1, 2, 3, 4) => {} | ^^^^^^^^^^^^ expected a tuple with 3 elements, found one with 4 elements | = note: expected type `({integer}, {integer}, {integer})` @@ -10,7 +10,7 @@ LL | (1, 2, 3, 4) => {} //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/pat-tuple-overfield.rs:6:9 | -LL | (1, 2, .., 3, 4) => {} //~ ERROR mismatched types +LL | (1, 2, .., 3, 4) => {} | ^^^^^^^^^^^^^^^^ expected a tuple with 3 elements, found one with 4 elements | = note: expected type `({integer}, {integer}, {integer})` diff --git a/src/test/ui/pattern/patkind-litrange-no-expr.stderr b/src/test/ui/pattern/patkind-litrange-no-expr.stderr index 4caafa7d3e84..7474d3267936 100644 --- a/src/test/ui/pattern/patkind-litrange-no-expr.stderr +++ b/src/test/ui/pattern/patkind-litrange-no-expr.stderr @@ -1,13 +1,13 @@ error: arbitrary expressions aren't allowed in patterns --> $DIR/patkind-litrange-no-expr.rs:20:13 | -LL | Arith = 1 + 1, //~ ERROR arbitrary expressions aren't allowed in patterns +LL | Arith = 1 + 1, | ^^^^^ error[E0029]: only char and numeric types are allowed in range patterns --> $DIR/patkind-litrange-no-expr.rs:20:13 | -LL | Arith = 1 + 1, //~ ERROR arbitrary expressions aren't allowed in patterns +LL | Arith = 1 + 1, | ^^^^^ ranges require char or numeric types | = note: start type: {integer} diff --git a/src/test/ui/pattern/pattern-binding-disambiguation.stderr b/src/test/ui/pattern/pattern-binding-disambiguation.stderr index 958934c301ff..faa0d7c30743 100644 --- a/src/test/ui/pattern/pattern-binding-disambiguation.stderr +++ b/src/test/ui/pattern/pattern-binding-disambiguation.stderr @@ -4,7 +4,7 @@ error[E0530]: match bindings cannot shadow tuple structs LL | struct TupleStruct(); | --------------------- the tuple struct `TupleStruct` is defined here ... -LL | TupleStruct => {} //~ ERROR match bindings cannot shadow tuple structs +LL | TupleStruct => {} | ^^^^^^^^^^^ cannot be named the same as a tuple struct error[E0530]: match bindings cannot shadow tuple variants @@ -13,7 +13,7 @@ error[E0530]: match bindings cannot shadow tuple variants LL | use E::*; | ---- the tuple variant `TupleVariant` is imported here ... -LL | TupleVariant => {} //~ ERROR match bindings cannot shadow tuple variants +LL | TupleVariant => {} | ^^^^^^^^^^^^ cannot be named the same as a tuple variant error[E0530]: match bindings cannot shadow struct variants @@ -22,7 +22,7 @@ error[E0530]: match bindings cannot shadow struct variants LL | use E::*; | ---- the struct variant `BracedVariant` is imported here ... -LL | BracedVariant => {} //~ ERROR match bindings cannot shadow struct variants +LL | BracedVariant => {} | ^^^^^^^^^^^^^ cannot be named the same as a struct variant error[E0530]: match bindings cannot shadow statics @@ -31,7 +31,7 @@ error[E0530]: match bindings cannot shadow statics LL | static STATIC: () = (); | ----------------------- the static `STATIC` is defined here ... -LL | STATIC => {} //~ ERROR match bindings cannot shadow statics +LL | STATIC => {} | ^^^^^^ cannot be named the same as a static error[E0530]: let bindings cannot shadow tuple structs @@ -40,7 +40,7 @@ error[E0530]: let bindings cannot shadow tuple structs LL | struct TupleStruct(); | --------------------- the tuple struct `TupleStruct` is defined here ... -LL | let TupleStruct = doesnt_matter; //~ ERROR let bindings cannot shadow tuple structs +LL | let TupleStruct = doesnt_matter; | ^^^^^^^^^^^ cannot be named the same as a tuple struct error[E0530]: let bindings cannot shadow tuple variants @@ -49,7 +49,7 @@ error[E0530]: let bindings cannot shadow tuple variants LL | use E::*; | ---- the tuple variant `TupleVariant` is imported here ... -LL | let TupleVariant = doesnt_matter; //~ ERROR let bindings cannot shadow tuple variants +LL | let TupleVariant = doesnt_matter; | ^^^^^^^^^^^^ cannot be named the same as a tuple variant error[E0530]: let bindings cannot shadow struct variants @@ -58,7 +58,7 @@ error[E0530]: let bindings cannot shadow struct variants LL | use E::*; | ---- the struct variant `BracedVariant` is imported here ... -LL | let BracedVariant = doesnt_matter; //~ ERROR let bindings cannot shadow struct variants +LL | let BracedVariant = doesnt_matter; | ^^^^^^^^^^^^^ cannot be named the same as a struct variant error[E0530]: let bindings cannot shadow statics @@ -67,7 +67,7 @@ error[E0530]: let bindings cannot shadow statics LL | static STATIC: () = (); | ----------------------- the static `STATIC` is defined here ... -LL | let STATIC = doesnt_matter; //~ ERROR let bindings cannot shadow statics +LL | let STATIC = doesnt_matter; | ^^^^^^ cannot be named the same as a static error: aborting due to 8 previous errors diff --git a/src/test/ui/pattern/pattern-error-continue.stderr b/src/test/ui/pattern/pattern-error-continue.stderr index 654814afcfe1..11e0c31cfa62 100644 --- a/src/test/ui/pattern/pattern-error-continue.stderr +++ b/src/test/ui/pattern/pattern-error-continue.stderr @@ -1,13 +1,13 @@ error[E0433]: failed to resolve: use of undeclared type or module `E` --> $DIR/pattern-error-continue.rs:35:9 | -LL | E::V => {} //~ ERROR failed to resolve: use of undeclared type or module `E` +LL | E::V => {} | ^ use of undeclared type or module `E` error[E0532]: expected tuple struct/variant, found unit variant `A::D` --> $DIR/pattern-error-continue.rs:18:9 | -LL | A::D(_) => (), //~ ERROR expected tuple struct/variant, found unit variant `A::D` +LL | A::D(_) => (), | ^^^- | | | help: a tuple variant with a similar name exists: `B` @@ -15,7 +15,7 @@ LL | A::D(_) => (), //~ ERROR expected tuple struct/variant, found error[E0023]: this pattern has 3 fields, but the corresponding tuple variant has 2 fields --> $DIR/pattern-error-continue.rs:17:9 | -LL | A::B(_, _, _) => (), //~ ERROR this pattern has 3 fields, but +LL | A::B(_, _, _) => (), | ^^^^^^^^^^^^^ expected 2 fields, found 3 error[E0308]: mismatched types diff --git a/src/test/ui/pattern/pattern-ident-path-generics.stderr b/src/test/ui/pattern/pattern-ident-path-generics.stderr index 278b3d19d8bc..bfc10c5f8665 100644 --- a/src/test/ui/pattern/pattern-ident-path-generics.stderr +++ b/src/test/ui/pattern/pattern-ident-path-generics.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/pattern-ident-path-generics.rs:3:9 | -LL | None:: => {} //~ ERROR mismatched types +LL | None:: => {} | ^^^^^^^^^^^^^ expected &str, found isize | = note: expected type `std::option::Option<&str>` diff --git a/src/test/ui/pattern/pattern-tyvar.stderr b/src/test/ui/pattern/pattern-tyvar.stderr index 69cd552aabd1..548347034671 100644 --- a/src/test/ui/pattern/pattern-tyvar.stderr +++ b/src/test/ui/pattern/pattern-tyvar.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | match t { | - this match expression has type `std::option::Option>` -LL | Bar::T1(_, Some::(x)) => { //~ ERROR mismatched types +LL | Bar::T1(_, Some::(x)) => { | ^^^^^^^^^^^^^^^^ expected struct `std::vec::Vec`, found isize | = note: expected type `std::option::Option>` diff --git a/src/test/ui/pattern/slice-pattern-const-2.stderr b/src/test/ui/pattern/slice-pattern-const-2.stderr index 95651ccc401e..e2c408a90e4e 100644 --- a/src/test/ui/pattern/slice-pattern-const-2.stderr +++ b/src/test/ui/pattern/slice-pattern-const-2.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/slice-pattern-const-2.rs:9:9 | -LL | [4, 5, 6, 7] => (), //~ ERROR unreachable pattern +LL | [4, 5, 6, 7] => (), | ^^^^^^^^^^^^ | note: lint level defined here @@ -13,13 +13,13 @@ LL | #![deny(unreachable_patterns)] error: unreachable pattern --> $DIR/slice-pattern-const-2.rs:15:9 | -LL | [4, 5, 6, 7] => (), //~ ERROR unreachable pattern +LL | [4, 5, 6, 7] => (), | ^^^^^^^^^^^^ error: unreachable pattern --> $DIR/slice-pattern-const-2.rs:28:9 | -LL | FOO => (), //~ ERROR unreachable pattern +LL | FOO => (), | ^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/pattern/slice-pattern-const-3.stderr b/src/test/ui/pattern/slice-pattern-const-3.stderr index 531bbbc84d03..eab4fc3f086d 100644 --- a/src/test/ui/pattern/slice-pattern-const-3.stderr +++ b/src/test/ui/pattern/slice-pattern-const-3.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/slice-pattern-const-3.rs:28:9 | -LL | FOO => (), //~ ERROR unreachable pattern +LL | FOO => (), | ^^^ | note: lint level defined here diff --git a/src/test/ui/pattern/slice-pattern-const.stderr b/src/test/ui/pattern/slice-pattern-const.stderr index 412e0158c01c..2dd10a0478ab 100644 --- a/src/test/ui/pattern/slice-pattern-const.stderr +++ b/src/test/ui/pattern/slice-pattern-const.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/slice-pattern-const.rs:9:9 | -LL | [84, 69, 83, 84] => (), //~ ERROR unreachable pattern +LL | [84, 69, 83, 84] => (), | ^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,43 +13,43 @@ LL | #![deny(unreachable_patterns)] error: unreachable pattern --> $DIR/slice-pattern-const.rs:15:9 | -LL | [84, 69, 83, 84] => (), //~ ERROR unreachable pattern +LL | [84, 69, 83, 84] => (), | ^^^^^^^^^^^^^^^^ error: unreachable pattern --> $DIR/slice-pattern-const.rs:21:9 | -LL | MAGIC_TEST => (), //~ ERROR unreachable pattern +LL | MAGIC_TEST => (), | ^^^^^^^^^^ error: unreachable pattern --> $DIR/slice-pattern-const.rs:28:9 | -LL | FOO => (), //~ ERROR unreachable pattern +LL | FOO => (), | ^^^ error: unreachable pattern --> $DIR/slice-pattern-const.rs:35:9 | -LL | BAR => (), //~ ERROR unreachable pattern +LL | BAR => (), | ^^^ error: unreachable pattern --> $DIR/slice-pattern-const.rs:43:9 | -LL | BOO => (), //~ ERROR unreachable pattern +LL | BOO => (), | ^^^ error: unreachable pattern --> $DIR/slice-pattern-const.rs:44:9 | -LL | b"" => (), //~ ERROR unreachable pattern +LL | b"" => (), | ^^^ error: unreachable pattern --> $DIR/slice-pattern-const.rs:45:9 | -LL | _ => (), //~ ERROR unreachable pattern +LL | _ => (), | ^ error: aborting due to 8 previous errors diff --git a/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr b/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr index 5ebe00e624fc..ee1e36081e77 100644 --- a/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr +++ b/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr @@ -34,7 +34,7 @@ error[E0308]: mismatched types LL | fn baz() -> impl std::fmt::Display { | ---------------------- expected because this return type... LL | / if false { -LL | | //~^ ERROR mismatched types +LL | | LL | | return 0i32; | | ---- ...is found to be `i32` here LL | | } else { @@ -54,7 +54,7 @@ LL | | 0i32 LL | | } else { LL | | 1u32 | | ^^^^ expected i32, found u32 -LL | | //~^ ERROR if and else have incompatible types +LL | | LL | | } | |_____- if and else have incompatible types | diff --git a/src/test/ui/precise_pointer_size_matching.stderr b/src/test/ui/precise_pointer_size_matching.stderr index 4acbec6c7ff1..6f0322fd9b95 100644 --- a/src/test/ui/precise_pointer_size_matching.stderr +++ b/src/test/ui/precise_pointer_size_matching.stderr @@ -1,14 +1,18 @@ error[E0004]: non-exhaustive patterns: `$ISIZE_MIN..=-6isize` and `21isize..=$ISIZE_MAX` not covered --> $DIR/precise_pointer_size_matching.rs:24:11 | -LL | match 0isize { //~ ERROR non-exhaustive patterns +LL | match 0isize { | ^^^^^^ patterns `$ISIZE_MIN..=-6isize` and `21isize..=$ISIZE_MAX` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `0usize` and `21usize..=$USIZE_MAX` not covered --> $DIR/precise_pointer_size_matching.rs:29:11 | -LL | match 0usize { //~ ERROR non-exhaustive patterns +LL | match 0usize { | ^^^^^^ patterns `0usize` and `21usize..=$USIZE_MAX` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to 2 previous errors diff --git a/src/test/ui/prim-with-args.stderr b/src/test/ui/prim-with-args.stderr index 91259e87efc0..4535633bc6f3 100644 --- a/src/test/ui/prim-with-args.stderr +++ b/src/test/ui/prim-with-args.stderr @@ -1,133 +1,133 @@ error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:3:14 | -LL | let x: isize; //~ ERROR type arguments are not allowed on this entity +LL | let x: isize; | ^^^^^ type argument not allowed error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:4:11 | -LL | let x: i8; //~ ERROR type arguments are not allowed on this entity +LL | let x: i8; | ^^^^^ type argument not allowed error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:5:12 | -LL | let x: i16; //~ ERROR type arguments are not allowed on this entity +LL | let x: i16; | ^^^^^ type argument not allowed error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:6:12 | -LL | let x: i32; //~ ERROR type arguments are not allowed on this entity +LL | let x: i32; | ^^^^^ type argument not allowed error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:7:12 | -LL | let x: i64; //~ ERROR type arguments are not allowed on this entity +LL | let x: i64; | ^^^^^ type argument not allowed error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:8:14 | -LL | let x: usize; //~ ERROR type arguments are not allowed on this entity +LL | let x: usize; | ^^^^^ type argument not allowed error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:9:11 | -LL | let x: u8; //~ ERROR type arguments are not allowed on this entity +LL | let x: u8; | ^^^^^ type argument not allowed error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:10:12 | -LL | let x: u16; //~ ERROR type arguments are not allowed on this entity +LL | let x: u16; | ^^^^^ type argument not allowed error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:11:12 | -LL | let x: u32; //~ ERROR type arguments are not allowed on this entity +LL | let x: u32; | ^^^^^ type argument not allowed error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:12:12 | -LL | let x: u64; //~ ERROR type arguments are not allowed on this entity +LL | let x: u64; | ^^^^^ type argument not allowed error[E0109]: type arguments are not allowed on this entity --> $DIR/prim-with-args.rs:13:13 | -LL | let x: char; //~ ERROR type arguments are not allowed on this entity +LL | let x: char; | ^^^^^ type argument not allowed error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:15:14 | -LL | let x: isize<'static>; //~ ERROR lifetime arguments are not allowed on this entity +LL | let x: isize<'static>; | ^^^^^^^ lifetime argument not allowed error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:16:11 | -LL | let x: i8<'static>; //~ ERROR lifetime arguments are not allowed on this entity +LL | let x: i8<'static>; | ^^^^^^^ lifetime argument not allowed error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:17:12 | -LL | let x: i16<'static>; //~ ERROR lifetime arguments are not allowed on this entity +LL | let x: i16<'static>; | ^^^^^^^ lifetime argument not allowed error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:18:12 | -LL | let x: i32<'static>; //~ ERROR lifetime arguments are not allowed on this entity +LL | let x: i32<'static>; | ^^^^^^^ lifetime argument not allowed error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:19:12 | -LL | let x: i64<'static>; //~ ERROR lifetime arguments are not allowed on this entity +LL | let x: i64<'static>; | ^^^^^^^ lifetime argument not allowed error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:20:14 | -LL | let x: usize<'static>; //~ ERROR lifetime arguments are not allowed on this entity +LL | let x: usize<'static>; | ^^^^^^^ lifetime argument not allowed error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:21:11 | -LL | let x: u8<'static>; //~ ERROR lifetime arguments are not allowed on this entity +LL | let x: u8<'static>; | ^^^^^^^ lifetime argument not allowed error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:22:12 | -LL | let x: u16<'static>; //~ ERROR lifetime arguments are not allowed on this entity +LL | let x: u16<'static>; | ^^^^^^^ lifetime argument not allowed error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:23:12 | -LL | let x: u32<'static>; //~ ERROR lifetime arguments are not allowed on this entity +LL | let x: u32<'static>; | ^^^^^^^ lifetime argument not allowed error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:24:12 | -LL | let x: u64<'static>; //~ ERROR lifetime arguments are not allowed on this entity +LL | let x: u64<'static>; | ^^^^^^^ lifetime argument not allowed error[E0110]: lifetime arguments are not allowed on this entity --> $DIR/prim-with-args.rs:25:13 | -LL | let x: char<'static>; //~ ERROR lifetime arguments are not allowed on this entity +LL | let x: char<'static>; | ^^^^^^^ lifetime argument not allowed error: aborting due to 22 previous errors diff --git a/src/test/ui/primitive-binop-lhs-mut.rs b/src/test/ui/primitive-binop-lhs-mut.rs new file mode 100644 index 000000000000..4f1c456ace35 --- /dev/null +++ b/src/test/ui/primitive-binop-lhs-mut.rs @@ -0,0 +1,6 @@ +// run-pass + +fn main() { + let x = Box::new(0); + assert_eq!(0, *x + { drop(x); let _ = Box::new(main); 0 }); +} diff --git a/src/test/ui/priv-in-bad-locations.stderr b/src/test/ui/priv-in-bad-locations.stderr index 09706a6d255b..713568f879da 100644 --- a/src/test/ui/priv-in-bad-locations.stderr +++ b/src/test/ui/priv-in-bad-locations.stderr @@ -1,7 +1,7 @@ error[E0449]: unnecessary visibility qualifier --> $DIR/priv-in-bad-locations.rs:1:1 | -LL | pub extern { //~ ERROR unnecessary visibility qualifier +LL | pub extern { | ^^^ `pub` not permitted here because it's implied | = note: place qualifiers on individual foreign items instead @@ -9,7 +9,7 @@ LL | pub extern { //~ ERROR unnecessary visibility qualifier error[E0449]: unnecessary visibility qualifier --> $DIR/priv-in-bad-locations.rs:11:1 | -LL | pub impl B {} //~ ERROR unnecessary visibility qualifier +LL | pub impl B {} | ^^^ `pub` not permitted here because it's implied | = note: place qualifiers on individual impl items instead @@ -17,13 +17,13 @@ LL | pub impl B {} //~ ERROR unnecessary visibility qualifier error[E0449]: unnecessary visibility qualifier --> $DIR/priv-in-bad-locations.rs:13:1 | -LL | pub impl A for B { //~ ERROR unnecessary visibility qualifier +LL | pub impl A for B { | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/priv-in-bad-locations.rs:14:5 | -LL | pub fn foo(&self) {} //~ ERROR unnecessary visibility qualifier +LL | pub fn foo(&self) {} | ^^^ `pub` not permitted here because it's implied error: aborting due to 4 previous errors diff --git a/src/test/ui/privacy/decl-macro.stderr b/src/test/ui/privacy/decl-macro.stderr index c8b043d1b5f3..230cf95de620 100644 --- a/src/test/ui/privacy/decl-macro.stderr +++ b/src/test/ui/privacy/decl-macro.stderr @@ -1,7 +1,7 @@ error[E0603]: macro `mac` is private --> $DIR/decl-macro.rs:8:8 | -LL | m::mac!(); //~ ERROR macro `mac` is private +LL | m::mac!(); | ^^^ error: aborting due to previous error diff --git a/src/test/ui/privacy/privacy-in-paths.stderr b/src/test/ui/privacy/privacy-in-paths.stderr index 563aaec89aa3..4b9faca04570 100644 --- a/src/test/ui/privacy/privacy-in-paths.stderr +++ b/src/test/ui/privacy/privacy-in-paths.stderr @@ -1,19 +1,19 @@ error[E0603]: module `bar` is private --> $DIR/privacy-in-paths.rs:24:16 | -LL | ::foo::bar::baz::f(); //~ERROR module `bar` is private +LL | ::foo::bar::baz::f(); | ^^^ error[E0603]: module `bar` is private --> $DIR/privacy-in-paths.rs:25:16 | -LL | ::foo::bar::S::f(); //~ERROR module `bar` is private +LL | ::foo::bar::S::f(); | ^^^ error[E0603]: trait `T` is private --> $DIR/privacy-in-paths.rs:26:23 | -LL | <() as ::foo::T>::Assoc::f(); //~ERROR trait `T` is private +LL | <() as ::foo::T>::Assoc::f(); | ^ error: aborting due to 3 previous errors diff --git a/src/test/ui/privacy/privacy-ns1.stderr b/src/test/ui/privacy/privacy-ns1.stderr index 6ba2dbe41a2b..07b013be7251 100644 --- a/src/test/ui/privacy/privacy-ns1.stderr +++ b/src/test/ui/privacy/privacy-ns1.stderr @@ -1,11 +1,11 @@ error[E0423]: expected function, found trait `Bar` --> $DIR/privacy-ns1.rs:20:5 | -LL | Bar(); //~ ERROR expected function, found trait `Bar` +LL | Bar(); | ^^^ help: a unit struct with a similar name exists | -LL | Baz(); //~ ERROR expected function, found trait `Bar` +LL | Baz(); | ^^^ help: possible better candidates are found in other modules, you can import them into scope | @@ -19,11 +19,11 @@ LL | use foo3::Bar; error[E0573]: expected type, found function `Bar` --> $DIR/privacy-ns1.rs:35:17 | -LL | let _x: Box; //~ ERROR expected type, found function `Bar` +LL | let _x: Box; | ^^^ help: a struct with a similar name exists | -LL | let _x: Box; //~ ERROR expected type, found function `Bar` +LL | let _x: Box; | ^^^ help: possible better candidates are found in other modules, you can import them into scope | @@ -37,11 +37,11 @@ LL | use foo3::Bar; error[E0425]: cannot find function `Bar` in this scope --> $DIR/privacy-ns1.rs:50:5 | -LL | Bar(); //~ ERROR cannot find function `Bar` in this scope +LL | Bar(); | ^^^ help: a unit struct with a similar name exists | -LL | Baz(); //~ ERROR cannot find function `Bar` in this scope +LL | Baz(); | ^^^ help: possible candidates are found in other modules, you can import them into scope | @@ -55,11 +55,11 @@ LL | use foo3::Bar; error[E0412]: cannot find type `Bar` in this scope --> $DIR/privacy-ns1.rs:51:17 | -LL | let _x: Box; //~ ERROR cannot find type `Bar` in this scope +LL | let _x: Box; | ^^^ help: a struct with a similar name exists | -LL | let _x: Box; //~ ERROR cannot find type `Bar` in this scope +LL | let _x: Box; | ^^^ help: possible candidates are found in other modules, you can import them into scope | diff --git a/src/test/ui/privacy/privacy-ns2.stderr b/src/test/ui/privacy/privacy-ns2.stderr index 0012072ed113..cd5b53690644 100644 --- a/src/test/ui/privacy/privacy-ns2.stderr +++ b/src/test/ui/privacy/privacy-ns2.stderr @@ -1,7 +1,7 @@ error[E0423]: expected function, found trait `Bar` --> $DIR/privacy-ns2.rs:20:5 | -LL | Bar(); //~ ERROR expected function, found trait `Bar` +LL | Bar(); | ^^^ not a function help: possible better candidates are found in other modules, you can import them into scope | @@ -15,11 +15,11 @@ LL | use foo3::Bar; error[E0423]: expected function, found trait `Bar` --> $DIR/privacy-ns2.rs:26:5 | -LL | Bar(); //~ ERROR expected function, found trait `Bar` +LL | Bar(); | ^^^ help: a unit struct with a similar name exists | -LL | Baz(); //~ ERROR expected function, found trait `Bar` +LL | Baz(); | ^^^ help: possible better candidates are found in other modules, you can import them into scope | @@ -33,7 +33,7 @@ LL | use foo3::Bar; error[E0573]: expected type, found function `Bar` --> $DIR/privacy-ns2.rs:41:18 | -LL | let _x : Box; //~ ERROR expected type, found function `Bar` +LL | let _x : Box; | ^^^ not a type help: possible better candidates are found in other modules, you can import them into scope | @@ -47,11 +47,11 @@ LL | use foo3::Bar; error[E0573]: expected type, found function `Bar` --> $DIR/privacy-ns2.rs:47:17 | -LL | let _x: Box; //~ ERROR expected type, found function `Bar` +LL | let _x: Box; | ^^^ help: a struct with a similar name exists | -LL | let _x: Box; //~ ERROR expected type, found function `Bar` +LL | let _x: Box; | ^^^ help: possible better candidates are found in other modules, you can import them into scope | @@ -65,19 +65,19 @@ LL | use foo3::Bar; error[E0603]: trait `Bar` is private --> $DIR/privacy-ns2.rs:60:15 | -LL | use foo3::Bar; //~ ERROR `Bar` is private +LL | use foo3::Bar; | ^^^ error[E0603]: trait `Bar` is private --> $DIR/privacy-ns2.rs:64:15 | -LL | use foo3::Bar; //~ ERROR `Bar` is private +LL | use foo3::Bar; | ^^^ error[E0603]: trait `Bar` is private --> $DIR/privacy-ns2.rs:71:16 | -LL | use foo3::{Bar,Baz}; //~ ERROR `Bar` is private +LL | use foo3::{Bar,Baz}; | ^^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/privacy/privacy-sanity.stderr b/src/test/ui/privacy/privacy-sanity.stderr index b1e3127645e0..c92553fd1a16 100644 --- a/src/test/ui/privacy/privacy-sanity.stderr +++ b/src/test/ui/privacy/privacy-sanity.stderr @@ -1,31 +1,31 @@ error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:13:1 | -LL | pub impl Tr for S { //~ ERROR unnecessary visibility qualifier +LL | pub impl Tr for S { | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:14:5 | -LL | pub fn f() {} //~ ERROR unnecessary visibility qualifier +LL | pub fn f() {} | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:15:5 | -LL | pub const C: u8 = 0; //~ ERROR unnecessary visibility qualifier +LL | pub const C: u8 = 0; | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:16:5 | -LL | pub type T = u8; //~ ERROR unnecessary visibility qualifier +LL | pub type T = u8; | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:18:1 | -LL | pub impl S { //~ ERROR unnecessary visibility qualifier +LL | pub impl S { | ^^^ `pub` not permitted here because it's implied | = note: place qualifiers on individual impl items instead @@ -33,7 +33,7 @@ LL | pub impl S { //~ ERROR unnecessary visibility qualifier error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:23:1 | -LL | pub extern "C" { //~ ERROR unnecessary visibility qualifier +LL | pub extern "C" { | ^^^ `pub` not permitted here because it's implied | = note: place qualifiers on individual foreign items instead @@ -41,31 +41,31 @@ LL | pub extern "C" { //~ ERROR unnecessary visibility qualifier error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:39:5 | -LL | pub impl Tr for S { //~ ERROR unnecessary visibility qualifier +LL | pub impl Tr for S { | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:40:9 | -LL | pub fn f() {} //~ ERROR unnecessary visibility qualifier +LL | pub fn f() {} | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:41:9 | -LL | pub const C: u8 = 0; //~ ERROR unnecessary visibility qualifier +LL | pub const C: u8 = 0; | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:42:9 | -LL | pub type T = u8; //~ ERROR unnecessary visibility qualifier +LL | pub type T = u8; | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:44:5 | -LL | pub impl S { //~ ERROR unnecessary visibility qualifier +LL | pub impl S { | ^^^ `pub` not permitted here because it's implied | = note: place qualifiers on individual impl items instead @@ -73,7 +73,7 @@ LL | pub impl S { //~ ERROR unnecessary visibility qualifier error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:49:5 | -LL | pub extern "C" { //~ ERROR unnecessary visibility qualifier +LL | pub extern "C" { | ^^^ `pub` not permitted here because it's implied | = note: place qualifiers on individual foreign items instead @@ -81,31 +81,31 @@ LL | pub extern "C" { //~ ERROR unnecessary visibility qualifier error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:68:5 | -LL | pub impl Tr for S { //~ ERROR unnecessary visibility qualifier +LL | pub impl Tr for S { | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:69:9 | -LL | pub fn f() {} //~ ERROR unnecessary visibility qualifier +LL | pub fn f() {} | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:70:9 | -LL | pub const C: u8 = 0; //~ ERROR unnecessary visibility qualifier +LL | pub const C: u8 = 0; | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:71:9 | -LL | pub type T = u8; //~ ERROR unnecessary visibility qualifier +LL | pub type T = u8; | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:73:5 | -LL | pub impl S { //~ ERROR unnecessary visibility qualifier +LL | pub impl S { | ^^^ `pub` not permitted here because it's implied | = note: place qualifiers on individual impl items instead @@ -113,7 +113,7 @@ LL | pub impl S { //~ ERROR unnecessary visibility qualifier error[E0449]: unnecessary visibility qualifier --> $DIR/privacy-sanity.rs:78:5 | -LL | pub extern "C" { //~ ERROR unnecessary visibility qualifier +LL | pub extern "C" { | ^^^ `pub` not permitted here because it's implied | = note: place qualifiers on individual foreign items instead diff --git a/src/test/ui/privacy/privacy-ufcs.stderr b/src/test/ui/privacy/privacy-ufcs.stderr index c70afe5061d3..6be14df89d20 100644 --- a/src/test/ui/privacy/privacy-ufcs.stderr +++ b/src/test/ui/privacy/privacy-ufcs.stderr @@ -1,7 +1,7 @@ error[E0603]: trait `Bar` is private --> $DIR/privacy-ufcs.rs:12:20 | -LL | ::baz(); //~ERROR trait `Bar` is private +LL | ::baz(); | ^^^ error: aborting due to previous error diff --git a/src/test/ui/privacy/privacy1.stderr b/src/test/ui/privacy/privacy1.stderr index 7feebabe781a..73672d1c214f 100644 --- a/src/test/ui/privacy/privacy1.stderr +++ b/src/test/ui/privacy/privacy1.stderr @@ -13,55 +13,55 @@ LL | use bar::baz; error[E0603]: module `i` is private --> $DIR/privacy1.rs:164:20 | -LL | use self::foo::i::A; //~ ERROR: module `i` is private +LL | use self::foo::i::A; | ^ error[E0603]: module `baz` is private --> $DIR/privacy1.rs:104:16 | -LL | ::bar::baz::A::foo(); //~ ERROR: module `baz` is private +LL | ::bar::baz::A::foo(); | ^^^ error[E0603]: module `baz` is private --> $DIR/privacy1.rs:105:16 | -LL | ::bar::baz::A::bar(); //~ ERROR: module `baz` is private +LL | ::bar::baz::A::bar(); | ^^^ error[E0603]: module `baz` is private --> $DIR/privacy1.rs:107:16 | -LL | ::bar::baz::A.foo2(); //~ ERROR: module `baz` is private +LL | ::bar::baz::A.foo2(); | ^^^ error[E0603]: module `baz` is private --> $DIR/privacy1.rs:108:16 | -LL | ::bar::baz::A.bar2(); //~ ERROR: module `baz` is private +LL | ::bar::baz::A.bar2(); | ^^^ error[E0603]: trait `B` is private --> $DIR/privacy1.rs:112:16 | -LL | ::bar::B::foo(); //~ ERROR: trait `B` is private +LL | ::bar::B::foo(); | ^ error[E0603]: function `epriv` is private --> $DIR/privacy1.rs:118:20 | -LL | ::bar::epriv(); //~ ERROR: function `epriv` is private +LL | ::bar::epriv(); | ^^^^^ error[E0603]: module `baz` is private --> $DIR/privacy1.rs:127:16 | -LL | ::bar::baz::foo(); //~ ERROR: module `baz` is private +LL | ::bar::baz::foo(); | ^^^ error[E0603]: module `baz` is private --> $DIR/privacy1.rs:128:16 | -LL | ::bar::baz::bar(); //~ ERROR: module `baz` is private +LL | ::bar::baz::bar(); | ^^^ error[E0603]: trait `B` is private @@ -73,31 +73,31 @@ LL | impl ::bar::B for f32 { fn foo() -> f32 { 1.0 } } error[E0624]: method `bar` is private --> $DIR/privacy1.rs:77:9 | -LL | self::baz::A::bar(); //~ ERROR: method `bar` is private +LL | self::baz::A::bar(); | ^^^^^^^^^^^^^^^^^ error[E0624]: method `bar` is private --> $DIR/privacy1.rs:95:5 | -LL | bar::A::bar(); //~ ERROR: method `bar` is private +LL | bar::A::bar(); | ^^^^^^^^^^^ error[E0624]: method `bar` is private --> $DIR/privacy1.rs:102:9 | -LL | ::bar::A::bar(); //~ ERROR: method `bar` is private +LL | ::bar::A::bar(); | ^^^^^^^^^^^^^ error[E0624]: method `bar` is private --> $DIR/privacy1.rs:105:9 | -LL | ::bar::baz::A::bar(); //~ ERROR: module `baz` is private +LL | ::bar::baz::A::bar(); | ^^^^^^^^^^^^^^^^^^ error[E0624]: method `bar2` is private --> $DIR/privacy1.rs:108:23 | -LL | ::bar::baz::A.bar2(); //~ ERROR: module `baz` is private +LL | ::bar::baz::A.bar2(); | ^^^^ error: aborting due to 17 previous errors diff --git a/src/test/ui/privacy/privacy4.stderr b/src/test/ui/privacy/privacy4.stderr index 9e3e48272f90..e4a20f920a06 100644 --- a/src/test/ui/privacy/privacy4.stderr +++ b/src/test/ui/privacy/privacy4.stderr @@ -1,7 +1,7 @@ error[E0603]: module `glob` is private --> $DIR/privacy4.rs:21:14 | -LL | use bar::glob::gpriv; //~ ERROR: module `glob` is private +LL | use bar::glob::gpriv; | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/privacy/privacy5.stderr b/src/test/ui/privacy/privacy5.stderr index cdd9b2cefbba..7568c346b248 100644 --- a/src/test/ui/privacy/privacy5.stderr +++ b/src/test/ui/privacy/privacy5.stderr @@ -1,289 +1,289 @@ error[E0603]: tuple struct `A` is private --> $DIR/privacy5.rs:51:16 | -LL | let a = a::A(()); //~ ERROR tuple struct `A` is private +LL | let a = a::A(()); | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:52:16 | -LL | let b = a::B(2); //~ ERROR tuple struct `B` is private +LL | let b = a::B(2); | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:53:16 | -LL | let c = a::C(2, 3); //~ ERROR tuple struct `C` is private +LL | let c = a::C(2, 3); | ^ error[E0603]: tuple struct `A` is private --> $DIR/privacy5.rs:56:12 | -LL | let a::A(()) = a; //~ ERROR tuple struct `A` is private +LL | let a::A(()) = a; | ^ error[E0603]: tuple struct `A` is private --> $DIR/privacy5.rs:57:12 | -LL | let a::A(_) = a; //~ ERROR tuple struct `A` is private +LL | let a::A(_) = a; | ^ error[E0603]: tuple struct `A` is private --> $DIR/privacy5.rs:58:18 | -LL | match a { a::A(()) => {} } //~ ERROR tuple struct `A` is private +LL | match a { a::A(()) => {} } | ^ error[E0603]: tuple struct `A` is private --> $DIR/privacy5.rs:59:18 | -LL | match a { a::A(_) => {} } //~ ERROR tuple struct `A` is private +LL | match a { a::A(_) => {} } | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:61:12 | -LL | let a::B(_) = b; //~ ERROR tuple struct `B` is private +LL | let a::B(_) = b; | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:62:12 | -LL | let a::B(_b) = b; //~ ERROR tuple struct `B` is private +LL | let a::B(_b) = b; | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:63:18 | -LL | match b { a::B(_) => {} } //~ ERROR tuple struct `B` is private +LL | match b { a::B(_) => {} } | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:64:18 | -LL | match b { a::B(_b) => {} } //~ ERROR tuple struct `B` is private +LL | match b { a::B(_b) => {} } | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:65:18 | -LL | match b { a::B(1) => {} a::B(_) => {} } //~ ERROR tuple struct `B` is private +LL | match b { a::B(1) => {} a::B(_) => {} } | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:65:32 | -LL | match b { a::B(1) => {} a::B(_) => {} } //~ ERROR tuple struct `B` is private +LL | match b { a::B(1) => {} a::B(_) => {} } | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:68:12 | -LL | let a::C(_, _) = c; //~ ERROR tuple struct `C` is private +LL | let a::C(_, _) = c; | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:69:12 | -LL | let a::C(_a, _) = c; //~ ERROR tuple struct `C` is private +LL | let a::C(_a, _) = c; | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:70:12 | -LL | let a::C(_, _b) = c; //~ ERROR tuple struct `C` is private +LL | let a::C(_, _b) = c; | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:71:12 | -LL | let a::C(_a, _b) = c; //~ ERROR tuple struct `C` is private +LL | let a::C(_a, _b) = c; | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:72:18 | -LL | match c { a::C(_, _) => {} } //~ ERROR tuple struct `C` is private +LL | match c { a::C(_, _) => {} } | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:73:18 | -LL | match c { a::C(_a, _) => {} } //~ ERROR tuple struct `C` is private +LL | match c { a::C(_a, _) => {} } | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:74:18 | -LL | match c { a::C(_, _b) => {} } //~ ERROR tuple struct `C` is private +LL | match c { a::C(_, _b) => {} } | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:75:18 | -LL | match c { a::C(_a, _b) => {} } //~ ERROR tuple struct `C` is private +LL | match c { a::C(_a, _b) => {} } | ^ error[E0603]: tuple struct `A` is private --> $DIR/privacy5.rs:83:17 | -LL | let a2 = a::A; //~ ERROR tuple struct `A` is private +LL | let a2 = a::A; | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:84:17 | -LL | let b2 = a::B; //~ ERROR tuple struct `B` is private +LL | let b2 = a::B; | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:85:17 | -LL | let c2 = a::C; //~ ERROR tuple struct `C` is private +LL | let c2 = a::C; | ^ error[E0603]: tuple struct `A` is private --> $DIR/privacy5.rs:90:20 | -LL | let a = other::A(()); //~ ERROR tuple struct `A` is private +LL | let a = other::A(()); | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:91:20 | -LL | let b = other::B(2); //~ ERROR tuple struct `B` is private +LL | let b = other::B(2); | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:92:20 | -LL | let c = other::C(2, 3); //~ ERROR tuple struct `C` is private +LL | let c = other::C(2, 3); | ^ error[E0603]: tuple struct `A` is private --> $DIR/privacy5.rs:95:16 | -LL | let other::A(()) = a; //~ ERROR tuple struct `A` is private +LL | let other::A(()) = a; | ^ error[E0603]: tuple struct `A` is private --> $DIR/privacy5.rs:96:16 | -LL | let other::A(_) = a; //~ ERROR tuple struct `A` is private +LL | let other::A(_) = a; | ^ error[E0603]: tuple struct `A` is private --> $DIR/privacy5.rs:97:22 | -LL | match a { other::A(()) => {} } //~ ERROR tuple struct `A` is private +LL | match a { other::A(()) => {} } | ^ error[E0603]: tuple struct `A` is private --> $DIR/privacy5.rs:98:22 | -LL | match a { other::A(_) => {} } //~ ERROR tuple struct `A` is private +LL | match a { other::A(_) => {} } | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:100:16 | -LL | let other::B(_) = b; //~ ERROR tuple struct `B` is private +LL | let other::B(_) = b; | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:101:16 | -LL | let other::B(_b) = b; //~ ERROR tuple struct `B` is private +LL | let other::B(_b) = b; | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:102:22 | -LL | match b { other::B(_) => {} } //~ ERROR tuple struct `B` is private +LL | match b { other::B(_) => {} } | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:103:22 | -LL | match b { other::B(_b) => {} } //~ ERROR tuple struct `B` is private +LL | match b { other::B(_b) => {} } | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:104:22 | -LL | match b { other::B(1) => {} other::B(_) => {} } //~ ERROR tuple struct `B` is private +LL | match b { other::B(1) => {} other::B(_) => {} } | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:104:40 | -LL | match b { other::B(1) => {} other::B(_) => {} } //~ ERROR tuple struct `B` is private +LL | match b { other::B(1) => {} other::B(_) => {} } | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:107:16 | -LL | let other::C(_, _) = c; //~ ERROR tuple struct `C` is private +LL | let other::C(_, _) = c; | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:108:16 | -LL | let other::C(_a, _) = c; //~ ERROR tuple struct `C` is private +LL | let other::C(_a, _) = c; | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:109:16 | -LL | let other::C(_, _b) = c; //~ ERROR tuple struct `C` is private +LL | let other::C(_, _b) = c; | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:110:16 | -LL | let other::C(_a, _b) = c; //~ ERROR tuple struct `C` is private +LL | let other::C(_a, _b) = c; | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:111:22 | -LL | match c { other::C(_, _) => {} } //~ ERROR tuple struct `C` is private +LL | match c { other::C(_, _) => {} } | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:112:22 | -LL | match c { other::C(_a, _) => {} } //~ ERROR tuple struct `C` is private +LL | match c { other::C(_a, _) => {} } | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:113:22 | -LL | match c { other::C(_, _b) => {} } //~ ERROR tuple struct `C` is private +LL | match c { other::C(_, _b) => {} } | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:114:22 | -LL | match c { other::C(_a, _b) => {} } //~ ERROR tuple struct `C` is private +LL | match c { other::C(_a, _b) => {} } | ^ error[E0603]: tuple struct `A` is private --> $DIR/privacy5.rs:122:21 | -LL | let a2 = other::A; //~ ERROR tuple struct `A` is private +LL | let a2 = other::A; | ^ error[E0603]: tuple struct `B` is private --> $DIR/privacy5.rs:123:21 | -LL | let b2 = other::B; //~ ERROR tuple struct `B` is private +LL | let b2 = other::B; | ^ error[E0603]: tuple struct `C` is private --> $DIR/privacy5.rs:124:21 | -LL | let c2 = other::C; //~ ERROR tuple struct `C` is private +LL | let c2 = other::C; | ^ error: aborting due to 48 previous errors diff --git a/src/test/ui/privacy/private-impl-method.stderr b/src/test/ui/privacy/private-impl-method.stderr index 8e254b15c789..e1da3f47a4ef 100644 --- a/src/test/ui/privacy/private-impl-method.stderr +++ b/src/test/ui/privacy/private-impl-method.stderr @@ -1,7 +1,7 @@ error[E0624]: method `foo` is private --> $DIR/private-impl-method.rs:20:7 | -LL | s.foo(); //~ ERROR method `foo` is private +LL | s.foo(); | ^^^ error: aborting due to previous error diff --git a/src/test/ui/privacy/private-in-public-assoc-ty.stderr b/src/test/ui/privacy/private-in-public-assoc-ty.stderr index 0e5dab1a08c3..a610b4759231 100644 --- a/src/test/ui/privacy/private-in-public-assoc-ty.stderr +++ b/src/test/ui/privacy/private-in-public-assoc-ty.stderr @@ -2,9 +2,9 @@ warning: private trait `m::PrivTr` in public interface (error E0445) --> $DIR/private-in-public-assoc-ty.rs:15:5 | LL | / pub trait PubTr { -LL | | //~^ WARN private trait `m::PrivTr` in public interface -LL | | //~| WARN this was previously accepted -LL | | //~| WARN private type `m::Priv` in public interface +LL | | +LL | | +LL | | ... | LL | | fn infer_exist() -> Self::Exist; LL | | } @@ -18,9 +18,9 @@ warning: private type `m::Priv` in public interface (error E0446) --> $DIR/private-in-public-assoc-ty.rs:15:5 | LL | / pub trait PubTr { -LL | | //~^ WARN private trait `m::PrivTr` in public interface -LL | | //~| WARN this was previously accepted -LL | | //~| WARN private type `m::Priv` in public interface +LL | | +LL | | +LL | | ... | LL | | fn infer_exist() -> Self::Exist; LL | | } diff --git a/src/test/ui/privacy/private-in-public-ill-formed.stderr b/src/test/ui/privacy/private-in-public-ill-formed.stderr index ab6531cc748e..a1a326f2873e 100644 --- a/src/test/ui/privacy/private-in-public-ill-formed.stderr +++ b/src/test/ui/privacy/private-in-public-ill-formed.stderr @@ -1,7 +1,7 @@ error[E0118]: no base type found for inherent implementation --> $DIR/private-in-public-ill-formed.rs:14:10 | -LL | impl ::AssocAlias { //~ ERROR no base type found for inherent implementation +LL | impl ::AssocAlias { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl requires a base type | = note: either implement a trait on it or create a newtype to wrap it instead @@ -9,7 +9,7 @@ LL | impl ::AssocAlias { //~ ERROR no base type found for in error[E0118]: no base type found for inherent implementation --> $DIR/private-in-public-ill-formed.rs:30:10 | -LL | impl ::AssocAlias { //~ ERROR no base type found for inherent implementation +LL | impl ::AssocAlias { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl requires a base type | = note: either implement a trait on it or create a newtype to wrap it instead diff --git a/src/test/ui/privacy/private-in-public-lint.stderr b/src/test/ui/privacy/private-in-public-lint.stderr index 730ac24d5e54..441a4d5cffd4 100644 --- a/src/test/ui/privacy/private-in-public-lint.stderr +++ b/src/test/ui/privacy/private-in-public-lint.stderr @@ -4,7 +4,7 @@ error[E0446]: private type `m1::Priv` in public interface LL | struct Priv; | - `m1::Priv` declared as private ... -LL | pub fn f() -> Priv {Priv} //~ ERROR private type `m1::Priv` in public interface +LL | pub fn f() -> Priv {Priv} | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `m2::Priv` in public interface @@ -13,7 +13,7 @@ error[E0446]: private type `m2::Priv` in public interface LL | struct Priv; | - `m2::Priv` declared as private ... -LL | pub fn f() -> Priv {Priv} //~ ERROR private type `m2::Priv` in public interface +LL | pub fn f() -> Priv {Priv} | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error: aborting due to 2 previous errors diff --git a/src/test/ui/privacy/private-in-public-non-principal.stderr b/src/test/ui/privacy/private-in-public-non-principal.stderr index 996740558977..729b94ed8926 100644 --- a/src/test/ui/privacy/private-in-public-non-principal.stderr +++ b/src/test/ui/privacy/private-in-public-non-principal.stderr @@ -11,7 +11,7 @@ LL | pub fn leak_dyn_nonprincipal() -> Box { lo error: missing documentation for a method --> $DIR/private-in-public-non-principal.rs:13:9 | -LL | pub fn check_doc_lint() {} //~ ERROR missing documentation for a method +LL | pub fn check_doc_lint() {} | ^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/privacy/private-in-public-warn.stderr b/src/test/ui/privacy/private-in-public-warn.stderr index 621d9a57fa07..16b7e5103283 100644 --- a/src/test/ui/privacy/private-in-public-warn.stderr +++ b/src/test/ui/privacy/private-in-public-warn.stderr @@ -1,7 +1,7 @@ error: private type `types::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:15:5 | -LL | pub type Alias = Priv; //~ ERROR private type `types::Priv` in public interface +LL | pub type Alias = Priv; | ^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -15,7 +15,7 @@ LL | #![deny(private_in_public)] error: private type `types::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:18:12 | -LL | V1(Priv), //~ ERROR private type `types::Priv` in public interface +LL | V1(Priv), | ^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -24,7 +24,7 @@ LL | V1(Priv), //~ ERROR private type `types::Priv` in public interface error: private type `types::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:20:14 | -LL | V2 { field: Priv }, //~ ERROR private type `types::Priv` in public interface +LL | V2 { field: Priv }, | ^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -33,7 +33,7 @@ LL | V2 { field: Priv }, //~ ERROR private type `types::Priv` in public error: private type `types::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:24:9 | -LL | const C: Priv = Priv; //~ ERROR private type `types::Priv` in public interface +LL | const C: Priv = Priv; | ^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -45,13 +45,13 @@ error[E0446]: private type `types::Priv` in public interface LL | struct Priv; | - `types::Priv` declared as private ... -LL | type Alias = Priv; //~ ERROR private type `types::Priv` in public interface +LL | type Alias = Priv; | ^^^^^^^^^^^^^^^^^^ can't leak private type error: private type `types::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:27:9 | -LL | fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in public interface +LL | fn f1(arg: Priv) {} | ^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -60,7 +60,7 @@ LL | fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in public error: private type `types::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:29:9 | -LL | fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` in public interface +LL | fn f2() -> Priv { panic!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -69,7 +69,7 @@ LL | fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` i error: private type `types::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:33:9 | -LL | pub static ES: Priv; //~ ERROR private type `types::Priv` in public interface +LL | pub static ES: Priv; | ^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -78,7 +78,7 @@ LL | pub static ES: Priv; //~ ERROR private type `types::Priv` in public error: private type `types::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:35:9 | -LL | pub fn ef1(arg: Priv); //~ ERROR private type `types::Priv` in public interface +LL | pub fn ef1(arg: Priv); | ^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -87,7 +87,7 @@ LL | pub fn ef1(arg: Priv); //~ ERROR private type `types::Priv` in publ error: private type `types::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:37:9 | -LL | pub fn ef2() -> Priv; //~ ERROR private type `types::Priv` in public interface +LL | pub fn ef2() -> Priv; | ^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -99,13 +99,13 @@ error[E0446]: private type `types::Priv` in public interface LL | struct Priv; | - `types::Priv` declared as private ... -LL | type Alias = Priv; //~ ERROR private type `types::Priv` in public interface +LL | type Alias = Priv; | ^^^^^^^^^^^^^^^^^^ can't leak private type error: private trait `traits::PrivTr` in public interface (error E0445) --> $DIR/private-in-public-warn.rs:50:5 | -LL | pub type Alias = T; //~ ERROR private trait `traits::PrivTr` in public interface +LL | pub type Alias = T; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -114,7 +114,7 @@ LL | pub type Alias = T; //~ ERROR private trait `traits::PrivTr` error: private trait `traits::PrivTr` in public interface (error E0445) --> $DIR/private-in-public-warn.rs:53:5 | -LL | pub trait Tr1: PrivTr {} //~ ERROR private trait `traits::PrivTr` in public interface +LL | pub trait Tr1: PrivTr {} | ^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -123,7 +123,7 @@ LL | pub trait Tr1: PrivTr {} //~ ERROR private trait `traits::PrivTr` in pu error: private trait `traits::PrivTr` in public interface (error E0445) --> $DIR/private-in-public-warn.rs:55:5 | -LL | pub trait Tr2 {} //~ ERROR private trait `traits::PrivTr` in public interface +LL | pub trait Tr2 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -133,11 +133,11 @@ error: private trait `traits::PrivTr` in public interface (error E0445) --> $DIR/private-in-public-warn.rs:57:5 | LL | / pub trait Tr3 { -LL | | //~^ ERROR private trait `traits::PrivTr` in public interface -LL | | //~| WARNING hard error +LL | | +LL | | LL | | type Alias: PrivTr; -LL | | fn f(arg: T) {} //~ ERROR private trait `traits::PrivTr` in public interface -LL | | //~^ WARNING hard error +LL | | fn f(arg: T) {} +LL | | LL | | } | |_____^ | @@ -147,7 +147,7 @@ LL | | } error: private trait `traits::PrivTr` in public interface (error E0445) --> $DIR/private-in-public-warn.rs:61:9 | -LL | fn f(arg: T) {} //~ ERROR private trait `traits::PrivTr` in public interface +LL | fn f(arg: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -156,7 +156,7 @@ LL | fn f(arg: T) {} //~ ERROR private trait `traits::PrivTr` error: private trait `traits::PrivTr` in public interface (error E0445) --> $DIR/private-in-public-warn.rs:64:5 | -LL | impl Pub {} //~ ERROR private trait `traits::PrivTr` in public interface +LL | impl Pub {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -165,7 +165,7 @@ LL | impl Pub {} //~ ERROR private trait `traits::PrivTr` in p error: private trait `traits::PrivTr` in public interface (error E0445) --> $DIR/private-in-public-warn.rs:66:5 | -LL | impl PubTr for Pub {} //~ ERROR private trait `traits::PrivTr` in public interface +LL | impl PubTr for Pub {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -228,7 +228,7 @@ LL | pub trait Tr1: PrivTr {} error: private type `generics::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:104:5 | -LL | pub trait Tr2: PubTr {} //~ ERROR private type `generics::Priv` in public interface +LL | pub trait Tr2: PubTr {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -237,7 +237,7 @@ LL | pub trait Tr2: PubTr {} //~ ERROR private type `generics::Priv` i error: private type `generics::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:106:5 | -LL | pub trait Tr3: PubTr<[Priv; 1]> {} //~ ERROR private type `generics::Priv` in public interface +LL | pub trait Tr3: PubTr<[Priv; 1]> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -246,7 +246,7 @@ LL | pub trait Tr3: PubTr<[Priv; 1]> {} //~ ERROR private type `generics::Pr error: private type `generics::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:108:5 | -LL | pub trait Tr4: PubTr> {} //~ ERROR private type `generics::Priv` in public interface +LL | pub trait Tr4: PubTr> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -258,13 +258,13 @@ error[E0446]: private type `impls::Priv` in public interface LL | struct Priv; | - `impls::Priv` declared as private ... -LL | type Alias = Priv; //~ ERROR private type `impls::Priv` in public interface +LL | type Alias = Priv; | ^^^^^^^^^^^^^^^^^^ can't leak private type error: private type `aliases_pub::Priv` in public interface (error E0446) --> $DIR/private-in-public-warn.rs:206:9 | -LL | pub fn f(arg: Priv) {} //~ ERROR private type `aliases_pub::Priv` in public interface +LL | pub fn f(arg: Priv) {} | ^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -276,7 +276,7 @@ error[E0446]: private type `aliases_pub::Priv` in public interface LL | struct Priv; | - `aliases_pub::Priv` declared as private ... -LL | type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in public interface +LL | type Check = Priv; | ^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_pub::Priv` in public interface @@ -285,7 +285,7 @@ error[E0446]: private type `aliases_pub::Priv` in public interface LL | struct Priv; | - `aliases_pub::Priv` declared as private ... -LL | type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in public interface +LL | type Check = Priv; | ^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_pub::Priv` in public interface @@ -294,7 +294,7 @@ error[E0446]: private type `aliases_pub::Priv` in public interface LL | struct Priv; | - `aliases_pub::Priv` declared as private ... -LL | type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in public interface +LL | type Check = Priv; | ^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_pub::Priv` in public interface @@ -303,7 +303,7 @@ error[E0446]: private type `aliases_pub::Priv` in public interface LL | struct Priv; | - `aliases_pub::Priv` declared as private ... -LL | type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in public interface +LL | type Check = Priv; | ^^^^^^^^^^^^^^^^^^ can't leak private type error: private trait `aliases_priv::PrivTr1` in public interface (error E0445) @@ -336,7 +336,7 @@ LL | pub trait Tr2: PrivUseAliasTr {} warning: bounds on generic parameters are not enforced in type aliases --> $DIR/private-in-public-warn.rs:50:23 | -LL | pub type Alias = T; //~ ERROR private trait `traits::PrivTr` in public interface +LL | pub type Alias = T; | ^^^^^^ | = note: #[warn(type_alias_bounds)] on by default diff --git a/src/test/ui/privacy/private-in-public.stderr b/src/test/ui/privacy/private-in-public.stderr index bf88a83e633c..3c57e50cfedf 100644 --- a/src/test/ui/privacy/private-in-public.stderr +++ b/src/test/ui/privacy/private-in-public.stderr @@ -4,7 +4,7 @@ error[E0446]: private type `types::Priv` in public interface LL | struct Priv; | - `types::Priv` declared as private ... -LL | pub const C: Priv = Priv; //~ ERROR private type `types::Priv` in public interface +LL | pub const C: Priv = Priv; | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface @@ -13,7 +13,7 @@ error[E0446]: private type `types::Priv` in public interface LL | struct Priv; | - `types::Priv` declared as private ... -LL | pub static S: Priv = Priv; //~ ERROR private type `types::Priv` in public interface +LL | pub static S: Priv = Priv; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface @@ -22,7 +22,7 @@ error[E0446]: private type `types::Priv` in public interface LL | struct Priv; | - `types::Priv` declared as private ... -LL | pub fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in public interface +LL | pub fn f1(arg: Priv) {} | ^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface @@ -31,7 +31,7 @@ error[E0446]: private type `types::Priv` in public interface LL | struct Priv; | - `types::Priv` declared as private ... -LL | pub fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` in public interface +LL | pub fn f2() -> Priv { panic!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface @@ -40,7 +40,7 @@ error[E0446]: private type `types::Priv` in public interface LL | struct Priv; | - `types::Priv` declared as private ... -LL | pub struct S1(pub Priv); //~ ERROR private type `types::Priv` in public interface +LL | pub struct S1(pub Priv); | ^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface @@ -49,7 +49,7 @@ error[E0446]: private type `types::Priv` in public interface LL | struct Priv; | - `types::Priv` declared as private ... -LL | pub struct S2 { pub field: Priv } //~ ERROR private type `types::Priv` in public interface +LL | pub struct S2 { pub field: Priv } | ^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface @@ -58,7 +58,7 @@ error[E0446]: private type `types::Priv` in public interface LL | struct Priv; | - `types::Priv` declared as private ... -LL | pub const C: Priv = Priv; //~ ERROR private type `types::Priv` in public interface +LL | pub const C: Priv = Priv; | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface @@ -67,7 +67,7 @@ error[E0446]: private type `types::Priv` in public interface LL | struct Priv; | - `types::Priv` declared as private ... -LL | pub fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in public interface +LL | pub fn f1(arg: Priv) {} | ^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `types::Priv` in public interface @@ -76,7 +76,7 @@ error[E0446]: private type `types::Priv` in public interface LL | struct Priv; | - `types::Priv` declared as private ... -LL | pub fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` in public interface +LL | pub fn f2() -> Priv { panic!() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0445]: private trait `traits::PrivTr` in public interface @@ -85,7 +85,7 @@ error[E0445]: private trait `traits::PrivTr` in public interface LL | trait PrivTr {} | - `traits::PrivTr` declared as private ... -LL | pub enum E { V(T) } //~ ERROR private trait `traits::PrivTr` in public interface +LL | pub enum E { V(T) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits::PrivTr` in public interface @@ -94,7 +94,7 @@ error[E0445]: private trait `traits::PrivTr` in public interface LL | trait PrivTr {} | - `traits::PrivTr` declared as private ... -LL | pub fn f(arg: T) {} //~ ERROR private trait `traits::PrivTr` in public interface +LL | pub fn f(arg: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits::PrivTr` in public interface @@ -103,7 +103,7 @@ error[E0445]: private trait `traits::PrivTr` in public interface LL | trait PrivTr {} | - `traits::PrivTr` declared as private ... -LL | pub struct S1(T); //~ ERROR private trait `traits::PrivTr` in public interface +LL | pub struct S1(T); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits::PrivTr` in public interface @@ -112,8 +112,8 @@ error[E0445]: private trait `traits::PrivTr` in public interface LL | trait PrivTr {} | - `traits::PrivTr` declared as private ... -LL | / impl Pub { //~ ERROR private trait `traits::PrivTr` in public interface -LL | | pub fn f(arg: U) {} //~ ERROR private trait `traits::PrivTr` in public interface +LL | / impl Pub { +LL | | pub fn f(arg: U) {} LL | | } | |_____^ can't leak private trait @@ -123,7 +123,7 @@ error[E0445]: private trait `traits::PrivTr` in public interface LL | trait PrivTr {} | - `traits::PrivTr` declared as private ... -LL | pub fn f(arg: U) {} //~ ERROR private trait `traits::PrivTr` in public interface +LL | pub fn f(arg: U) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits_where::PrivTr` in public interface @@ -160,9 +160,9 @@ LL | trait PrivTr {} | - `traits_where::PrivTr` declared as private ... LL | / impl Pub where T: PrivTr { -LL | | //~^ ERROR private trait `traits_where::PrivTr` in public interface +LL | | LL | | pub fn f(arg: U) where U: PrivTr {} -LL | | //~^ ERROR private trait `traits_where::PrivTr` in public interface +LL | | LL | | } | |_____^ can't leak private trait @@ -181,7 +181,7 @@ error[E0446]: private type `generics::Priv` in public interface LL | struct Priv(T); | - `generics::Priv` declared as private ... -LL | pub fn f1(arg: [Priv; 1]) {} //~ ERROR private type `generics::Priv` in public interface +LL | pub fn f1(arg: [Priv; 1]) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `generics::Priv` in public interface @@ -190,7 +190,7 @@ error[E0446]: private type `generics::Priv` in public interface LL | struct Priv(T); | - `generics::Priv` declared as private ... -LL | pub fn f2(arg: Pub) {} //~ ERROR private type `generics::Priv` in public interface +LL | pub fn f2(arg: Pub) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `generics::Priv` in public interface @@ -208,7 +208,7 @@ error[E0446]: private type `impls::Priv` in public interface LL | struct Priv; | - `impls::Priv` declared as private ... -LL | pub fn f(arg: Priv) {} //~ ERROR private type `impls::Priv` in public interface +LL | pub fn f(arg: Priv) {} | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0445]: private trait `aliases_pub::PrivTr` in public interface @@ -235,7 +235,7 @@ error[E0446]: private type `aliases_pub::Priv` in public interface LL | struct Priv; | - `aliases_pub::Priv` declared as private ... -LL | pub fn f(arg: Priv) {} //~ ERROR private type `aliases_pub::Priv` in public interface +LL | pub fn f(arg: Priv) {} | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_priv::Priv1` in public interface @@ -244,7 +244,7 @@ error[E0446]: private type `aliases_priv::Priv1` in public interface LL | struct Priv1; | - `aliases_priv::Priv1` declared as private ... -LL | pub fn f1(arg: PrivUseAlias) {} //~ ERROR private type `aliases_priv::Priv1` in public interface +LL | pub fn f1(arg: PrivUseAlias) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_priv::Priv2` in public interface @@ -253,7 +253,7 @@ error[E0446]: private type `aliases_priv::Priv2` in public interface LL | struct Priv2; | - `aliases_priv::Priv2` declared as private ... -LL | pub fn f2(arg: PrivAlias) {} //~ ERROR private type `aliases_priv::Priv2` in public interface +LL | pub fn f2(arg: PrivAlias) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0445]: private trait `aliases_priv::PrivTr` in public interface @@ -289,7 +289,7 @@ error[E0446]: private type `aliases_params::Priv` in public interface LL | struct Priv; | - `aliases_params::Priv` declared as private ... -LL | pub fn f3(arg: Result) {} //~ ERROR private type `aliases_params::Priv` in public interface +LL | pub fn f3(arg: Result) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error: aborting due to 32 previous errors diff --git a/src/test/ui/privacy/private-inferred-type-1.stderr b/src/test/ui/privacy/private-inferred-type-1.stderr index 06df7e847837..097b8b9a61ef 100644 --- a/src/test/ui/privacy/private-inferred-type-1.stderr +++ b/src/test/ui/privacy/private-inferred-type-1.stderr @@ -1,13 +1,13 @@ error: type `m::Priv` is private --> $DIR/private-inferred-type-1.rs:16:5 | -LL | [].arr0_secret(); //~ ERROR type `m::Priv` is private +LL | [].arr0_secret(); | ^^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type-1.rs:17:5 | -LL | None.ty_param_secret(); //~ ERROR type `m::Priv` is private +LL | None.ty_param_secret(); | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/privacy/private-inferred-type-2.stderr b/src/test/ui/privacy/private-inferred-type-2.stderr index 7a3f52fa05df..da95cc49241a 100644 --- a/src/test/ui/privacy/private-inferred-type-2.stderr +++ b/src/test/ui/privacy/private-inferred-type-2.stderr @@ -1,19 +1,19 @@ error: type `m::Priv` is private --> $DIR/private-inferred-type-2.rs:16:5 | -LL | m::Pub::get_priv; //~ ERROR type `m::Priv` is private +LL | m::Pub::get_priv; | ^^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type-2.rs:17:5 | -LL | m::Pub::static_method; //~ ERROR type `m::Priv` is private +LL | m::Pub::static_method; | ^^^^^^^^^^^^^^^^^^^^^ error: type `ext::Priv` is private --> $DIR/private-inferred-type-2.rs:18:5 | -LL | ext::Pub::static_method; //~ ERROR type `ext::Priv` is private +LL | ext::Pub::static_method; | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/privacy/private-inferred-type.stderr b/src/test/ui/privacy/private-inferred-type.stderr index 80a475f7dcee..baa98292b67b 100644 --- a/src/test/ui/privacy/private-inferred-type.stderr +++ b/src/test/ui/privacy/private-inferred-type.stderr @@ -1,97 +1,115 @@ +error[E0446]: private type `m::Priv` in public interface + --> $DIR/private-inferred-type.rs:61:36 + | +LL | struct Priv; + | - `m::Priv` declared as private +... +LL | impl TraitWithAssocTy for u8 { type AssocTy = Priv; } + | ^^^^^^^^^^^^^^^^^^^^ can't leak private type + +error[E0446]: private type `adjust::S2` in public interface + --> $DIR/private-inferred-type.rs:83:9 + | +LL | struct S2; + | - `adjust::S2` declared as private +... +LL | type Target = S2Alias; + | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type + error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:97:9 | -LL | let _: m::Alias; //~ ERROR type `m::Priv` is private +LL | let _: m::Alias; | ^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:97:12 | -LL | let _: m::Alias; //~ ERROR type `m::Priv` is private +LL | let _: m::Alias; | ^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:99:13 | -LL | let _: ::AssocTy; //~ ERROR type `m::Priv` is private +LL | let _: ::AssocTy; | ^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:100:5 | -LL | m::Alias {}; //~ ERROR type `m::Priv` is private +LL | m::Alias {}; | ^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:101:5 | -LL | m::Pub { 0: m::Alias {} }; //~ ERROR type `m::Priv` is private +LL | m::Pub { 0: m::Alias {} }; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:103:5 | -LL | m::Pub::static_method; //~ ERROR type `m::Priv` is private +LL | m::Pub::static_method; | ^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:104:5 | -LL | m::Pub::INHERENT_ASSOC_CONST; //~ ERROR type `m::Priv` is private +LL | m::Pub::INHERENT_ASSOC_CONST; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:105:5 | -LL | m::Pub(0u8).method_with_substs::(); //~ ERROR type `m::Priv` is private +LL | m::Pub(0u8).method_with_substs::(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:106:17 | -LL | m::Pub(0u8).method_with_priv_params(loop{}); //~ ERROR type `m::Priv` is private +LL | m::Pub(0u8).method_with_priv_params(loop{}); | ^^^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:107:5 | -LL | ::TRAIT_ASSOC_CONST; //~ ERROR type `m::Priv` is private +LL | ::TRAIT_ASSOC_CONST; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:108:6 | -LL | >::INHERENT_ASSOC_CONST; //~ ERROR type `m::Priv` is private +LL | >::INHERENT_ASSOC_CONST; | ^^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:109:5 | -LL | >::INHERENT_ASSOC_CONST_GENERIC_SELF; //~ ERROR type `m::Priv` is private +LL | >::INHERENT_ASSOC_CONST_GENERIC_SELF; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:110:5 | -LL | >::static_method_generic_self; //~ ERROR type `m::Priv` is private +LL | >::static_method_generic_self; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:112:5 | -LL | u8::pub_method; //~ ERROR type `m::Priv` is private +LL | u8::pub_method; | ^^^^^^^^^^^^^^ error: type `adjust::S2` is private --> $DIR/private-inferred-type.rs:114:5 | -LL | adjust::S1.method_s3(); //~ ERROR type `adjust::S2` is private +LL | adjust::S1.method_s3(); | ^^^^^^^^^^ error: type `fn() {m::priv_fn}` is private --> $DIR/private-inferred-type.rs:39:9 | -LL | priv_fn; //~ ERROR type `fn() {m::priv_fn}` is private +LL | priv_fn; | ^^^^^^^ ... LL | m::m!(); @@ -100,7 +118,7 @@ LL | m::m!(); error: type `m::PrivEnum` is private --> $DIR/private-inferred-type.rs:41:9 | -LL | PrivEnum::Variant; //~ ERROR type `m::PrivEnum` is private +LL | PrivEnum::Variant; | ^^^^^^^^^^^^^^^^^ ... LL | m::m!(); @@ -109,7 +127,7 @@ LL | m::m!(); error: type `fn() {::method}` is private --> $DIR/private-inferred-type.rs:43:9 | -LL | ::method; //~ ERROR type `fn() {::method}` is private +LL | ::method; | ^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | m::m!(); @@ -145,81 +163,63 @@ LL | m::m!(); error: trait `m::Trait` is private --> $DIR/private-inferred-type.rs:118:5 | -LL | m::leak_anon1(); //~ ERROR trait `m::Trait` is private +LL | m::leak_anon1(); | ^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:119:5 | -LL | m::leak_anon2(); //~ ERROR type `m::Priv` is private +LL | m::leak_anon2(); | ^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:120:5 | -LL | m::leak_anon3(); //~ ERROR type `m::Priv` is private +LL | m::leak_anon3(); | ^^^^^^^^^^^^^^^ error: trait `m::Trait` is private --> $DIR/private-inferred-type.rs:122:5 | -LL | m::leak_dyn1(); //~ ERROR trait `m::Trait` is private +LL | m::leak_dyn1(); | ^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:123:5 | -LL | m::leak_dyn2(); //~ ERROR type `m::Priv` is private +LL | m::leak_dyn2(); | ^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:124:5 | -LL | m::leak_dyn3(); //~ ERROR type `m::Priv` is private +LL | m::leak_dyn3(); | ^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:127:13 | -LL | let a = m::Alias {}; //~ ERROR type `m::Priv` is private +LL | let a = m::Alias {}; | ^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:128:17 | -LL | let mut b = a; //~ ERROR type `m::Priv` is private +LL | let mut b = a; | ^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:129:9 | -LL | b = a; //~ ERROR type `m::Priv` is private +LL | b = a; | ^ error: type `m::Priv` is private --> $DIR/private-inferred-type.rs:130:11 | -LL | match a { //~ ERROR type `m::Priv` is private +LL | match a { | ^ -error[E0446]: private type `m::Priv` in public interface - --> $DIR/private-inferred-type.rs:61:36 - | -LL | struct Priv; - | - `m::Priv` declared as private -... -LL | impl TraitWithAssocTy for u8 { type AssocTy = Priv; } - | ^^^^^^^^^^^^^^^^^^^^ can't leak private type - -error[E0446]: private type `adjust::S2` in public interface - --> $DIR/private-inferred-type.rs:83:9 - | -LL | struct S2; - | - `adjust::S2` declared as private -... -LL | type Target = S2Alias; //~ ERROR private type `adjust::S2` in public interface - | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type - error: aborting due to 33 previous errors For more information about this error, try `rustc --explain E0446`. diff --git a/src/test/ui/privacy/private-item-simple.stderr b/src/test/ui/privacy/private-item-simple.stderr index 2ac694f35d46..0d5435e1c504 100644 --- a/src/test/ui/privacy/private-item-simple.stderr +++ b/src/test/ui/privacy/private-item-simple.stderr @@ -1,7 +1,7 @@ error[E0603]: function `f` is private --> $DIR/private-item-simple.rs:6:8 | -LL | a::f(); //~ ERROR function `f` is private +LL | a::f(); | ^ error: aborting due to previous error diff --git a/src/test/ui/privacy/private-method-cross-crate.stderr b/src/test/ui/privacy/private-method-cross-crate.stderr index bd28f2e5a8ba..10e0bfe5b136 100644 --- a/src/test/ui/privacy/private-method-cross-crate.stderr +++ b/src/test/ui/privacy/private-method-cross-crate.stderr @@ -1,7 +1,7 @@ error[E0624]: method `nap` is private --> $DIR/private-method-cross-crate.rs:7:8 | -LL | nyan.nap(); //~ ERROR method `nap` is private +LL | nyan.nap(); | ^^^ error: aborting due to previous error diff --git a/src/test/ui/privacy/private-method-inherited.stderr b/src/test/ui/privacy/private-method-inherited.stderr index 30c1e99ceddb..d2ba591ef0cc 100644 --- a/src/test/ui/privacy/private-method-inherited.stderr +++ b/src/test/ui/privacy/private-method-inherited.stderr @@ -1,7 +1,7 @@ error[E0624]: method `f` is private --> $DIR/private-method-inherited.rs:13:7 | -LL | x.f(); //~ ERROR method `f` is private +LL | x.f(); | ^ error: aborting due to previous error diff --git a/src/test/ui/privacy/private-method.stderr b/src/test/ui/privacy/private-method.stderr index 64820e5ea8c7..61fc122e318e 100644 --- a/src/test/ui/privacy/private-method.stderr +++ b/src/test/ui/privacy/private-method.stderr @@ -1,7 +1,7 @@ error[E0624]: method `nap` is private --> $DIR/private-method.rs:22:8 | -LL | nyan.nap(); //~ ERROR method `nap` is private +LL | nyan.nap(); | ^^^ error: aborting due to previous error diff --git a/src/test/ui/privacy/private-struct-field-ctor.stderr b/src/test/ui/privacy/private-struct-field-ctor.stderr index 943abeed114c..97585c1d8805 100644 --- a/src/test/ui/privacy/private-struct-field-ctor.stderr +++ b/src/test/ui/privacy/private-struct-field-ctor.stderr @@ -1,7 +1,7 @@ error[E0451]: field `x` of struct `a::Foo` is private --> $DIR/private-struct-field-ctor.rs:8:22 | -LL | let s = a::Foo { x: 1 }; //~ ERROR field `x` of struct `a::Foo` is private +LL | let s = a::Foo { x: 1 }; | ^^^^ field `x` is private error: aborting due to previous error diff --git a/src/test/ui/privacy/private-struct-field-pattern.stderr b/src/test/ui/privacy/private-struct-field-pattern.stderr index 05e6d3d72431..69bd58aacfc5 100644 --- a/src/test/ui/privacy/private-struct-field-pattern.stderr +++ b/src/test/ui/privacy/private-struct-field-pattern.stderr @@ -1,7 +1,7 @@ error[E0451]: field `x` of struct `a::Foo` is private --> $DIR/private-struct-field-pattern.rs:15:15 | -LL | Foo { x: _ } => {} //~ ERROR field `x` of struct `a::Foo` is private +LL | Foo { x: _ } => {} | ^^^^ field `x` is private error: aborting due to previous error diff --git a/src/test/ui/privacy/private-struct-field.stderr b/src/test/ui/privacy/private-struct-field.stderr index 7cb6d6ab4d7e..da53c73b4311 100644 --- a/src/test/ui/privacy/private-struct-field.stderr +++ b/src/test/ui/privacy/private-struct-field.stderr @@ -1,7 +1,7 @@ error[E0616]: field `meows` of struct `cat::Cat` is private --> $DIR/private-struct-field.rs:13:16 | -LL | assert_eq!(nyan.meows, 52); //~ ERROR field `meows` of struct `cat::Cat` is private +LL | assert_eq!(nyan.meows, 52); | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/privacy/private-type-in-interface.stderr b/src/test/ui/privacy/private-type-in-interface.stderr index b436f20fce98..aa4bfb7fc9a1 100644 --- a/src/test/ui/privacy/private-type-in-interface.stderr +++ b/src/test/ui/privacy/private-type-in-interface.stderr @@ -1,55 +1,55 @@ error: type `m::Priv` is private --> $DIR/private-type-in-interface.rs:15:9 | -LL | fn f(_: m::Alias) {} //~ ERROR type `m::Priv` is private +LL | fn f(_: m::Alias) {} | ^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-type-in-interface.rs:15:6 | -LL | fn f(_: m::Alias) {} //~ ERROR type `m::Priv` is private +LL | fn f(_: m::Alias) {} | ^ error: type `ext::Priv` is private --> $DIR/private-type-in-interface.rs:17:13 | -LL | fn f_ext(_: ext::Alias) {} //~ ERROR type `ext::Priv` is private +LL | fn f_ext(_: ext::Alias) {} | ^^^^^^^^^^ error: type `ext::Priv` is private --> $DIR/private-type-in-interface.rs:17:10 | -LL | fn f_ext(_: ext::Alias) {} //~ ERROR type `ext::Priv` is private +LL | fn f_ext(_: ext::Alias) {} | ^ error: type `m::Priv` is private --> $DIR/private-type-in-interface.rs:21:6 | -LL | impl m::Alias {} //~ ERROR type `m::Priv` is private +LL | impl m::Alias {} | ^^^^^^^^ error: type `ext::Priv` is private --> $DIR/private-type-in-interface.rs:22:14 | -LL | impl Tr1 for ext::Alias {} //~ ERROR type `ext::Priv` is private +LL | impl Tr1 for ext::Alias {} | ^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-type-in-interface.rs:23:10 | -LL | type A = ::X; //~ ERROR type `m::Priv` is private +LL | type A = ::X; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: type `m::Priv` is private --> $DIR/private-type-in-interface.rs:27:11 | -LL | fn g() -> impl Tr2 { 0 } //~ ERROR type `m::Priv` is private +LL | fn g() -> impl Tr2 { 0 } | ^^^^^^^^^^^^^^^^^^ error: type `ext::Priv` is private --> $DIR/private-type-in-interface.rs:28:15 | -LL | fn g_ext() -> impl Tr2 { 0 } //~ ERROR type `ext::Priv` is private +LL | fn g_ext() -> impl Tr2 { 0 } | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to 9 previous errors diff --git a/src/test/ui/privacy/private-variant-reexport.stderr b/src/test/ui/privacy/private-variant-reexport.stderr index 99f4a41272cd..8e4c34528624 100644 --- a/src/test/ui/privacy/private-variant-reexport.stderr +++ b/src/test/ui/privacy/private-variant-reexport.stderr @@ -1,7 +1,7 @@ error: variant `V` is private and cannot be re-exported --> $DIR/private-variant-reexport.rs:2:13 | -LL | pub use ::E::V; //~ ERROR variant `V` is private and cannot be re-exported +LL | pub use ::E::V; | ^^^^^^ ... LL | enum E { V } @@ -10,19 +10,19 @@ LL | enum E { V } error: variant `V` is private and cannot be re-exported --> $DIR/private-variant-reexport.rs:6:19 | -LL | pub use ::E::{V}; //~ ERROR variant `V` is private and cannot be re-exported +LL | pub use ::E::{V}; | ^ error: variant `V` is private and cannot be re-exported --> $DIR/private-variant-reexport.rs:10:22 | -LL | pub use ::E::V::{self}; //~ ERROR variant `V` is private and cannot be re-exported +LL | pub use ::E::V::{self}; | ^^^^ error: enum is private and its variants cannot be re-exported --> $DIR/private-variant-reexport.rs:14:13 | -LL | pub use ::E::*; //~ ERROR enum is private and its variants cannot be re-exported +LL | pub use ::E::*; | ^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/privacy/restricted/private-in-public.stderr b/src/test/ui/privacy/restricted/private-in-public.stderr index 2fb7059e0d40..87c96d31f092 100644 --- a/src/test/ui/privacy/restricted/private-in-public.stderr +++ b/src/test/ui/privacy/restricted/private-in-public.stderr @@ -4,7 +4,7 @@ error[E0446]: private type `foo::Priv` in public interface LL | struct Priv; | - `foo::Priv` declared as private ... -LL | pub(crate) fn g(_: Priv) {} //~ ERROR E0446 +LL | pub(crate) fn g(_: Priv) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `foo::Priv` in public interface @@ -13,7 +13,7 @@ error[E0446]: private type `foo::Priv` in public interface LL | struct Priv; | - `foo::Priv` declared as private ... -LL | crate fn h(_: Priv) {} //~ ERROR E0446 +LL | crate fn h(_: Priv) {} | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error: aborting due to 2 previous errors diff --git a/src/test/ui/privacy/restricted/struct-literal-field.stderr b/src/test/ui/privacy/restricted/struct-literal-field.stderr index 0109cae91a0c..dd609944a4b3 100644 --- a/src/test/ui/privacy/restricted/struct-literal-field.stderr +++ b/src/test/ui/privacy/restricted/struct-literal-field.stderr @@ -1,7 +1,7 @@ error[E0451]: field `x` of struct `foo::bar::S` is private --> $DIR/struct-literal-field.rs:18:9 | -LL | S { x: 0 }; //~ ERROR private +LL | S { x: 0 }; | ^^^^ field `x` is private error: aborting due to previous error diff --git a/src/test/ui/privacy/restricted/test.stderr b/src/test/ui/privacy/restricted/test.stderr index 7539b0e1af4c..b4ef7b8e3f79 100644 --- a/src/test/ui/privacy/restricted/test.stderr +++ b/src/test/ui/privacy/restricted/test.stderr @@ -1,79 +1,79 @@ error[E0433]: failed to resolve: maybe a missing `extern crate bad;`? --> $DIR/test.rs:50:12 | -LL | pub(in bad::path) mod m1 {} //~ ERROR failed to resolve: maybe a missing `extern crate bad;`? +LL | pub(in bad::path) mod m1 {} | ^^^ maybe a missing `extern crate bad;`? error: visibilities can only be restricted to ancestor modules --> $DIR/test.rs:51:12 | -LL | pub(in foo) mod m2 {} //~ ERROR visibilities can only be restricted to ancestor modules +LL | pub(in foo) mod m2 {} | ^^^ error[E0364]: `f` is private, and cannot be re-exported --> $DIR/test.rs:21:24 | -LL | pub(super) use foo::bar::f as g; //~ ERROR cannot be re-exported +LL | pub(super) use foo::bar::f as g; | ^^^^^^^^^^^^^^^^ | note: consider marking `f` as `pub` in the imported module --> $DIR/test.rs:21:24 | -LL | pub(super) use foo::bar::f as g; //~ ERROR cannot be re-exported +LL | pub(super) use foo::bar::f as g; | ^^^^^^^^^^^^^^^^ error[E0603]: struct `Crate` is private --> $DIR/test.rs:38:25 | -LL | use pub_restricted::Crate; //~ ERROR private +LL | use pub_restricted::Crate; | ^^^^^ error[E0603]: function `f` is private --> $DIR/test.rs:30:19 | -LL | use foo::bar::f; //~ ERROR private +LL | use foo::bar::f; | ^ error[E0616]: field `x` of struct `foo::bar::S` is private --> $DIR/test.rs:31:5 | -LL | S::default().x; //~ ERROR private +LL | S::default().x; | ^^^^^^^^^^^^^^ error[E0624]: method `f` is private --> $DIR/test.rs:32:18 | -LL | S::default().f(); //~ ERROR private +LL | S::default().f(); | ^ error[E0624]: method `g` is private --> $DIR/test.rs:33:5 | -LL | S::g(); //~ ERROR private +LL | S::g(); | ^^^^ error[E0616]: field `y` of struct `pub_restricted::Universe` is private --> $DIR/test.rs:42:13 | -LL | let _ = u.y; //~ ERROR private +LL | let _ = u.y; | ^^^ error[E0616]: field `z` of struct `pub_restricted::Universe` is private --> $DIR/test.rs:43:13 | -LL | let _ = u.z; //~ ERROR private +LL | let _ = u.z; | ^^^ error[E0624]: method `g` is private --> $DIR/test.rs:45:7 | -LL | u.g(); //~ ERROR private +LL | u.g(); | ^ error[E0624]: method `h` is private --> $DIR/test.rs:46:7 | -LL | u.h(); //~ ERROR private +LL | u.h(); | ^ error: aborting due to 12 previous errors diff --git a/src/test/ui/privacy/union-field-privacy-1.stderr b/src/test/ui/privacy/union-field-privacy-1.stderr index d31360dbe651..96a1d7ed5090 100644 --- a/src/test/ui/privacy/union-field-privacy-1.stderr +++ b/src/test/ui/privacy/union-field-privacy-1.stderr @@ -1,13 +1,13 @@ error[E0451]: field `c` of union `m::U` is private --> $DIR/union-field-privacy-1.rs:12:20 | -LL | let u = m::U { c: 0 }; //~ ERROR field `c` of union `m::U` is private +LL | let u = m::U { c: 0 }; | ^^^^ field `c` is private error[E0451]: field `c` of union `m::U` is private --> $DIR/union-field-privacy-1.rs:16:16 | -LL | let m::U { c } = u; //~ ERROR field `c` of union `m::U` is private +LL | let m::U { c } = u; | ^ field `c` is private error: aborting due to 2 previous errors diff --git a/src/test/ui/privacy/union-field-privacy-2.stderr b/src/test/ui/privacy/union-field-privacy-2.stderr index bd2c834c966d..df054b8cff8a 100644 --- a/src/test/ui/privacy/union-field-privacy-2.stderr +++ b/src/test/ui/privacy/union-field-privacy-2.stderr @@ -1,7 +1,7 @@ error[E0616]: field `c` of struct `m::U` is private --> $DIR/union-field-privacy-2.rs:14:13 | -LL | let c = u.c; //~ ERROR field `c` of struct `m::U` is private +LL | let c = u.c; | ^^^ error: aborting due to previous error diff --git a/src/test/ui/proc-macro/ambiguous-builtin-attrs-test.stderr b/src/test/ui/proc-macro/ambiguous-builtin-attrs-test.stderr index db07055b6a10..316eb636ba82 100644 --- a/src/test/ui/proc-macro/ambiguous-builtin-attrs-test.stderr +++ b/src/test/ui/proc-macro/ambiguous-builtin-attrs-test.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `NonExistent` in this scope --> $DIR/ambiguous-builtin-attrs-test.rs:19:5 | -LL | NonExistent; //~ ERROR cannot find value `NonExistent` in this scope +LL | NonExistent; | ^^^^^^^^^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/proc-macro/ambiguous-builtin-attrs.stderr b/src/test/ui/proc-macro/ambiguous-builtin-attrs.stderr index 79dc922b9db2..975be7ce03b8 100644 --- a/src/test/ui/proc-macro/ambiguous-builtin-attrs.stderr +++ b/src/test/ui/proc-macro/ambiguous-builtin-attrs.stderr @@ -1,13 +1,13 @@ error[E0425]: cannot find value `NonExistent` in this scope --> $DIR/ambiguous-builtin-attrs.rs:30:5 | -LL | NonExistent; //~ ERROR cannot find value `NonExistent` in this scope +LL | NonExistent; | ^^^^^^^^^^^ not found in this scope error[E0659]: `repr` is ambiguous (built-in attribute vs any other name) --> $DIR/ambiguous-builtin-attrs.rs:9:3 | -LL | #[repr(C)] //~ ERROR `repr` is ambiguous +LL | #[repr(C)] | ^^^^ ambiguous name | = note: `repr` could refer to a built-in attribute @@ -21,7 +21,7 @@ LL | use builtin_attrs::*; error[E0659]: `repr` is ambiguous (built-in attribute vs any other name) --> $DIR/ambiguous-builtin-attrs.rs:11:19 | -LL | #[cfg_attr(all(), repr(C))] //~ ERROR `repr` is ambiguous +LL | #[cfg_attr(all(), repr(C))] | ^^^^ ambiguous name | = note: `repr` could refer to a built-in attribute @@ -35,7 +35,7 @@ LL | use builtin_attrs::*; error[E0659]: `repr` is ambiguous (built-in attribute vs any other name) --> $DIR/ambiguous-builtin-attrs.rs:20:34 | -LL | fn non_macro_expanded_location<#[repr(C)] T>() { //~ ERROR `repr` is ambiguous +LL | fn non_macro_expanded_location<#[repr(C)] T>() { | ^^^^ ambiguous name | = note: `repr` could refer to a built-in attribute @@ -49,7 +49,7 @@ LL | use builtin_attrs::*; error[E0659]: `repr` is ambiguous (built-in attribute vs any other name) --> $DIR/ambiguous-builtin-attrs.rs:22:11 | -LL | #[repr(C)] //~ ERROR `repr` is ambiguous +LL | #[repr(C)] | ^^^^ ambiguous name | = note: `repr` could refer to a built-in attribute @@ -63,7 +63,7 @@ LL | use builtin_attrs::*; error[E0659]: `feature` is ambiguous (built-in attribute vs any other name) --> $DIR/ambiguous-builtin-attrs.rs:3:4 | -LL | #![feature(decl_macro)] //~ ERROR `feature` is ambiguous +LL | #![feature(decl_macro)] | ^^^^^^^ ambiguous name | = note: `feature` could refer to a built-in attribute diff --git a/src/test/ui/proc-macro/attribute-order-restricted.stderr b/src/test/ui/proc-macro/attribute-order-restricted.stderr index a4f165cd1b52..39db45cf569a 100644 --- a/src/test/ui/proc-macro/attribute-order-restricted.stderr +++ b/src/test/ui/proc-macro/attribute-order-restricted.stderr @@ -1,7 +1,7 @@ error: macro attributes must be placed before `#[derive]` --> $DIR/attribute-order-restricted.rs:11:1 | -LL | #[attr_proc_macro] //~ ERROR macro attributes must be placed before `#[derive]` +LL | #[attr_proc_macro] | ^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/proc-macro/attribute-spans-preserved.stderr b/src/test/ui/proc-macro/attribute-spans-preserved.stderr index 8371088c4c20..6c571dbdb476 100644 --- a/src/test/ui/proc-macro/attribute-spans-preserved.stderr +++ b/src/test/ui/proc-macro/attribute-spans-preserved.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/attribute-spans-preserved.rs:7:23 | -LL | #[ foo ( let y: u32 = "z"; ) ] //~ ERROR: mismatched types +LL | #[ foo ( let y: u32 = "z"; ) ] | ^^^ expected u32, found reference | = note: expected type `u32` @@ -10,7 +10,7 @@ LL | #[ foo ( let y: u32 = "z"; ) ] //~ ERROR: mismatched types error[E0308]: mismatched types --> $DIR/attribute-spans-preserved.rs:8:23 | -LL | #[ bar { let x: u32 = "y"; } ] //~ ERROR: mismatched types +LL | #[ bar { let x: u32 = "y"; } ] | ^^^ expected u32, found reference | = note: expected type `u32` diff --git a/src/test/ui/proc-macro/attributes-included.stderr b/src/test/ui/proc-macro/attributes-included.stderr index 87b6fb9539fb..fcd77b2d383d 100644 --- a/src/test/ui/proc-macro/attributes-included.stderr +++ b/src/test/ui/proc-macro/attributes-included.stderr @@ -1,7 +1,7 @@ warning: unused variable: `a` --> $DIR/attributes-included.rs:17:9 | -LL | let a: i32 = "foo"; //~ WARN: unused variable +LL | let a: i32 = "foo"; | ^ help: consider prefixing with an underscore: `_a` | note: lint level defined here diff --git a/src/test/ui/proc-macro/define-two.stderr b/src/test/ui/proc-macro/define-two.stderr index c74215f415e0..bf1bd8427c83 100644 --- a/src/test/ui/proc-macro/define-two.stderr +++ b/src/test/ui/proc-macro/define-two.stderr @@ -4,7 +4,7 @@ error[E0428]: the name `A` is defined multiple times LL | #[proc_macro_derive(A)] | - previous definition of the macro `A` here ... -LL | #[proc_macro_derive(A)] //~ ERROR the name `A` is defined multiple times +LL | #[proc_macro_derive(A)] | ^ `A` redefined here | = note: `A` must be defined only once in the macro namespace of this module diff --git a/src/test/ui/proc-macro/derive-helper-shadowing.stderr b/src/test/ui/proc-macro/derive-helper-shadowing.stderr index 8180c84d3f6e..5f2009b384b1 100644 --- a/src/test/ui/proc-macro/derive-helper-shadowing.stderr +++ b/src/test/ui/proc-macro/derive-helper-shadowing.stderr @@ -1,7 +1,7 @@ error[E0658]: The attribute `my_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/derive-helper-shadowing.rs:20:15 | -LL | #[my_attr] //~ ERROR attribute `my_attr` is currently unknown +LL | #[my_attr] | ^^^^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #[my_attr] //~ ERROR attribute `my_attr` is currently unknown error[E0659]: `my_attr` is ambiguous (derive helper attribute vs any other name) --> $DIR/derive-helper-shadowing.rs:6:3 | -LL | #[my_attr] //~ ERROR `my_attr` is ambiguous +LL | #[my_attr] | ^^^^^^^ ambiguous name | note: `my_attr` could refer to the derive helper attribute defined here diff --git a/src/test/ui/proc-macro/derive-still-gated.stderr b/src/test/ui/proc-macro/derive-still-gated.stderr index ece1b6212914..f7c8960372ec 100644 --- a/src/test/ui/proc-macro/derive-still-gated.stderr +++ b/src/test/ui/proc-macro/derive-still-gated.stderr @@ -1,7 +1,7 @@ error[E0658]: The attribute `derive_A` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/derive-still-gated.rs:8:3 | -LL | #[derive_A] //~ ERROR attribute `derive_A` is currently unknown +LL | #[derive_A] | ^^^^^^^^ help: a built-in attribute with a similar name exists: `derive` | = help: add #![feature(custom_attribute)] to the crate attributes to enable diff --git a/src/test/ui/proc-macro/dollar-crate.stderr b/src/test/ui/proc-macro/dollar-crate.stderr index 08de3c7d1a66..d1b836e7f6f2 100644 --- a/src/test/ui/proc-macro/dollar-crate.stderr +++ b/src/test/ui/proc-macro/dollar-crate.stderr @@ -1,7 +1,7 @@ error[E0428]: the name `D` is defined multiple times --> $DIR/dollar-crate.rs:27:13 | -LL | struct D($crate::S); //~ ERROR the name `D` is defined multiple times +LL | struct D($crate::S); | ^^^^^^^^^^^^^^^^^^^^ | | | `D` redefined here @@ -15,7 +15,7 @@ LL | local!(); error[E0428]: the name `D` is defined multiple times --> $DIR/dollar-crate.rs:37:5 | -LL | dollar_crate_external::external!(); //~ ERROR the name `D` is defined multiple times +LL | dollar_crate_external::external!(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | `D` redefined here diff --git a/src/test/ui/proc-macro/exports.stderr b/src/test/ui/proc-macro/exports.stderr index 6cf5c63d2da4..2f81921358df 100644 --- a/src/test/ui/proc-macro/exports.stderr +++ b/src/test/ui/proc-macro/exports.stderr @@ -1,25 +1,25 @@ error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently --> $DIR/exports.rs:7:1 | -LL | pub fn a() {} //~ ERROR: cannot export any items +LL | pub fn a() {} | ^^^^^^^^^^^^^ error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently --> $DIR/exports.rs:8:1 | -LL | pub struct B; //~ ERROR: cannot export any items +LL | pub struct B; | ^^^^^^^^^^^^^ error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently --> $DIR/exports.rs:9:1 | -LL | pub enum C {} //~ ERROR: cannot export any items +LL | pub enum C {} | ^^^^^^^^^^^^^ error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently --> $DIR/exports.rs:10:1 | -LL | pub mod d {} //~ ERROR: cannot export any items +LL | pub mod d {} | ^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/proc-macro/generate-mod.stderr b/src/test/ui/proc-macro/generate-mod.stderr index 1177fc6e575a..1b828b4f03f2 100644 --- a/src/test/ui/proc-macro/generate-mod.stderr +++ b/src/test/ui/proc-macro/generate-mod.stderr @@ -1,31 +1,31 @@ error[E0412]: cannot find type `FromOutside` in this scope --> $DIR/generate-mod.rs:9:1 | -LL | generate_mod::check!(); //~ ERROR cannot find type `FromOutside` in this scope +LL | generate_mod::check!(); | ^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope error[E0412]: cannot find type `Outer` in this scope --> $DIR/generate-mod.rs:9:1 | -LL | generate_mod::check!(); //~ ERROR cannot find type `FromOutside` in this scope +LL | generate_mod::check!(); | ^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope error[E0412]: cannot find type `FromOutside` in this scope --> $DIR/generate-mod.rs:12:1 | -LL | #[generate_mod::check_attr] //~ ERROR cannot find type `FromOutside` in this scope +LL | #[generate_mod::check_attr] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope error[E0412]: cannot find type `OuterAttr` in this scope --> $DIR/generate-mod.rs:12:1 | -LL | #[generate_mod::check_attr] //~ ERROR cannot find type `FromOutside` in this scope +LL | #[generate_mod::check_attr] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope warning: cannot find type `FromOutside` in this scope --> $DIR/generate-mod.rs:16:10 | -LL | #[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOutside` in this scope +LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import | = note: #[warn(proc_macro_derive_resolution_fallback)] on by default @@ -35,7 +35,7 @@ LL | #[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOutside warning: cannot find type `OuterDerive` in this scope --> $DIR/generate-mod.rs:16:10 | -LL | #[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOutside` in this scope +LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -44,7 +44,7 @@ LL | #[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOutside warning: cannot find type `FromOutside` in this scope --> $DIR/generate-mod.rs:23:14 | -LL | #[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOutside` in this scope +LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -53,7 +53,7 @@ LL | #[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOut warning: cannot find type `OuterDerive` in this scope --> $DIR/generate-mod.rs:23:14 | -LL | #[derive(generate_mod::CheckDerive)] //~ WARN cannot find type `FromOutside` in this scope +LL | #[derive(generate_mod::CheckDerive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ names from parent modules are not accessible without an explicit import | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/proc-macro/invalid-attributes.stderr b/src/test/ui/proc-macro/invalid-attributes.stderr index 06a7ef2b206c..8dff60d0dc55 100644 --- a/src/test/ui/proc-macro/invalid-attributes.stderr +++ b/src/test/ui/proc-macro/invalid-attributes.stderr @@ -1,37 +1,37 @@ error: attribute must be of the form `#[proc_macro]` --> $DIR/invalid-attributes.rs:10:1 | -LL | #[proc_macro = "test"] //~ ERROR attribute must be of the form +LL | #[proc_macro = "test"] | ^^^^^^^^^^^^^^^^^^^^^^ error: attribute must be of the form `#[proc_macro]` --> $DIR/invalid-attributes.rs:13:1 | -LL | #[proc_macro()] //~ ERROR attribute must be of the form +LL | #[proc_macro()] | ^^^^^^^^^^^^^^^ error: attribute must be of the form `#[proc_macro]` --> $DIR/invalid-attributes.rs:16:1 | -LL | #[proc_macro(x)] //~ ERROR attribute must be of the form +LL | #[proc_macro(x)] | ^^^^^^^^^^^^^^^^ error: attribute must be of the form `#[proc_macro_attribute]` --> $DIR/invalid-attributes.rs:19:1 | -LL | #[proc_macro_attribute = "test"] //~ ERROR attribute must be of the form +LL | #[proc_macro_attribute = "test"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: attribute must be of the form `#[proc_macro_attribute]` --> $DIR/invalid-attributes.rs:22:1 | -LL | #[proc_macro_attribute()] //~ ERROR attribute must be of the form +LL | #[proc_macro_attribute()] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: attribute must be of the form `#[proc_macro_attribute]` --> $DIR/invalid-attributes.rs:25:1 | -LL | #[proc_macro_attribute(x)] //~ ERROR attribute must be of the form +LL | #[proc_macro_attribute(x)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/proc-macro/invalid-punct-ident-1.stderr b/src/test/ui/proc-macro/invalid-punct-ident-1.stderr index 875941303787..9a53741f94f9 100644 --- a/src/test/ui/proc-macro/invalid-punct-ident-1.stderr +++ b/src/test/ui/proc-macro/invalid-punct-ident-1.stderr @@ -1,7 +1,7 @@ error: proc macro panicked --> $DIR/invalid-punct-ident-1.rs:6:1 | -LL | invalid_punct!(); //~ ERROR proc macro panicked +LL | invalid_punct!(); | ^^^^^^^^^^^^^^^^^ | = help: message: unsupported character `'`'` diff --git a/src/test/ui/proc-macro/invalid-punct-ident-2.stderr b/src/test/ui/proc-macro/invalid-punct-ident-2.stderr index 384d30650f10..77a26b830d98 100644 --- a/src/test/ui/proc-macro/invalid-punct-ident-2.stderr +++ b/src/test/ui/proc-macro/invalid-punct-ident-2.stderr @@ -1,7 +1,7 @@ error: proc macro panicked --> $DIR/invalid-punct-ident-2.rs:6:1 | -LL | invalid_ident!(); //~ ERROR proc macro panicked +LL | invalid_ident!(); | ^^^^^^^^^^^^^^^^^ | = help: message: `"*"` is not a valid identifier diff --git a/src/test/ui/proc-macro/invalid-punct-ident-3.stderr b/src/test/ui/proc-macro/invalid-punct-ident-3.stderr index fd34459e8976..6ff47e3752c5 100644 --- a/src/test/ui/proc-macro/invalid-punct-ident-3.stderr +++ b/src/test/ui/proc-macro/invalid-punct-ident-3.stderr @@ -1,7 +1,7 @@ error: proc macro panicked --> $DIR/invalid-punct-ident-3.rs:6:1 | -LL | invalid_raw_ident!(); //~ ERROR proc macro panicked +LL | invalid_raw_ident!(); | ^^^^^^^^^^^^^^^^^^^^^ | = help: message: `"self"` is not a valid raw identifier diff --git a/src/test/ui/proc-macro/invalid-punct-ident-4.stderr b/src/test/ui/proc-macro/invalid-punct-ident-4.stderr index 39eb64e555c1..da2bf07a1a3a 100644 --- a/src/test/ui/proc-macro/invalid-punct-ident-4.stderr +++ b/src/test/ui/proc-macro/invalid-punct-ident-4.stderr @@ -1,13 +1,13 @@ error: unexpected close delimiter: `)` --> $DIR/invalid-punct-ident-4.rs:6:1 | -LL | lexer_failure!(); //~ ERROR proc macro panicked +LL | lexer_failure!(); | ^^^^^^^^^^^^^^^^^ unexpected close delimiter error: proc macro panicked --> $DIR/invalid-punct-ident-4.rs:6:1 | -LL | lexer_failure!(); //~ ERROR proc macro panicked +LL | lexer_failure!(); | ^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/proc-macro/issue-37788.stderr b/src/test/ui/proc-macro/issue-37788.stderr index 40f28460b163..0727e8c8ed16 100644 --- a/src/test/ui/proc-macro/issue-37788.stderr +++ b/src/test/ui/proc-macro/issue-37788.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn main() { | - expected `()` because of default return type LL | // Test that constructing the `visible_parent_map` (in `cstore_impl.rs`) does not ICE. -LL | std::cell::Cell::new(0) //~ ERROR mismatched types +LL | std::cell::Cell::new(0) | ^^^^^^^^^^^^^^^^^^^^^^^- help: try adding a semicolon: `;` | | | expected (), found struct `std::cell::Cell` diff --git a/src/test/ui/proc-macro/issue-38586.stderr b/src/test/ui/proc-macro/issue-38586.stderr index 9657914f49bb..2584e0c62eec 100644 --- a/src/test/ui/proc-macro/issue-38586.stderr +++ b/src/test/ui/proc-macro/issue-38586.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `foo` in this scope --> $DIR/issue-38586.rs:6:10 | -LL | #[derive(A)] //~ ERROR `foo` +LL | #[derive(A)] | ^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/proc-macro/issue-50493.stderr b/src/test/ui/proc-macro/issue-50493.stderr index 559e8f0f2225..28c61a2f52fe 100644 --- a/src/test/ui/proc-macro/issue-50493.stderr +++ b/src/test/ui/proc-macro/issue-50493.stderr @@ -1,13 +1,13 @@ error: visibilities can only be restricted to ancestor modules --> $DIR/issue-50493.rs:8:12 | -LL | pub(in restricted) field: usize, //~ visibilities can only be restricted to ancestor modules +LL | pub(in restricted) field: usize, | ^^^^^^^^^^ error[E0616]: field `field` of struct `Restricted` is private --> $DIR/issue-50493.rs:6:10 | -LL | #[derive(Derive)] //~ ERROR field `field` of struct `Restricted` is private +LL | #[derive(Derive)] | ^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/proc-macro/lifetimes.stderr b/src/test/ui/proc-macro/lifetimes.stderr index c873ab68654b..2356a119530b 100644 --- a/src/test/ui/proc-macro/lifetimes.stderr +++ b/src/test/ui/proc-macro/lifetimes.stderr @@ -1,7 +1,7 @@ error: expected type, found `'` --> $DIR/lifetimes.rs:9:10 | -LL | type A = single_quote_alone!(); //~ ERROR expected type, found `'` +LL | type A = single_quote_alone!(); | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/proc-macro/macro-brackets.stderr b/src/test/ui/proc-macro/macro-brackets.stderr index a3cc7d485cd3..7447b5c15eef 100644 --- a/src/test/ui/proc-macro/macro-brackets.stderr +++ b/src/test/ui/proc-macro/macro-brackets.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/macro-brackets.rs:11:21 | -LL | id![static X: u32 = 'a';]; //~ ERROR: mismatched types +LL | id![static X: u32 = 'a';]; | ^^^ expected u32, found char error: aborting due to previous error diff --git a/src/test/ui/proc-macro/macro-namespace-reserved-2.stderr b/src/test/ui/proc-macro/macro-namespace-reserved-2.stderr index c1821199e30b..548f9e3051dd 100644 --- a/src/test/ui/proc-macro/macro-namespace-reserved-2.stderr +++ b/src/test/ui/proc-macro/macro-namespace-reserved-2.stderr @@ -1,55 +1,55 @@ error: can't use a procedural macro from the same crate that defines it --> $DIR/macro-namespace-reserved-2.rs:25:5 | -LL | my_macro!(); //~ ERROR can't use a procedural macro from the same crate that defines it +LL | my_macro!(); | ^^^^^^^^ error: can't use a procedural macro from the same crate that defines it --> $DIR/macro-namespace-reserved-2.rs:28:5 | -LL | my_macro_attr!(); //~ ERROR can't use a procedural macro from the same crate that defines it +LL | my_macro_attr!(); | ^^^^^^^^^^^^^ error: can't use a procedural macro from the same crate that defines it --> $DIR/macro-namespace-reserved-2.rs:31:5 | -LL | MyTrait!(); //~ ERROR can't use a procedural macro from the same crate that defines it +LL | MyTrait!(); | ^^^^^^^ error: can't use a procedural macro from the same crate that defines it --> $DIR/macro-namespace-reserved-2.rs:34:3 | -LL | #[my_macro] //~ ERROR can't use a procedural macro from the same crate that defines it +LL | #[my_macro] | ^^^^^^^^ error: can't use a procedural macro from the same crate that defines it --> $DIR/macro-namespace-reserved-2.rs:36:3 | -LL | #[my_macro_attr] //~ ERROR can't use a procedural macro from the same crate that defines it +LL | #[my_macro_attr] | ^^^^^^^^^^^^^ error: can't use a procedural macro from the same crate that defines it --> $DIR/macro-namespace-reserved-2.rs:38:3 | -LL | #[MyTrait] //~ ERROR can't use a procedural macro from the same crate that defines it +LL | #[MyTrait] | ^^^^^^^ error: can't use a procedural macro from the same crate that defines it --> $DIR/macro-namespace-reserved-2.rs:41:10 | -LL | #[derive(my_macro)] //~ ERROR can't use a procedural macro from the same crate that defines it +LL | #[derive(my_macro)] | ^^^^^^^^ error: can't use a procedural macro from the same crate that defines it --> $DIR/macro-namespace-reserved-2.rs:43:10 | -LL | #[derive(my_macro_attr)] //~ ERROR can't use a procedural macro from the same crate that defines it +LL | #[derive(my_macro_attr)] | ^^^^^^^^^^^^^ error: can't use a procedural macro from the same crate that defines it --> $DIR/macro-namespace-reserved-2.rs:45:10 | -LL | #[derive(MyTrait)] //~ ERROR can't use a procedural macro from the same crate that defines it +LL | #[derive(MyTrait)] | ^^^^^^^ error: aborting due to 9 previous errors diff --git a/src/test/ui/proc-macro/macro-namespace-reserved.stderr b/src/test/ui/proc-macro/macro-namespace-reserved.stderr index 2192e6d2b17a..f5d589c3ac6e 100644 --- a/src/test/ui/proc-macro/macro-namespace-reserved.stderr +++ b/src/test/ui/proc-macro/macro-namespace-reserved.stderr @@ -4,7 +4,7 @@ error[E0428]: the name `my_macro` is defined multiple times LL | pub fn my_macro(input: TokenStream) -> TokenStream { | -------------------------------------------------- previous definition of the macro `my_macro` here ... -LL | macro my_macro() {} //~ ERROR the name `my_macro` is defined multiple times +LL | macro my_macro() {} | ^^^^^^^^^^^^^^^^ `my_macro` redefined here | = note: `my_macro` must be defined only once in the macro namespace of this module @@ -15,7 +15,7 @@ error[E0428]: the name `my_macro_attr` is defined multiple times LL | pub fn my_macro_attr(input: TokenStream, _: TokenStream) -> TokenStream { | ----------------------------------------------------------------------- previous definition of the macro `my_macro_attr` here ... -LL | macro my_macro_attr() {} //~ ERROR the name `my_macro_attr` is defined multiple times +LL | macro my_macro_attr() {} | ^^^^^^^^^^^^^^^^^^^^^ `my_macro_attr` redefined here | = note: `my_macro_attr` must be defined only once in the macro namespace of this module @@ -26,7 +26,7 @@ error[E0428]: the name `MyTrait` is defined multiple times LL | #[proc_macro_derive(MyTrait)] | ------- previous definition of the macro `MyTrait` here ... -LL | macro MyTrait() {} //~ ERROR the name `MyTrait` is defined multiple times +LL | macro MyTrait() {} | ^^^^^^^^^^^^^^^ `MyTrait` redefined here | = note: `MyTrait` must be defined only once in the macro namespace of this module diff --git a/src/test/ui/proc-macro/more-gates.stderr b/src/test/ui/proc-macro/more-gates.stderr index 21e75027e487..c6c2954f9398 100644 --- a/src/test/ui/proc-macro/more-gates.stderr +++ b/src/test/ui/proc-macro/more-gates.stderr @@ -17,7 +17,7 @@ LL | #[attr2mac2] error[E0658]: procedural macros cannot expand to macro definitions (see issue #54727) --> $DIR/more-gates.rs:16:1 | -LL | mac2mac1!(); //~ ERROR: cannot expand to macro definitions +LL | mac2mac1!(); | ^^^^^^^^^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | mac2mac1!(); //~ ERROR: cannot expand to macro definitions error[E0658]: procedural macros cannot expand to macro definitions (see issue #54727) --> $DIR/more-gates.rs:17:1 | -LL | mac2mac2!(); //~ ERROR: cannot expand to macro definitions +LL | mac2mac2!(); | ^^^^^^^^^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable diff --git a/src/test/ui/proc-macro/multispan.stderr b/src/test/ui/proc-macro/multispan.stderr index 7519f778e9e7..44af07a79423 100644 --- a/src/test/ui/proc-macro/multispan.stderr +++ b/src/test/ui/proc-macro/multispan.stderr @@ -1,85 +1,85 @@ error: hello to you, too! --> $DIR/multispan.rs:14:5 | -LL | hello!(hi); //~ ERROR hello to you, too! +LL | hello!(hi); | ^^^^^^^^^^^ | note: found these 'hi's --> $DIR/multispan.rs:14:12 | -LL | hello!(hi); //~ ERROR hello to you, too! +LL | hello!(hi); | ^^ error: hello to you, too! --> $DIR/multispan.rs:17:5 | -LL | hello!(hi hi); //~ ERROR hello to you, too! +LL | hello!(hi hi); | ^^^^^^^^^^^^^^ | note: found these 'hi's --> $DIR/multispan.rs:17:12 | -LL | hello!(hi hi); //~ ERROR hello to you, too! +LL | hello!(hi hi); | ^^ ^^ error: hello to you, too! --> $DIR/multispan.rs:20:5 | -LL | hello!(hi hi hi); //~ ERROR hello to you, too! +LL | hello!(hi hi hi); | ^^^^^^^^^^^^^^^^^ | note: found these 'hi's --> $DIR/multispan.rs:20:12 | -LL | hello!(hi hi hi); //~ ERROR hello to you, too! +LL | hello!(hi hi hi); | ^^ ^^ ^^ error: hello to you, too! --> $DIR/multispan.rs:23:5 | -LL | hello!(hi hey hi yo hi beep beep hi hi); //~ ERROR hello to you, too! +LL | hello!(hi hey hi yo hi beep beep hi hi); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: found these 'hi's --> $DIR/multispan.rs:23:12 | -LL | hello!(hi hey hi yo hi beep beep hi hi); //~ ERROR hello to you, too! +LL | hello!(hi hey hi yo hi beep beep hi hi); | ^^ ^^ ^^ ^^ ^^ error: hello to you, too! --> $DIR/multispan.rs:24:5 | -LL | hello!(hi there, hi how are you? hi... hi.); //~ ERROR hello to you, too! +LL | hello!(hi there, hi how are you? hi... hi.); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: found these 'hi's --> $DIR/multispan.rs:24:12 | -LL | hello!(hi there, hi how are you? hi... hi.); //~ ERROR hello to you, too! +LL | hello!(hi there, hi how are you? hi... hi.); | ^^ ^^ ^^ ^^ error: hello to you, too! --> $DIR/multispan.rs:25:5 | -LL | hello!(whoah. hi di hi di ho); //~ ERROR hello to you, too! +LL | hello!(whoah. hi di hi di ho); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: found these 'hi's --> $DIR/multispan.rs:25:19 | -LL | hello!(whoah. hi di hi di ho); //~ ERROR hello to you, too! +LL | hello!(whoah. hi di hi di ho); | ^^ ^^ error: hello to you, too! --> $DIR/multispan.rs:26:5 | -LL | hello!(hi good hi and good bye); //~ ERROR hello to you, too! +LL | hello!(hi good hi and good bye); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: found these 'hi's --> $DIR/multispan.rs:26:12 | -LL | hello!(hi good hi and good bye); //~ ERROR hello to you, too! +LL | hello!(hi good hi and good bye); | ^^ ^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/proc-macro/nested-item-spans.stderr b/src/test/ui/proc-macro/nested-item-spans.stderr index cba4b73486c1..011a91d44629 100644 --- a/src/test/ui/proc-macro/nested-item-spans.stderr +++ b/src/test/ui/proc-macro/nested-item-spans.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/nested-item-spans.rs:10:22 | -LL | let x: u32 = "x"; //~ ERROR: mismatched types +LL | let x: u32 = "x"; | ^^^ expected u32, found reference | = note: expected type `u32` @@ -10,7 +10,7 @@ LL | let x: u32 = "x"; //~ ERROR: mismatched types error[E0308]: mismatched types --> $DIR/nested-item-spans.rs:19:22 | -LL | let x: u32 = "x"; //~ ERROR: mismatched types +LL | let x: u32 = "x"; | ^^^ expected u32, found reference | = note: expected type `u32` diff --git a/src/test/ui/proc-macro/no-macro-use-attr.stderr b/src/test/ui/proc-macro/no-macro-use-attr.stderr index fe5107e17cb9..4b2fce7f6e4c 100644 --- a/src/test/ui/proc-macro/no-macro-use-attr.stderr +++ b/src/test/ui/proc-macro/no-macro-use-attr.stderr @@ -13,7 +13,7 @@ LL | #![warn(unused_extern_crates)] error: compilation successful --> $DIR/no-macro-use-attr.rs:10:1 | -LL | fn main() {} //~ ERROR compilation successful +LL | fn main() {} | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/proc-macro/proc-macro-attributes.rs b/src/test/ui/proc-macro/proc-macro-attributes.rs index 1cc824e943c7..062053453ee4 100644 --- a/src/test/ui/proc-macro/proc-macro-attributes.rs +++ b/src/test/ui/proc-macro/proc-macro-attributes.rs @@ -8,7 +8,6 @@ extern crate derive_b; #[B(D)] //~ ERROR `B` is ambiguous #[B(E = "foo")] //~ ERROR `B` is ambiguous #[B(arbitrary tokens)] //~ ERROR `B` is ambiguous - //~^ ERROR expected one of `(`, `)`, `,`, `::`, or `=`, found `tokens` #[derive(B)] struct B; diff --git a/src/test/ui/proc-macro/proc-macro-attributes.stderr b/src/test/ui/proc-macro/proc-macro-attributes.stderr index 7ac44c9354dd..f8f1e7cd988f 100644 --- a/src/test/ui/proc-macro/proc-macro-attributes.stderr +++ b/src/test/ui/proc-macro/proc-macro-attributes.stderr @@ -1,7 +1,7 @@ error[E0658]: The attribute `C` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/proc-macro-attributes.rs:7:3 | -LL | #[C] //~ ERROR attribute `C` is currently unknown to the compiler +LL | #[C] | ^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -9,11 +9,11 @@ LL | #[C] //~ ERROR attribute `C` is currently unknown to the compiler error[E0659]: `B` is ambiguous (derive helper attribute vs any other name) --> $DIR/proc-macro-attributes.rs:6:3 | -LL | #[B] //~ ERROR `B` is ambiguous +LL | #[B] | ^ ambiguous name | note: `B` could refer to the derive helper attribute defined here - --> $DIR/proc-macro-attributes.rs:12:10 + --> $DIR/proc-macro-attributes.rs:11:10 | LL | #[derive(B)] | ^ @@ -26,11 +26,11 @@ LL | #[macro_use] error[E0659]: `B` is ambiguous (derive helper attribute vs any other name) --> $DIR/proc-macro-attributes.rs:8:3 | -LL | #[B(D)] //~ ERROR `B` is ambiguous +LL | #[B(D)] | ^ ambiguous name | note: `B` could refer to the derive helper attribute defined here - --> $DIR/proc-macro-attributes.rs:12:10 + --> $DIR/proc-macro-attributes.rs:11:10 | LL | #[derive(B)] | ^ @@ -43,11 +43,11 @@ LL | #[macro_use] error[E0659]: `B` is ambiguous (derive helper attribute vs any other name) --> $DIR/proc-macro-attributes.rs:9:3 | -LL | #[B(E = "foo")] //~ ERROR `B` is ambiguous +LL | #[B(E = "foo")] | ^ ambiguous name | note: `B` could refer to the derive helper attribute defined here - --> $DIR/proc-macro-attributes.rs:12:10 + --> $DIR/proc-macro-attributes.rs:11:10 | LL | #[derive(B)] | ^ @@ -60,11 +60,11 @@ LL | #[macro_use] error[E0659]: `B` is ambiguous (derive helper attribute vs any other name) --> $DIR/proc-macro-attributes.rs:10:3 | -LL | #[B(arbitrary tokens)] //~ ERROR `B` is ambiguous +LL | #[B(arbitrary tokens)] | ^ ambiguous name | note: `B` could refer to the derive helper attribute defined here - --> $DIR/proc-macro-attributes.rs:12:10 + --> $DIR/proc-macro-attributes.rs:11:10 | LL | #[derive(B)] | ^ @@ -74,13 +74,7 @@ note: `B` could also refer to the derive macro imported here LL | #[macro_use] | ^^^^^^^^^^^^ -error: expected one of `(`, `)`, `,`, `::`, or `=`, found `tokens` - --> $DIR/proc-macro-attributes.rs:10:15 - | -LL | #[B(arbitrary tokens)] //~ ERROR `B` is ambiguous - | ^^^^^^ expected one of `(`, `)`, `,`, `::`, or `=` here - -error: aborting due to 6 previous errors +error: aborting due to 5 previous errors Some errors occurred: E0658, E0659. For more information about an error, try `rustc --explain E0658`. diff --git a/src/test/ui/proc-macro/proc-macro-gates.rs b/src/test/ui/proc-macro/proc-macro-gates.rs index b708f6303148..af6bfa08aaa9 100644 --- a/src/test/ui/proc-macro/proc-macro-gates.rs +++ b/src/test/ui/proc-macro/proc-macro-gates.rs @@ -19,7 +19,7 @@ mod _test2_inner { //~| ERROR: non-builtin inner attributes are unstable } -#[a = y] //~ ERROR: must only be followed by a delimiter token +#[a = "y"] //~ ERROR: must only be followed by a delimiter token fn _test3() {} fn attrs() { diff --git a/src/test/ui/proc-macro/proc-macro-gates.stderr b/src/test/ui/proc-macro/proc-macro-gates.stderr index c0bc06d358de..4ae8e63df724 100644 --- a/src/test/ui/proc-macro/proc-macro-gates.stderr +++ b/src/test/ui/proc-macro/proc-macro-gates.stderr @@ -1,7 +1,7 @@ error[E0658]: non-builtin inner attributes are unstable (see issue #54726) --> $DIR/proc-macro-gates.rs:11:5 | -LL | #![a] //~ ERROR: non-builtin inner attributes are unstable +LL | #![a] | ^^^^^ | = help: add #![feature(custom_inner_attributes)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #![a] //~ ERROR: non-builtin inner attributes are unstable error[E0658]: non-builtin inner attributes are unstable (see issue #54726) --> $DIR/proc-macro-gates.rs:18:5 | -LL | #![a] //~ ERROR: custom attributes cannot be applied to modules +LL | #![a] | ^^^^^ | = help: add #![feature(custom_inner_attributes)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | #![a] //~ ERROR: custom attributes cannot be applied to modules error[E0658]: custom attributes cannot be applied to modules (see issue #54727) --> $DIR/proc-macro-gates.rs:14:1 | -LL | #[a] //~ ERROR: custom attributes cannot be applied to modules +LL | #[a] | ^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | #[a] //~ ERROR: custom attributes cannot be applied to modules error[E0658]: custom attributes cannot be applied to modules (see issue #54727) --> $DIR/proc-macro-gates.rs:18:5 | -LL | #![a] //~ ERROR: custom attributes cannot be applied to modules +LL | #![a] | ^^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -33,13 +33,13 @@ LL | #![a] //~ ERROR: custom attributes cannot be applied to modules error: custom attribute invocations must be of the form #[foo] or #[foo(..)], the macro name must only be followed by a delimiter token --> $DIR/proc-macro-gates.rs:22:1 | -LL | #[a = y] //~ ERROR: must only be followed by a delimiter token - | ^^^^^^^^ +LL | #[a = "y"] + | ^^^^^^^^^^ error[E0658]: custom attributes cannot be applied to statements (see issue #54727) --> $DIR/proc-macro-gates.rs:31:5 | -LL | #[a] //~ ERROR: custom attributes cannot be applied to statements +LL | #[a] | ^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -47,7 +47,7 @@ LL | #[a] //~ ERROR: custom attributes cannot be applied to statements error[E0658]: custom attributes cannot be applied to statements (see issue #54727) --> $DIR/proc-macro-gates.rs:35:5 | -LL | #[a] //~ ERROR: custom attributes cannot be applied to statements +LL | #[a] | ^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -55,7 +55,7 @@ LL | #[a] //~ ERROR: custom attributes cannot be applied to statements error[E0658]: custom attributes cannot be applied to statements (see issue #54727) --> $DIR/proc-macro-gates.rs:39:5 | -LL | #[a] //~ ERROR: custom attributes cannot be applied to statements +LL | #[a] | ^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -63,7 +63,7 @@ LL | #[a] //~ ERROR: custom attributes cannot be applied to statements error[E0658]: custom attributes cannot be applied to expressions (see issue #54727) --> $DIR/proc-macro-gates.rs:43:14 | -LL | let _x = #[a] 2; //~ ERROR: custom attributes cannot be applied to expressions +LL | let _x = #[a] 2; | ^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -71,7 +71,7 @@ LL | let _x = #[a] 2; //~ ERROR: custom attributes cannot be applied to expr error[E0658]: custom attributes cannot be applied to expressions (see issue #54727) --> $DIR/proc-macro-gates.rs:46:15 | -LL | let _x = [#[a] 2]; //~ ERROR: custom attributes cannot be applied to expressions +LL | let _x = [#[a] 2]; | ^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -79,7 +79,7 @@ LL | let _x = [#[a] 2]; //~ ERROR: custom attributes cannot be applied to ex error[E0658]: custom attributes cannot be applied to expressions (see issue #54727) --> $DIR/proc-macro-gates.rs:49:14 | -LL | let _x = #[a] println!(); //~ ERROR: custom attributes cannot be applied to expressions +LL | let _x = #[a] println!(); | ^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -87,7 +87,7 @@ LL | let _x = #[a] println!(); //~ ERROR: custom attributes cannot be applie error[E0658]: procedural macros cannot be expanded to types (see issue #54727) --> $DIR/proc-macro-gates.rs:53:13 | -LL | let _x: m!(u32) = 3; //~ ERROR: procedural macros cannot be expanded to types +LL | let _x: m!(u32) = 3; | ^^^^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -95,7 +95,7 @@ LL | let _x: m!(u32) = 3; //~ ERROR: procedural macros cannot be expanded to error[E0658]: procedural macros cannot be expanded to patterns (see issue #54727) --> $DIR/proc-macro-gates.rs:54:12 | -LL | if let m!(Some(_x)) = Some(3) {} //~ ERROR: procedural macros cannot be expanded to patterns +LL | if let m!(Some(_x)) = Some(3) {} | ^^^^^^^^^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -103,7 +103,7 @@ LL | if let m!(Some(_x)) = Some(3) {} //~ ERROR: procedural macros cannot be error[E0658]: procedural macros cannot be expanded to statements (see issue #54727) --> $DIR/proc-macro-gates.rs:56:5 | -LL | m!(struct S;); //~ ERROR: procedural macros cannot be expanded to statements +LL | m!(struct S;); | ^^^^^^^^^^^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -111,7 +111,7 @@ LL | m!(struct S;); //~ ERROR: procedural macros cannot be expanded to state error[E0658]: procedural macros cannot be expanded to statements (see issue #54727) --> $DIR/proc-macro-gates.rs:57:5 | -LL | m!(let _x = 3;); //~ ERROR: procedural macros cannot be expanded to statements +LL | m!(let _x = 3;); | ^^^^^^^^^^^^^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -119,7 +119,7 @@ LL | m!(let _x = 3;); //~ ERROR: procedural macros cannot be expanded to sta error[E0658]: procedural macros cannot be expanded to expressions (see issue #54727) --> $DIR/proc-macro-gates.rs:59:14 | -LL | let _x = m!(3); //~ ERROR: procedural macros cannot be expanded to expressions +LL | let _x = m!(3); | ^^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable @@ -127,7 +127,7 @@ LL | let _x = m!(3); //~ ERROR: procedural macros cannot be expanded to expr error[E0658]: procedural macros cannot be expanded to expressions (see issue #54727) --> $DIR/proc-macro-gates.rs:60:15 | -LL | let _x = [m!(3)]; //~ ERROR: procedural macros cannot be expanded to expressions +LL | let _x = [m!(3)]; | ^^^^^ | = help: add #![feature(proc_macro_hygiene)] to the crate attributes to enable diff --git a/src/test/ui/proc-macro/proc-macro-gates2.stderr b/src/test/ui/proc-macro/proc-macro-gates2.stderr index 262482aea345..89ad527a43c8 100644 --- a/src/test/ui/proc-macro/proc-macro-gates2.stderr +++ b/src/test/ui/proc-macro/proc-macro-gates2.stderr @@ -9,7 +9,7 @@ LL | fn _test6<#[a] T>() {} error[E0658]: The attribute `a` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/proc-macro-gates2.rs:18:9 | -LL | #[a] //~ ERROR: unknown to the compiler +LL | #[a] | ^^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable diff --git a/src/test/ui/proc-macro/pub-at-crate-root.stderr b/src/test/ui/proc-macro/pub-at-crate-root.stderr index 47be1c44d2d8..66fa499d33bb 100644 --- a/src/test/ui/proc-macro/pub-at-crate-root.stderr +++ b/src/test/ui/proc-macro/pub-at-crate-root.stderr @@ -1,7 +1,7 @@ error: `proc-macro` crate types cannot export any items other than functions tagged with `#[proc_macro_derive]` currently --> $DIR/pub-at-crate-root.rs:8:1 | -LL | / pub mod a { //~ `proc-macro` crate types cannot export any items +LL | / pub mod a { LL | | use proc_macro::TokenStream; LL | | LL | | #[proc_macro_derive(B)] @@ -14,7 +14,7 @@ error: functions tagged with `#[proc_macro_derive]` must currently reside in the --> $DIR/pub-at-crate-root.rs:12:5 | LL | / pub fn bar(a: TokenStream) -> TokenStream { -LL | | //~^ ERROR: must currently reside in the root of the crate +LL | | LL | | a LL | | } | |_____^ @@ -23,7 +23,7 @@ error: functions tagged with `#[proc_macro_derive]` must be `pub` --> $DIR/pub-at-crate-root.rs:19:1 | LL | / fn bar(a: proc_macro::TokenStream) -> proc_macro::TokenStream { -LL | | //~^ ERROR: functions tagged with `#[proc_macro_derive]` must be `pub` +LL | | LL | | a LL | | } | |_^ diff --git a/src/test/ui/proc-macro/shadow.stderr b/src/test/ui/proc-macro/shadow.stderr index 2dfe2a94c88e..91b73903aca2 100644 --- a/src/test/ui/proc-macro/shadow.stderr +++ b/src/test/ui/proc-macro/shadow.stderr @@ -4,7 +4,7 @@ error[E0259]: the name `derive_a` is defined multiple times LL | extern crate derive_a; | ---------------------- previous import of the extern crate `derive_a` here LL | / #[macro_use] -LL | | extern crate derive_a; //~ ERROR the name `derive_a` is defined multiple times +LL | | extern crate derive_a; | | ^^^^^^^^^^^^^^^^^^^^^- | |_|____________________| | | help: remove unnecessary import diff --git a/src/test/ui/proc-macro/signature.stderr b/src/test/ui/proc-macro/signature.stderr index 99cb3316533a..4743e3031a34 100644 --- a/src/test/ui/proc-macro/signature.stderr +++ b/src/test/ui/proc-macro/signature.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/signature.rs:10:1 | LL | / pub unsafe extern fn foo(a: i32, b: u32) -> u32 { -LL | | //~^ ERROR: mismatched types +LL | | LL | | loop {} LL | | } | |_^ expected normal fn, found unsafe fn diff --git a/src/test/ui/proc-macro/span-preservation.stderr b/src/test/ui/proc-macro/span-preservation.stderr index db524907b656..fbccde28f59b 100644 --- a/src/test/ui/proc-macro/span-preservation.stderr +++ b/src/test/ui/proc-macro/span-preservation.stderr @@ -6,7 +6,7 @@ error[E0308]: mismatched types error[E0308]: mismatched types --> $DIR/span-preservation.rs:13:20 | -LL | let x: usize = "hello";;;;; //~ ERROR mismatched types +LL | let x: usize = "hello";;;;; | ^^^^^^^ expected usize, found reference | = note: expected type `usize` @@ -18,19 +18,19 @@ error[E0308]: mismatched types LL | fn b(x: Option) -> usize { | ----- expected `usize` because of return type LL | match x { -LL | Some(x) => { return x }, //~ ERROR mismatched types +LL | Some(x) => { return x }, | ^ expected usize, found isize error[E0308]: mismatched types --> $DIR/span-preservation.rs:35:22 | -LL | let x = Foo { a: 10isize }; //~ ERROR mismatched types +LL | let x = Foo { a: 10isize }; | ^^^^^^^ expected usize, found isize error[E0560]: struct `c::Foo` has no field named `b` --> $DIR/span-preservation.rs:36:26 | -LL | let y = Foo { a: 10, b: 10isize }; //~ ERROR has no field named `b` +LL | let y = Foo { a: 10, b: 10isize }; | ^ `c::Foo` does not have this field | = note: available fields are: `a` @@ -40,7 +40,7 @@ error[E0308]: mismatched types | LL | extern "C" fn baz() { | - possibly return type missing here? -LL | 0 //~ ERROR mismatched types +LL | 0 | ^ expected (), found integer | = note: expected type `()` diff --git a/src/test/ui/proc-macro/subspan.stderr b/src/test/ui/proc-macro/subspan.stderr index 94f1be6021fa..5117dd6d32d4 100644 --- a/src/test/ui/proc-macro/subspan.stderr +++ b/src/test/ui/proc-macro/subspan.stderr @@ -1,97 +1,97 @@ error: found 'hi's --> $DIR/subspan.rs:11:1 | -LL | subspan!("hi"); //~ ERROR found 'hi's +LL | subspan!("hi"); | ^^^^^^^^^^^^^^^ | note: here --> $DIR/subspan.rs:11:11 | -LL | subspan!("hi"); //~ ERROR found 'hi's +LL | subspan!("hi"); | ^^ error: found 'hi's --> $DIR/subspan.rs:14:1 | -LL | subspan!("hihi"); //~ ERROR found 'hi's +LL | subspan!("hihi"); | ^^^^^^^^^^^^^^^^^ | note: here --> $DIR/subspan.rs:14:11 | -LL | subspan!("hihi"); //~ ERROR found 'hi's +LL | subspan!("hihi"); | ^^^^ error: found 'hi's --> $DIR/subspan.rs:17:1 | -LL | subspan!("hihihi"); //~ ERROR found 'hi's +LL | subspan!("hihihi"); | ^^^^^^^^^^^^^^^^^^^ | note: here --> $DIR/subspan.rs:17:11 | -LL | subspan!("hihihi"); //~ ERROR found 'hi's +LL | subspan!("hihihi"); | ^^^^^^ error: found 'hi's --> $DIR/subspan.rs:20:1 | -LL | subspan!("why I hide? hi!"); //~ ERROR found 'hi's +LL | subspan!("why I hide? hi!"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: here --> $DIR/subspan.rs:20:17 | -LL | subspan!("why I hide? hi!"); //~ ERROR found 'hi's +LL | subspan!("why I hide? hi!"); | ^^ ^^ error: found 'hi's --> $DIR/subspan.rs:21:1 | -LL | subspan!("hey, hi, hidy, hidy, hi hi"); //~ ERROR found 'hi's +LL | subspan!("hey, hi, hidy, hidy, hi hi"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: here --> $DIR/subspan.rs:21:16 | -LL | subspan!("hey, hi, hidy, hidy, hi hi"); //~ ERROR found 'hi's +LL | subspan!("hey, hi, hidy, hidy, hi hi"); | ^^ ^^ ^^ ^^ ^^ error: found 'hi's --> $DIR/subspan.rs:22:1 | -LL | subspan!("this is a hi, and this is another hi"); //~ ERROR found 'hi's +LL | subspan!("this is a hi, and this is another hi"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: here --> $DIR/subspan.rs:22:12 | -LL | subspan!("this is a hi, and this is another hi"); //~ ERROR found 'hi's +LL | subspan!("this is a hi, and this is another hi"); | ^^ ^^ ^^ ^^ error: found 'hi's --> $DIR/subspan.rs:23:1 | -LL | subspan!("how are you this evening"); //~ ERROR found 'hi's +LL | subspan!("how are you this evening"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: here --> $DIR/subspan.rs:23:24 | -LL | subspan!("how are you this evening"); //~ ERROR found 'hi's +LL | subspan!("how are you this evening"); | ^^ error: found 'hi's --> $DIR/subspan.rs:24:1 | -LL | subspan!("this is highly eradic"); //~ ERROR found 'hi's +LL | subspan!("this is highly eradic"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: here --> $DIR/subspan.rs:24:12 | -LL | subspan!("this is highly eradic"); //~ ERROR found 'hi's +LL | subspan!("this is highly eradic"); | ^^ ^^ error: aborting due to 8 previous errors diff --git a/src/test/ui/proc-macro/three-equals.stderr b/src/test/ui/proc-macro/three-equals.stderr index e38343348dd9..f8dfa841d4f3 100644 --- a/src/test/ui/proc-macro/three-equals.stderr +++ b/src/test/ui/proc-macro/three-equals.stderr @@ -1,7 +1,7 @@ error: found 2 equal signs, need exactly 3 --> $DIR/three-equals.rs:15:5 | -LL | three_equals!(==); //~ ERROR found 2 equal signs, need exactly 3 +LL | three_equals!(==); | ^^^^^^^^^^^^^^^^^^ | = help: input must be: `===` @@ -9,38 +9,38 @@ LL | three_equals!(==); //~ ERROR found 2 equal signs, need exactly 3 error: expected EOF, found `=`. --> $DIR/three-equals.rs:18:21 | -LL | three_equals!(=====); //~ ERROR expected EOF +LL | three_equals!(=====); | ^^ | note: last good input was here --> $DIR/three-equals.rs:18:21 | -LL | three_equals!(=====); //~ ERROR expected EOF +LL | three_equals!(=====); | ^^ = help: input must be: `===` error: expected `=`, found `abc`. --> $DIR/three-equals.rs:21:19 | -LL | three_equals!(abc); //~ ERROR expected `=` +LL | three_equals!(abc); | ^^^ error: expected `=`, found `!`. --> $DIR/three-equals.rs:24:19 | -LL | three_equals!(!!); //~ ERROR expected `=` +LL | three_equals!(!!); | ^ error: expected EOF, found `a`. --> $DIR/three-equals.rs:27:22 | -LL | three_equals!(===a); //~ ERROR expected EOF +LL | three_equals!(===a); | ^ | note: last good input was here --> $DIR/three-equals.rs:27:21 | -LL | three_equals!(===a); //~ ERROR expected EOF +LL | three_equals!(===a); | ^ = help: input must be: `===` diff --git a/src/test/ui/ptr-coercion.stderr b/src/test/ui/ptr-coercion.stderr index 2499e90db7d9..019241d6874a 100644 --- a/src/test/ui/ptr-coercion.stderr +++ b/src/test/ui/ptr-coercion.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/ptr-coercion.rs:7:25 | -LL | let x: *mut isize = x; //~ ERROR mismatched types +LL | let x: *mut isize = x; | ^ types differ in mutability | = note: expected type `*mut isize` @@ -10,7 +10,7 @@ LL | let x: *mut isize = x; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/ptr-coercion.rs:13:25 | -LL | let x: *mut isize = &42; //~ ERROR mismatched types +LL | let x: *mut isize = &42; | ^^^ types differ in mutability | = note: expected type `*mut isize` @@ -19,7 +19,7 @@ LL | let x: *mut isize = &42; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/ptr-coercion.rs:19:25 | -LL | let x: *mut isize = x; //~ ERROR mismatched types +LL | let x: *mut isize = x; | ^ types differ in mutability | = note: expected type `*mut isize` diff --git a/src/test/ui/pub/pub-reexport-priv-extern-crate.stderr b/src/test/ui/pub/pub-reexport-priv-extern-crate.stderr index e895d51a848b..61c148bf2df2 100644 --- a/src/test/ui/pub/pub-reexport-priv-extern-crate.stderr +++ b/src/test/ui/pub/pub-reexport-priv-extern-crate.stderr @@ -1,7 +1,7 @@ error: extern crate `core` is private, and cannot be re-exported (error E0365), consider declaring with `pub` --> $DIR/pub-reexport-priv-extern-crate.rs:4:9 | -LL | pub use core as reexported_core; //~ ERROR `core` is private, and cannot be re-exported +LL | pub use core as reexported_core; | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: #[deny(pub_use_of_private_extern_crate)] on by default @@ -11,7 +11,7 @@ LL | pub use core as reexported_core; //~ ERROR `core` is private, and cannot be error: extern crate `core` is private, and cannot be re-exported (error E0365), consider declaring with `pub` --> $DIR/pub-reexport-priv-extern-crate.rs:12:9 | -LL | use foo1::core; //~ ERROR `core` is private, and cannot be re-exported +LL | use foo1::core; | ^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -20,7 +20,7 @@ LL | use foo1::core; //~ ERROR `core` is private, and cannot be re-exported error: extern crate `core` is private, and cannot be re-exported (error E0365), consider declaring with `pub` --> $DIR/pub-reexport-priv-extern-crate.rs:20:13 | -LL | pub use foo2::bar::core; //~ ERROR `core` is private, and cannot be re-exported +LL | pub use foo2::bar::core; | ^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/pub/pub-restricted-error-fn.stderr b/src/test/ui/pub/pub-restricted-error-fn.stderr index 86fe1b2186f4..fcff5334890e 100644 --- a/src/test/ui/pub/pub-restricted-error-fn.stderr +++ b/src/test/ui/pub/pub-restricted-error-fn.stderr @@ -1,7 +1,7 @@ error: unmatched visibility `pub` --> $DIR/pub-restricted-error-fn.rs:3:10 | -LL | pub(crate) () fn foo() {} //~ unmatched visibility +LL | pub(crate) () fn foo() {} | ^ error: aborting due to previous error diff --git a/src/test/ui/pub/pub-restricted-error.stderr b/src/test/ui/pub/pub-restricted-error.stderr index ca720279946f..d856833d04fb 100644 --- a/src/test/ui/pub/pub-restricted-error.stderr +++ b/src/test/ui/pub/pub-restricted-error.stderr @@ -1,7 +1,7 @@ error: expected identifier, found `(` --> $DIR/pub-restricted-error.rs:6:16 | -LL | pub(crate) () foo: usize, //~ ERROR expected identifier +LL | pub(crate) () foo: usize, | ^ expected identifier error: aborting due to previous error diff --git a/src/test/ui/pub/pub-restricted-non-path.stderr b/src/test/ui/pub/pub-restricted-non-path.stderr index 526e964f8ee3..e0ea50621f75 100644 --- a/src/test/ui/pub/pub-restricted-non-path.stderr +++ b/src/test/ui/pub/pub-restricted-non-path.stderr @@ -1,7 +1,7 @@ error: expected identifier, found `.` --> $DIR/pub-restricted-non-path.rs:3:6 | -LL | pub (.) fn afn() {} //~ ERROR expected identifier +LL | pub (.) fn afn() {} | ^ expected identifier error: aborting due to previous error diff --git a/src/test/ui/pub/pub-restricted.stderr b/src/test/ui/pub/pub-restricted.stderr index 40cf398023b2..7eeefa955054 100644 --- a/src/test/ui/pub/pub-restricted.stderr +++ b/src/test/ui/pub/pub-restricted.stderr @@ -1,7 +1,7 @@ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:5:6 | -LL | pub (a) fn afn() {} //~ incorrect visibility restriction +LL | pub (a) fn afn() {} | ^ help: make this visible only to module `a` with `in`: `in a` | = help: some possible visibility restrictions are: @@ -12,7 +12,7 @@ LL | pub (a) fn afn() {} //~ incorrect visibility restriction error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:6:6 | -LL | pub (b) fn bfn() {} //~ incorrect visibility restriction +LL | pub (b) fn bfn() {} | ^ help: make this visible only to module `b` with `in`: `in b` | = help: some possible visibility restrictions are: @@ -23,7 +23,7 @@ LL | pub (b) fn bfn() {} //~ incorrect visibility restriction error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:22:14 | -LL | pub (a) invalid: usize, //~ incorrect visibility restriction +LL | pub (a) invalid: usize, | ^ help: make this visible only to module `a` with `in`: `in a` | = help: some possible visibility restrictions are: @@ -34,7 +34,7 @@ LL | pub (a) invalid: usize, //~ incorrect visibility restriction error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:31:6 | -LL | pub (xyz) fn xyz() {} //~ incorrect visibility restriction +LL | pub (xyz) fn xyz() {} | ^^^ help: make this visible only to module `xyz` with `in`: `in xyz` | = help: some possible visibility restrictions are: @@ -45,7 +45,7 @@ LL | pub (xyz) fn xyz() {} //~ incorrect visibility restriction error: visibilities can only be restricted to ancestor modules --> $DIR/pub-restricted.rs:23:17 | -LL | pub (in x) non_parent_invalid: usize, //~ ERROR visibilities can only be restricted +LL | pub (in x) non_parent_invalid: usize, | ^ error: aborting due to 5 previous errors diff --git a/src/test/ui/qualified/qualified-path-params.stderr b/src/test/ui/qualified/qualified-path-params.stderr index 18fca2e30469..926b098040f1 100644 --- a/src/test/ui/qualified/qualified-path-params.stderr +++ b/src/test/ui/qualified/qualified-path-params.stderr @@ -7,7 +7,7 @@ LL | ::A::f:: => {} error[E0029]: only char and numeric types are allowed in range patterns --> $DIR/qualified-path-params.rs:22:15 | -LL | 0 ..= ::A::f:: => {} //~ ERROR only char and numeric types are allowed in range +LL | 0 ..= ::A::f:: => {} | ^^^^^^^^^^^^^^^^^^^^^ ranges require char or numeric types | = note: start type: {integer} diff --git a/src/test/ui/question-mark-type-infer.stderr b/src/test/ui/question-mark-type-infer.stderr index c998bdc086f1..f62a540572c9 100644 --- a/src/test/ui/question-mark-type-infer.stderr +++ b/src/test/ui/question-mark-type-infer.stderr @@ -1,7 +1,7 @@ error[E0284]: type annotations required: cannot resolve `<_ as std::ops::Try>::Ok == _` --> $DIR/question-mark-type-infer.rs:12:5 | -LL | l.iter().map(f).collect()? //~ ERROR type annotations required: cannot resolve +LL | l.iter().map(f).collect()? | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/range/range_traits-2.stderr b/src/test/ui/range/range_traits-2.stderr index f7f887006ed5..598a0b3ed037 100644 --- a/src/test/ui/range/range_traits-2.stderr +++ b/src/test/ui/range/range_traits-2.stderr @@ -1,7 +1,7 @@ error[E0204]: the trait `Copy` may not be implemented for this type --> $DIR/range_traits-2.rs:3:10 | -LL | #[derive(Copy, Clone)] //~ ERROR Copy +LL | #[derive(Copy, Clone)] | ^^^^ LL | struct R(Range); | ------------ this field does not implement `Copy` diff --git a/src/test/ui/range/range_traits-3.stderr b/src/test/ui/range/range_traits-3.stderr index 910ba5172767..e2713a2bd5ed 100644 --- a/src/test/ui/range/range_traits-3.stderr +++ b/src/test/ui/range/range_traits-3.stderr @@ -1,7 +1,7 @@ error[E0204]: the trait `Copy` may not be implemented for this type --> $DIR/range_traits-3.rs:3:10 | -LL | #[derive(Copy, Clone)] //~ ERROR Copy +LL | #[derive(Copy, Clone)] | ^^^^ LL | struct R(RangeFrom); | ---------------- this field does not implement `Copy` diff --git a/src/test/ui/range/range_traits-6.stderr b/src/test/ui/range/range_traits-6.stderr index c1916e24bfee..226d72ce0262 100644 --- a/src/test/ui/range/range_traits-6.stderr +++ b/src/test/ui/range/range_traits-6.stderr @@ -1,7 +1,7 @@ error[E0204]: the trait `Copy` may not be implemented for this type --> $DIR/range_traits-6.rs:3:10 | -LL | #[derive(Copy, Clone)] //~ ERROR Copy +LL | #[derive(Copy, Clone)] | ^^^^ LL | struct R(RangeInclusive); | --------------------- this field does not implement `Copy` diff --git a/src/test/ui/reachable/expr_add.stderr b/src/test/ui/reachable/expr_add.stderr index 548600f26ec8..02b29021cb61 100644 --- a/src/test/ui/reachable/expr_add.stderr +++ b/src/test/ui/reachable/expr_add.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_add.rs:17:13 | -LL | let x = Foo + return; //~ ERROR unreachable +LL | let x = Foo + return; | ^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/reachable/expr_array.stderr b/src/test/ui/reachable/expr_array.stderr index b6e79e551cd8..18d7ffe74bd1 100644 --- a/src/test/ui/reachable/expr_array.stderr +++ b/src/test/ui/reachable/expr_array.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_array.rs:9:34 | -LL | let x: [usize; 2] = [return, 22]; //~ ERROR unreachable +LL | let x: [usize; 2] = [return, 22]; | ^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unreachable_code)] error: unreachable expression --> $DIR/expr_array.rs:14:25 | -LL | let x: [usize; 2] = [22, return]; //~ ERROR unreachable +LL | let x: [usize; 2] = [22, return]; | ^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/reachable/expr_assign.stderr b/src/test/ui/reachable/expr_assign.stderr index 949009b72996..def16d90a749 100644 --- a/src/test/ui/reachable/expr_assign.stderr +++ b/src/test/ui/reachable/expr_assign.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_assign.rs:10:5 | -LL | x = return; //~ ERROR unreachable +LL | x = return; | ^^^^^^^^^^ | note: lint level defined here @@ -13,13 +13,13 @@ LL | #![deny(unreachable_code)] error: unreachable expression --> $DIR/expr_assign.rs:20:14 | -LL | *p = return; //~ ERROR unreachable +LL | *p = return; | ^^^^^^ error: unreachable expression --> $DIR/expr_assign.rs:26:15 | -LL | *{return; &mut i} = 22; //~ ERROR unreachable +LL | *{return; &mut i} = 22; | ^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/reachable/expr_block.stderr b/src/test/ui/reachable/expr_block.stderr index d71d12b744a6..a498502e6cb1 100644 --- a/src/test/ui/reachable/expr_block.stderr +++ b/src/test/ui/reachable/expr_block.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_block.rs:10:9 | -LL | 22 //~ ERROR unreachable +LL | 22 | ^^ | note: lint level defined here diff --git a/src/test/ui/reachable/expr_box.stderr b/src/test/ui/reachable/expr_box.stderr index 289cef24bcec..63137ce3da18 100644 --- a/src/test/ui/reachable/expr_box.stderr +++ b/src/test/ui/reachable/expr_box.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_box.rs:6:13 | -LL | let x = box return; //~ ERROR unreachable +LL | let x = box return; | ^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/reachable/expr_call.stderr b/src/test/ui/reachable/expr_call.stderr index aecaf24adc44..df5cff16f9a4 100644 --- a/src/test/ui/reachable/expr_call.stderr +++ b/src/test/ui/reachable/expr_call.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_call.rs:13:17 | -LL | foo(return, 22); //~ ERROR unreachable +LL | foo(return, 22); | ^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unreachable_code)] error: unreachable expression --> $DIR/expr_call.rs:18:5 | -LL | bar(return); //~ ERROR unreachable +LL | bar(return); | ^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/reachable/expr_cast.stderr b/src/test/ui/reachable/expr_cast.stderr index 21f8a0f418e5..3086745d28ed 100644 --- a/src/test/ui/reachable/expr_cast.stderr +++ b/src/test/ui/reachable/expr_cast.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_cast.rs:9:13 | -LL | let x = {return} as !; //~ ERROR unreachable +LL | let x = {return} as !; | ^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/reachable/expr_method.stderr b/src/test/ui/reachable/expr_method.stderr index f1770df2f9ea..bbfa2ef529ad 100644 --- a/src/test/ui/reachable/expr_method.stderr +++ b/src/test/ui/reachable/expr_method.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_method.rs:16:21 | -LL | Foo.foo(return, 22); //~ ERROR unreachable +LL | Foo.foo(return, 22); | ^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unreachable_code)] error: unreachable expression --> $DIR/expr_method.rs:21:5 | -LL | Foo.bar(return); //~ ERROR unreachable +LL | Foo.bar(return); | ^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/reachable/expr_repeat.stderr b/src/test/ui/reachable/expr_repeat.stderr index 288c18d5d659..0536cdef7212 100644 --- a/src/test/ui/reachable/expr_repeat.stderr +++ b/src/test/ui/reachable/expr_repeat.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_repeat.rs:9:25 | -LL | let x: [usize; 2] = [return; 2]; //~ ERROR unreachable +LL | let x: [usize; 2] = [return; 2]; | ^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/reachable/expr_return.stderr b/src/test/ui/reachable/expr_return.stderr index e5ce660d6959..3317da58aba1 100644 --- a/src/test/ui/reachable/expr_return.stderr +++ b/src/test/ui/reachable/expr_return.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_return.rs:10:22 | -LL | let x = {return {return {return;}}}; //~ ERROR unreachable +LL | let x = {return {return {return;}}}; | ^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/reachable/expr_struct.stderr b/src/test/ui/reachable/expr_struct.stderr index 5fbf603602ba..dcccb7a4db30 100644 --- a/src/test/ui/reachable/expr_struct.stderr +++ b/src/test/ui/reachable/expr_struct.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_struct.rs:14:13 | -LL | let x = Foo { a: 22, b: 33, ..return }; //~ ERROR unreachable +LL | let x = Foo { a: 22, b: 33, ..return }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,19 +13,19 @@ LL | #![deny(unreachable_code)] error: unreachable expression --> $DIR/expr_struct.rs:19:33 | -LL | let x = Foo { a: return, b: 33, ..return }; //~ ERROR unreachable +LL | let x = Foo { a: return, b: 33, ..return }; | ^^ error: unreachable expression --> $DIR/expr_struct.rs:24:39 | -LL | let x = Foo { a: 22, b: return, ..return }; //~ ERROR unreachable +LL | let x = Foo { a: 22, b: return, ..return }; | ^^^^^^ error: unreachable expression --> $DIR/expr_struct.rs:29:13 | -LL | let x = Foo { a: 22, b: return }; //~ ERROR unreachable +LL | let x = Foo { a: 22, b: return }; | ^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/reachable/expr_tup.stderr b/src/test/ui/reachable/expr_tup.stderr index def678ec93ea..1837031107d5 100644 --- a/src/test/ui/reachable/expr_tup.stderr +++ b/src/test/ui/reachable/expr_tup.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_tup.rs:9:38 | -LL | let x: (usize, usize) = (return, 2); //~ ERROR unreachable +LL | let x: (usize, usize) = (return, 2); | ^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unreachable_code)] error: unreachable expression --> $DIR/expr_tup.rs:14:29 | -LL | let x: (usize, usize) = (2, return); //~ ERROR unreachable +LL | let x: (usize, usize) = (2, return); | ^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/reachable/expr_type.stderr b/src/test/ui/reachable/expr_type.stderr index b90cd7903417..f867c8916341 100644 --- a/src/test/ui/reachable/expr_type.stderr +++ b/src/test/ui/reachable/expr_type.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/expr_type.rs:9:13 | -LL | let x = {return}: !; //~ ERROR unreachable +LL | let x = {return}: !; | ^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/reachable/expr_unary.stderr b/src/test/ui/reachable/expr_unary.stderr index 44887f0ee523..61982289cdc6 100644 --- a/src/test/ui/reachable/expr_unary.stderr +++ b/src/test/ui/reachable/expr_unary.stderr @@ -1,13 +1,13 @@ error[E0600]: cannot apply unary operator `!` to type `!` --> $DIR/expr_unary.rs:8:16 | -LL | let x: ! = ! { return; }; //~ ERROR unreachable +LL | let x: ! = ! { return; }; | ^^^^^^^^^^^^^ cannot apply unary operator `!` error: unreachable expression --> $DIR/expr_unary.rs:8:16 | -LL | let x: ! = ! { return; }; //~ ERROR unreachable +LL | let x: ! = ! { return; }; | ^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/recursion/recursion.stderr b/src/test/ui/recursion/recursion.stderr index 1bef37ad5888..9213ba052a9e 100644 --- a/src/test/ui/recursion/recursion.stderr +++ b/src/test/ui/recursion/recursion.stderr @@ -1,7 +1,7 @@ error: reached the recursion limit while instantiating `test::>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>` --> $DIR/recursion.rs:12:1 | -LL | / fn test (n:isize, i:isize, first:T, second:T) ->isize { //~ ERROR recursion limit +LL | / fn test (n:isize, i:isize, first:T, second:T) ->isize { LL | | match n { 0 => {first.dot(second)} LL | | // FIXME(#4287) Error message should be here. It should be LL | | // a type error to instantiate `test` at a type other than T. diff --git a/src/test/ui/recursion/recursive-reexports.stderr b/src/test/ui/recursion/recursive-reexports.stderr index 681931ef830f..01afc1458afb 100644 --- a/src/test/ui/recursion/recursive-reexports.stderr +++ b/src/test/ui/recursion/recursive-reexports.stderr @@ -1,7 +1,7 @@ error[E0412]: cannot find type `S` in module `recursive_reexports` --> $DIR/recursive-reexports.rs:5:32 | -LL | fn f() -> recursive_reexports::S {} //~ ERROR cannot find type `S` in module `recursive_reexports` +LL | fn f() -> recursive_reexports::S {} | ^ not found in `recursive_reexports` error: aborting due to previous error diff --git a/src/test/ui/ref-suggestion.nll.stderr b/src/test/ui/ref-suggestion.nll.stderr index 402f3c77cdb7..9ff8e21bb58b 100644 --- a/src/test/ui/ref-suggestion.nll.stderr +++ b/src/test/ui/ref-suggestion.nll.stderr @@ -5,7 +5,7 @@ LL | let x = vec![1]; | - move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait LL | let y = x; | - value moved here -LL | x; //~ ERROR use of moved value +LL | x; | ^ value used here after move error[E0382]: use of moved value: `x` @@ -15,7 +15,7 @@ LL | let x = vec![1]; | - move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait LL | let mut y = x; | - value moved here -LL | x; //~ ERROR use of moved value +LL | x; | ^ value used here after move error[E0382]: use of moved value: `x` @@ -24,7 +24,7 @@ error[E0382]: use of moved value: `x` LL | (Some(y), ()) => {}, | - value moved here ... -LL | x; //~ ERROR use of partially moved value +LL | x; | ^ value used here after partial move | = note: move occurs because value has type `std::vec::Vec`, which does not implement the `Copy` trait diff --git a/src/test/ui/ref-suggestion.stderr b/src/test/ui/ref-suggestion.stderr index 1f871bafeec9..df677a611cd5 100644 --- a/src/test/ui/ref-suggestion.stderr +++ b/src/test/ui/ref-suggestion.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x` | LL | let y = x; | - value moved here -LL | x; //~ ERROR use of moved value +LL | x; | ^ value used here after move | = note: move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait @@ -13,7 +13,7 @@ error[E0382]: use of moved value: `x` | LL | let mut y = x; | ----- value moved here -LL | x; //~ ERROR use of moved value +LL | x; | ^ value used here after move | = note: move occurs because `x` has type `std::vec::Vec`, which does not implement the `Copy` trait @@ -24,7 +24,7 @@ error[E0382]: use of partially moved value: `x` LL | (Some(y), ()) => {}, | - value moved here ... -LL | x; //~ ERROR use of partially moved value +LL | x; | ^ value used here after move | = note: move occurs because the value has type `std::vec::Vec`, which does not implement the `Copy` trait diff --git a/src/test/ui/regions-fn-subtyping-return-static-fail.stderr b/src/test/ui/regions-fn-subtyping-return-static-fail.stderr index 66e6a615b33b..35478a7db860 100644 --- a/src/test/ui/regions-fn-subtyping-return-static-fail.stderr +++ b/src/test/ui/regions-fn-subtyping-return-static-fail.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/regions-fn-subtyping-return-static-fail.rs:40:12 | -LL | want_F(bar); //~ ERROR mismatched types +LL | want_F(bar); | ^^^ expected concrete lifetime, found bound lifetime parameter 'cx | = note: expected type `for<'cx> fn(&'cx S) -> &'cx S` @@ -10,7 +10,7 @@ LL | want_F(bar); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/regions-fn-subtyping-return-static-fail.rs:48:12 | -LL | want_G(baz); //~ ERROR mismatched types +LL | want_G(baz); | ^^^ expected concrete lifetime, found bound lifetime parameter 'cx | = note: expected type `for<'cx> fn(&'cx S) -> &'static S` diff --git a/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr b/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr index fa4c8a9dc6d8..bce310bafaa9 100644 --- a/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr +++ b/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr @@ -3,8 +3,8 @@ warning: function cannot return without recursing | LL | fn call_rec(mut f: F) -> usize where F: FnMut(usize) -> usize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing -LL | //~^ WARN function cannot return without recursing -LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` +LL | +LL | (|x| f(x))(call_rec(f)) | ----------- recursive call site | = note: #[warn(unconditional_recursion)] on by default @@ -13,7 +13,7 @@ LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` error[E0505]: cannot move out of `f` because it is borrowed --> $DIR/region-bound-on-closure-outlives-call.rs:3:25 | -LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` +LL | (|x| f(x))(call_rec(f)) | ---------- ^ move out of `f` occurs here | || | | || borrow occurs due to use in closure diff --git a/src/test/ui/regions/region-bound-on-closure-outlives-call.stderr b/src/test/ui/regions/region-bound-on-closure-outlives-call.stderr index 3e60efd14720..cb888ab66c47 100644 --- a/src/test/ui/regions/region-bound-on-closure-outlives-call.stderr +++ b/src/test/ui/regions/region-bound-on-closure-outlives-call.stderr @@ -3,8 +3,8 @@ warning: function cannot return without recursing | LL | fn call_rec(mut f: F) -> usize where F: FnMut(usize) -> usize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing -LL | //~^ WARN function cannot return without recursing -LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` +LL | +LL | (|x| f(x))(call_rec(f)) | ----------- recursive call site | = note: #[warn(unconditional_recursion)] on by default @@ -13,7 +13,7 @@ LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` error[E0505]: cannot move out of `f` because it is borrowed --> $DIR/region-bound-on-closure-outlives-call.rs:3:25 | -LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f` +LL | (|x| f(x))(call_rec(f)) | --- ^ move out of `f` occurs here | | | borrow of `f` occurs here diff --git a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr index 16c31fbcac0f..ec71d55705e8 100644 --- a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr +++ b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr @@ -13,18 +13,18 @@ LL | z: Box+'b+'c>, note: lifetime parameter instantiated with the lifetime 'b as defined on the struct at 11:15 --> $DIR/region-bounds-on-objects-and-type-parameters.rs:11:15 | -LL | struct Foo<'a,'b,'c> { //~ ERROR parameter `'c` is never used +LL | struct Foo<'a,'b,'c> { | ^^ note: but lifetime parameter must outlive the lifetime 'a as defined on the struct at 11:12 --> $DIR/region-bounds-on-objects-and-type-parameters.rs:11:12 | -LL | struct Foo<'a,'b,'c> { //~ ERROR parameter `'c` is never used +LL | struct Foo<'a,'b,'c> { | ^^ error[E0392]: parameter `'c` is never used --> $DIR/region-bounds-on-objects-and-type-parameters.rs:11:18 | -LL | struct Foo<'a,'b,'c> { //~ ERROR parameter `'c` is never used +LL | struct Foo<'a,'b,'c> { | ^^ unused type parameter | = help: consider removing `'c` or using a marker such as `std::marker::PhantomData` diff --git a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr index 5c8b3d3ba692..7b901c2f9601 100644 --- a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr +++ b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr @@ -4,7 +4,7 @@ error[E0623]: lifetime mismatch LL | fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) { | --------- --------- these two types are declared with different lifetimes... LL | // Illegal now because there is no `'b:'a` declaration. -LL | *x = *y; //~ ERROR E0623 +LL | *x = *y; | ^^ ...but data from `y` flows into `x` here error[E0623]: lifetime mismatch @@ -13,13 +13,13 @@ error[E0623]: lifetime mismatch LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) { | --------- --------- these two types are declared with different lifetimes... ... -LL | a(x, y); //~ ERROR lifetime mismatch [E0623] +LL | a(x, y); | ^ ...but data from `y` flows into `x` here error[E0308]: mismatched types --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:20:43 | -LL | let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR mismatched types +LL | let _: fn(&mut &isize, &mut &isize) = a; | ^ expected concrete lifetime, found bound lifetime parameter | = note: expected type `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)` diff --git a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr index f36885f7aeb9..3e42cfcffb43 100644 --- a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr +++ b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr @@ -4,7 +4,7 @@ error[E0623]: lifetime mismatch LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { | --------- --------- these two types are declared with different lifetimes... LL | // Illegal now because there is no `'b:'a` declaration. -LL | *x = *y; //~ ERROR E0623 +LL | *x = *y; | ^^ ...but data from `y` flows into `x` here error[E0623]: lifetime mismatch @@ -15,7 +15,7 @@ LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { | | | these two types are declared with different lifetimes... ... -LL | *z = *y; //~ ERROR E0623 +LL | *z = *y; | ^^ ...but data from `y` flows into `z` here error[E0623]: lifetime mismatch @@ -24,13 +24,13 @@ error[E0623]: lifetime mismatch LL | fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) { | --------- --------- these two types are declared with different lifetimes... ... -LL | a(x, y, z); //~ ERROR lifetime mismatch [E0623] +LL | a(x, y, z); | ^ ...but data from `y` flows into `x` here error[E0308]: mismatched types --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:22:56 | -LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; //~ ERROR E0308 +LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; | ^ expected concrete lifetime, found bound lifetime parameter | = note: expected type `for<'r, 's, 't0, 't1, 't2, 't3> fn(&'r mut &'s isize, &'t0 mut &'t1 isize, &'t2 mut &'t3 isize)` diff --git a/src/test/ui/regions/region-object-lifetime-2.stderr b/src/test/ui/regions/region-object-lifetime-2.stderr index f1e87ebf4749..8817ad1c9f73 100644 --- a/src/test/ui/regions/region-object-lifetime-2.stderr +++ b/src/test/ui/regions/region-object-lifetime-2.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements --> $DIR/region-object-lifetime-2.rs:10:7 | -LL | x.borrowed() //~ ERROR cannot infer +LL | x.borrowed() | ^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 9:42... @@ -12,7 +12,7 @@ LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () { note: ...so that reference does not outlive borrowed content --> $DIR/region-object-lifetime-2.rs:10:5 | -LL | x.borrowed() //~ ERROR cannot infer +LL | x.borrowed() | ^ note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 9:45... --> $DIR/region-object-lifetime-2.rs:9:45 @@ -22,7 +22,7 @@ LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () { note: ...so that reference does not outlive borrowed content --> $DIR/region-object-lifetime-2.rs:10:5 | -LL | x.borrowed() //~ ERROR cannot infer +LL | x.borrowed() | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/regions/region-object-lifetime-4.stderr b/src/test/ui/regions/region-object-lifetime-4.stderr index 862a469ddb98..fee7f40efd48 100644 --- a/src/test/ui/regions/region-object-lifetime-4.stderr +++ b/src/test/ui/regions/region-object-lifetime-4.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements --> $DIR/region-object-lifetime-4.rs:12:7 | -LL | x.borrowed() //~ ERROR cannot infer +LL | x.borrowed() | ^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 11:41... @@ -12,7 +12,7 @@ LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () { note: ...so that reference does not outlive borrowed content --> $DIR/region-object-lifetime-4.rs:12:5 | -LL | x.borrowed() //~ ERROR cannot infer +LL | x.borrowed() | ^ note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 11:44... --> $DIR/region-object-lifetime-4.rs:11:44 @@ -22,7 +22,7 @@ LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () { note: ...so that reference does not outlive borrowed content --> $DIR/region-object-lifetime-4.rs:12:5 | -LL | x.borrowed() //~ ERROR cannot infer +LL | x.borrowed() | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/regions/region-object-lifetime-5.nll.stderr b/src/test/ui/regions/region-object-lifetime-5.nll.stderr index c6d7135a2dbc..b86f6e3a2a12 100644 --- a/src/test/ui/regions/region-object-lifetime-5.nll.stderr +++ b/src/test/ui/regions/region-object-lifetime-5.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local data `*x` --> $DIR/region-object-lifetime-5.rs:11:5 | -LL | x.borrowed() //~ ERROR `*x` does not live long enough +LL | x.borrowed() | -^^^^^^^^^^^ | | | returns a value referencing data owned by the current function diff --git a/src/test/ui/regions/region-object-lifetime-5.stderr b/src/test/ui/regions/region-object-lifetime-5.stderr index 002bae18b1c0..1efaee181cb7 100644 --- a/src/test/ui/regions/region-object-lifetime-5.stderr +++ b/src/test/ui/regions/region-object-lifetime-5.stderr @@ -1,7 +1,7 @@ error[E0597]: `*x` does not live long enough --> $DIR/region-object-lifetime-5.rs:11:5 | -LL | x.borrowed() //~ ERROR `*x` does not live long enough +LL | x.borrowed() | ^ borrowed value does not live long enough LL | } | - borrowed value only lives until here diff --git a/src/test/ui/regions/regions-addr-of-arg.nll.stderr b/src/test/ui/regions/regions-addr-of-arg.nll.stderr index 0f60bc669b2d..54f44b98b919 100644 --- a/src/test/ui/regions/regions-addr-of-arg.nll.stderr +++ b/src/test/ui/regions/regions-addr-of-arg.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `a` does not live long enough --> $DIR/regions-addr-of-arg.rs:5:30 | -LL | let _p: &'static isize = &a; //~ ERROR `a` does not live long enough +LL | let _p: &'static isize = &a; | -------------- ^^ borrowed value does not live long enough | | | type annotation requires that `a` is borrowed for `'static` @@ -11,7 +11,7 @@ LL | } error[E0515]: cannot return reference to function parameter `a` --> $DIR/regions-addr-of-arg.rs:13:5 | -LL | &a //~ ERROR `a` does not live long enough +LL | &a | ^^ returns a reference to data owned by the current function error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/regions-addr-of-arg.stderr b/src/test/ui/regions/regions-addr-of-arg.stderr index 61e28b8bbead..3e76a7dda992 100644 --- a/src/test/ui/regions/regions-addr-of-arg.stderr +++ b/src/test/ui/regions/regions-addr-of-arg.stderr @@ -1,7 +1,7 @@ error[E0597]: `a` does not live long enough --> $DIR/regions-addr-of-arg.rs:5:31 | -LL | let _p: &'static isize = &a; //~ ERROR `a` does not live long enough +LL | let _p: &'static isize = &a; | ^ borrowed value does not live long enough LL | } | - borrowed value only lives until here @@ -11,7 +11,7 @@ LL | } error[E0597]: `a` does not live long enough --> $DIR/regions-addr-of-arg.rs:13:6 | -LL | &a //~ ERROR `a` does not live long enough +LL | &a | ^ borrowed value does not live long enough LL | } | - borrowed value only lives until here diff --git a/src/test/ui/regions/regions-addr-of-self.stderr b/src/test/ui/regions/regions-addr-of-self.stderr index 2ea8aecacdae..a0b8b6b51e5a 100644 --- a/src/test/ui/regions/regions-addr-of-self.stderr +++ b/src/test/ui/regions/regions-addr-of-self.stderr @@ -1,27 +1,27 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements --> $DIR/regions-addr-of-self.rs:7:37 | -LL | let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer +LL | let p: &'static mut usize = &mut self.cats_chased; | ^^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 6:5... --> $DIR/regions-addr-of-self.rs:6:5 | LL | / pub fn chase_cat(&mut self) { -LL | | let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer +LL | | let p: &'static mut usize = &mut self.cats_chased; LL | | *p += 1; LL | | } | |_____^ note: ...so that reference does not outlive borrowed content --> $DIR/regions-addr-of-self.rs:7:37 | -LL | let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer +LL | let p: &'static mut usize = &mut self.cats_chased; | ^^^^^^^^^^^^^^^^^^^^^ = note: but, the lifetime must be valid for the static lifetime... note: ...so that reference does not outlive borrowed content --> $DIR/regions-addr-of-self.rs:7:37 | -LL | let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer +LL | let p: &'static mut usize = &mut self.cats_chased; | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/regions/regions-addr-of-upvar-self.stderr b/src/test/ui/regions/regions-addr-of-upvar-self.stderr index 97470aae54a0..01b2631a5371 100644 --- a/src/test/ui/regions/regions-addr-of-upvar-self.stderr +++ b/src/test/ui/regions/regions-addr-of-upvar-self.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements --> $DIR/regions-addr-of-upvar-self.rs:10:41 | -LL | let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer +LL | let p: &'static mut usize = &mut self.food; | ^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime as defined on the body at 9:18... @@ -12,13 +12,13 @@ LL | let _f = || { note: ...so that reference does not outlive borrowed content --> $DIR/regions-addr-of-upvar-self.rs:10:41 | -LL | let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer +LL | let p: &'static mut usize = &mut self.food; | ^^^^^^^^^^^^^^ = note: but, the lifetime must be valid for the static lifetime... note: ...so that reference does not outlive borrowed content --> $DIR/regions-addr-of-upvar-self.rs:10:41 | -LL | let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer +LL | let p: &'static mut usize = &mut self.food; | ^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/regions/regions-adjusted-lvalue-op.nll.stderr b/src/test/ui/regions/regions-adjusted-lvalue-op.nll.stderr index f188da5038d8..2c55634445d8 100644 --- a/src/test/ui/regions/regions-adjusted-lvalue-op.nll.stderr +++ b/src/test/ui/regions/regions-adjusted-lvalue-op.nll.stderr @@ -1,7 +1,7 @@ error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable --> $DIR/regions-adjusted-lvalue-op.rs:14:16 | -LL | v[0].oh_no(&v); //~ ERROR cannot borrow `v` as immutable because +LL | v[0].oh_no(&v); | - ----- ^^ immutable borrow occurs here | | | | | mutable borrow later used by call @@ -10,7 +10,7 @@ LL | v[0].oh_no(&v); //~ ERROR cannot borrow `v` as immutable because error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable --> $DIR/regions-adjusted-lvalue-op.rs:15:16 | -LL | (*v).oh_no(&v); //~ ERROR cannot borrow `v` as immutable because +LL | (*v).oh_no(&v); | - ----- ^^ immutable borrow occurs here | | | | | mutable borrow later used by call diff --git a/src/test/ui/regions/regions-adjusted-lvalue-op.stderr b/src/test/ui/regions/regions-adjusted-lvalue-op.stderr index 9988289b91e6..2c4c75f323ce 100644 --- a/src/test/ui/regions/regions-adjusted-lvalue-op.stderr +++ b/src/test/ui/regions/regions-adjusted-lvalue-op.stderr @@ -1,7 +1,7 @@ error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable --> $DIR/regions-adjusted-lvalue-op.rs:14:17 | -LL | v[0].oh_no(&v); //~ ERROR cannot borrow `v` as immutable because +LL | v[0].oh_no(&v); | - ^- mutable borrow ends here | | | | | immutable borrow occurs here @@ -10,7 +10,7 @@ LL | v[0].oh_no(&v); //~ ERROR cannot borrow `v` as immutable because error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable --> $DIR/regions-adjusted-lvalue-op.rs:15:17 | -LL | (*v).oh_no(&v); //~ ERROR cannot borrow `v` as immutable because +LL | (*v).oh_no(&v); | - ^- mutable borrow ends here | | | | | immutable borrow occurs here diff --git a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr index dbda9f4067b0..c72d6483c28f 100644 --- a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr +++ b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr @@ -1,7 +1,7 @@ error[E0477]: the type `&'a isize` does not fulfill the required lifetime --> $DIR/regions-bounded-by-trait-requiring-static.rs:22:5 | -LL | assert_send::<&'a isize>(); //~ ERROR does not fulfill the required lifetime +LL | assert_send::<&'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: type must satisfy the static lifetime @@ -9,7 +9,7 @@ LL | assert_send::<&'a isize>(); //~ ERROR does not fulfill the required lif error[E0477]: the type `&'a str` does not fulfill the required lifetime --> $DIR/regions-bounded-by-trait-requiring-static.rs:26:5 | -LL | assert_send::<&'a str>(); //~ ERROR does not fulfill the required lifetime +LL | assert_send::<&'a str>(); | ^^^^^^^^^^^^^^^^^^^^^^ | = note: type must satisfy the static lifetime @@ -17,7 +17,7 @@ LL | assert_send::<&'a str>(); //~ ERROR does not fulfill the required lifet error[E0477]: the type `&'a [isize]` does not fulfill the required lifetime --> $DIR/regions-bounded-by-trait-requiring-static.rs:30:5 | -LL | assert_send::<&'a [isize]>(); //~ ERROR does not fulfill the required lifetime +LL | assert_send::<&'a [isize]>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: type must satisfy the static lifetime @@ -25,7 +25,7 @@ LL | assert_send::<&'a [isize]>(); //~ ERROR does not fulfill the required l error[E0477]: the type `std::boxed::Box<&'a isize>` does not fulfill the required lifetime --> $DIR/regions-bounded-by-trait-requiring-static.rs:44:5 | -LL | assert_send::>(); //~ ERROR does not fulfill the required lifetime +LL | assert_send::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: type must satisfy the static lifetime @@ -33,7 +33,7 @@ LL | assert_send::>(); //~ ERROR does not fulfill the require error[E0477]: the type `*const &'a isize` does not fulfill the required lifetime --> $DIR/regions-bounded-by-trait-requiring-static.rs:55:5 | -LL | assert_send::<*const &'a isize>(); //~ ERROR does not fulfill the required lifetime +LL | assert_send::<*const &'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: type must satisfy the static lifetime @@ -41,7 +41,7 @@ LL | assert_send::<*const &'a isize>(); //~ ERROR does not fulfill the requi error[E0477]: the type `*mut &'a isize` does not fulfill the required lifetime --> $DIR/regions-bounded-by-trait-requiring-static.rs:59:5 | -LL | assert_send::<*mut &'a isize>(); //~ ERROR does not fulfill the required lifetime +LL | assert_send::<*mut &'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: type must satisfy the static lifetime diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.stderr index 50339590ee54..eb205a303dbd 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.stderr @@ -4,7 +4,7 @@ error[E0623]: lifetime mismatch LL | fn call_bigger_region<'x, 'y>(a: Inv<'x>, b: Inv<'y>) { | ------- ------- these two types are declared with different lifetimes... LL | // Here the value provided for 'y is 'y, and hence 'y:'x does not hold. -LL | a.bigger_region(b) //~ ERROR lifetime mismatch [E0623] +LL | a.bigger_region(b) | ^^^^^^^^^^^^^ ...but data from `b` flows into `a` here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.stderr index c9cbacded907..de1073cd1d9d 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.stderr @@ -4,7 +4,7 @@ error[E0623]: lifetime mismatch LL | fn caller2<'a,'b,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) { | ------- ------- these two types are declared with different lifetimes... LL | // Here the value provided for 'y is 'b, and hence 'b:'a does not hold. -LL | f.method(b); //~ ERROR lifetime mismatch [E0623] +LL | f.method(b); | ^^^^^^ ...but data from `b` flows into `a` here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-bounds.stderr b/src/test/ui/regions/regions-bounds.stderr index 95857e987751..27eb8891c6c0 100644 --- a/src/test/ui/regions/regions-bounds.stderr +++ b/src/test/ui/regions/regions-bounds.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/regions-bounds.rs:9:12 | -LL | return e; //~ ERROR mismatched types +LL | return e; | ^ lifetime mismatch | = note: expected type `TupleStruct<'b>` @@ -20,7 +20,7 @@ LL | fn a_fn1<'a,'b>(e: TupleStruct<'a>) -> TupleStruct<'b> { error[E0308]: mismatched types --> $DIR/regions-bounds.rs:13:12 | -LL | return e; //~ ERROR mismatched types +LL | return e; | ^ lifetime mismatch | = note: expected type `Struct<'b>` diff --git a/src/test/ui/regions/regions-close-associated-type-into-object.stderr b/src/test/ui/regions/regions-close-associated-type-into-object.stderr index 182081ede0c6..89c0c2534266 100644 --- a/src/test/ui/regions/regions-close-associated-type-into-object.stderr +++ b/src/test/ui/regions/regions-close-associated-type-into-object.stderr @@ -1,53 +1,53 @@ error[E0310]: the associated type `::Item` may not live long enough --> $DIR/regions-close-associated-type-into-object.rs:15:5 | -LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough +LL | Box::new(item) | ^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `::Item: 'static`... note: ...so that the type `::Item` will meet its required lifetime bounds --> $DIR/regions-close-associated-type-into-object.rs:15:5 | -LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough +LL | Box::new(item) | ^^^^^^^^^^^^^^ error[E0310]: the associated type `::Item` may not live long enough --> $DIR/regions-close-associated-type-into-object.rs:22:5 | -LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough +LL | Box::new(item) | ^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `::Item: 'static`... note: ...so that the type `std::boxed::Box<::Item>` will meet its required lifetime bounds --> $DIR/regions-close-associated-type-into-object.rs:22:5 | -LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough +LL | Box::new(item) | ^^^^^^^^^^^^^^ error[E0309]: the associated type `::Item` may not live long enough --> $DIR/regions-close-associated-type-into-object.rs:28:5 | -LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough +LL | Box::new(item) | ^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `::Item: 'a`... note: ...so that the type `::Item` will meet its required lifetime bounds --> $DIR/regions-close-associated-type-into-object.rs:28:5 | -LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough +LL | Box::new(item) | ^^^^^^^^^^^^^^ error[E0309]: the associated type `::Item` may not live long enough --> $DIR/regions-close-associated-type-into-object.rs:35:5 | -LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough +LL | Box::new(item) | ^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `::Item: 'a`... note: ...so that the type `std::boxed::Box<::Item>` will meet its required lifetime bounds --> $DIR/regions-close-associated-type-into-object.rs:35:5 | -LL | Box::new(item) //~ ERROR associated type `::Item` may not live long enough +LL | Box::new(item) | ^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/regions/regions-close-object-into-object-1.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-1.nll.stderr index 0e68a0548e62..8e119c4f5355 100644 --- a/src/test/ui/regions/regions-close-object-into-object-1.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-1.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local data `*v` --> $DIR/regions-close-object-into-object-1.rs:12:5 | -LL | box B(&*v) as Box //~ ERROR `*v` does not live long enough +LL | box B(&*v) as Box | ^^^^^^---^^^^^^^^^^^ | | | | | `*v` is borrowed here diff --git a/src/test/ui/regions/regions-close-object-into-object-1.stderr b/src/test/ui/regions/regions-close-object-into-object-1.stderr index 817f664db45d..c7bde8dbd6df 100644 --- a/src/test/ui/regions/regions-close-object-into-object-1.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-1.stderr @@ -1,7 +1,7 @@ error[E0597]: `*v` does not live long enough --> $DIR/regions-close-object-into-object-1.rs:12:12 | -LL | box B(&*v) as Box //~ ERROR `*v` does not live long enough +LL | box B(&*v) as Box | ^^ borrowed value does not live long enough LL | } | - borrowed value only lives until here diff --git a/src/test/ui/regions/regions-close-object-into-object-2.stderr b/src/test/ui/regions/regions-close-object-into-object-2.stderr index de9a250ced66..d5e228e1f0d9 100644 --- a/src/test/ui/regions/regions-close-object-into-object-2.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-2.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements --> $DIR/regions-close-object-into-object-2.rs:10:11 | -LL | box B(&*v) as Box //~ ERROR cannot infer +LL | box B(&*v) as Box | ^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 9:6... @@ -12,7 +12,7 @@ LL | fn g<'a, T: 'static>(v: Box+'a>) -> Box { note: ...so that the type `(dyn A + 'a)` is not borrowed for too long --> $DIR/regions-close-object-into-object-2.rs:10:11 | -LL | box B(&*v) as Box //~ ERROR cannot infer +LL | box B(&*v) as Box | ^^^ = note: but, the lifetime must be valid for the static lifetime... = note: ...so that the expression is assignable: diff --git a/src/test/ui/regions/regions-close-object-into-object-3.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-3.nll.stderr index 6225575ddf3a..9ea13638f5ca 100644 --- a/src/test/ui/regions/regions-close-object-into-object-3.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-3.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local data `*v` --> $DIR/regions-close-object-into-object-3.rs:11:5 | -LL | box B(&*v) as Box //~ ERROR `*v` does not live long enough +LL | box B(&*v) as Box | ^^^^^^---^^^^^^^^^^^ | | | | | `*v` is borrowed here diff --git a/src/test/ui/regions/regions-close-object-into-object-3.stderr b/src/test/ui/regions/regions-close-object-into-object-3.stderr index 1736a5f215cd..122e57a3250c 100644 --- a/src/test/ui/regions/regions-close-object-into-object-3.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-3.stderr @@ -1,7 +1,7 @@ error[E0597]: `*v` does not live long enough --> $DIR/regions-close-object-into-object-3.rs:11:12 | -LL | box B(&*v) as Box //~ ERROR `*v` does not live long enough +LL | box B(&*v) as Box | ^^ borrowed value does not live long enough LL | } | - borrowed value only lives until here diff --git a/src/test/ui/regions/regions-close-object-into-object-4.stderr b/src/test/ui/regions/regions-close-object-into-object-4.stderr index 87bf28d74d4d..c9ad95d31d6a 100644 --- a/src/test/ui/regions/regions-close-object-into-object-4.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-4.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements --> $DIR/regions-close-object-into-object-4.rs:10:11 | -LL | box B(&*v) as Box //~ ERROR cannot infer +LL | box B(&*v) as Box | ^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 9:6... @@ -12,7 +12,7 @@ LL | fn i<'a, T, U>(v: Box+'a>) -> Box { note: ...so that the type `(dyn A + 'a)` is not borrowed for too long --> $DIR/regions-close-object-into-object-4.rs:10:11 | -LL | box B(&*v) as Box //~ ERROR cannot infer +LL | box B(&*v) as Box | ^^^ = note: but, the lifetime must be valid for the static lifetime... = note: ...so that the expression is assignable: diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr b/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr index 4803ae844151..68809eb548b2 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5 | -LL | box v as Box //~ ERROR cannot infer an appropriate lifetime +LL | box v as Box | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 18:20... @@ -12,7 +12,7 @@ LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { note: ...so that the declared lifetime parameter bounds are satisfied --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5 | -LL | box v as Box //~ ERROR cannot infer an appropriate lifetime +LL | box v as Box | ^^^^^^^^^^^^^^^^^^^^^^^^^^ note: but, the lifetime must be valid for the lifetime 'c as defined on the function body at 18:26... --> $DIR/regions-close-over-type-parameter-multiple.rs:18:26 diff --git a/src/test/ui/regions/regions-close-param-into-object.stderr b/src/test/ui/regions/regions-close-param-into-object.stderr index 58028fc7bd8c..a7f05723817e 100644 --- a/src/test/ui/regions/regions-close-param-into-object.stderr +++ b/src/test/ui/regions/regions-close-param-into-object.stderr @@ -4,13 +4,13 @@ error[E0310]: the parameter type `T` may not live long enough LL | fn p1(v: T) -> Box | - help: consider adding an explicit lifetime bound `T: 'static`... ... -LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough +LL | Box::new(v) | ^^^^^^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds --> $DIR/regions-close-param-into-object.rs:6:5 | -LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough +LL | Box::new(v) | ^^^^^^^^^^^ error[E0310]: the parameter type `T` may not live long enough @@ -19,13 +19,13 @@ error[E0310]: the parameter type `T` may not live long enough LL | fn p2(v: Box) -> Box | - help: consider adding an explicit lifetime bound `T: 'static`... ... -LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough +LL | Box::new(v) | ^^^^^^^^^^^ | note: ...so that the type `std::boxed::Box` will meet its required lifetime bounds --> $DIR/regions-close-param-into-object.rs:12:5 | -LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough +LL | Box::new(v) | ^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough @@ -34,13 +34,13 @@ error[E0309]: the parameter type `T` may not live long enough LL | fn p3<'a,T>(v: T) -> Box | - help: consider adding an explicit lifetime bound `T: 'a`... ... -LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough +LL | Box::new(v) | ^^^^^^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds --> $DIR/regions-close-param-into-object.rs:18:5 | -LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough +LL | Box::new(v) | ^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough @@ -49,13 +49,13 @@ error[E0309]: the parameter type `T` may not live long enough LL | fn p4<'a,T>(v: Box) -> Box | - help: consider adding an explicit lifetime bound `T: 'a`... ... -LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough +LL | Box::new(v) | ^^^^^^^^^^^ | note: ...so that the type `std::boxed::Box` will meet its required lifetime bounds --> $DIR/regions-close-param-into-object.rs:24:5 | -LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough +LL | Box::new(v) | ^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/regions/regions-creating-enums.nll.stderr b/src/test/ui/regions/regions-creating-enums.nll.stderr index fe4b97a33b5c..a95d84629013 100644 --- a/src/test/ui/regions/regions-creating-enums.nll.stderr +++ b/src/test/ui/regions/regions-creating-enums.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return reference to temporary value --> $DIR/regions-creating-enums.rs:23:16 | -LL | return &Ast::Num((*f)(x)); //~ ERROR borrowed value does not live long enough +LL | return &Ast::Num((*f)(x)); | ^----------------- | || | |temporary value created here @@ -10,7 +10,7 @@ LL | return &Ast::Num((*f)(x)); //~ ERROR borrowed value does not live l error[E0515]: cannot return reference to temporary value --> $DIR/regions-creating-enums.rs:28:16 | -LL | return &Ast::Add(m_x, m_y); //~ ERROR borrowed value does not live long enough +LL | return &Ast::Add(m_x, m_y); | ^------------------ | || | |temporary value created here diff --git a/src/test/ui/regions/regions-creating-enums.stderr b/src/test/ui/regions/regions-creating-enums.stderr index 36cd6d0c22e5..bb11be9b7581 100644 --- a/src/test/ui/regions/regions-creating-enums.stderr +++ b/src/test/ui/regions/regions-creating-enums.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/regions-creating-enums.rs:23:17 | -LL | return &Ast::Num((*f)(x)); //~ ERROR borrowed value does not live long enough +LL | return &Ast::Num((*f)(x)); | ^^^^^^^^^^^^^^^^^- temporary value only lives until here | | | temporary value does not live long enough @@ -16,7 +16,7 @@ LL | fn map_nums<'a,'b, F>(x: &Ast, f: &mut F) -> &'a Ast<'b> where F: FnMut(usi error[E0597]: borrowed value does not live long enough --> $DIR/regions-creating-enums.rs:28:17 | -LL | return &Ast::Add(m_x, m_y); //~ ERROR borrowed value does not live long enough +LL | return &Ast::Add(m_x, m_y); | ^^^^^^^^^^^^^^^^^^- temporary value only lives until here | | | temporary value does not live long enough diff --git a/src/test/ui/regions/regions-creating-enums3.stderr b/src/test/ui/regions/regions-creating-enums3.stderr index 2a0efaa598c7..2fc1fc3f6812 100644 --- a/src/test/ui/regions/regions-creating-enums3.stderr +++ b/src/test/ui/regions/regions-creating-enums3.stderr @@ -5,7 +5,7 @@ LL | fn mk_add_bad1<'a,'b>(x: &'a Ast<'a>, y: &'b Ast<'b>) -> Ast<'a> { | ----------- ------- | | | this parameter and the return type are declared with different lifetimes... -LL | Ast::Add(x, y) //~ ERROR lifetime mismatch [E0623] +LL | Ast::Add(x, y) | ^^^^^^^^^^^^^^ ...but data from `y` is returned here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-creating-enums4.stderr b/src/test/ui/regions/regions-creating-enums4.stderr index 569530768b83..4d00783d180b 100644 --- a/src/test/ui/regions/regions-creating-enums4.stderr +++ b/src/test/ui/regions/regions-creating-enums4.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements --> $DIR/regions-creating-enums4.rs:7:5 | -LL | Ast::Add(x, y) //~ ERROR cannot infer +LL | Ast::Add(x, y) | ^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 6:16... diff --git a/src/test/ui/regions/regions-enum-not-wf.stderr b/src/test/ui/regions/regions-enum-not-wf.stderr index d10f7ed28fc2..870140856675 100644 --- a/src/test/ui/regions/regions-enum-not-wf.stderr +++ b/src/test/ui/regions/regions-enum-not-wf.stderr @@ -3,13 +3,13 @@ error[E0309]: the parameter type `T` may not live long enough | LL | enum Ref1<'a, T> { | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | Ref1Variant1(RequireOutlives<'a, T>) //~ ERROR the parameter type `T` may not live long enough +LL | Ref1Variant1(RequireOutlives<'a, T>) | ^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds --> $DIR/regions-enum-not-wf.rs:18:18 | -LL | Ref1Variant1(RequireOutlives<'a, T>) //~ ERROR the parameter type `T` may not live long enough +LL | Ref1Variant1(RequireOutlives<'a, T>) | ^^^^^^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough @@ -18,40 +18,40 @@ error[E0309]: the parameter type `T` may not live long enough LL | enum Ref2<'a, T> { | - help: consider adding an explicit lifetime bound `T: 'a`... LL | Ref2Variant1, -LL | Ref2Variant2(isize, RequireOutlives<'a, T>), //~ ERROR the parameter type `T` may not live long enough +LL | Ref2Variant2(isize, RequireOutlives<'a, T>), | ^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds --> $DIR/regions-enum-not-wf.rs:23:25 | -LL | Ref2Variant2(isize, RequireOutlives<'a, T>), //~ ERROR the parameter type `T` may not live long enough +LL | Ref2Variant2(isize, RequireOutlives<'a, T>), | ^^^^^^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough --> $DIR/regions-enum-not-wf.rs:35:1 | -LL | enum RefDouble<'a, 'b, T> { //~ ERROR the parameter type `T` may not live long enough [E0309] +LL | enum RefDouble<'a, 'b, T> { | ^ - help: consider adding an explicit lifetime bound `T: 'b`... | _| | | LL | | RefDoubleVariant1(&'a RequireOutlives<'b, T>) -LL | | //~^ the parameter type `T` may not live long enough [E0309] +LL | | LL | | } | |_^ | note: ...so that the type `T` will meet its required lifetime bounds --> $DIR/regions-enum-not-wf.rs:35:1 | -LL | / enum RefDouble<'a, 'b, T> { //~ ERROR the parameter type `T` may not live long enough [E0309] +LL | / enum RefDouble<'a, 'b, T> { LL | | RefDoubleVariant1(&'a RequireOutlives<'b, T>) -LL | | //~^ the parameter type `T` may not live long enough [E0309] +LL | | LL | | } | |_^ error[E0309]: the parameter type `T` may not live long enough --> $DIR/regions-enum-not-wf.rs:36:23 | -LL | enum RefDouble<'a, 'b, T> { //~ ERROR the parameter type `T` may not live long enough [E0309] +LL | enum RefDouble<'a, 'b, T> { | - help: consider adding an explicit lifetime bound `T: 'b`... LL | RefDoubleVariant1(&'a RequireOutlives<'b, T>) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/regions/regions-escape-method.stderr b/src/test/ui/regions/regions-escape-method.stderr index 8575a24281d0..b93dd0d4c57c 100644 --- a/src/test/ui/regions/regions-escape-method.stderr +++ b/src/test/ui/regions/regions-escape-method.stderr @@ -1,13 +1,13 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> $DIR/regions-escape-method.rs:15:13 | -LL | s.f(|p| p) //~ ERROR cannot infer +LL | s.f(|p| p) | ^ | note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 15:9... --> $DIR/regions-escape-method.rs:15:9 | -LL | s.f(|p| p) //~ ERROR cannot infer +LL | s.f(|p| p) | ^^^^^ = note: ...so that the expression is assignable: expected &i32 @@ -15,12 +15,12 @@ LL | s.f(|p| p) //~ ERROR cannot infer note: but, the lifetime must be valid for the method call at 15:5... --> $DIR/regions-escape-method.rs:15:5 | -LL | s.f(|p| p) //~ ERROR cannot infer +LL | s.f(|p| p) | ^^^^^^^^^^ note: ...so that a type/lifetime parameter is in scope here --> $DIR/regions-escape-method.rs:15:5 | -LL | s.f(|p| p) //~ ERROR cannot infer +LL | s.f(|p| p) | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/regions/regions-escape-via-trait-or-not.stderr b/src/test/ui/regions/regions-escape-via-trait-or-not.stderr index 8f4bfd889a83..a6b165e2d444 100644 --- a/src/test/ui/regions/regions-escape-via-trait-or-not.stderr +++ b/src/test/ui/regions/regions-escape-via-trait-or-not.stderr @@ -1,13 +1,13 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> $DIR/regions-escape-via-trait-or-not.rs:18:14 | -LL | with(|o| o) //~ ERROR cannot infer +LL | with(|o| o) | ^ | note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 18:10... --> $DIR/regions-escape-via-trait-or-not.rs:18:10 | -LL | with(|o| o) //~ ERROR cannot infer +LL | with(|o| o) | ^^^^^ = note: ...so that the expression is assignable: expected &isize @@ -15,12 +15,12 @@ LL | with(|o| o) //~ ERROR cannot infer note: but, the lifetime must be valid for the expression at 18:5... --> $DIR/regions-escape-via-trait-or-not.rs:18:5 | -LL | with(|o| o) //~ ERROR cannot infer +LL | with(|o| o) | ^^^^ note: ...so type `fn([closure@$DIR/regions-escape-via-trait-or-not.rs:18:10: 18:15]) -> isize {with::<&isize, [closure@$DIR/regions-escape-via-trait-or-not.rs:18:10: 18:15]>}` of expression is valid during the expression --> $DIR/regions-escape-via-trait-or-not.rs:18:5 | -LL | with(|o| o) //~ ERROR cannot infer +LL | with(|o| o) | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/regions/regions-fn-subtyping-return-static.stderr b/src/test/ui/regions/regions-fn-subtyping-return-static.stderr index 42a5a7c806e0..cda5ce273bd9 100644 --- a/src/test/ui/regions/regions-fn-subtyping-return-static.stderr +++ b/src/test/ui/regions/regions-fn-subtyping-return-static.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/regions-fn-subtyping-return-static.rs:41:12 | -LL | want_F(bar); //~ ERROR mismatched types +LL | want_F(bar); | ^^^ expected concrete lifetime, found bound lifetime parameter 'cx | = note: expected type `for<'cx> fn(&'cx S) -> &'cx S` diff --git a/src/test/ui/regions/regions-free-region-ordering-callee-4.stderr b/src/test/ui/regions/regions-free-region-ordering-callee-4.stderr index e3f42d592283..3b8f09f1ad80 100644 --- a/src/test/ui/regions/regions-free-region-ordering-callee-4.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-callee-4.stderr @@ -2,7 +2,7 @@ error[E0491]: in type `&'a &'b usize`, reference has a longer lifetime than the --> $DIR/regions-free-region-ordering-callee-4.rs:5:1 | LL | / fn ordering4<'a, 'b, F>(a: &'a usize, b: &'b usize, x: F) where F: FnOnce(&'a &'b usize) { -LL | | //~^ ERROR reference has a longer lifetime than the data it references +LL | | LL | | // Do not infer ordering from closure argument types. LL | | let z: Option<&'a &'b usize> = None; LL | | } diff --git a/src/test/ui/regions/regions-free-region-ordering-callee.stderr b/src/test/ui/regions/regions-free-region-ordering-callee.stderr index b5c66386341a..4648bf046bc7 100644 --- a/src/test/ui/regions/regions-free-region-ordering-callee.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-callee.stderr @@ -6,7 +6,7 @@ LL | fn ordering2<'a, 'b>(x: &'a &'b usize, y: &'a usize) -> &'b usize { | | | this parameter and the return type are declared with different lifetimes... LL | // However, it is not safe to assume that 'b <= 'a -LL | &*y //~ ERROR lifetime mismatch [E0623] +LL | &*y | ^^^ ...but data from `x` is returned here error[E0623]: lifetime mismatch diff --git a/src/test/ui/regions/regions-free-region-ordering-caller.stderr b/src/test/ui/regions/regions-free-region-ordering-caller.stderr deleted file mode 100644 index 67ee950ae8f5..000000000000 --- a/src/test/ui/regions/regions-free-region-ordering-caller.stderr +++ /dev/null @@ -1,32 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/regions-free-region-ordering-caller.rs:8:12 - | -LL | fn call2<'a, 'b>(a: &'a usize, b: &'b usize) { - | --------- --------- - | | - | these two types are declared with different lifetimes... -LL | let z: Option<&'b &'a usize> = None;//~ ERROR E0623 - | ^^^^^^^^^^^^^^^^^^^^^ ...but data from `a` flows into `b` here - -error[E0623]: lifetime mismatch - --> $DIR/regions-free-region-ordering-caller.rs:13:12 - | -LL | fn call3<'a, 'b>(a: &'a usize, b: &'b usize) { - | --------- --------- - | | - | these two types are declared with different lifetimes... -LL | let y: Paramd<'a> = Paramd { x: a }; -LL | let z: Option<&'b Paramd<'a>> = None;//~ ERROR E0623 - | ^^^^^^^^^^^^^^^^^^^^^^ ...but data from `a` flows into `b` here - -error[E0623]: lifetime mismatch - --> $DIR/regions-free-region-ordering-caller.rs:17:12 - | -LL | fn call4<'a, 'b>(a: &'a usize, b: &'b usize) { - | --------- --------- these two types are declared with different lifetimes... -LL | let z: Option<&'a &'b usize> = None;//~ ERROR E0623 - | ^^^^^^^^^^^^^^^^^^^^^ ...but data from `b` flows into `a` here - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/regions/regions-free-region-ordering-incorrect.stderr b/src/test/ui/regions/regions-free-region-ordering-incorrect.stderr index 12e080726763..676e96a038b4 100644 --- a/src/test/ui/regions/regions-free-region-ordering-incorrect.stderr +++ b/src/test/ui/regions/regions-free-region-ordering-incorrect.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements --> $DIR/regions-free-region-ordering-incorrect.rs:17:21 | -LL | None => &self.val //~ ERROR cannot infer +LL | None => &self.val | ^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the method body at 14:12... @@ -12,7 +12,7 @@ LL | fn get<'a>(&'a self) -> &'b T { note: ...so that reference does not outlive borrowed content --> $DIR/regions-free-region-ordering-incorrect.rs:17:21 | -LL | None => &self.val //~ ERROR cannot infer +LL | None => &self.val | ^^^^^^^^^ note: but, the lifetime must be valid for the lifetime 'b as defined on the impl at 13:6... --> $DIR/regions-free-region-ordering-incorrect.rs:13:6 @@ -24,7 +24,7 @@ note: ...so that reference does not outlive borrowed content | LL | / match self.next { LL | | Some(ref next) => next.get(), -LL | | None => &self.val //~ ERROR cannot infer +LL | | None => &self.val LL | | } | |_________^ diff --git a/src/test/ui/regions/regions-glb-free-free.stderr b/src/test/ui/regions/regions-glb-free-free.stderr index 23492b3c718e..575037a0a4d6 100644 --- a/src/test/ui/regions/regions-glb-free-free.stderr +++ b/src/test/ui/regions/regions-glb-free-free.stderr @@ -3,7 +3,7 @@ error[E0621]: explicit lifetime required in the type of `s` | LL | pub fn set_desc(self, s: &str) -> Flag<'a> { | ---- help: add explicit lifetime `'a` to the type of `s`: `&'a str` -LL | / Flag { //~ ERROR explicit lifetime required in the type of `s` [E0621] +LL | / Flag { LL | | name: self.name, LL | | desc: s, LL | | max_count: self.max_count, diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr b/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr index e2a4a1eec425..ca86eb7edae1 100644 --- a/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr +++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr @@ -2,7 +2,7 @@ error[E0491]: in type `&'x (dyn for<'z> Trait1<>::Foo> + 'x) --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:21:1 | LL | / fn callee<'x, 'y, T>(t: &'x for<'z> Trait1< >::Foo >) -LL | | //~^ ERROR reference has a longer lifetime than the data it references +LL | | LL | | { LL | | } | |_^ diff --git a/src/test/ui/regions/regions-in-enums-anon.stderr b/src/test/ui/regions/regions-in-enums-anon.stderr index 9cfdb67939f1..ae06e7653dbe 100644 --- a/src/test/ui/regions/regions-in-enums-anon.stderr +++ b/src/test/ui/regions/regions-in-enums-anon.stderr @@ -1,7 +1,7 @@ error[E0106]: missing lifetime specifier --> $DIR/regions-in-enums-anon.rs:4:9 | -LL | Bar(&isize) //~ ERROR missing lifetime specifier +LL | Bar(&isize) | ^ expected lifetime parameter error: aborting due to previous error diff --git a/src/test/ui/regions/regions-in-enums.stderr b/src/test/ui/regions/regions-in-enums.stderr index d0137d1afefb..cfed9feba4b8 100644 --- a/src/test/ui/regions/regions-in-enums.stderr +++ b/src/test/ui/regions/regions-in-enums.stderr @@ -1,13 +1,13 @@ error[E0261]: use of undeclared lifetime name `'foo` --> $DIR/regions-in-enums.rs:13:9 | -LL | X5(&'foo usize) //~ ERROR use of undeclared lifetime name `'foo` +LL | X5(&'foo usize) | ^^^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-in-enums.rs:17:9 | -LL | X6(&'a usize) //~ ERROR use of undeclared lifetime name `'a` +LL | X6(&'a usize) | ^^ undeclared lifetime error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/regions-in-structs-anon.stderr b/src/test/ui/regions/regions-in-structs-anon.stderr index 9defd82aed59..a1d4ebb597b4 100644 --- a/src/test/ui/regions/regions-in-structs-anon.stderr +++ b/src/test/ui/regions/regions-in-structs-anon.stderr @@ -1,7 +1,7 @@ error[E0106]: missing lifetime specifier --> $DIR/regions-in-structs-anon.rs:4:8 | -LL | x: &isize //~ ERROR missing lifetime specifier +LL | x: &isize | ^ expected lifetime parameter error: aborting due to previous error diff --git a/src/test/ui/regions/regions-in-structs.stderr b/src/test/ui/regions/regions-in-structs.stderr index dea7f1054183..8314942759d1 100644 --- a/src/test/ui/regions/regions-in-structs.stderr +++ b/src/test/ui/regions/regions-in-structs.stderr @@ -1,13 +1,13 @@ error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-in-structs.rs:10:9 | -LL | a: &'a isize, //~ ERROR use of undeclared lifetime name `'a` +LL | a: &'a isize, | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-in-structs.rs:11:9 | -LL | b: &'a isize, //~ ERROR use of undeclared lifetime name `'a` +LL | b: &'a isize, | ^^ undeclared lifetime error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr b/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr index 62f0ceba94f2..2c7a6e8b5c0b 100644 --- a/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr +++ b/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local data `*p` --> $DIR/regions-infer-borrow-scope-too-big.rs:13:12 | -LL | let xc = x_coord(&*p); //~ ERROR `*p` does not live long enough +LL | let xc = x_coord(&*p); | --- `*p` is borrowed here LL | assert_eq!(*xc, 3); LL | return xc; diff --git a/src/test/ui/regions/regions-infer-borrow-scope-too-big.stderr b/src/test/ui/regions/regions-infer-borrow-scope-too-big.stderr index 562ec649a48e..ed4bc155040f 100644 --- a/src/test/ui/regions/regions-infer-borrow-scope-too-big.stderr +++ b/src/test/ui/regions/regions-infer-borrow-scope-too-big.stderr @@ -1,7 +1,7 @@ error[E0597]: `*p` does not live long enough --> $DIR/regions-infer-borrow-scope-too-big.rs:11:23 | -LL | let xc = x_coord(&*p); //~ ERROR `*p` does not live long enough +LL | let xc = x_coord(&*p); | ^^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/regions/regions-infer-bound-from-trait.stderr b/src/test/ui/regions/regions-infer-bound-from-trait.stderr index 100ac7633584..382d932e81ad 100644 --- a/src/test/ui/regions/regions-infer-bound-from-trait.stderr +++ b/src/test/ui/regions/regions-infer-bound-from-trait.stderr @@ -3,13 +3,13 @@ error[E0309]: the parameter type `A` may not live long enough | LL | fn bar1<'a,A>(x: Inv<'a>, a: A) { | - help: consider adding an explicit lifetime bound `A: 'a`... -LL | check_bound(x, a) //~ ERROR parameter type `A` may not live long enough +LL | check_bound(x, a) | ^^^^^^^^^^^ | note: ...so that the type `A` will meet its required lifetime bounds --> $DIR/regions-infer-bound-from-trait.rs:33:5 | -LL | check_bound(x, a) //~ ERROR parameter type `A` may not live long enough +LL | check_bound(x, a) | ^^^^^^^^^^^ error[E0309]: the parameter type `A` may not live long enough @@ -17,13 +17,13 @@ error[E0309]: the parameter type `A` may not live long enough | LL | fn bar2<'a,'b,A:Is<'b>>(x: Inv<'a>, y: Inv<'b>, a: A) { | -- help: consider adding an explicit lifetime bound `A: 'a`... -LL | check_bound(x, a) //~ ERROR parameter type `A` may not live long enough +LL | check_bound(x, a) | ^^^^^^^^^^^ | note: ...so that the type `A` will meet its required lifetime bounds --> $DIR/regions-infer-bound-from-trait.rs:37:5 | -LL | check_bound(x, a) //~ ERROR parameter type `A` may not live long enough +LL | check_bound(x, a) | ^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.stderr b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.stderr index 9dafc1680866..f3a0358b90fb 100644 --- a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.stderr +++ b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.stderr @@ -7,7 +7,7 @@ LL | s: &'short isize, LL | l: &'long isize, | ------------ ... -LL | let _: Contravariant<'long> = c; //~ ERROR E0623 +LL | let _: Contravariant<'long> = c; | ^ ...but data from `c` flows into `l` here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-infer-covariance-due-to-decl.stderr b/src/test/ui/regions/regions-infer-covariance-due-to-decl.stderr index a47427036661..c3e2075fbc37 100644 --- a/src/test/ui/regions/regions-infer-covariance-due-to-decl.stderr +++ b/src/test/ui/regions/regions-infer-covariance-due-to-decl.stderr @@ -6,7 +6,7 @@ LL | fn use_<'short,'long>(c: Covariant<'long>, LL | s: &'short isize, | ------------- these two types are declared with different lifetimes... ... -LL | let _: Covariant<'short> = c; //~ ERROR E0623 +LL | let _: Covariant<'short> = c; | ^ ...but data from `s` flows into `c` here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr index 8d8c218958a2..d31ed3ede36f 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/regions-infer-invariance-due-to-decl.rs:12:5 | -LL | b_isize //~ ERROR mismatched types +LL | b_isize | ^^^^^^^ lifetime mismatch | = note: expected type `Invariant<'static>` diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr index 7058757f908e..f8bdd014db7c 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:10:5 | -LL | b_isize //~ ERROR mismatched types +LL | b_isize | ^^^^^^^ lifetime mismatch | = note: expected type `Invariant<'static>` diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr index 51b2330b658f..1de6f22f08e5 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:10:5 | -LL | b_isize //~ ERROR mismatched types +LL | b_isize | ^^^^^^^ lifetime mismatch | = note: expected type `Invariant<'static>` diff --git a/src/test/ui/regions/regions-infer-not-param.stderr b/src/test/ui/regions/regions-infer-not-param.stderr index d0d41c271c6b..f43ab8291218 100644 --- a/src/test/ui/regions/regions-infer-not-param.stderr +++ b/src/test/ui/regions/regions-infer-not-param.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/regions-infer-not-param.rs:15:54 | -LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } //~ ERROR mismatched types +LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } | ^ lifetime mismatch | = note: expected type `Direct<'b>` @@ -9,18 +9,18 @@ LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } //~ ERROR mismatch note: the lifetime 'a as defined on the function body at 15:16... --> $DIR/regions-infer-not-param.rs:15:16 | -LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } //~ ERROR mismatched types +LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } | ^^ note: ...does not necessarily outlive the lifetime 'b as defined on the function body at 15:19 --> $DIR/regions-infer-not-param.rs:15:19 | -LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } //~ ERROR mismatched types +LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } | ^^ error[E0308]: mismatched types --> $DIR/regions-infer-not-param.rs:19:63 | -LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^ lifetime mismatch | = note: expected type `Indirect2<'b>` @@ -28,18 +28,18 @@ LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR note: the lifetime 'a as defined on the function body at 19:19... --> $DIR/regions-infer-not-param.rs:19:19 | -LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^^ note: ...does not necessarily outlive the lifetime 'b as defined on the function body at 19:22 --> $DIR/regions-infer-not-param.rs:19:22 | -LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^^ error[E0308]: mismatched types --> $DIR/regions-infer-not-param.rs:19:63 | -LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^ lifetime mismatch | = note: expected type `Indirect2<'b>` @@ -47,12 +47,12 @@ LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR note: the lifetime 'b as defined on the function body at 19:22... --> $DIR/regions-infer-not-param.rs:19:22 | -LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^^ note: ...does not necessarily outlive the lifetime 'a as defined on the function body at 19:19 --> $DIR/regions-infer-not-param.rs:19:19 | -LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types +LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/regions/regions-infer-paramd-indirect.stderr b/src/test/ui/regions/regions-infer-paramd-indirect.stderr index 47de228e31d2..1b999ed059c4 100644 --- a/src/test/ui/regions/regions-infer-paramd-indirect.stderr +++ b/src/test/ui/regions/regions-infer-paramd-indirect.stderr @@ -11,10 +11,10 @@ note: the anonymous lifetime #2 defined on the method body at 21:5... | LL | / fn set_f_bad(&mut self, b: Box) { LL | | self.f = b; -LL | | //~^ ERROR mismatched types -LL | | //~| expected type `std::boxed::Box>` -LL | | //~| found type `std::boxed::Box>` -LL | | //~| lifetime mismatch +LL | | +LL | | +LL | | +LL | | LL | | } | |_____^ note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 16:6 diff --git a/src/test/ui/regions/regions-infer-proc-static-upvar.nll.stderr b/src/test/ui/regions/regions-infer-proc-static-upvar.nll.stderr index b44f8c1e7a8d..803d0d744910 100644 --- a/src/test/ui/regions/regions-infer-proc-static-upvar.nll.stderr +++ b/src/test/ui/regions/regions-infer-proc-static-upvar.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `x` does not live long enough --> $DIR/regions-infer-proc-static-upvar.rs:10:13 | -LL | let y = &x; //~ ERROR `x` does not live long enough +LL | let y = &x; | ^^ borrowed value does not live long enough LL | / foo(move|| { LL | | let _a = *y; diff --git a/src/test/ui/regions/regions-infer-proc-static-upvar.stderr b/src/test/ui/regions/regions-infer-proc-static-upvar.stderr index f929a06bad75..21b2e881a79a 100644 --- a/src/test/ui/regions/regions-infer-proc-static-upvar.stderr +++ b/src/test/ui/regions/regions-infer-proc-static-upvar.stderr @@ -1,7 +1,7 @@ error[E0597]: `x` does not live long enough --> $DIR/regions-infer-proc-static-upvar.rs:10:14 | -LL | let y = &x; //~ ERROR `x` does not live long enough +LL | let y = &x; | ^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr b/src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr index 99d85e9e4b5a..46200e4d84bc 100644 --- a/src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr +++ b/src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr @@ -4,7 +4,7 @@ error[E0623]: lifetime mismatch LL | fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) { | --------- --------- these two types are declared with different lifetimes... LL | // Illegal now because there is no `'b:'a` declaration. -LL | *x = *y; //~ ERROR E0623 +LL | *x = *y; | ^^ ...but data from `y` flows into `x` here error[E0623]: lifetime mismatch @@ -13,13 +13,13 @@ error[E0623]: lifetime mismatch LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) { | --------- --------- these two types are declared with different lifetimes... ... -LL | a(x, y); //~ ERROR lifetime mismatch [E0623] +LL | a(x, y); | ^ ...but data from `y` flows into `x` here error[E0308]: mismatched types --> $DIR/regions-lifetime-bounds-on-fns.rs:20:43 | -LL | let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR E0308 +LL | let _: fn(&mut &isize, &mut &isize) = a; | ^ expected concrete lifetime, found bound lifetime parameter | = note: expected type `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)` diff --git a/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr b/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr index 48daff1dbd87..7984f4f0e546 100644 --- a/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr +++ b/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.nll.stderr @@ -3,7 +3,7 @@ error[E0515]: cannot return value referencing temporary value | LL | let testValue = &id(Test); | -------- temporary value created here -LL | //~^ ERROR borrowed value does not live long enough +LL | LL | testValue | ^^^^^^^^^ returns a value referencing data owned by the current function @@ -12,7 +12,7 @@ error[E0515]: cannot return value referencing temporary value | LL | let testValue = &id(MyEnum::Variant1); | -------------------- temporary value created here -LL | //~^ ERROR borrowed value does not live long enough +LL | LL | testValue | ^^^^^^^^^ returns a value referencing data owned by the current function diff --git a/src/test/ui/regions/regions-name-duplicated.stderr b/src/test/ui/regions/regions-name-duplicated.stderr index 1b552006a934..a7e03a61adcf 100644 --- a/src/test/ui/regions/regions-name-duplicated.stderr +++ b/src/test/ui/regions/regions-name-duplicated.stderr @@ -1,7 +1,7 @@ error[E0263]: lifetime name `'a` declared twice in the same scope --> $DIR/regions-name-duplicated.rs:1:16 | -LL | struct Foo<'a, 'a> { //~ ERROR lifetime name `'a` declared twice +LL | struct Foo<'a, 'a> { | -- ^^ declared twice | | | previous declaration here diff --git a/src/test/ui/regions/regions-name-static.stderr b/src/test/ui/regions/regions-name-static.stderr index bf7b021f9fe5..4b7026e65eac 100644 --- a/src/test/ui/regions/regions-name-static.stderr +++ b/src/test/ui/regions/regions-name-static.stderr @@ -1,7 +1,7 @@ error[E0262]: invalid lifetime parameter name: `'static` --> $DIR/regions-name-static.rs:1:12 | -LL | struct Foo<'static> { //~ ERROR invalid lifetime parameter name: `'static` +LL | struct Foo<'static> { | ^^^^^^^ 'static is a reserved lifetime name error: aborting due to previous error diff --git a/src/test/ui/regions/regions-name-undeclared.stderr b/src/test/ui/regions/regions-name-undeclared.stderr index 7b041d5dad5e..4840d751f7f5 100644 --- a/src/test/ui/regions/regions-name-undeclared.stderr +++ b/src/test/ui/regions/regions-name-undeclared.stderr @@ -1,67 +1,67 @@ error[E0261]: use of undeclared lifetime name `'b` --> $DIR/regions-name-undeclared.rs:15:24 | -LL | fn m4(&self, arg: &'b isize) { } //~ ERROR undeclared lifetime +LL | fn m4(&self, arg: &'b isize) { } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` --> $DIR/regions-name-undeclared.rs:16:12 | -LL | fn m5(&'b self) { } //~ ERROR undeclared lifetime +LL | fn m5(&'b self) { } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` --> $DIR/regions-name-undeclared.rs:17:27 | -LL | fn m6(&self, arg: Foo<'b>) { } //~ ERROR undeclared lifetime +LL | fn m6(&self, arg: Foo<'b>) { } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-name-undeclared.rs:25:22 | -LL | type X = Option<&'a isize>; //~ ERROR undeclared lifetime +LL | type X = Option<&'a isize>; | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-name-undeclared.rs:27:13 | -LL | E1(&'a isize) //~ ERROR undeclared lifetime +LL | E1(&'a isize) | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-name-undeclared.rs:30:13 | -LL | f: &'a isize //~ ERROR undeclared lifetime +LL | f: &'a isize | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-name-undeclared.rs:32:14 | -LL | fn f(a: &'a isize) { } //~ ERROR undeclared lifetime +LL | fn f(a: &'a isize) { } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-name-undeclared.rs:40:17 | -LL | fn fn_types(a: &'a isize, //~ ERROR undeclared lifetime +LL | fn fn_types(a: &'a isize, | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` --> $DIR/regions-name-undeclared.rs:42:36 | -LL | &'b isize, //~ ERROR undeclared lifetime +LL | &'b isize, | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` --> $DIR/regions-name-undeclared.rs:45:36 | -LL | &'b isize)>, //~ ERROR undeclared lifetime +LL | &'b isize)>, | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-name-undeclared.rs:46:17 | -LL | c: &'a isize) //~ ERROR undeclared lifetime +LL | c: &'a isize) | ^^ undeclared lifetime error: aborting due to 11 previous errors diff --git a/src/test/ui/regions/regions-nested-fns-2.nll.stderr b/src/test/ui/regions/regions-nested-fns-2.nll.stderr index ebcc31d3a20e..8627dac54592 100644 --- a/src/test/ui/regions/regions-nested-fns-2.nll.stderr +++ b/src/test/ui/regions/regions-nested-fns-2.nll.stderr @@ -3,7 +3,7 @@ error[E0597]: `y` does not live long enough | LL | |z| { | --- value captured here -LL | //~^ ERROR E0373 +LL | LL | if false { &y } else { z } | -^ | || diff --git a/src/test/ui/regions/regions-nested-fns-2.stderr b/src/test/ui/regions/regions-nested-fns-2.stderr index 924eac6fdd41..08bab6e98063 100644 --- a/src/test/ui/regions/regions-nested-fns-2.stderr +++ b/src/test/ui/regions/regions-nested-fns-2.stderr @@ -3,7 +3,7 @@ error[E0373]: closure may outlive the current function, but it borrows `y`, whic | LL | |z| { | ^^^ may outlive borrowed value `y` -LL | //~^ ERROR E0373 +LL | LL | if false { &y } else { z } | - `y` is borrowed here help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword diff --git a/src/test/ui/regions/regions-nested-fns.stderr b/src/test/ui/regions/regions-nested-fns.stderr index d6d4c44de61d..3cecd4ee83ca 100644 --- a/src/test/ui/regions/regions-nested-fns.stderr +++ b/src/test/ui/regions/regions-nested-fns.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> $DIR/regions-nested-fns.rs:5:18 | -LL | let mut ay = &y; //~ ERROR E0495 +LL | let mut ay = &y; | ^^ | note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 7:54... @@ -24,7 +24,7 @@ note: but, the lifetime must be valid for the anonymous lifetime #2 defined on t | LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { | ____________________________________________________________________^ -LL | | if false { return x; } //~ ERROR E0312 +LL | | if false { return x; } LL | | if false { return ay; } LL | | return z; LL | | })); @@ -36,7 +36,7 @@ LL | | })); error[E0312]: lifetime of reference outlives lifetime of borrowed content... --> $DIR/regions-nested-fns.rs:14:27 | -LL | if false { return x; } //~ ERROR E0312 +LL | if false { return x; } | ^ | note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 13:68... @@ -44,7 +44,7 @@ note: ...the reference is valid for the anonymous lifetime #2 defined on the bod | LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { | ____________________________________________________________________^ -LL | | if false { return x; } //~ ERROR E0312 +LL | | if false { return x; } LL | | if false { return ay; } LL | | return z; LL | | })); diff --git a/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr b/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr index a4197eed2252..c44edf1f03bc 100644 --- a/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr +++ b/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements --> $DIR/regions-normalize-in-where-clause-list.rs:22:1 | -LL | / fn bar<'a, 'b>() //~ ERROR cannot infer +LL | / fn bar<'a, 'b>() LL | | where <() as Project<'a, 'b>>::Item : Eq LL | | { LL | | } @@ -10,12 +10,12 @@ LL | | } note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 22:8... --> $DIR/regions-normalize-in-where-clause-list.rs:22:8 | -LL | fn bar<'a, 'b>() //~ ERROR cannot infer +LL | fn bar<'a, 'b>() | ^^ note: ...but the lifetime must also be valid for the lifetime 'b as defined on the function body at 22:12... --> $DIR/regions-normalize-in-where-clause-list.rs:22:12 | -LL | fn bar<'a, 'b>() //~ ERROR cannot infer +LL | fn bar<'a, 'b>() | ^^ = note: ...so that the types are compatible: expected Project<'a, 'b> diff --git a/src/test/ui/regions/regions-outlives-projection-container.stderr b/src/test/ui/regions/regions-outlives-projection-container.stderr index 884314f421a1..b50347ac9642 100644 --- a/src/test/ui/regions/regions-outlives-projection-container.stderr +++ b/src/test/ui/regions/regions-outlives-projection-container.stderr @@ -52,7 +52,7 @@ LL | fn call_with_assoc<'a,'b>() { error[E0491]: in type `&'a WithoutAssoc>`, reference has a longer lifetime than the data it references --> $DIR/regions-outlives-projection-container.rs:74:12 | -LL | call::<&'a WithoutAssoc>>(); //~ ERROR reference has a longer lifetime +LL | call::<&'a WithoutAssoc>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime 'a as defined on the function body at 71:23 diff --git a/src/test/ui/regions/regions-pattern-typing-issue-19552.nll.stderr b/src/test/ui/regions/regions-pattern-typing-issue-19552.nll.stderr index 8809cf4b09e5..f77d94a24b88 100644 --- a/src/test/ui/regions/regions-pattern-typing-issue-19552.nll.stderr +++ b/src/test/ui/regions/regions-pattern-typing-issue-19552.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `line` does not live long enough --> $DIR/regions-pattern-typing-issue-19552.rs:5:14 | -LL | match [&*line] { //~ ERROR `line` does not live long enough +LL | match [&*line] { | ^^^^ borrowed value does not live long enough LL | [ word ] => { assert_static(word); } | ------------------- argument requires that `line` is borrowed for `'static` diff --git a/src/test/ui/regions/regions-pattern-typing-issue-19552.stderr b/src/test/ui/regions/regions-pattern-typing-issue-19552.stderr index ad80925cad7d..3e3201db240c 100644 --- a/src/test/ui/regions/regions-pattern-typing-issue-19552.stderr +++ b/src/test/ui/regions/regions-pattern-typing-issue-19552.stderr @@ -1,7 +1,7 @@ error[E0597]: `line` does not live long enough --> $DIR/regions-pattern-typing-issue-19552.rs:5:14 | -LL | match [&*line] { //~ ERROR `line` does not live long enough +LL | match [&*line] { | ^^^^ borrowed value does not live long enough ... LL | } diff --git a/src/test/ui/regions/regions-proc-bound-capture.stderr b/src/test/ui/regions/regions-proc-bound-capture.stderr index 31be3ab4d3d5..aea7347d53c2 100644 --- a/src/test/ui/regions/regions-proc-bound-capture.stderr +++ b/src/test/ui/regions/regions-proc-bound-capture.stderr @@ -4,7 +4,7 @@ error[E0621]: explicit lifetime required in the type of `x` LL | fn static_proc(x: &isize) -> Box(isize) + 'static> { | ------ help: add explicit lifetime `'static` to the type of `x`: `&'static isize` LL | // This is illegal, because the region bound on `proc` is 'static. -LL | Box::new(move|| { *x }) //~ ERROR explicit lifetime required in the type of `x` [E0621] +LL | Box::new(move|| { *x }) | ^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required error: aborting due to previous error diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.stderr index 5670e5305ebb..aca3a1ed0572 100644 --- a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.stderr +++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.stderr @@ -5,7 +5,7 @@ LL | fn copy_borrowed_ptr<'a, 'b, 'c>(p: &'a mut &'b mut &'c mut isize) -> &'b m | ----------------------------- ------------- | | | this parameter and the return type are declared with different lifetimes... -LL | &mut ***p //~ ERROR lifetime mismatch [E0623] +LL | &mut ***p | ^^^^^^^^^ ...but data from `p` is returned here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.stderr index 90004e27d95c..a9916dbe4f5e 100644 --- a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.stderr +++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.stderr @@ -5,7 +5,7 @@ LL | fn copy_borrowed_ptr<'a, 'b>(p: &'a mut &'b mut isize) -> &'b mut isize { | --------------------- ------------- | | | this parameter and the return type are declared with different lifetimes... -LL | &mut **p //~ ERROR lifetime mismatch [E0623] +LL | &mut **p | ^^^^^^^^ ...but data from `p` is returned here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr b/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr index bead12356f1f..ccba6c59b616 100644 --- a/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr +++ b/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr @@ -3,13 +3,13 @@ error[E0515]: cannot return value referencing function parameter | LL | fn arg_item(box ref x: Box) -> &'static isize { | --------- function parameter borrowed here -LL | x //~^ ERROR borrowed value does not live long enough +LL | x | ^ returns a value referencing data owned by the current function error[E0515]: cannot return value referencing function parameter --> $DIR/regions-ref-in-fn-arg.rs:11:22 | -LL | with(|box ref x| x) //~ ERROR borrowed value does not live long enough +LL | with(|box ref x| x) | --------- ^ returns a value referencing data owned by the current function | | | function parameter borrowed here diff --git a/src/test/ui/regions/regions-ref-in-fn-arg.stderr b/src/test/ui/regions/regions-ref-in-fn-arg.stderr index 748508ecbcd3..9ecd327510a8 100644 --- a/src/test/ui/regions/regions-ref-in-fn-arg.stderr +++ b/src/test/ui/regions/regions-ref-in-fn-arg.stderr @@ -3,7 +3,7 @@ error[E0597]: borrowed value does not live long enough | LL | fn arg_item(box ref x: Box) -> &'static isize { | ^^^^^ borrowed value does not live long enough -LL | x //~^ ERROR borrowed value does not live long enough +LL | x LL | } | - borrowed value only lives until here | @@ -12,7 +12,7 @@ LL | } error[E0597]: borrowed value does not live long enough --> $DIR/regions-ref-in-fn-arg.rs:11:15 | -LL | with(|box ref x| x) //~ ERROR borrowed value does not live long enough +LL | with(|box ref x| x) | ^^^^^ - borrowed value only lives until here | | | borrowed value does not live long enough diff --git a/src/test/ui/regions/regions-ret.nll.stderr b/src/test/ui/regions/regions-ret.nll.stderr index b8b4ce56bb24..0e4875ac9855 100644 --- a/src/test/ui/regions/regions-ret.nll.stderr +++ b/src/test/ui/regions/regions-ret.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return reference to temporary value --> $DIR/regions-ret.rs:4:12 | -LL | return &id(3); //~ ERROR borrowed value does not live long enough +LL | return &id(3); | ^----- | || | |temporary value created here diff --git a/src/test/ui/regions/regions-ret.stderr b/src/test/ui/regions/regions-ret.stderr index 001f62ab60cd..77820a34e40b 100644 --- a/src/test/ui/regions/regions-ret.stderr +++ b/src/test/ui/regions/regions-ret.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/regions-ret.rs:4:13 | -LL | return &id(3); //~ ERROR borrowed value does not live long enough +LL | return &id(3); | ^^^^^- temporary value only lives until here | | | temporary value does not live long enough @@ -10,7 +10,7 @@ note: borrowed value must be valid for the anonymous lifetime #1 defined on the --> $DIR/regions-ret.rs:3:1 | LL | / fn f(_x: &isize) -> &isize { -LL | | return &id(3); //~ ERROR borrowed value does not live long enough +LL | | return &id(3); LL | | } | |_^ = note: consider using a `let` binding to increase its lifetime diff --git a/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.stderr b/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.stderr index e4b14811d907..9cf0b0ffabde 100644 --- a/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.stderr +++ b/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.stderr @@ -1,18 +1,18 @@ error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:7:24 | -LL | let mut f = || &mut x; //~ ERROR cannot infer +LL | let mut f = || &mut x; | ^^^^^^ | note: first, the lifetime cannot outlive the lifetime as defined on the body at 7:21... --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:7:21 | -LL | let mut f = || &mut x; //~ ERROR cannot infer +LL | let mut f = || &mut x; | ^^^^^^^^^ note: ...so that closure can access `x` --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:7:24 | -LL | let mut f = || &mut x; //~ ERROR cannot infer +LL | let mut f = || &mut x; | ^^^^^^ note: but, the lifetime must be valid for the call at 9:17... --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:9:17 diff --git a/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr b/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr index 1bdcf83521d0..9d87fe266b15 100644 --- a/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr +++ b/src/test/ui/regions/regions-return-stack-allocated-vec.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return reference to temporary value --> $DIR/regions-return-stack-allocated-vec.rs:4:5 | -LL | &[x] //~ ERROR borrowed value does not live long enough +LL | &[x] | ^--- | || | |temporary value created here diff --git a/src/test/ui/regions/regions-return-stack-allocated-vec.stderr b/src/test/ui/regions/regions-return-stack-allocated-vec.stderr index 78eec7cc456e..3256294473f1 100644 --- a/src/test/ui/regions/regions-return-stack-allocated-vec.stderr +++ b/src/test/ui/regions/regions-return-stack-allocated-vec.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/regions-return-stack-allocated-vec.rs:4:6 | -LL | &[x] //~ ERROR borrowed value does not live long enough +LL | &[x] | ^^^ temporary value does not live long enough LL | } | - temporary value only lives until here diff --git a/src/test/ui/regions/regions-steal-closure.nll.stderr b/src/test/ui/regions/regions-steal-closure.nll.stderr index c30f9c52363a..5b0efaf95597 100644 --- a/src/test/ui/regions/regions-steal-closure.nll.stderr +++ b/src/test/ui/regions/regions-steal-closure.nll.stderr @@ -4,7 +4,7 @@ error[E0597]: `i` does not live long enough LL | let mut cl_box = { | ---------- borrow later stored here LL | let mut i = 3; -LL | box_it(Box::new(|| i += 1)) //~ ERROR `i` does not live long enough +LL | box_it(Box::new(|| i += 1)) | -- ^ borrowed value does not live long enough | | | value captured here diff --git a/src/test/ui/regions/regions-steal-closure.stderr b/src/test/ui/regions/regions-steal-closure.stderr index dc5c16715352..8cfd5b503121 100644 --- a/src/test/ui/regions/regions-steal-closure.stderr +++ b/src/test/ui/regions/regions-steal-closure.stderr @@ -1,7 +1,7 @@ error[E0597]: `i` does not live long enough --> $DIR/regions-steal-closure.rs:14:28 | -LL | box_it(Box::new(|| i += 1)) //~ ERROR `i` does not live long enough +LL | box_it(Box::new(|| i += 1)) | -- ^ borrowed value does not live long enough | | | capture occurs here diff --git a/src/test/ui/regions/regions-trait-1.stderr b/src/test/ui/regions/regions-trait-1.stderr index e1aa2a2c2993..421f826ccc54 100644 --- a/src/test/ui/regions/regions-trait-1.stderr +++ b/src/test/ui/regions/regions-trait-1.stderr @@ -1,7 +1,7 @@ error[E0308]: method not compatible with trait --> $DIR/regions-trait-1.rs:16:5 | -LL | fn get_ctxt(&self) -> &'a Ctxt { //~ ERROR method not compatible with trait +LL | fn get_ctxt(&self) -> &'a Ctxt { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `fn(&HasCtxt<'a>) -> &Ctxt` @@ -14,7 +14,7 @@ LL | impl<'a> GetCtxt for HasCtxt<'a> { note: ...does not necessarily outlive the anonymous lifetime #1 defined on the method body at 16:5 --> $DIR/regions-trait-1.rs:16:5 | -LL | / fn get_ctxt(&self) -> &'a Ctxt { //~ ERROR method not compatible with trait +LL | / fn get_ctxt(&self) -> &'a Ctxt { LL | | self.c LL | | } | |_____^ diff --git a/src/test/ui/regions/regions-trait-object-subtyping.stderr b/src/test/ui/regions/regions-trait-object-subtyping.stderr index dc5ce34d7d89..3b30ddd16ccc 100644 --- a/src/test/ui/regions/regions-trait-object-subtyping.stderr +++ b/src/test/ui/regions/regions-trait-object-subtyping.stderr @@ -1,7 +1,7 @@ error[E0478]: lifetime bound not satisfied --> $DIR/regions-trait-object-subtyping.rs:15:5 | -LL | x //~ ERROR lifetime bound not satisfied +LL | x | ^ | note: lifetime parameter instantiated with the lifetime 'a as defined on the function body at 13:9 @@ -18,7 +18,7 @@ LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { error[E0495]: cannot infer an appropriate lifetime for automatic coercion due to conflicting requirements --> $DIR/regions-trait-object-subtyping.rs:15:5 | -LL | x //~ ERROR lifetime bound not satisfied +LL | x | ^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 13:9... @@ -29,7 +29,7 @@ LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { note: ...so that reference does not outlive borrowed content --> $DIR/regions-trait-object-subtyping.rs:15:5 | -LL | x //~ ERROR lifetime bound not satisfied +LL | x | ^ note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 13:12... --> $DIR/regions-trait-object-subtyping.rs:13:12 @@ -43,7 +43,7 @@ LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy { error[E0308]: mismatched types --> $DIR/regions-trait-object-subtyping.rs:22:5 | -LL | x //~ ERROR mismatched types +LL | x | ^ lifetime mismatch | = note: expected type `Wrapper<&'b mut (dyn Dummy + 'b)>` diff --git a/src/test/ui/regions/regions-trait-variance.nll.stderr b/src/test/ui/regions/regions-trait-variance.nll.stderr index ca05c93a7ece..56c9f89e1f59 100644 --- a/src/test/ui/regions/regions-trait-variance.nll.stderr +++ b/src/test/ui/regions/regions-trait-variance.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing local data `*b` --> $DIR/regions-trait-variance.rs:38:5 | -LL | let bb: &B = &*b; //~ ERROR `*b` does not live long enough +LL | let bb: &B = &*b; | --- `*b` is borrowed here LL | make_a(bb) | ^^^^^^^^^^ returns a value referencing data owned by the current function diff --git a/src/test/ui/regions/regions-trait-variance.stderr b/src/test/ui/regions/regions-trait-variance.stderr index ddc8ce9796d6..32c89b8eeff5 100644 --- a/src/test/ui/regions/regions-trait-variance.stderr +++ b/src/test/ui/regions/regions-trait-variance.stderr @@ -1,7 +1,7 @@ error[E0597]: `*b` does not live long enough --> $DIR/regions-trait-variance.rs:37:19 | -LL | let bb: &B = &*b; //~ ERROR `*b` does not live long enough +LL | let bb: &B = &*b; | ^^ borrowed value does not live long enough LL | make_a(bb) LL | } diff --git a/src/test/ui/regions/regions-undeclared.stderr b/src/test/ui/regions/regions-undeclared.stderr index 7e35dc1c4741..495aec3fde5f 100644 --- a/src/test/ui/regions/regions-undeclared.stderr +++ b/src/test/ui/regions/regions-undeclared.stderr @@ -1,31 +1,31 @@ error[E0261]: use of undeclared lifetime name `'blk` --> $DIR/regions-undeclared.rs:1:14 | -LL | static c_x: &'blk isize = &22; //~ ERROR use of undeclared lifetime name `'blk` +LL | static c_x: &'blk isize = &22; | ^^^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-undeclared.rs:4:10 | -LL | Foo(&'a isize), //~ ERROR use of undeclared lifetime name `'a` +LL | Foo(&'a isize), | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-undeclared.rs:5:10 | -LL | Bar(&'a isize), //~ ERROR use of undeclared lifetime name `'a` +LL | Bar(&'a isize), | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-undeclared.rs:8:15 | -LL | fn fnDecl(x: &'a isize, //~ ERROR use of undeclared lifetime name `'a` +LL | fn fnDecl(x: &'a isize, | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` --> $DIR/regions-undeclared.rs:9:15 | -LL | y: &'a isize) //~ ERROR use of undeclared lifetime name `'a` +LL | y: &'a isize) | ^^ undeclared lifetime error: aborting due to 5 previous errors diff --git a/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr b/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr index e38574e774d1..146fb8fd81fc 100644 --- a/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr +++ b/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/regions-var-type-out-of-scope.rs:9:14 | -LL | x = &id(3); //~ ERROR borrowed value does not live long enough +LL | x = &id(3); | ^^^^^- temporary value is freed at the end of this statement | | | creates a temporary which is freed while still in use diff --git a/src/test/ui/regions/regions-var-type-out-of-scope.stderr b/src/test/ui/regions/regions-var-type-out-of-scope.stderr index f474b9a2343c..0363fe0d19f1 100644 --- a/src/test/ui/regions/regions-var-type-out-of-scope.stderr +++ b/src/test/ui/regions/regions-var-type-out-of-scope.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/regions-var-type-out-of-scope.rs:9:14 | -LL | x = &id(3); //~ ERROR borrowed value does not live long enough +LL | x = &id(3); | ^^^^^- temporary value dropped here while still borrowed | | | temporary value does not live long enough diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.stderr b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.stderr index 20615e6a3d7b..e135007604b8 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.stderr +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.stderr @@ -6,7 +6,7 @@ LL | fn use_<'short,'long>(c: S<'long, 'short>, | | | this type is declared with multiple lifetimes... ... -LL | let _: S<'long, 'long> = c; //~ ERROR E0623 +LL | let _: S<'long, 'long> = c; | ^ ...but data with one lifetime flows into the other here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant.stderr b/src/test/ui/regions/regions-variance-contravariant-use-covariant.stderr index da8d21881919..e7c106cbbe3d 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant.stderr +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant.stderr @@ -7,7 +7,7 @@ LL | s: &'short isize, LL | l: &'long isize, | ------------ ... -LL | let _: Contravariant<'long> = c; //~ ERROR E0623 +LL | let _: Contravariant<'long> = c; | ^ ...but data from `c` flows into `l` here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-variance-covariant-use-contravariant.stderr b/src/test/ui/regions/regions-variance-covariant-use-contravariant.stderr index 74a6aee26276..e5e5261ba993 100644 --- a/src/test/ui/regions/regions-variance-covariant-use-contravariant.stderr +++ b/src/test/ui/regions/regions-variance-covariant-use-contravariant.stderr @@ -6,7 +6,7 @@ LL | fn use_<'short,'long>(c: Covariant<'long>, LL | s: &'short isize, | ------------- these two types are declared with different lifetimes... ... -LL | let _: Covariant<'short> = c; //~ ERROR E0623 +LL | let _: Covariant<'short> = c; | ^ ...but data from `s` flows into `c` here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-variance-invariant-use-contravariant.stderr b/src/test/ui/regions/regions-variance-invariant-use-contravariant.stderr index 2332acdf8321..2a2d5d019a12 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-contravariant.stderr +++ b/src/test/ui/regions/regions-variance-invariant-use-contravariant.stderr @@ -6,7 +6,7 @@ LL | fn use_<'short,'long>(c: Invariant<'long>, LL | s: &'short isize, | ------------- these two types are declared with different lifetimes... ... -LL | let _: Invariant<'short> = c; //~ ERROR E0623 +LL | let _: Invariant<'short> = c; | ^ ...but data from `s` flows into `c` here error: aborting due to previous error diff --git a/src/test/ui/regions/regions-variance-invariant-use-covariant.stderr b/src/test/ui/regions/regions-variance-invariant-use-covariant.stderr index f1d1a14f52b8..90b37ce935a6 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-covariant.stderr +++ b/src/test/ui/regions/regions-variance-invariant-use-covariant.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/regions-variance-invariant-use-covariant.rs:17:33 | -LL | let _: Invariant<'static> = c; //~ ERROR mismatched types +LL | let _: Invariant<'static> = c; | ^ lifetime mismatch | = note: expected type `Invariant<'static>` diff --git a/src/test/ui/regions/regions-wf-trait-object.stderr b/src/test/ui/regions/regions-wf-trait-object.stderr index c26895773761..3dc1c4dcd22d 100644 --- a/src/test/ui/regions/regions-wf-trait-object.stderr +++ b/src/test/ui/regions/regions-wf-trait-object.stderr @@ -1,7 +1,7 @@ error[E0478]: lifetime bound not satisfied --> $DIR/regions-wf-trait-object.rs:7:5 | -LL | x: Box+'b> //~ ERROR E0478 +LL | x: Box+'b> | ^^^^^^^^^^^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime 'b as defined on the struct at 6:15 diff --git a/src/test/ui/reject-specialized-drops-8142.stderr b/src/test/ui/reject-specialized-drops-8142.stderr index 1782d3b31058..7dacc1f27402 100644 --- a/src/test/ui/reject-specialized-drops-8142.stderr +++ b/src/test/ui/reject-specialized-drops-8142.stderr @@ -2,7 +2,7 @@ error[E0367]: The requirement `'adds_bnd : 'al` is added only by the Drop impl. --> $DIR/reject-specialized-drops-8142.rs:19:1 | LL | / impl<'al,'adds_bnd:'al> Drop for K<'al,'adds_bnd> { // REJECT -LL | | //~^ ERROR The requirement `'adds_bnd : 'al` is added only by the Drop impl. +LL | | LL | | fn drop(&mut self) { } } | |____________________________^ | @@ -16,7 +16,7 @@ error[E0367]: The requirement `'adds_bnd : 'al` is added only by the Drop impl. --> $DIR/reject-specialized-drops-8142.rs:23:1 | LL | / impl<'al,'adds_bnd> Drop for L<'al,'adds_bnd> where 'adds_bnd:'al { // REJECT -LL | | //~^ ERROR The requirement `'adds_bnd : 'al` is added only by the Drop impl. +LL | | LL | | fn drop(&mut self) { } } | |____________________________^ | diff --git a/src/test/ui/repr/repr-align-assign.stderr b/src/test/ui/repr/repr-align-assign.stderr index 884a99357cdb..cc046e04de54 100644 --- a/src/test/ui/repr/repr-align-assign.stderr +++ b/src/test/ui/repr/repr-align-assign.stderr @@ -1,13 +1,13 @@ error[E0693]: incorrect `repr(align)` attribute format --> $DIR/repr-align-assign.rs:5:8 | -LL | #[repr(align=8)] //~ ERROR incorrect `repr(align)` attribute format +LL | #[repr(align=8)] | ^^^^^^^ help: use parentheses instead: `align(8)` error[E0693]: incorrect `repr(align)` attribute format --> $DIR/repr-align-assign.rs:8:8 | -LL | #[repr(align="8")] //~ ERROR incorrect `repr(align)` attribute format +LL | #[repr(align="8")] | ^^^^^^^^^ help: use parentheses instead: `align(8)` error: aborting due to 2 previous errors diff --git a/src/test/ui/repr/repr-align.stderr b/src/test/ui/repr/repr-align.stderr index f1a5d88ace1f..641f117a7171 100644 --- a/src/test/ui/repr/repr-align.stderr +++ b/src/test/ui/repr/repr-align.stderr @@ -1,25 +1,25 @@ error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer --> $DIR/repr-align.rs:4:8 | -LL | #[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer +LL | #[repr(align(16.0))] | ^^^^^^^^^^^ error[E0589]: invalid `repr(align)` attribute: not a power of two --> $DIR/repr-align.rs:7:8 | -LL | #[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two +LL | #[repr(align(15))] | ^^^^^^^^^ error[E0589]: invalid `repr(align)` attribute: larger than 2^29 --> $DIR/repr-align.rs:10:8 | -LL | #[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29 +LL | #[repr(align(4294967296))] | ^^^^^^^^^^^^^^^^^ error[E0589]: invalid `repr(align)` attribute: not a power of two --> $DIR/repr-align.rs:16:8 | -LL | #[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two +LL | #[repr(align(15))] | ^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/repr/repr-packed-contains-align.stderr b/src/test/ui/repr/repr-packed-contains-align.stderr index 59f8b359d1f5..df001d6b5f2a 100644 --- a/src/test/ui/repr/repr-packed-contains-align.stderr +++ b/src/test/ui/repr/repr-packed-contains-align.stderr @@ -1,31 +1,31 @@ error[E0588]: packed type cannot transitively contain a `[repr(align)]` type --> $DIR/repr-packed-contains-align.rs:19:1 | -LL | struct SC(SA); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type +LL | struct SC(SA); | ^^^^^^^^^^^^^^ error[E0588]: packed type cannot transitively contain a `[repr(align)]` type --> $DIR/repr-packed-contains-align.rs:22:1 | -LL | struct SD(SB); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type +LL | struct SD(SB); | ^^^^^^^^^^^^^^ error[E0588]: packed type cannot transitively contain a `[repr(align)]` type --> $DIR/repr-packed-contains-align.rs:25:1 | -LL | struct SE(UA); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type +LL | struct SE(UA); | ^^^^^^^^^^^^^^ error[E0588]: packed type cannot transitively contain a `[repr(align)]` type --> $DIR/repr-packed-contains-align.rs:28:1 | -LL | struct SF(UB); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type +LL | struct SF(UB); | ^^^^^^^^^^^^^^ error[E0588]: packed type cannot transitively contain a `[repr(align)]` type --> $DIR/repr-packed-contains-align.rs:31:1 | -LL | / union UC { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type +LL | / union UC { LL | | a: UA LL | | } | |_^ @@ -33,7 +33,7 @@ LL | | } error[E0588]: packed type cannot transitively contain a `[repr(align)]` type --> $DIR/repr-packed-contains-align.rs:36:1 | -LL | / union UD { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type +LL | / union UD { LL | | n: UB LL | | } | |_^ @@ -41,7 +41,7 @@ LL | | } error[E0588]: packed type cannot transitively contain a `[repr(align)]` type --> $DIR/repr-packed-contains-align.rs:41:1 | -LL | / union UE { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type +LL | / union UE { LL | | a: SA LL | | } | |_^ @@ -49,7 +49,7 @@ LL | | } error[E0588]: packed type cannot transitively contain a `[repr(align)]` type --> $DIR/repr-packed-contains-align.rs:46:1 | -LL | / union UF { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type +LL | / union UF { LL | | n: SB LL | | } | |_^ diff --git a/src/test/ui/repr/repr-transparent-other-items.stderr b/src/test/ui/repr/repr-transparent-other-items.stderr index 5b7f9650d0c0..c3fb1d9e21e6 100644 --- a/src/test/ui/repr/repr-transparent-other-items.stderr +++ b/src/test/ui/repr/repr-transparent-other-items.stderr @@ -1,15 +1,15 @@ error[E0517]: attribute should be applied to struct --> $DIR/repr-transparent-other-items.rs:3:8 | -LL | #[repr(transparent)] //~ ERROR unsupported representation for zero-variant enum +LL | #[repr(transparent)] | ^^^^^^^^^^^ -LL | enum Void {} //~| ERROR should be applied to struct +LL | enum Void {} | ------------ not a struct error[E0517]: attribute should be applied to struct --> $DIR/repr-transparent-other-items.rs:6:8 | -LL | #[repr(transparent)] //~ ERROR should be applied to struct +LL | #[repr(transparent)] | ^^^^^^^^^^^ LL | / enum FieldlessEnum { LL | | Foo, @@ -20,7 +20,7 @@ LL | | } error[E0517]: attribute should be applied to struct --> $DIR/repr-transparent-other-items.rs:12:8 | -LL | #[repr(transparent)] //~ ERROR should be applied to struct +LL | #[repr(transparent)] | ^^^^^^^^^^^ LL | / enum Enum { LL | | Foo(String), @@ -31,7 +31,7 @@ LL | | } error[E0517]: attribute should be applied to struct --> $DIR/repr-transparent-other-items.rs:18:8 | -LL | #[repr(transparent)] //~ ERROR should be applied to struct +LL | #[repr(transparent)] | ^^^^^^^^^^^ LL | / union Foo { LL | | u: u32, @@ -42,7 +42,7 @@ LL | | } error[E0517]: attribute should be applied to struct --> $DIR/repr-transparent-other-items.rs:24:8 | -LL | #[repr(transparent)] //~ ERROR should be applied to struct +LL | #[repr(transparent)] | ^^^^^^^^^^^ LL | fn cant_repr_this() {} | ---------------------- not a struct @@ -50,7 +50,7 @@ LL | fn cant_repr_this() {} error[E0517]: attribute should be applied to struct --> $DIR/repr-transparent-other-items.rs:27:8 | -LL | #[repr(transparent)] //~ ERROR should be applied to struct +LL | #[repr(transparent)] | ^^^^^^^^^^^ LL | static CANT_REPR_THIS: u32 = 0; | ------------------------------- not a struct @@ -58,9 +58,9 @@ LL | static CANT_REPR_THIS: u32 = 0; error[E0084]: unsupported representation for zero-variant enum --> $DIR/repr-transparent-other-items.rs:3:1 | -LL | #[repr(transparent)] //~ ERROR unsupported representation for zero-variant enum +LL | #[repr(transparent)] | ^^^^^^^^^^^^^^^^^^^^ -LL | enum Void {} //~| ERROR should be applied to struct +LL | enum Void {} | ------------ zero-variant enum error: aborting due to 7 previous errors diff --git a/src/test/ui/repr/repr-transparent-other-reprs.stderr b/src/test/ui/repr/repr-transparent-other-reprs.stderr index 1aafa4362492..9b48bb3a43d2 100644 --- a/src/test/ui/repr/repr-transparent-other-reprs.stderr +++ b/src/test/ui/repr/repr-transparent-other-reprs.stderr @@ -1,25 +1,25 @@ error[E0692]: transparent struct cannot have other repr hints --> $DIR/repr-transparent-other-reprs.rs:5:8 | -LL | #[repr(transparent, C)] //~ ERROR cannot have other repr +LL | #[repr(transparent, C)] | ^^^^^^^^^^^ ^ error[E0692]: transparent struct cannot have other repr hints --> $DIR/repr-transparent-other-reprs.rs:10:8 | -LL | #[repr(transparent, packed)] //~ ERROR cannot have other repr +LL | #[repr(transparent, packed)] | ^^^^^^^^^^^ ^^^^^^ error[E0692]: transparent struct cannot have other repr hints --> $DIR/repr-transparent-other-reprs.rs:13:8 | -LL | #[repr(transparent, align(2))] //~ ERROR cannot have other repr +LL | #[repr(transparent, align(2))] | ^^^^^^^^^^^ ^^^^^^^^ error[E0692]: transparent struct cannot have other repr hints --> $DIR/repr-transparent-other-reprs.rs:16:8 | -LL | #[repr(transparent)] //~ ERROR cannot have other repr +LL | #[repr(transparent)] | ^^^^^^^^^^^ LL | #[repr(C)] | ^ diff --git a/src/test/ui/repr/repr-transparent.stderr b/src/test/ui/repr/repr-transparent.stderr index 02bf2154fe59..2ecee838be14 100644 --- a/src/test/ui/repr/repr-transparent.stderr +++ b/src/test/ui/repr/repr-transparent.stderr @@ -1,7 +1,7 @@ error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 0 --> $DIR/repr-transparent.rs:11:1 | -LL | struct NoFields; //~ ERROR needs exactly one non-zero-sized field +LL | struct NoFields; | ^^^^^^^^^^^^^^^^ | = note: non-zero-sized field @@ -9,7 +9,7 @@ LL | struct NoFields; //~ ERROR needs exactly one non-zero-sized field error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 0 --> $DIR/repr-transparent.rs:14:1 | -LL | struct ContainsOnlyZst(()); //~ ERROR needs exactly one non-zero-sized field +LL | struct ContainsOnlyZst(()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: non-zero-sized field @@ -17,7 +17,7 @@ LL | struct ContainsOnlyZst(()); //~ ERROR needs exactly one non-zero-sized fiel error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 0 --> $DIR/repr-transparent.rs:17:1 | -LL | struct ContainsOnlyZstArray([bool; 0]); //~ ERROR needs exactly one non-zero-sized field +LL | struct ContainsOnlyZstArray([bool; 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: non-zero-sized field @@ -33,13 +33,13 @@ LL | struct ContainsMultipleZst(PhantomData<*const i32>, NoFields); error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 2 --> $DIR/repr-transparent.rs:24:1 | -LL | struct MultipleNonZst(u8, u8); //~ ERROR needs exactly one non-zero-sized field +LL | struct MultipleNonZst(u8, u8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: non-zero-sized field --> $DIR/repr-transparent.rs:24:23 | -LL | struct MultipleNonZst(u8, u8); //~ ERROR needs exactly one non-zero-sized field +LL | struct MultipleNonZst(u8, u8); | ^^ ^^ error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 2 @@ -57,13 +57,13 @@ LL | pub struct StructWithProjection(f32, ::It); error[E0691]: zero-sized field in transparent struct has alignment larger than 1 --> $DIR/repr-transparent.rs:34:32 | -LL | struct NontrivialAlignZst(u32, [u16; 0]); //~ ERROR alignment larger than 1 +LL | struct NontrivialAlignZst(u32, [u16; 0]); | ^^^^^^^^ error[E0691]: zero-sized field in transparent struct has alignment larger than 1 --> $DIR/repr-transparent.rs:40:24 | -LL | struct GenericAlign(ZstAlign32, u32); //~ ERROR alignment larger than 1 +LL | struct GenericAlign(ZstAlign32, u32); | ^^^^^^^^^^^^^ error: aborting due to 8 previous errors diff --git a/src/test/ui/reserved/reserved-attr-on-macro.stderr b/src/test/ui/reserved/reserved-attr-on-macro.stderr index 46d3478b6284..3e082e53ca83 100644 --- a/src/test/ui/reserved/reserved-attr-on-macro.stderr +++ b/src/test/ui/reserved/reserved-attr-on-macro.stderr @@ -9,7 +9,7 @@ LL | #[rustc_attribute_should_be_reserved] error: cannot determine resolution for the macro `foo` --> $DIR/reserved-attr-on-macro.rs:8:5 | -LL | foo!(); //~ ERROR cannot determine resolution for the macro `foo` +LL | foo!(); | ^^^ | = note: import resolution is stuck, try simplifying macro imports diff --git a/src/test/ui/resolve/issue-17518.stderr b/src/test/ui/resolve/issue-17518.stderr index 5d080d989446..057aac25234d 100644 --- a/src/test/ui/resolve/issue-17518.stderr +++ b/src/test/ui/resolve/issue-17518.stderr @@ -1,7 +1,7 @@ error[E0422]: cannot find struct, variant or union type `E` in this scope --> $DIR/issue-17518.rs:6:5 | -LL | E { name: "foobar" }; //~ ERROR cannot find struct, variant or union type `E` +LL | E { name: "foobar" }; | ^ not found in this scope help: possible candidate is found in another module, you can import it into scope | diff --git a/src/test/ui/resolve/issue-22692.stderr b/src/test/ui/resolve/issue-22692.stderr index 1c8d959d60d6..13752430e714 100644 --- a/src/test/ui/resolve/issue-22692.stderr +++ b/src/test/ui/resolve/issue-22692.stderr @@ -1,7 +1,7 @@ error[E0423]: expected value, found struct `String` --> $DIR/issue-22692.rs:2:13 | -LL | let _ = String.new(); //~ ERROR expected value, found struct `String` +LL | let _ = String.new(); | ^^^^^^---- | | | help: use `::` to access an associated function: `String::new` diff --git a/src/test/ui/resolve/issue-33876.stderr b/src/test/ui/resolve/issue-33876.stderr index fb61abc95054..29a63fdd11fe 100644 --- a/src/test/ui/resolve/issue-33876.stderr +++ b/src/test/ui/resolve/issue-33876.stderr @@ -1,7 +1,7 @@ error[E0423]: expected value, found trait `Bar` --> $DIR/issue-33876.rs:10:22 | -LL | let any: &Any = &Bar; //~ ERROR expected value, found trait `Bar` +LL | let any: &Any = &Bar; | ^^^ not a value error: aborting due to previous error diff --git a/src/test/ui/resolve/issue-3907.stderr b/src/test/ui/resolve/issue-3907.stderr index 55bd555676ab..49f7ae844910 100644 --- a/src/test/ui/resolve/issue-3907.stderr +++ b/src/test/ui/resolve/issue-3907.stderr @@ -1,7 +1,7 @@ error[E0404]: expected trait, found type alias `Foo` --> $DIR/issue-3907.rs:10:6 | -LL | impl Foo for S { //~ ERROR expected trait, found type alias `Foo` +LL | impl Foo for S { | ^^^ type aliases cannot be used as traits | = note: did you mean to use a trait alias? diff --git a/src/test/ui/resolve/issue-5035.stderr b/src/test/ui/resolve/issue-5035.stderr index 57ad5f22f4c2..68d35f3b5fef 100644 --- a/src/test/ui/resolve/issue-5035.stderr +++ b/src/test/ui/resolve/issue-5035.stderr @@ -1,13 +1,13 @@ error[E0432]: unresolved import `ImportError` --> $DIR/issue-5035.rs:5:5 | -LL | use ImportError; //~ ERROR unresolved import `ImportError` [E0432] +LL | use ImportError; | ^^^^^^^^^^^ no `ImportError` in the root error[E0404]: expected trait, found type alias `K` --> $DIR/issue-5035.rs:3:6 | -LL | impl K for isize {} //~ ERROR expected trait, found type alias `K` +LL | impl K for isize {} | ^ | | | type aliases cannot be used as traits diff --git a/src/test/ui/resolve/issue-54379.stderr b/src/test/ui/resolve/issue-54379.stderr index 9dbab6917c7e..60a6f904610b 100644 --- a/src/test/ui/resolve/issue-54379.stderr +++ b/src/test/ui/resolve/issue-54379.stderr @@ -1,7 +1,7 @@ error: expected `}`, found `,` --> $DIR/issue-54379.rs:9:22 | -LL | MyStruct { .., Some(_) } => {}, //~ ERROR pattern does not mention field `s1` +LL | MyStruct { .., Some(_) } => {}, | --^ | | | | | expected `}` @@ -10,13 +10,13 @@ LL | MyStruct { .., Some(_) } => {}, //~ ERROR pattern does not mention error: expected `,` --> $DIR/issue-54379.rs:9:24 | -LL | MyStruct { .., Some(_) } => {}, //~ ERROR pattern does not mention field `s1` +LL | MyStruct { .., Some(_) } => {}, | ^^^^ error[E0027]: pattern does not mention field `s1` --> $DIR/issue-54379.rs:9:9 | -LL | MyStruct { .., Some(_) } => {}, //~ ERROR pattern does not mention field `s1` +LL | MyStruct { .., Some(_) } => {}, | ^^^^^^^^^^^^^^^^^^^^^^^^ missing field `s1` error: aborting due to 3 previous errors diff --git a/src/test/ui/resolve/issue-6702.stderr b/src/test/ui/resolve/issue-6702.stderr index 906ac2808aa9..9a46f0d77426 100644 --- a/src/test/ui/resolve/issue-6702.stderr +++ b/src/test/ui/resolve/issue-6702.stderr @@ -1,7 +1,7 @@ error[E0423]: expected function, found struct `Monster` --> $DIR/issue-6702.rs:7:14 | -LL | let _m = Monster(); //~ ERROR expected function, found struct `Monster` +LL | let _m = Monster(); | ^^^^^^^ did you mean `Monster { /* fields */ }`? error: aborting due to previous error diff --git a/src/test/ui/resolve/name-clash-nullary.stderr b/src/test/ui/resolve/name-clash-nullary.stderr index 5bb9371da6d2..51793f426d6d 100644 --- a/src/test/ui/resolve/name-clash-nullary.stderr +++ b/src/test/ui/resolve/name-clash-nullary.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/name-clash-nullary.rs:2:7 | -LL | let None: isize = 42; //~ ERROR mismatched types +LL | let None: isize = 42; | ^^^^ expected isize, found enum `std::option::Option` | = note: expected type `isize` diff --git a/src/test/ui/resolve/resolve-bad-import-prefix.stderr b/src/test/ui/resolve/resolve-bad-import-prefix.stderr index f39e1edb6134..852b9c6afff3 100644 --- a/src/test/ui/resolve/resolve-bad-import-prefix.stderr +++ b/src/test/ui/resolve/resolve-bad-import-prefix.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `Nonexistent` --> $DIR/resolve-bad-import-prefix.rs:12:5 | -LL | use Nonexistent::{}; //~ ERROR unresolved import `Nonexistent` +LL | use Nonexistent::{}; | ^^^^^^^^^^^^^^^ no `Nonexistent` in the root error: aborting due to previous error diff --git a/src/test/ui/resolve/resolve-bad-visibility.stderr b/src/test/ui/resolve/resolve-bad-visibility.stderr index 519e7a946e14..32b85f202f1d 100644 --- a/src/test/ui/resolve/resolve-bad-visibility.stderr +++ b/src/test/ui/resolve/resolve-bad-visibility.stderr @@ -1,31 +1,31 @@ error: visibilities can only be restricted to ancestor modules --> $DIR/resolve-bad-visibility.rs:6:8 | -LL | pub(in std::vec) struct F; //~ ERROR visibilities can only be restricted to ancestor modules +LL | pub(in std::vec) struct F; | ^^^^^^^^ error[E0577]: expected module, found enum `E` --> $DIR/resolve-bad-visibility.rs:4:8 | -LL | pub(in E) struct S; //~ ERROR expected module, found enum `E` +LL | pub(in E) struct S; | ^ not a module error[E0577]: expected module, found trait `Tr` --> $DIR/resolve-bad-visibility.rs:5:8 | -LL | pub(in Tr) struct Z; //~ ERROR expected module, found trait `Tr` +LL | pub(in Tr) struct Z; | ^^ not a module error[E0578]: cannot find module `nonexistent` in the crate root --> $DIR/resolve-bad-visibility.rs:7:8 | -LL | pub(in nonexistent) struct G; //~ ERROR cannot find module `nonexistent` in the crate root +LL | pub(in nonexistent) struct G; | ^^^^^^^^^^^ not found in the crate root error[E0578]: cannot find module `too_soon` in the crate root --> $DIR/resolve-bad-visibility.rs:8:8 | -LL | pub(in too_soon) struct H; //~ ERROR cannot find module `too_soon` in the crate root +LL | pub(in too_soon) struct H; | ^^^^^^^^ not found in the crate root error: aborting due to 5 previous errors diff --git a/src/test/ui/resolve/resolve-conflict-import-vs-extern-crate.stderr b/src/test/ui/resolve/resolve-conflict-import-vs-extern-crate.stderr index 24889a0a820e..a0a858209019 100644 --- a/src/test/ui/resolve/resolve-conflict-import-vs-extern-crate.stderr +++ b/src/test/ui/resolve/resolve-conflict-import-vs-extern-crate.stderr @@ -1,13 +1,13 @@ error[E0254]: the name `std` is defined multiple times --> $DIR/resolve-conflict-import-vs-extern-crate.rs:1:5 | -LL | use std::slice as std; //~ ERROR the name `std` is defined multiple times +LL | use std::slice as std; | ^^^^^^^^^^^^^^^^^ `std` reimported here | = note: `std` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL | use std::slice as other_std; //~ ERROR the name `std` is defined multiple times +LL | use std::slice as other_std; | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/resolve/resolve-conflict-item-vs-extern-crate.stderr b/src/test/ui/resolve/resolve-conflict-item-vs-extern-crate.stderr index 5e190bf31853..7b9fb6c63f67 100644 --- a/src/test/ui/resolve/resolve-conflict-item-vs-extern-crate.stderr +++ b/src/test/ui/resolve/resolve-conflict-item-vs-extern-crate.stderr @@ -1,7 +1,7 @@ error[E0260]: the name `std` is defined multiple times --> $DIR/resolve-conflict-item-vs-extern-crate.rs:2:1 | -LL | mod std {} //~ ERROR the name `std` is defined multiple times +LL | mod std {} | ^^^^^^^ `std` redefined here | = note: `std` must be defined only once in the type namespace of this module diff --git a/src/test/ui/resolve/resolve-inconsistent-names.stderr b/src/test/ui/resolve/resolve-inconsistent-names.stderr index 20346d5aefe7..c75718149fa4 100644 --- a/src/test/ui/resolve/resolve-inconsistent-names.stderr +++ b/src/test/ui/resolve/resolve-inconsistent-names.stderr @@ -1,7 +1,7 @@ error[E0408]: variable `a` is not bound in all patterns --> $DIR/resolve-inconsistent-names.rs:4:12 | -LL | a | b => {} //~ ERROR variable `a` is not bound in all patterns +LL | a | b => {} | - ^ pattern doesn't bind `a` | | | variable not in all patterns @@ -9,7 +9,7 @@ LL | a | b => {} //~ ERROR variable `a` is not bound in all patterns error[E0408]: variable `b` is not bound in all patterns --> $DIR/resolve-inconsistent-names.rs:4:8 | -LL | a | b => {} //~ ERROR variable `a` is not bound in all patterns +LL | a | b => {} | ^ - variable not in all patterns | | | pattern doesn't bind `b` diff --git a/src/test/ui/resolve/resolve-label.stderr b/src/test/ui/resolve/resolve-label.stderr index fecfd922347b..72a8e443bac9 100644 --- a/src/test/ui/resolve/resolve-label.stderr +++ b/src/test/ui/resolve/resolve-label.stderr @@ -1,7 +1,7 @@ error[E0426]: use of undeclared label `'l` --> $DIR/resolve-label.rs:5:23 | -LL | break 'l; //~ ERROR use of undeclared label +LL | break 'l; | ^^ undeclared label `'l` error: aborting due to previous error diff --git a/src/test/ui/resolve/resolve-self-in-impl-2.stderr b/src/test/ui/resolve/resolve-self-in-impl-2.stderr index 1f5887e1352e..765f150ebc74 100644 --- a/src/test/ui/resolve/resolve-self-in-impl-2.stderr +++ b/src/test/ui/resolve/resolve-self-in-impl-2.stderr @@ -1,13 +1,13 @@ error[E0411]: expected trait, found self type `Self` --> $DIR/resolve-self-in-impl-2.rs:4:6 | -LL | impl Self for S {} //~ ERROR expected trait, found self type `Self` +LL | impl Self for S {} | ^^^^ `Self` is only available in impls, traits, and type definitions error[E0405]: cannot find trait `N` in `Self` --> $DIR/resolve-self-in-impl-2.rs:5:12 | -LL | impl Self::N for S {} //~ ERROR cannot find trait `N` in `Self` +LL | impl Self::N for S {} | ^ not found in `Self` error: aborting due to 2 previous errors diff --git a/src/test/ui/resolve/resolve-self-in-impl.stderr b/src/test/ui/resolve/resolve-self-in-impl.stderr index 1940c0cd2a4b..58e851e5c12c 100644 --- a/src/test/ui/resolve/resolve-self-in-impl.stderr +++ b/src/test/ui/resolve/resolve-self-in-impl.stderr @@ -1,7 +1,7 @@ error[E0391]: cycle detected when processing `` --> $DIR/resolve-self-in-impl.rs:14:13 | -LL | impl Tr for Self {} //~ ERROR cycle detected +LL | impl Tr for Self {} | ^^^^ | = note: ...which again requires processing ``, completing the cycle @@ -20,7 +20,7 @@ LL | | fn main() {} error[E0391]: cycle detected when processing `` --> $DIR/resolve-self-in-impl.rs:15:15 | -LL | impl Tr for S {} //~ ERROR cycle detected +LL | impl Tr for S {} | ^^^^ | = note: ...which again requires processing ``, completing the cycle @@ -39,7 +39,7 @@ LL | | fn main() {} error[E0391]: cycle detected when processing `` --> $DIR/resolve-self-in-impl.rs:16:6 | -LL | impl Self {} //~ ERROR cycle detected +LL | impl Self {} | ^^^^ | = note: ...which again requires processing ``, completing the cycle @@ -58,7 +58,7 @@ LL | | fn main() {} error[E0391]: cycle detected when processing `` --> $DIR/resolve-self-in-impl.rs:17:8 | -LL | impl S {} //~ ERROR cycle detected +LL | impl S {} | ^^^^ | = note: ...which again requires processing ``, completing the cycle @@ -77,7 +77,7 @@ LL | | fn main() {} error[E0391]: cycle detected when processing `` --> $DIR/resolve-self-in-impl.rs:18:1 | -LL | impl Tr for S {} //~ ERROR cycle detected +LL | impl Tr for S {} | ^^^^^^^^^^^^^^^^^^^^^^ | = note: ...which again requires processing ``, completing the cycle diff --git a/src/test/ui/resolve/resolve-variant-assoc-item.stderr b/src/test/ui/resolve/resolve-variant-assoc-item.stderr index b93005849f43..173976d707c7 100644 --- a/src/test/ui/resolve/resolve-variant-assoc-item.stderr +++ b/src/test/ui/resolve/resolve-variant-assoc-item.stderr @@ -1,13 +1,13 @@ error[E0433]: failed to resolve: not a module `V` --> $DIR/resolve-variant-assoc-item.rs:5:8 | -LL | E::V::associated_item; //~ ERROR failed to resolve: not a module `V` +LL | E::V::associated_item; | ^ not a module `V` error[E0433]: failed to resolve: not a module `V` --> $DIR/resolve-variant-assoc-item.rs:6:5 | -LL | V::associated_item; //~ ERROR failed to resolve: not a module `V` +LL | V::associated_item; | ^ not a module `V` error: aborting due to 2 previous errors diff --git a/src/test/ui/resolve/token-error-correct-2.stderr b/src/test/ui/resolve/token-error-correct-2.stderr index 481ed8828897..d568117d6762 100644 --- a/src/test/ui/resolve/token-error-correct-2.stderr +++ b/src/test/ui/resolve/token-error-correct-2.stderr @@ -3,8 +3,8 @@ error: incorrect close delimiter: `)` | LL | if foo { | - un-closed delimiter -LL | //~^ ERROR: cannot find value `foo` -LL | ) //~ ERROR: incorrect close delimiter: `)` +LL | +LL | ) | ^ incorrect close delimiter error[E0425]: cannot find value `foo` in this scope diff --git a/src/test/ui/resolve/token-error-correct-3.rs b/src/test/ui/resolve/token-error-correct-3.rs index b1ca0bbfc57c..212b88ac8b05 100644 --- a/src/test/ui/resolve/token-error-correct-3.rs +++ b/src/test/ui/resolve/token-error-correct-3.rs @@ -10,16 +10,14 @@ pub mod raw { pub fn ensure_dir_exists, F: FnOnce(&Path)>(path: P, callback: F) -> io::Result { - if !is_directory(path.as_ref()) { //~ ERROR: cannot find function `is_directory` - callback(path.as_ref(); //~ ERROR expected one of - fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types - //~^ expected (), found enum `std::result::Result` - //~| expected type `()` - //~| found type `std::result::Result` - //~| expected one of + if !is_directory(path.as_ref()) { + //~^ ERROR cannot find function `is_directory` + callback(path.as_ref(); + //~^ ERROR expected one of + fs::create_dir_all(path.as_ref()).map(|()| true) + //~^ ERROR mismatched types } else { - //~^ ERROR: expected one of - //~| unexpected token + //~^ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `)` Ok(false); } diff --git a/src/test/ui/resolve/token-error-correct-3.stderr b/src/test/ui/resolve/token-error-correct-3.stderr index a6bb83c71f31..52a3117ff3ac 100644 --- a/src/test/ui/resolve/token-error-correct-3.stderr +++ b/src/test/ui/resolve/token-error-correct-3.stderr @@ -1,31 +1,31 @@ error: expected one of `)`, `,`, `.`, `?`, or an operator, found `;` - --> $DIR/token-error-correct-3.rs:14:35 + --> $DIR/token-error-correct-3.rs:15:35 | -LL | callback(path.as_ref(); //~ ERROR expected one of +LL | callback(path.as_ref(); | - ^ | | | | | help: `)` may belong here | unclosed delimiter error: expected one of `.`, `;`, `?`, `}`, or an operator, found `)` - --> $DIR/token-error-correct-3.rs:20:9 + --> $DIR/token-error-correct-3.rs:19:9 | -LL | fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types +LL | fs::create_dir_all(path.as_ref()).map(|()| true) | - expected one of `.`, `;`, `?`, `}`, or an operator here -... +LL | LL | } else { | ^ unexpected token error[E0425]: cannot find function `is_directory` in this scope --> $DIR/token-error-correct-3.rs:13:13 | -LL | if !is_directory(path.as_ref()) { //~ ERROR: cannot find function `is_directory` +LL | if !is_directory(path.as_ref()) { | ^^^^^^^^^^^^ not found in this scope error[E0308]: mismatched types - --> $DIR/token-error-correct-3.rs:15:13 + --> $DIR/token-error-correct-3.rs:17:13 | -LL | fs::create_dir_all(path.as_ref()).map(|()| true) //~ ERROR: mismatched types +LL | fs::create_dir_all(path.as_ref()).map(|()| true) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- help: try adding a semicolon: `;` | | | expected (), found enum `std::result::Result` diff --git a/src/test/ui/resolve/token-error-correct.stderr b/src/test/ui/resolve/token-error-correct.stderr index b0827ea7367c..9452e2d68dec 100644 --- a/src/test/ui/resolve/token-error-correct.stderr +++ b/src/test/ui/resolve/token-error-correct.stderr @@ -5,7 +5,7 @@ LL | fn main() { | - close delimiter possibly meant for this LL | foo(bar(; | - un-closed delimiter -LL | //~^ ERROR cannot find function `bar` in this scope +LL | LL | } | ^ incorrect close delimiter diff --git a/src/test/ui/resolve/tuple-struct-alias.stderr b/src/test/ui/resolve/tuple-struct-alias.stderr index f299aa40a31e..fc701b1644d1 100644 --- a/src/test/ui/resolve/tuple-struct-alias.stderr +++ b/src/test/ui/resolve/tuple-struct-alias.stderr @@ -1,7 +1,7 @@ error[E0423]: expected function, found type alias `A` --> $DIR/tuple-struct-alias.rs:5:13 | -LL | let s = A(0, 1); //~ ERROR expected function +LL | let s = A(0, 1); | ^ help: a tuple struct with a similar name exists: `S` | = note: can't use a type alias as a constructor @@ -9,7 +9,7 @@ LL | let s = A(0, 1); //~ ERROR expected function error[E0532]: expected tuple struct/variant, found type alias `A` --> $DIR/tuple-struct-alias.rs:7:9 | -LL | A(..) => {} //~ ERROR expected tuple struct/variant +LL | A(..) => {} | ^ help: a tuple struct with a similar name exists: `S` | = note: can't use a type alias as a constructor diff --git a/src/test/ui/resolve/use_suggestion_placement.stderr b/src/test/ui/resolve/use_suggestion_placement.stderr index dcbb8dfe665c..8d2fdd530f10 100644 --- a/src/test/ui/resolve/use_suggestion_placement.stderr +++ b/src/test/ui/resolve/use_suggestion_placement.stderr @@ -1,7 +1,7 @@ error[E0412]: cannot find type `Path` in this scope --> $DIR/use_suggestion_placement.rs:17:16 | -LL | type Bar = Path; //~ ERROR cannot find +LL | type Bar = Path; | ^^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -11,7 +11,7 @@ LL | use std::path::Path; error[E0425]: cannot find value `A` in this scope --> $DIR/use_suggestion_placement.rs:22:13 | -LL | let _ = A; //~ ERROR cannot find +LL | let _ = A; | ^ not found in this scope help: possible candidate is found in another module, you can import it into scope | @@ -21,7 +21,7 @@ LL | use m::A; error[E0412]: cannot find type `HashMap` in this scope --> $DIR/use_suggestion_placement.rs:27:23 | -LL | type Dict = HashMap; //~ ERROR cannot find +LL | type Dict = HashMap; | ^^^^^^^ not found in this scope help: possible candidates are found in other modules, you can import them into scope | diff --git a/src/test/ui/resolve_self_super_hint.rs b/src/test/ui/resolve_self_super_hint.rs index 193a6ecf9d57..91a01cc0fa23 100644 --- a/src/test/ui/resolve_self_super_hint.rs +++ b/src/test/ui/resolve_self_super_hint.rs @@ -5,19 +5,23 @@ mod a { extern crate alloc; use alloc::HashMap; //~^ ERROR unresolved import `alloc` [E0432] - //~| did you mean `self::alloc`? + //~| HELP a similar path exists + //~| SUGGESTION self::alloc mod b { use alloc::HashMap; //~^ ERROR unresolved import `alloc` [E0432] - //~| did you mean `super::alloc`? + //~| HELP a similar path exists + //~| SUGGESTION super::alloc mod c { use alloc::HashMap; //~^ ERROR unresolved import `alloc` [E0432] - //~| did you mean `a::alloc`? + //~| HELP a similar path exists + //~| SUGGESTION a::alloc mod d { use alloc::HashMap; //~^ ERROR unresolved import `alloc` [E0432] - //~| did you mean `a::alloc`? + //~| HELP a similar path exists + //~| SUGGESTION a::alloc } } } diff --git a/src/test/ui/resolve_self_super_hint.stderr b/src/test/ui/resolve_self_super_hint.stderr index ddae0e5f6aab..03214cad8e41 100644 --- a/src/test/ui/resolve_self_super_hint.stderr +++ b/src/test/ui/resolve_self_super_hint.stderr @@ -2,25 +2,31 @@ error[E0432]: unresolved import `alloc` --> $DIR/resolve_self_super_hint.rs:6:9 | LL | use alloc::HashMap; - | ^^^^^ did you mean `self::alloc`? + | ^^^^^ help: a similar path exists: `self::alloc` error[E0432]: unresolved import `alloc` - --> $DIR/resolve_self_super_hint.rs:10:13 + --> $DIR/resolve_self_super_hint.rs:11:13 | LL | use alloc::HashMap; - | ^^^^^ did you mean `super::alloc`? + | ^^^^^ help: a similar path exists: `super::alloc` error[E0432]: unresolved import `alloc` - --> $DIR/resolve_self_super_hint.rs:14:17 + --> $DIR/resolve_self_super_hint.rs:16:17 | LL | use alloc::HashMap; - | ^^^^^ did you mean `a::alloc`? + | ^^^^^ + | | + | unresolved import + | help: a similar path exists: `a::alloc` error[E0432]: unresolved import `alloc` - --> $DIR/resolve_self_super_hint.rs:18:21 + --> $DIR/resolve_self_super_hint.rs:21:21 | LL | use alloc::HashMap; - | ^^^^^ did you mean `a::alloc`? + | ^^^^^ + | | + | unresolved import + | help: a similar path exists: `a::alloc` error: aborting due to 4 previous errors diff --git a/src/test/ui/retslot-cast.stderr b/src/test/ui/retslot-cast.stderr index 855aa501082b..3c58285bdb35 100644 --- a/src/test/ui/retslot-cast.stderr +++ b/src/test/ui/retslot-cast.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/retslot-cast.rs:13:5 | -LL | inner(x) //~ ERROR mismatched types +LL | inner(x) | ^^^^^^^^ expected trait `std::iter::Iterator`, found trait `std::iter::Iterator + std::marker::Send` | = note: expected type `std::option::Option<&dyn std::iter::Iterator>` diff --git a/src/test/ui/return/return-from-diverging.stderr b/src/test/ui/return/return-from-diverging.stderr index 2862ae641df1..3dd029c14c0f 100644 --- a/src/test/ui/return/return-from-diverging.stderr +++ b/src/test/ui/return/return-from-diverging.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | fn fail() -> ! { | - expected `!` because of return type -LL | return "wow"; //~ ERROR mismatched types +LL | return "wow"; | ^^^^^ expected !, found reference | = note: expected type `!` diff --git a/src/test/ui/return/return-match-array-const.stderr b/src/test/ui/return/return-match-array-const.stderr index 763b3d987d7c..6e8c9ed40bbe 100644 --- a/src/test/ui/return/return-match-array-const.stderr +++ b/src/test/ui/return/return-match-array-const.stderr @@ -1,19 +1,19 @@ error[E0572]: return statement outside of function body --> $DIR/return-match-array-const.rs:2:10 | -LL | [(); return match 0 { n => n }]; //~ ERROR: return statement outside of function body +LL | [(); return match 0 { n => n }]; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0572]: return statement outside of function body --> $DIR/return-match-array-const.rs:4:10 | -LL | [(); return match 0 { 0 => 0 }]; //~ ERROR: return statement outside of function body +LL | [(); return match 0 { 0 => 0 }]; | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0572]: return statement outside of function body --> $DIR/return-match-array-const.rs:6:10 | -LL | [(); return match () { 'a' => 0, _ => 0 }]; //~ ERROR: return statement outside of function body +LL | [(); return match () { 'a' => 0, _ => 0 }]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/return/return-unit-from-diverging.stderr b/src/test/ui/return/return-unit-from-diverging.stderr index 19eccac34338..befc57563a9c 100644 --- a/src/test/ui/return/return-unit-from-diverging.stderr +++ b/src/test/ui/return/return-unit-from-diverging.stderr @@ -3,7 +3,7 @@ error[E0069]: `return;` in a function whose return type is not `()` | LL | fn fail() -> ! { | - expected `!` because of this return type -LL | return; //~ ERROR in a function whose return type is not +LL | return; | ^^^^^^ return type is not `()` error: aborting due to previous error diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-in-test-should-panic.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-in-test-should-panic.stderr index 23a56bf8fec1..7f6749fc9ccb 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-in-test-should-panic.stderr +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-in-test-should-panic.stderr @@ -2,7 +2,7 @@ error: functions using `#[should_panic]` must return `()` --> $DIR/termination-trait-in-test-should-panic.rs:11:1 | LL | / fn not_a_num() -> Result<(), ParseIntError> { -LL | | //~^ ERROR functions using `#[should_panic]` must return `()` +LL | | LL | | let _: u32 = "abc".parse()?; LL | | Ok(()) LL | | } diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-main-wrong-type.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-main-wrong-type.stderr index c1be04ca881e..31b90340d79f 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-main-wrong-type.stderr +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-main-wrong-type.stderr @@ -1,7 +1,7 @@ error[E0277]: `main` has invalid return type `char` --> $DIR/termination-trait-main-wrong-type.rs:1:14 | -LL | fn main() -> char { //~ ERROR +LL | fn main() -> char { | ^^^^ `main` can only return types that implement `std::process::Termination` | = help: consider using `()`, or a `Result` diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-not-satisfied.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-not-satisfied.stderr index 2f05f9b0f7a1..72a58a04170f 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-not-satisfied.stderr +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-not-satisfied.stderr @@ -1,7 +1,7 @@ error[E0277]: `main` has invalid return type `ReturnType` --> $DIR/termination-trait-not-satisfied.rs:3:14 | -LL | fn main() -> ReturnType { //~ ERROR `main` has invalid return type `ReturnType` +LL | fn main() -> ReturnType { | ^^^^^^^^^^ `main` can only return types that implement `std::process::Termination` | = help: consider using `()`, or a `Result` diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr index a99f852d99bc..18115541af95 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr @@ -1,7 +1,7 @@ error[E0277]: `main` has invalid return type `std::result::Result` --> $DIR/termination-trait-test-wrong-type.rs:6:1 | -LL | / fn can_parse_zero_as_f32() -> Result { //~ ERROR +LL | / fn can_parse_zero_as_f32() -> Result { LL | | "0".parse() LL | | } | |_^ `main` can only return types that implement `std::process::Termination` diff --git a/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr b/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr index 3a6f66ca4dac..04572920ee41 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/borrowck-issue-49631.nll.stderr @@ -5,7 +5,7 @@ LL | while let Some(Ok(string)) = foo.get() { | --- immutable borrow occurs here LL | foo.mutate(); | ^^^^^^^^^^^^ mutable borrow occurs here -LL | //~^ ERROR cannot borrow `foo` as mutable +LL | LL | println!("foo={:?}", *string); | ------- immutable borrow later used here diff --git a/src/test/ui/rfc-2005-default-binding-mode/const.stderr b/src/test/ui/rfc-2005-default-binding-mode/const.stderr index 7ce8a3256327..210b4f6be63d 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/const.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/const.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/const.rs:14:9 | -LL | FOO => {}, //~ ERROR mismatched types +LL | FOO => {}, | ^^^ expected &Foo, found struct `Foo` | = note: expected type `&Foo` diff --git a/src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr b/src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr index 5920be4132a9..d6a89006bc0f 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/enum.nll.stderr @@ -1,19 +1,19 @@ error[E0594]: cannot assign to `*x` which is behind a `&` reference --> $DIR/enum.rs:9:5 | -LL | *x += 1; //~ ERROR cannot assign to immutable +LL | *x += 1; | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*x` which is behind a `&` reference --> $DIR/enum.rs:13:9 | -LL | *x += 1; //~ ERROR cannot assign to immutable +LL | *x += 1; | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*x` which is behind a `&` reference --> $DIR/enum.rs:19:9 | -LL | *x += 1; //~ ERROR cannot assign to immutable +LL | *x += 1; | ^^^^^^^ `x` is a `&` reference, so the data it refers to cannot be written error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc-2005-default-binding-mode/enum.stderr b/src/test/ui/rfc-2005-default-binding-mode/enum.stderr index d29b0111d8bb..5106618af64d 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/enum.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/enum.stderr @@ -1,19 +1,19 @@ error[E0594]: cannot assign to immutable borrowed content `*x` --> $DIR/enum.rs:9:5 | -LL | *x += 1; //~ ERROR cannot assign to immutable +LL | *x += 1; | ^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content `*x` --> $DIR/enum.rs:13:9 | -LL | *x += 1; //~ ERROR cannot assign to immutable +LL | *x += 1; | ^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content `*x` --> $DIR/enum.rs:19:9 | -LL | *x += 1; //~ ERROR cannot assign to immutable +LL | *x += 1; | ^^^^^^^ cannot borrow as mutable error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr index 2206c2f340e1..a6f2f3ec3096 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.nll.stderr @@ -1,19 +1,19 @@ error[E0594]: cannot assign to `*n` which is behind a `&` reference --> $DIR/explicit-mut.rs:7:13 | -LL | *n += 1; //~ ERROR cannot assign to immutable +LL | *n += 1; | ^^^^^^^ `n` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*n` which is behind a `&` reference --> $DIR/explicit-mut.rs:15:13 | -LL | *n += 1; //~ ERROR cannot assign to immutable +LL | *n += 1; | ^^^^^^^ `n` is a `&` reference, so the data it refers to cannot be written error[E0594]: cannot assign to `*n` which is behind a `&` reference --> $DIR/explicit-mut.rs:23:13 | -LL | *n += 1; //~ ERROR cannot assign to immutable +LL | *n += 1; | ^^^^^^^ `n` is a `&` reference, so the data it refers to cannot be written error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr index e03f67760d7e..b6424f842648 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/explicit-mut.stderr @@ -1,19 +1,19 @@ error[E0594]: cannot assign to immutable borrowed content `*n` --> $DIR/explicit-mut.rs:7:13 | -LL | *n += 1; //~ ERROR cannot assign to immutable +LL | *n += 1; | ^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content `*n` --> $DIR/explicit-mut.rs:15:13 | -LL | *n += 1; //~ ERROR cannot assign to immutable +LL | *n += 1; | ^^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to immutable borrowed content `*n` --> $DIR/explicit-mut.rs:23:13 | -LL | *n += 1; //~ ERROR cannot assign to immutable +LL | *n += 1; | ^^^^^^^ cannot borrow as mutable error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc-2005-default-binding-mode/lit.stderr b/src/test/ui/rfc-2005-default-binding-mode/lit.stderr index b78b4432bbe3..9be1876b7145 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/lit.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/lit.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/lit.rs:7:13 | -LL | "abc" => true, //~ ERROR mismatched types +LL | "abc" => true, | ^^^^^ expected &str, found str | = note: expected type `&&str` @@ -10,7 +10,7 @@ LL | "abc" => true, //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/lit.rs:16:9 | -LL | b"abc" => true, //~ ERROR mismatched types +LL | b"abc" => true, | ^^^^^^ expected &[u8], found array of 3 elements | = note: expected type `&&[u8]` diff --git a/src/test/ui/rfc-2005-default-binding-mode/no-double-error.stderr b/src/test/ui/rfc-2005-default-binding-mode/no-double-error.stderr index 9d35e167075a..1bf9b09fcc5e 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/no-double-error.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/no-double-error.stderr @@ -1,7 +1,7 @@ error[E0599]: no associated item named `XXX` found for type `u32` in the current scope --> $DIR/no-double-error.rs:8:14 | -LL | u32::XXX => { } //~ ERROR no associated item named +LL | u32::XXX => { } | -----^^^ | | | associated item not found in `u32` diff --git a/src/test/ui/rfc-2005-default-binding-mode/slice.stderr b/src/test/ui/rfc-2005-default-binding-mode/slice.stderr index 1dfad0d31896..f1e91a05f082 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/slice.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/slice.stderr @@ -1,8 +1,10 @@ error[E0004]: non-exhaustive patterns: `&[]` not covered --> $DIR/slice.rs:6:11 | -LL | match sl { //~ ERROR non-exhaustive patterns +LL | match sl { | ^^ pattern `&[]` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/rfc-2008-non-exhaustive/enum.stderr b/src/test/ui/rfc-2008-non-exhaustive/enum.stderr index acce9779067a..b5c1a4ebba4a 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/enum.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/enum.stderr @@ -3,6 +3,8 @@ error[E0004]: non-exhaustive patterns: `_` not covered | LL | match enum_unit { | ^^^^^^^^^ pattern `_` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.stderr b/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.stderr index 1d055fe8d4cb..ff082e6fc429 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.stderr @@ -9,7 +9,7 @@ error[E0701]: attribute can only be applied to a struct or enum | LL | #[non_exhaustive] | ^^^^^^^^^^^^^^^^^ -LL | //~^ ERROR attribute can only be applied to a struct or enum [E0701] +LL | LL | trait Bar { } | ------------- not a struct or enum @@ -18,7 +18,7 @@ error[E0701]: attribute can only be applied to a struct or enum | LL | #[non_exhaustive] | ^^^^^^^^^^^^^^^^^ -LL | //~^ ERROR attribute can only be applied to a struct or enum [E0701] +LL | LL | / union Baz { LL | | f1: u16, LL | | f2: u16 diff --git a/src/test/ui/rfc-2008-non-exhaustive/structs.stderr b/src/test/ui/rfc-2008-non-exhaustive/structs.stderr index 4532b5c34cc0..6213c392a9b4 100644 --- a/src/test/ui/rfc-2008-non-exhaustive/structs.stderr +++ b/src/test/ui/rfc-2008-non-exhaustive/structs.stderr @@ -27,7 +27,7 @@ error[E0639]: cannot create non-exhaustive struct using struct expression | LL | let fr = FunctionalRecord { | ______________^ -LL | | //~^ ERROR cannot create non-exhaustive struct +LL | | LL | | first_field: 1920, LL | | second_field: 1080, LL | | ..FunctionalRecord::default() diff --git a/src/test/ui/rfc-2093-infer-outlives/cross-crate.stderr b/src/test/ui/rfc-2093-infer-outlives/cross-crate.stderr index 850e7caec548..3368e35d304f 100644 --- a/src/test/ui/rfc-2093-infer-outlives/cross-crate.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/cross-crate.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/cross-crate.rs:4:1 | -LL | / struct Foo<'a, T> { //~ ERROR rustc_outlives +LL | / struct Foo<'a, T> { LL | | bar: std::slice::IterMut<'a, T> LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/dont-infer-static.stderr b/src/test/ui/rfc-2093-infer-outlives/dont-infer-static.stderr index e4f4b58fb33a..26cbeeaf5acd 100644 --- a/src/test/ui/rfc-2093-infer-outlives/dont-infer-static.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/dont-infer-static.stderr @@ -3,13 +3,13 @@ error[E0310]: the parameter type `U` may not live long enough | LL | struct Foo { | - help: consider adding an explicit lifetime bound `U: 'static`... -LL | bar: Bar //~ ERROR the parameter type `U` may not live long enough [E0310] +LL | bar: Bar | ^^^^^^^^^^^ | note: ...so that the type `U` will meet its required lifetime bounds --> $DIR/dont-infer-static.rs:10:5 | -LL | bar: Bar //~ ERROR the parameter type `U` may not live long enough [E0310] +LL | bar: Bar | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/rfc-2093-infer-outlives/enum.stderr b/src/test/ui/rfc-2093-infer-outlives/enum.stderr index c8e730090fc3..e81d10a66dff 100644 --- a/src/test/ui/rfc-2093-infer-outlives/enum.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/enum.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/enum.rs:9:1 | -LL | / enum Foo<'a, T> { //~ ERROR rustc_outlives +LL | / enum Foo<'a, T> { LL | | One(Bar<'a, T>) LL | | } | |_^ @@ -11,7 +11,7 @@ LL | | } error: rustc_outlives --> $DIR/enum.rs:15:1 | -LL | / struct Bar<'b, U> { //~ ERROR rustc_outlives +LL | / struct Bar<'b, U> { LL | | field2: &'b U LL | | } | |_^ @@ -21,7 +21,7 @@ LL | | } error: rustc_outlives --> $DIR/enum.rs:21:1 | -LL | / enum Ying<'c, K> { //~ ERROR rustc_outlives +LL | / enum Ying<'c, K> { LL | | One(&'c Yang) LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.stderr index a5bee93a1509..c87ef6c391b1 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-dyn.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/explicit-dyn.rs:8:1 | -LL | / struct Foo<'a, A> //~ ERROR rustc_outlives +LL | / struct Foo<'a, A> LL | | { LL | | foo: Box> LL | | } diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-enum.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-enum.stderr index 2149e0533c61..611df047cffc 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-enum.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-enum.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/explicit-enum.rs:4:1 | -LL | / enum Foo<'a, U> { //~ ERROR rustc_outlives +LL | / enum Foo<'a, U> { LL | | One(Bar<'a, U>) LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-projection.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-projection.stderr index 46793b1690a8..8e9b158ab7c9 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-projection.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-projection.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/explicit-projection.rs:8:1 | -LL | / struct Foo<'a, A, B> where A: Trait<'a, B> //~ ERROR rustc_outlives +LL | / struct Foo<'a, A, B> where A: Trait<'a, B> LL | | { LL | | foo: >::Type LL | | } diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-struct.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-struct.stderr index b694b7a95436..cbff2b777fe7 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-struct.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-struct.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/explicit-struct.rs:4:1 | -LL | / struct Foo<'b, U> { //~ ERROR rustc_outlives +LL | / struct Foo<'b, U> { LL | | bar: Bar<'b, U> LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/explicit-union.stderr b/src/test/ui/rfc-2093-infer-outlives/explicit-union.stderr index d70fad9d8304..adf62651cacb 100644 --- a/src/test/ui/rfc-2093-infer-outlives/explicit-union.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/explicit-union.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/explicit-union.rs:6:1 | -LL | / union Foo<'b, U> { //~ ERROR rustc_outlives +LL | / union Foo<'b, U> { LL | | bar: Bar<'b, U> LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/infer-static.stderr b/src/test/ui/rfc-2093-infer-outlives/infer-static.stderr index b3a827f38c55..106db765f7ea 100644 --- a/src/test/ui/rfc-2093-infer-outlives/infer-static.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/infer-static.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/infer-static.rs:5:1 | -LL | / struct Foo { //~ ERROR rustc_outlives +LL | / struct Foo { LL | | bar: Bar LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-enum.stderr b/src/test/ui/rfc-2093-infer-outlives/nested-enum.stderr index 76d18bbee9d6..6b143ba7eb96 100644 --- a/src/test/ui/rfc-2093-infer-outlives/nested-enum.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/nested-enum.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/nested-enum.rs:4:1 | -LL | / enum Foo<'a, T> { //~ ERROR rustc_outlives +LL | / enum Foo<'a, T> { LL | | LL | | One(Bar<'a, T>) LL | | } diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-regions.stderr b/src/test/ui/rfc-2093-infer-outlives/nested-regions.stderr index 2900a29ed7c0..4d8f7b7c8c46 100644 --- a/src/test/ui/rfc-2093-infer-outlives/nested-regions.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/nested-regions.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/nested-regions.rs:4:1 | -LL | / struct Foo<'a, 'b, T> { //~ ERROR rustc_outlives +LL | / struct Foo<'a, 'b, T> { LL | | x: &'a &'b T LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-structs.stderr b/src/test/ui/rfc-2093-infer-outlives/nested-structs.stderr index e8b822df9503..17d7c014e102 100644 --- a/src/test/ui/rfc-2093-infer-outlives/nested-structs.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/nested-structs.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/nested-structs.rs:4:1 | -LL | / struct Foo<'a, T> { //~ ERROR rustc_outlives +LL | / struct Foo<'a, T> { LL | | field1: Bar<'a, T> LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/nested-union.stderr b/src/test/ui/rfc-2093-infer-outlives/nested-union.stderr index 56a2f873c768..fc4b1a223294 100644 --- a/src/test/ui/rfc-2093-infer-outlives/nested-union.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/nested-union.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/nested-union.rs:6:1 | -LL | / union Foo<'a, T> { //~ ERROR rustc_outlives +LL | / union Foo<'a, T> { LL | | field1: Bar<'a, T> LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/projection.stderr b/src/test/ui/rfc-2093-infer-outlives/projection.stderr index 73d2420af00d..8a91c44c5806 100644 --- a/src/test/ui/rfc-2093-infer-outlives/projection.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/projection.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/projection.rs:4:1 | -LL | / struct Foo<'a, T: Iterator> { //~ ERROR rustc_outlives +LL | / struct Foo<'a, T: Iterator> { LL | | bar: &'a T::Item LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/reference.stderr b/src/test/ui/rfc-2093-infer-outlives/reference.stderr index 41a8de2d84bc..adb1c4a62904 100644 --- a/src/test/ui/rfc-2093-infer-outlives/reference.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/reference.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/reference.rs:4:1 | -LL | / struct Foo<'a, T> { //~ ERROR rustc_outlives +LL | / struct Foo<'a, T> { LL | | bar: &'a T, LL | | } | |_^ diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-enum-not-wf.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-enum-not-wf.stderr index d10f7ed28fc2..870140856675 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-enum-not-wf.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-enum-not-wf.stderr @@ -3,13 +3,13 @@ error[E0309]: the parameter type `T` may not live long enough | LL | enum Ref1<'a, T> { | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | Ref1Variant1(RequireOutlives<'a, T>) //~ ERROR the parameter type `T` may not live long enough +LL | Ref1Variant1(RequireOutlives<'a, T>) | ^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds --> $DIR/regions-enum-not-wf.rs:18:18 | -LL | Ref1Variant1(RequireOutlives<'a, T>) //~ ERROR the parameter type `T` may not live long enough +LL | Ref1Variant1(RequireOutlives<'a, T>) | ^^^^^^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough @@ -18,40 +18,40 @@ error[E0309]: the parameter type `T` may not live long enough LL | enum Ref2<'a, T> { | - help: consider adding an explicit lifetime bound `T: 'a`... LL | Ref2Variant1, -LL | Ref2Variant2(isize, RequireOutlives<'a, T>), //~ ERROR the parameter type `T` may not live long enough +LL | Ref2Variant2(isize, RequireOutlives<'a, T>), | ^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds --> $DIR/regions-enum-not-wf.rs:23:25 | -LL | Ref2Variant2(isize, RequireOutlives<'a, T>), //~ ERROR the parameter type `T` may not live long enough +LL | Ref2Variant2(isize, RequireOutlives<'a, T>), | ^^^^^^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough --> $DIR/regions-enum-not-wf.rs:35:1 | -LL | enum RefDouble<'a, 'b, T> { //~ ERROR the parameter type `T` may not live long enough [E0309] +LL | enum RefDouble<'a, 'b, T> { | ^ - help: consider adding an explicit lifetime bound `T: 'b`... | _| | | LL | | RefDoubleVariant1(&'a RequireOutlives<'b, T>) -LL | | //~^ the parameter type `T` may not live long enough [E0309] +LL | | LL | | } | |_^ | note: ...so that the type `T` will meet its required lifetime bounds --> $DIR/regions-enum-not-wf.rs:35:1 | -LL | / enum RefDouble<'a, 'b, T> { //~ ERROR the parameter type `T` may not live long enough [E0309] +LL | / enum RefDouble<'a, 'b, T> { LL | | RefDoubleVariant1(&'a RequireOutlives<'b, T>) -LL | | //~^ the parameter type `T` may not live long enough [E0309] +LL | | LL | | } | |_^ error[E0309]: the parameter type `T` may not live long enough --> $DIR/regions-enum-not-wf.rs:36:23 | -LL | enum RefDouble<'a, 'b, T> { //~ ERROR the parameter type `T` may not live long enough [E0309] +LL | enum RefDouble<'a, 'b, T> { | - help: consider adding an explicit lifetime bound `T: 'b`... LL | RefDoubleVariant1(&'a RequireOutlives<'b, T>) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr index 4b7732251b0d..be8b5c6446ca 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region-rev.stderr @@ -1,7 +1,7 @@ error[E0491]: in type `&'a rev_variant_struct_region::Foo<'b>`, reference has a longer lifetime than the data it references --> $DIR/regions-outlives-nominal-type-region-rev.rs:17:9 | -LL | type Out = &'a Foo<'b>; //~ ERROR reference has a longer lifetime +LL | type Out = &'a Foo<'b>; | ^^^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime 'a as defined on the impl at 16:10 diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr index 9cabc973d1a9..9a3ba2d65cad 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-region.stderr @@ -1,7 +1,7 @@ error[E0491]: in type `&'a variant_struct_region::Foo<'b>`, reference has a longer lifetime than the data it references --> $DIR/regions-outlives-nominal-type-region.rs:17:9 | -LL | type Out = &'a Foo<'b>; //~ ERROR reference has a longer lifetime +LL | type Out = &'a Foo<'b>; | ^^^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime 'a as defined on the impl at 16:10 diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr index 6142228664a4..5389beea3a70 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type-rev.stderr @@ -1,7 +1,7 @@ error[E0491]: in type `&'a variant_struct_type::Foo<&'b i32>`, reference has a longer lifetime than the data it references --> $DIR/regions-outlives-nominal-type-type-rev.rs:17:9 | -LL | type Out = &'a Foo<&'b i32>; //~ ERROR reference has a longer lifetime +LL | type Out = &'a Foo<&'b i32>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime 'a as defined on the impl at 16:10 diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr index 0831f3acef28..2f3ef48a0544 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-outlives-nominal-type-type.stderr @@ -1,7 +1,7 @@ error[E0491]: in type `&'a variant_struct_type::Foo<&'b i32>`, reference has a longer lifetime than the data it references --> $DIR/regions-outlives-nominal-type-type.rs:17:9 | -LL | type Out = &'a Foo<&'b i32>; //~ ERROR reference has a longer lifetime +LL | type Out = &'a Foo<&'b i32>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime 'a as defined on the impl at 16:10 diff --git a/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr b/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr index 2485c7c3659a..8130f5de5587 100644 --- a/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/regions-struct-not-wf.stderr @@ -3,13 +3,13 @@ error[E0309]: the parameter type `T` may not live long enough | LL | impl<'a, T> Trait<'a, T> for usize { | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | type Out = &'a T; //~ ERROR `T` may not live long enough +LL | type Out = &'a T; | ^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'a T` does not outlive the data it points at --> $DIR/regions-struct-not-wf.rs:13:5 | -LL | type Out = &'a T; //~ ERROR `T` may not live long enough +LL | type Out = &'a T; | ^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough @@ -17,19 +17,19 @@ error[E0309]: the parameter type `T` may not live long enough | LL | impl<'a, T> Trait<'a, T> for u32 { | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | type Out = RefOk<'a, T>; //~ ERROR `T` may not live long enough +LL | type Out = RefOk<'a, T>; | ^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the type `T` will meet its required lifetime bounds --> $DIR/regions-struct-not-wf.rs:21:5 | -LL | type Out = RefOk<'a, T>; //~ ERROR `T` may not live long enough +LL | type Out = RefOk<'a, T>; | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0491]: in type `&'a &'b T`, reference has a longer lifetime than the data it references --> $DIR/regions-struct-not-wf.rs:25:5 | -LL | type Out = &'a &'b T; //~ ERROR reference has a longer lifetime than the data +LL | type Out = &'a &'b T; | ^^^^^^^^^^^^^^^^^^^^^ | note: the pointer is valid for the lifetime 'a as defined on the impl at 24:6 diff --git a/src/test/ui/rfc-2093-infer-outlives/self-dyn.stderr b/src/test/ui/rfc-2093-infer-outlives/self-dyn.stderr index 62b546adfc14..0be14a6956f4 100644 --- a/src/test/ui/rfc-2093-infer-outlives/self-dyn.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/self-dyn.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/self-dyn.rs:9:1 | -LL | / struct Foo<'a, 'b, A> //~ ERROR rustc_outlives +LL | / struct Foo<'a, 'b, A> LL | | { LL | | foo: Box> LL | | } diff --git a/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr b/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr index 15ff6009e5c6..9ae05dab74d5 100644 --- a/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr +++ b/src/test/ui/rfc-2093-infer-outlives/self-structs.stderr @@ -1,7 +1,7 @@ error: rustc_outlives --> $DIR/self-structs.rs:4:1 | -LL | / struct Foo<'a, 'b, T> { //~ ERROR rustc_outlives +LL | / struct Foo<'a, 'b, T> { LL | | field1: Bar<'a, 'b, T> LL | | } | |_^ diff --git a/src/test/ui/rfc-2126-crate-paths/crate-path-non-absolute.stderr b/src/test/ui/rfc-2126-crate-paths/crate-path-non-absolute.stderr index 23485f7a5599..e4c47901455c 100644 --- a/src/test/ui/rfc-2126-crate-paths/crate-path-non-absolute.stderr +++ b/src/test/ui/rfc-2126-crate-paths/crate-path-non-absolute.stderr @@ -1,13 +1,13 @@ error[E0433]: failed to resolve: `crate` in paths can only be used in start position --> $DIR/crate-path-non-absolute.rs:7:22 | -LL | let s = ::m::crate::S; //~ ERROR failed to resolve +LL | let s = ::m::crate::S; | ^^^^^ `crate` in paths can only be used in start position error[E0433]: failed to resolve: global paths cannot start with `crate` --> $DIR/crate-path-non-absolute.rs:8:20 | -LL | let s1 = ::crate::S; //~ ERROR failed to resolve +LL | let s1 = ::crate::S; | ^^^^^ global paths cannot start with `crate` error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/meta.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/meta.stderr index e9de20edb505..eb4b9dea41bd 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/meta.stderr +++ b/src/test/ui/rfc-2126-extern-absolute-paths/meta.stderr @@ -1,7 +1,7 @@ error[E0463]: can't find crate for `meta` --> $DIR/meta.rs:5:5 | -LL | use meta; //~ ERROR can't find crate for `meta` +LL | use meta; | ^^^^ can't find crate error: aborting due to previous error diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-1.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-1.stderr index 23aeb92f4871..64b920e9aa7e 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-1.stderr +++ b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-1.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `xcrate` --> $DIR/non-existent-1.rs:3:5 | -LL | use xcrate::S; //~ ERROR unresolved import `xcrate` +LL | use xcrate::S; | ^^^^^^ use of undeclared type or module `xcrate` error: aborting due to previous error diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-3.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-3.stderr index b4982d5083c6..bfce180789cb 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-3.stderr +++ b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-3.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `ycrate` --> $DIR/non-existent-3.rs:3:5 | -LL | use ycrate; //~ ERROR unresolved import `ycrate` +LL | use ycrate; | ^^^^^^ no `ycrate` external crate error: aborting due to previous error diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr index 3bea7816b306..4e3fff98e6f4 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr +++ b/src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr @@ -1,13 +1,13 @@ error: cannot import a built-in macro --> $DIR/not-whitelisted.rs:6:5 | -LL | use test; //~ ERROR cannot import a built-in macro +LL | use test; | ^^^^ error[E0432]: unresolved import `alloc` --> $DIR/not-whitelisted.rs:5:5 | -LL | use alloc; //~ ERROR unresolved import `alloc` +LL | use alloc; | ^^^^^ no `alloc` external crate error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/single-segment.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/single-segment.stderr index d32835a49f88..396a798c8204 100644 --- a/src/test/ui/rfc-2126-extern-absolute-paths/single-segment.stderr +++ b/src/test/ui/rfc-2126-extern-absolute-paths/single-segment.stderr @@ -1,19 +1,19 @@ error: crate root imports need to be explicitly named: `use crate as name;` --> $DIR/single-segment.rs:5:5 | -LL | use crate; //~ ERROR crate root imports need to be explicitly named: `use crate as name;` +LL | use crate; | ^^^^^ error: cannot glob-import all possible crates --> $DIR/single-segment.rs:6:5 | -LL | use *; //~ ERROR cannot glob-import all possible crates +LL | use *; | ^ error[E0423]: expected value, found module `xcrate` --> $DIR/single-segment.rs:9:13 | -LL | let s = ::xcrate; //~ ERROR expected value, found module `xcrate` +LL | let s = ::xcrate; | ^^^^^^^^ not a value error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc-2166-underscore-imports/basic.stderr b/src/test/ui/rfc-2166-underscore-imports/basic.stderr index 308035919260..9ca60e8e0a95 100644 --- a/src/test/ui/rfc-2166-underscore-imports/basic.stderr +++ b/src/test/ui/rfc-2166-underscore-imports/basic.stderr @@ -1,7 +1,7 @@ warning: unused import: `m::Tr1 as _` --> $DIR/basic.rs:26:9 | -LL | use m::Tr1 as _; //~ WARN unused import +LL | use m::Tr1 as _; | ^^^^^^^^^^^ | note: lint level defined here @@ -13,6 +13,6 @@ LL | #![warn(unused_imports, unused_extern_crates)] warning: unused import: `S as _` --> $DIR/basic.rs:27:9 | -LL | use S as _; //~ WARN unused import +LL | use S as _; | ^^^^^^ diff --git a/src/test/ui/rfc-2166-underscore-imports/unused-2018.stderr b/src/test/ui/rfc-2166-underscore-imports/unused-2018.stderr index 4163c2876074..861b3f1d4fd1 100644 --- a/src/test/ui/rfc-2166-underscore-imports/unused-2018.stderr +++ b/src/test/ui/rfc-2166-underscore-imports/unused-2018.stderr @@ -1,7 +1,7 @@ error: unused import: `core::any` --> $DIR/unused-2018.rs:6:9 | -LL | use core::any; //~ ERROR unused import: `core::any` +LL | use core::any; | ^^^^^^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unused_imports)] error: unused import: `core` --> $DIR/unused-2018.rs:10:9 | -LL | use core; //~ ERROR unused import: `core` +LL | use core; | ^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr index 5a730ad2be42..5f0b3a1d40b7 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.nll.stderr @@ -5,7 +5,7 @@ LL | let a = NoCopy(0); | - move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait LL | let _ = dbg!(a); | ------- value moved here -LL | let _ = dbg!(a); //~ ERROR use of moved value +LL | let _ = dbg!(a); | ^ value used here after move | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr index 5f3a6b414e04..cfc318c1cd0f 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-move-semantics.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `a` | LL | let _ = dbg!(a); | ------- value moved here -LL | let _ = dbg!(a); //~ ERROR use of moved value +LL | let _ = dbg!(a); | ^ value used here after move | = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait @@ -14,7 +14,7 @@ error[E0382]: use of moved value: `a` | LL | let _ = dbg!(a); | ------- value moved here -LL | let _ = dbg!(a); //~ ERROR use of moved value +LL | let _ = dbg!(a); | ^^^^^^^ value used here after move | = note: move occurs because `a` has type `NoCopy`, which does not implement the `Copy` trait diff --git a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr index bd41f7b34053..ecab673953d6 100644 --- a/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr +++ b/src/test/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr @@ -1,7 +1,7 @@ error[E0277]: `NotDebug` doesn't implement `std::fmt::Debug` --> $DIR/dbg-macro-requires-debug.rs:6:23 | -LL | let _: NotDebug = dbg!(NotDebug); //~ ERROR `NotDebug` doesn't implement `std::fmt::Debug` +LL | let _: NotDebug = dbg!(NotDebug); | ^^^^^^^^^^^^^^ `NotDebug` cannot be formatted using `{:?}` | = help: the trait `std::fmt::Debug` is not implemented for `NotDebug` diff --git a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr index 5aa34bca1301..b323104048f6 100644 --- a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr +++ b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr @@ -1,6 +1,6 @@ warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash --> $DIR/generic-associated-types-where.rs:1:12 | -LL | #![feature(generic_associated_types)] //~ WARN `generic_associated_types` is incomplete +LL | #![feature(generic_associated_types)] | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/rmeta.stderr b/src/test/ui/rmeta.stderr index d36b3a746e6a..d15caeb66981 100644 --- a/src/test/ui/rmeta.stderr +++ b/src/test/ui/rmeta.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `Foo` in this scope --> $DIR/rmeta.rs:7:13 | -LL | let _ = Foo; //~ ERROR cannot find value `Foo` in this scope +LL | let _ = Foo; | ^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/rmeta_meta_main.stderr b/src/test/ui/rmeta_meta_main.stderr index bed9076d84cb..347e5e97d7a0 100644 --- a/src/test/ui/rmeta_meta_main.stderr +++ b/src/test/ui/rmeta_meta_main.stderr @@ -1,7 +1,7 @@ error[E0560]: struct `rmeta_meta::Foo` has no field named `field2` --> $DIR/rmeta_meta_main.rs:13:19 | -LL | let _ = Foo { field2: 42 }; //~ ERROR struct `rmeta_meta::Foo` has no field named `field2` +LL | let _ = Foo { field2: 42 }; | ^^^^^^ help: a field with a similar name exists: `field` error: aborting due to previous error diff --git a/src/test/ui/rust-2018/async-ident-allowed.stderr b/src/test/ui/rust-2018/async-ident-allowed.stderr index 61e1facd30e5..d3e450e9be0b 100644 --- a/src/test/ui/rust-2018/async-ident-allowed.stderr +++ b/src/test/ui/rust-2018/async-ident-allowed.stderr @@ -1,7 +1,7 @@ error: `async` is a keyword in the 2018 edition --> $DIR/async-ident-allowed.rs:9:9 | -LL | let async = 3; //~ ERROR: is a keyword +LL | let async = 3; | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` | note: lint level defined here diff --git a/src/test/ui/rust-2018/async-ident.stderr b/src/test/ui/rust-2018/async-ident.stderr index b33c043c9ea2..b14953377563 100644 --- a/src/test/ui/rust-2018/async-ident.stderr +++ b/src/test/ui/rust-2018/async-ident.stderr @@ -1,7 +1,7 @@ error: `async` is a keyword in the 2018 edition --> $DIR/async-ident.rs:7:4 | -LL | fn async() {} //~ ERROR async +LL | fn async() {} | ^^^^^ help: you can use a raw identifier to stay compatible: `r#async` | note: lint level defined here diff --git a/src/test/ui/rust-2018/dyn-keyword.stderr b/src/test/ui/rust-2018/dyn-keyword.stderr index 5a3e00ab1d96..fa79df49fb66 100644 --- a/src/test/ui/rust-2018/dyn-keyword.stderr +++ b/src/test/ui/rust-2018/dyn-keyword.stderr @@ -1,7 +1,7 @@ error: `dyn` is a keyword in the 2018 edition --> $DIR/dyn-keyword.rs:8:9 | -LL | let dyn = (); //~ ERROR dyn +LL | let dyn = (); | ^^^ help: you can use a raw identifier to stay compatible: `r#dyn` | note: lint level defined here diff --git a/src/test/ui/rust-2018/dyn-trait-compatibility.stderr b/src/test/ui/rust-2018/dyn-trait-compatibility.stderr index 6be005204658..e1f099e91907 100644 --- a/src/test/ui/rust-2018/dyn-trait-compatibility.stderr +++ b/src/test/ui/rust-2018/dyn-trait-compatibility.stderr @@ -1,17 +1,17 @@ error: expected identifier, found keyword `dyn` --> $DIR/dyn-trait-compatibility.rs:4:16 | -LL | type A1 = dyn::dyn; //~ERROR expected identifier, found keyword `dyn` +LL | type A1 = dyn::dyn; | ^^^ expected identifier, found keyword help: you can escape reserved keywords to use them as identifiers | -LL | type A1 = dyn::r#dyn; //~ERROR expected identifier, found keyword `dyn` +LL | type A1 = dyn::r#dyn; | ^^^^^ error: expected identifier, found `<` --> $DIR/dyn-trait-compatibility.rs:5:14 | -LL | type A2 = dyn; //~ERROR expected identifier, found `<` +LL | type A2 = dyn; | ^ expected identifier error: aborting due to 2 previous errors diff --git a/src/test/ui/rust-2018/future-proofing-locals.stderr b/src/test/ui/rust-2018/future-proofing-locals.stderr index 413e199cd646..4d666d22afed 100644 --- a/src/test/ui/rust-2018/future-proofing-locals.stderr +++ b/src/test/ui/rust-2018/future-proofing-locals.stderr @@ -1,55 +1,55 @@ error: imports cannot refer to type parameters --> $DIR/future-proofing-locals.rs:13:9 | -LL | use T as _; //~ ERROR imports cannot refer to type parameters +LL | use T as _; | ^ error: imports cannot refer to type parameters --> $DIR/future-proofing-locals.rs:14:9 | -LL | use T::U; //~ ERROR imports cannot refer to type parameters +LL | use T::U; | ^ error: imports cannot refer to type parameters --> $DIR/future-proofing-locals.rs:15:9 | -LL | use T::*; //~ ERROR imports cannot refer to type parameters +LL | use T::*; | ^ error: imports cannot refer to type parameters --> $DIR/future-proofing-locals.rs:19:9 | -LL | use T; //~ ERROR imports cannot refer to type parameters +LL | use T; | ^ error: imports cannot refer to local variables --> $DIR/future-proofing-locals.rs:25:9 | -LL | use x as _; //~ ERROR imports cannot refer to local variables +LL | use x as _; | ^ error: imports cannot refer to local variables --> $DIR/future-proofing-locals.rs:31:9 | -LL | use x; //~ ERROR imports cannot refer to local variables +LL | use x; | ^ error: imports cannot refer to local variables --> $DIR/future-proofing-locals.rs:37:17 | -LL | use x; //~ ERROR imports cannot refer to local variables +LL | use x; | ^ error: imports cannot refer to type parameters --> $DIR/future-proofing-locals.rs:45:10 | -LL | use {T as _, x}; //~ ERROR imports cannot refer to type parameters +LL | use {T as _, x}; | ^ error: imports cannot refer to local variables --> $DIR/future-proofing-locals.rs:45:18 | -LL | use {T as _, x}; //~ ERROR imports cannot refer to type parameters +LL | use {T as _, x}; | ^ error: aborting due to 9 previous errors diff --git a/src/test/ui/rust-2018/issue-54006.stderr b/src/test/ui/rust-2018/issue-54006.stderr index 6c6d7720be2c..1978138a6887 100644 --- a/src/test/ui/rust-2018/issue-54006.stderr +++ b/src/test/ui/rust-2018/issue-54006.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `alloc` --> $DIR/issue-54006.rs:6:5 | LL | use alloc::vec; - | ^^^^^ did you mean `core::alloc`? + | ^^^^^ help: a similar path exists: `core::alloc` error: cannot determine resolution for the macro `vec` --> $DIR/issue-54006.rs:10:18 diff --git a/src/test/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr b/src/test/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr index 7f3f6ccf39e0..49aaff620d66 100644 --- a/src/test/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr +++ b/src/test/ui/rust-2018/issue-54400-unused-extern-crate-attr-span.stderr @@ -1,7 +1,7 @@ error: unused extern crate --> $DIR/issue-54400-unused-extern-crate-attr-span.rs:12:1 | -LL | / #[cfg(blandiloquence)] //~ HELP remove it +LL | / #[cfg(blandiloquence)] LL | | extern crate edition_lint_paths; | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- | |________________________________| diff --git a/src/test/ui/rust-2018/local-path-suggestions-2015.stderr b/src/test/ui/rust-2018/local-path-suggestions-2015.stderr index be642c3bcdcb..666864a18af8 100644 --- a/src/test/ui/rust-2018/local-path-suggestions-2015.stderr +++ b/src/test/ui/rust-2018/local-path-suggestions-2015.stderr @@ -1,8 +1,11 @@ error[E0432]: unresolved import `foobar` --> $DIR/local-path-suggestions-2015.rs:24:5 | -LL | use foobar::Baz; //~ ERROR unresolved import `foobar` - | ^^^^^^ did you mean `aux_baz::foobar`? +LL | use foobar::Baz; + | ^^^^^^ + | | + | unresolved import + | help: a similar path exists: `aux_baz::foobar` error: aborting due to previous error diff --git a/src/test/ui/rust-2018/local-path-suggestions-2018.stderr b/src/test/ui/rust-2018/local-path-suggestions-2018.stderr index 71c8289264ff..40f3d6bf1cf1 100644 --- a/src/test/ui/rust-2018/local-path-suggestions-2018.stderr +++ b/src/test/ui/rust-2018/local-path-suggestions-2018.stderr @@ -1,16 +1,16 @@ error[E0432]: unresolved import `foo` --> $DIR/local-path-suggestions-2018.rs:10:9 | -LL | use foo::Bar; //~ ERROR unresolved import `foo` - | ^^^ did you mean `crate::foo`? +LL | use foo::Bar; + | ^^^ help: a similar path exists: `crate::foo` | = note: `use` statements changed in Rust 2018; read more at error[E0432]: unresolved import `foobar` --> $DIR/local-path-suggestions-2018.rs:19:5 | -LL | use foobar::Baz; //~ ERROR unresolved import `foobar` - | ^^^^^^ did you mean `baz::foobar`? +LL | use foobar::Baz; + | ^^^^^^ help: a similar path exists: `baz::foobar` error: aborting due to 2 previous errors diff --git a/src/test/ui/rust-2018/macro-use-warned-against.stderr b/src/test/ui/rust-2018/macro-use-warned-against.stderr index 55213a77a2c0..c3e459606e10 100644 --- a/src/test/ui/rust-2018/macro-use-warned-against.stderr +++ b/src/test/ui/rust-2018/macro-use-warned-against.stderr @@ -1,7 +1,7 @@ warning: deprecated `#[macro_use]` directive used to import macros should be replaced at use sites with a `use` statement to import the macro instead --> $DIR/macro-use-warned-against.rs:7:1 | -LL | #[macro_use] //~ WARN should be replaced at use sites with a `use` statement +LL | #[macro_use] | ^^^^^^^^^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![warn(macro_use_extern_crate, unused)] warning: unused `#[macro_use]` import --> $DIR/macro-use-warned-against.rs:9:1 | -LL | #[macro_use] //~ WARN unused `#[macro_use]` +LL | #[macro_use] | ^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/rust-2018/suggestions-not-always-applicable.stderr b/src/test/ui/rust-2018/suggestions-not-always-applicable.stderr index 53ea9e645726..19e87b664cc9 100644 --- a/src/test/ui/rust-2018/suggestions-not-always-applicable.stderr +++ b/src/test/ui/rust-2018/suggestions-not-always-applicable.stderr @@ -1,7 +1,7 @@ warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition --> $DIR/suggestions-not-always-applicable.rs:17:5 | -LL | #[foo] //~ WARN: absolute paths must start with +LL | #[foo] | ^^^^^^ | note: lint level defined here @@ -16,7 +16,7 @@ LL | #![warn(rust_2018_compatibility)] warning: absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition --> $DIR/suggestions-not-always-applicable.rs:17:5 | -LL | #[foo] //~ WARN: absolute paths must start with +LL | #[foo] | ^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! diff --git a/src/test/ui/rust-2018/trait-import-suggestions.stderr b/src/test/ui/rust-2018/trait-import-suggestions.stderr index e4c17680c90a..e2ffeaee4b42 100644 --- a/src/test/ui/rust-2018/trait-import-suggestions.stderr +++ b/src/test/ui/rust-2018/trait-import-suggestions.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `foobar` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:22:11 | -LL | x.foobar(); //~ ERROR no method named `foobar` +LL | x.foobar(); | ^^^^^^ | = help: items from traits can only be used if the trait is in scope @@ -11,7 +11,7 @@ LL | x.foobar(); //~ ERROR no method named `foobar` error[E0599]: no method named `bar` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:28:7 | -LL | x.bar(); //~ ERROR no method named `bar` +LL | x.bar(); | ^^^ | = help: items from traits can only be used if the trait is in scope @@ -23,13 +23,13 @@ LL | use crate::foo::Bar; error[E0599]: no method named `baz` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:29:7 | -LL | x.baz(); //~ ERROR no method named `baz` +LL | x.baz(); | ^^^ error[E0599]: no function or associated item named `from_str` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:30:18 | -LL | let y = u32::from_str("33"); //~ ERROR no function or associated item named `from_str` +LL | let y = u32::from_str("33"); | -----^^^^^^^^ | | | function or associated item not found in `u32` diff --git a/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr b/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr index 4a01ba5088f6..db176876382d 100644 --- a/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr +++ b/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow-nested.stderr @@ -1,7 +1,7 @@ error[E0659]: `sub` is ambiguous (name vs any other name during import resolution) --> $DIR/block-scoped-shadow-nested.rs:16:13 | -LL | use sub::bar; //~ ERROR `sub` is ambiguous +LL | use sub::bar; | ^^^ ambiguous name | note: `sub` could refer to the module imported here diff --git a/src/test/ui/rust-2018/uniform-paths/deadlock.stderr b/src/test/ui/rust-2018/uniform-paths/deadlock.stderr index 8bbc8f33039b..b4ac15c588eb 100644 --- a/src/test/ui/rust-2018/uniform-paths/deadlock.stderr +++ b/src/test/ui/rust-2018/uniform-paths/deadlock.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import --> $DIR/deadlock.rs:4:5 | -LL | use foo::bar; //~ ERROR unresolved import +LL | use foo::bar; | ^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/rust-2018/uniform-paths/issue-54253.stderr b/src/test/ui/rust-2018/uniform-paths/issue-54253.stderr index 3d7176265a27..adde63590351 100644 --- a/src/test/ui/rust-2018/uniform-paths/issue-54253.stderr +++ b/src/test/ui/rust-2018/uniform-paths/issue-54253.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `crate::version` --> $DIR/issue-54253.rs:10:9 | -LL | use crate::version; //~ ERROR unresolved import `crate::version` +LL | use crate::version; | ^^^^^^^^^^^^^^ no `version` in the root error: aborting due to previous error diff --git a/src/test/ui/rust-2018/uniform-paths/issue-56596.stderr b/src/test/ui/rust-2018/uniform-paths/issue-56596.stderr index 293d0ec6a720..b1c0b461db4a 100644 --- a/src/test/ui/rust-2018/uniform-paths/issue-56596.stderr +++ b/src/test/ui/rust-2018/uniform-paths/issue-56596.stderr @@ -1,7 +1,7 @@ error[E0659]: `issue_56596` is ambiguous (name vs any other name during import resolution) --> $DIR/issue-56596.rs:12:5 | -LL | use issue_56596; //~ ERROR `issue_56596` is ambiguous +LL | use issue_56596; | ^^^^^^^^^^^ ambiguous name | = note: `issue_56596` could refer to an extern crate passed with `--extern` diff --git a/src/test/ui/rust-2018/uniform-paths/macro-rules.stderr b/src/test/ui/rust-2018/uniform-paths/macro-rules.stderr index 684f5fceac15..e1000e588fa0 100644 --- a/src/test/ui/rust-2018/uniform-paths/macro-rules.stderr +++ b/src/test/ui/rust-2018/uniform-paths/macro-rules.stderr @@ -1,19 +1,19 @@ error[E0364]: `legacy_macro` is private, and cannot be re-exported --> $DIR/macro-rules.rs:11:13 | -LL | pub use legacy_macro as _; //~ ERROR `legacy_macro` is private, and cannot be re-exported +LL | pub use legacy_macro as _; | ^^^^^^^^^^^^^^^^^ | note: consider marking `legacy_macro` as `pub` in the imported module --> $DIR/macro-rules.rs:11:13 | -LL | pub use legacy_macro as _; //~ ERROR `legacy_macro` is private, and cannot be re-exported +LL | pub use legacy_macro as _; | ^^^^^^^^^^^^^^^^^ error[E0659]: `legacy_macro` is ambiguous (name vs any other name during import resolution) --> $DIR/macro-rules.rs:31:13 | -LL | use legacy_macro as _; //~ ERROR `legacy_macro` is ambiguous +LL | use legacy_macro as _; | ^^^^^^^^^^^^ ambiguous name | note: `legacy_macro` could refer to the macro defined here diff --git a/src/test/ui/rust-2018/uniform-paths/prelude-fail-2.stderr b/src/test/ui/rust-2018/uniform-paths/prelude-fail-2.stderr index 40b8fcf7158e..fc6453193bc9 100644 --- a/src/test/ui/rust-2018/uniform-paths/prelude-fail-2.stderr +++ b/src/test/ui/rust-2018/uniform-paths/prelude-fail-2.stderr @@ -1,7 +1,7 @@ error: cannot use a built-in attribute through an import --> $DIR/prelude-fail-2.rs:15:3 | -LL | #[imported_inline] //~ ERROR cannot use a built-in attribute through an import +LL | #[imported_inline] | ^^^^^^^^^^^^^^^ | note: the built-in attribute imported here @@ -13,13 +13,13 @@ LL | use inline as imported_inline; error: cannot use a built-in attribute through an import --> $DIR/prelude-fail-2.rs:16:3 | -LL | #[builtin::imported_inline] //~ ERROR cannot use a built-in attribute through an import +LL | #[builtin::imported_inline] | ^^^^^^^^^^^^^^^^^^^^^^^^ error: cannot use a tool module through an import --> $DIR/prelude-fail-2.rs:17:3 | -LL | #[imported_rustfmt::skip] //~ ERROR cannot use a tool module through an import +LL | #[imported_rustfmt::skip] | ^^^^^^^^^^^^^^^^ | note: the tool module imported here @@ -31,7 +31,7 @@ LL | use rustfmt as imported_rustfmt; error: cannot use a tool module through an import --> $DIR/prelude-fail-2.rs:18:13 | -LL | #[tool_mod::imported_rustfmt::skip] //~ ERROR cannot use a tool module through an import +LL | #[tool_mod::imported_rustfmt::skip] | ^^^^^^^^^^^^^^^^ | note: the tool module imported here diff --git a/src/test/ui/rust-2018/uniform-paths/prelude-fail.stderr b/src/test/ui/rust-2018/uniform-paths/prelude-fail.stderr index fdfea416b12f..a61af699cdc3 100644 --- a/src/test/ui/rust-2018/uniform-paths/prelude-fail.stderr +++ b/src/test/ui/rust-2018/uniform-paths/prelude-fail.stderr @@ -1,13 +1,13 @@ error: cannot import a built-in macro --> $DIR/prelude-fail.rs:4:5 | -LL | use env as env_imported; //~ ERROR cannot import a built-in macro +LL | use env as env_imported; | ^^^^^^^^^^^^^^^^^^^ error[E0432]: unresolved import `rustfmt` --> $DIR/prelude-fail.rs:7:5 | -LL | use rustfmt::skip as imported_rustfmt_skip; //~ ERROR unresolved import `rustfmt` +LL | use rustfmt::skip as imported_rustfmt_skip; | ^^^^^^^ not a module `rustfmt` error: aborting due to 2 previous errors diff --git a/src/test/ui/rustc-args-required-const.stderr b/src/test/ui/rustc-args-required-const.stderr index 7a1caf3c40fe..8b302692053a 100644 --- a/src/test/ui/rustc-args-required-const.stderr +++ b/src/test/ui/rustc-args-required-const.stderr @@ -1,13 +1,13 @@ error: argument 1 is required to be a constant --> $DIR/rustc-args-required-const.rs:24:5 | -LL | foo(a); //~ ERROR: argument 1 is required to be a constant +LL | foo(a); | ^^^^^^ error: argument 2 is required to be a constant --> $DIR/rustc-args-required-const.rs:26:5 | -LL | bar(a, a); //~ ERROR: argument 2 is required to be a constant +LL | bar(a, a); | ^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/rustc-args-required-const2.stderr b/src/test/ui/rustc-args-required-const2.stderr index 005f68fa2e64..a8906ad3bc55 100644 --- a/src/test/ui/rustc-args-required-const2.stderr +++ b/src/test/ui/rustc-args-required-const2.stderr @@ -1,7 +1,7 @@ error: this function can only be invoked directly, not through a function pointer --> $DIR/rustc-args-required-const2.rs:8:13 | -LL | let a = foo; //~ ERROR: this function can only be invoked directly +LL | let a = foo; | ^^^ error: aborting due to previous error diff --git a/src/test/ui/rustc-error.stderr b/src/test/ui/rustc-error.stderr index c6b9cf77e588..dcbc0e1feb21 100644 --- a/src/test/ui/rustc-error.stderr +++ b/src/test/ui/rustc-error.stderr @@ -2,7 +2,7 @@ error: compilation successful --> $DIR/rustc-error.rs:4:1 | LL | / fn main() { -LL | | //~^ ERROR compilation successful +LL | | LL | | } | |_^ diff --git a/src/test/ui/safe-extern-statics-mut.stderr b/src/test/ui/safe-extern-statics-mut.stderr index 4eecce6d3d31..388038834144 100644 --- a/src/test/ui/safe-extern-statics-mut.stderr +++ b/src/test/ui/safe-extern-statics-mut.stderr @@ -1,7 +1,7 @@ error[E0133]: use of mutable static is unsafe and requires unsafe function or block --> $DIR/safe-extern-statics-mut.rs:11:13 | -LL | let b = B; //~ ERROR use of mutable static is unsafe +LL | let b = B; | ^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior @@ -9,7 +9,7 @@ LL | let b = B; //~ ERROR use of mutable static is unsafe error[E0133]: use of mutable static is unsafe and requires unsafe function or block --> $DIR/safe-extern-statics-mut.rs:12:14 | -LL | let rb = &B; //~ ERROR use of mutable static is unsafe +LL | let rb = &B; | ^^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior @@ -17,7 +17,7 @@ LL | let rb = &B; //~ ERROR use of mutable static is unsafe error[E0133]: use of mutable static is unsafe and requires unsafe function or block --> $DIR/safe-extern-statics-mut.rs:13:14 | -LL | let xb = XB; //~ ERROR use of mutable static is unsafe +LL | let xb = XB; | ^^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior @@ -25,7 +25,7 @@ LL | let xb = XB; //~ ERROR use of mutable static is unsafe error[E0133]: use of mutable static is unsafe and requires unsafe function or block --> $DIR/safe-extern-statics-mut.rs:14:15 | -LL | let xrb = &XB; //~ ERROR use of mutable static is unsafe +LL | let xrb = &XB; | ^^^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior diff --git a/src/test/ui/safe-extern-statics.stderr b/src/test/ui/safe-extern-statics.stderr index 11ade798ba47..86976a2c932d 100644 --- a/src/test/ui/safe-extern-statics.stderr +++ b/src/test/ui/safe-extern-statics.stderr @@ -1,7 +1,7 @@ error: use of extern static is unsafe and requires unsafe function or block (error E0133) --> $DIR/safe-extern-statics.rs:13:13 | -LL | let a = A; //~ ERROR use of extern static is unsafe +LL | let a = A; | ^ | = note: #[deny(safe_extern_statics)] on by default @@ -12,7 +12,7 @@ LL | let a = A; //~ ERROR use of extern static is unsafe error: use of extern static is unsafe and requires unsafe function or block (error E0133) --> $DIR/safe-extern-statics.rs:15:14 | -LL | let ra = &A; //~ ERROR use of extern static is unsafe +LL | let ra = &A; | ^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -22,7 +22,7 @@ LL | let ra = &A; //~ ERROR use of extern static is unsafe error: use of extern static is unsafe and requires unsafe function or block (error E0133) --> $DIR/safe-extern-statics.rs:17:14 | -LL | let xa = XA; //~ ERROR use of extern static is unsafe +LL | let xa = XA; | ^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! @@ -32,7 +32,7 @@ LL | let xa = XA; //~ ERROR use of extern static is unsafe error: use of extern static is unsafe and requires unsafe function or block (error E0133) --> $DIR/safe-extern-statics.rs:19:15 | -LL | let xra = &XA; //~ ERROR use of extern static is unsafe +LL | let xra = &XA; | ^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! diff --git a/src/test/ui/self/self-infer.stderr b/src/test/ui/self/self-infer.stderr index 4b8fd7037795..f91cfe5eb621 100644 --- a/src/test/ui/self/self-infer.stderr +++ b/src/test/ui/self/self-infer.stderr @@ -1,13 +1,13 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/self-infer.rs:4:16 | -LL | fn f(self: _) {} //~ERROR the type placeholder `_` is not allowed within types on item sig +LL | fn f(self: _) {} | ^ not allowed in type signatures error[E0121]: the type placeholder `_` is not allowed within types on item signatures --> $DIR/self-infer.rs:5:17 | -LL | fn g(self: &_) {} //~ERROR the type placeholder `_` is not allowed within types on item sig +LL | fn g(self: &_) {} | ^ not allowed in type signatures error: aborting due to 2 previous errors diff --git a/src/test/ui/self/self-vs-path-ambiguity.stderr b/src/test/ui/self/self-vs-path-ambiguity.stderr index 954d240e71b6..5ce6a81bfcfd 100644 --- a/src/test/ui/self/self-vs-path-ambiguity.stderr +++ b/src/test/ui/self/self-vs-path-ambiguity.stderr @@ -1,7 +1,7 @@ error: unexpected lifetime `'a` in pattern --> $DIR/self-vs-path-ambiguity.rs:9:11 | -LL | fn i(&'a self::S: &S) {} //~ ERROR unexpected lifetime `'a` in pattern +LL | fn i(&'a self::S: &S) {} | ^^ unexpected lifetime error: aborting due to previous error diff --git a/src/test/ui/self/self_type_keyword-2.stderr b/src/test/ui/self/self_type_keyword-2.stderr index 55c8796e158f..eedec6896f47 100644 --- a/src/test/ui/self/self_type_keyword-2.stderr +++ b/src/test/ui/self/self_type_keyword-2.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `self::Self` --> $DIR/self_type_keyword-2.rs:1:5 | -LL | use self::Self as Foo; //~ ERROR unresolved import `self::Self` +LL | use self::Self as Foo; | ^^^^^^^^^^^^^^^^^ no `Self` in the root error[E0531]: cannot find unit struct/variant or constant `Self` in this scope diff --git a/src/test/ui/seq-args.stderr b/src/test/ui/seq-args.stderr index 81ba1abcd6dc..2e7d901640e8 100644 --- a/src/test/ui/seq-args.stderr +++ b/src/test/ui/seq-args.stderr @@ -1,13 +1,13 @@ error[E0107]: wrong number of type arguments: expected 0, found 1 --> $DIR/seq-args.rs:4:13 | -LL | impl Seq for Vec { //~ ERROR wrong number of type arguments +LL | impl Seq for Vec { | ^ unexpected type argument error[E0107]: wrong number of type arguments: expected 0, found 1 --> $DIR/seq-args.rs:7:10 | -LL | impl Seq for u32 { //~ ERROR wrong number of type arguments +LL | impl Seq for u32 { | ^^^^ unexpected type argument error: aborting due to 2 previous errors diff --git a/src/test/ui/shadowed/shadowed-trait-methods.stderr b/src/test/ui/shadowed/shadowed-trait-methods.stderr index 38b604af2900..e05da17983f8 100644 --- a/src/test/ui/shadowed/shadowed-trait-methods.stderr +++ b/src/test/ui/shadowed/shadowed-trait-methods.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `f` found for type `()` in the current scope --> $DIR/shadowed-trait-methods.rs:13:8 | -LL | ().f() //~ ERROR no method +LL | ().f() | ^ | = help: items from traits can only be used if the trait is in scope diff --git a/src/test/ui/shadowed/shadowed-use-visibility.stderr b/src/test/ui/shadowed/shadowed-use-visibility.stderr index 60e474a845fe..7c66fdf60b1d 100644 --- a/src/test/ui/shadowed/shadowed-use-visibility.stderr +++ b/src/test/ui/shadowed/shadowed-use-visibility.stderr @@ -1,13 +1,13 @@ error[E0603]: module `bar` is private --> $DIR/shadowed-use-visibility.rs:9:14 | -LL | use foo::bar::f as g; //~ ERROR module `bar` is private +LL | use foo::bar::f as g; | ^^^ error[E0603]: module `f` is private --> $DIR/shadowed-use-visibility.rs:15:10 | -LL | use bar::f::f; //~ ERROR module `f` is private +LL | use bar::f::f; | ^ error: aborting due to 2 previous errors diff --git a/src/test/ui/shadowed/shadowing-in-the-same-pattern.stderr b/src/test/ui/shadowed/shadowing-in-the-same-pattern.stderr index 5d0fc912d95c..71197efcaba5 100644 --- a/src/test/ui/shadowed/shadowing-in-the-same-pattern.stderr +++ b/src/test/ui/shadowed/shadowing-in-the-same-pattern.stderr @@ -1,13 +1,13 @@ error[E0416]: identifier `a` is bound more than once in the same pattern --> $DIR/shadowing-in-the-same-pattern.rs:3:10 | -LL | fn f((a, a): (isize, isize)) {} //~ ERROR identifier `a` is bound more than once +LL | fn f((a, a): (isize, isize)) {} | ^ used in a pattern more than once error[E0416]: identifier `a` is bound more than once in the same pattern --> $DIR/shadowing-in-the-same-pattern.rs:6:13 | -LL | let (a, a) = (1, 1); //~ ERROR identifier `a` is bound more than once +LL | let (a, a) = (1, 1); | ^ used in a pattern more than once error: aborting due to 2 previous errors diff --git a/src/test/ui/simd-type.stderr b/src/test/ui/simd-type.stderr index 5e309cea6ef1..027afcb981a0 100644 --- a/src/test/ui/simd-type.stderr +++ b/src/test/ui/simd-type.stderr @@ -1,19 +1,19 @@ error[E0075]: SIMD vector cannot be empty --> $DIR/simd-type.rs:5:1 | -LL | struct empty; //~ ERROR SIMD vector cannot be empty +LL | struct empty; | ^^^^^^^^^^^^^ error[E0076]: SIMD vector should be homogeneous --> $DIR/simd-type.rs:8:1 | -LL | struct i64f64(i64, f64); //~ ERROR SIMD vector should be homogeneous +LL | struct i64f64(i64, f64); | ^^^^^^^^^^^^^^^^^^^^^^^^ SIMD elements must have the same type error[E0077]: SIMD vector element type should be machine type --> $DIR/simd-type.rs:11:1 | -LL | struct int4(isize, isize, isize, isize); //~ ERROR SIMD vector element type should be machine type +LL | struct int4(isize, isize, isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/similar-tokens.stderr b/src/test/ui/similar-tokens.stderr index 898c3a0aa95c..3113d4a872d8 100644 --- a/src/test/ui/similar-tokens.stderr +++ b/src/test/ui/similar-tokens.stderr @@ -1,7 +1,7 @@ error: expected one of `,`, `::`, `as`, or `}`, found `.` --> $DIR/similar-tokens.rs:7:10 | -LL | use x::{A. B}; //~ ERROR expected one of `,`, `::`, `as`, or `}`, found `.` +LL | use x::{A. B}; | ^ expected one of `,`, `::`, `as`, or `}` here error: aborting due to previous error diff --git a/src/test/ui/single-primitive-inherent-impl.stderr b/src/test/ui/single-primitive-inherent-impl.stderr index 21bbbe693466..d357afa3b384 100644 --- a/src/test/ui/single-primitive-inherent-impl.stderr +++ b/src/test/ui/single-primitive-inherent-impl.stderr @@ -2,7 +2,7 @@ error[E0390]: only a single inherent implementation marked with `#[lang = "str"] --> $DIR/single-primitive-inherent-impl.rs:11:1 | LL | / impl str { -LL | | //~^ error: only a single inherent implementation marked with `#[lang = "str"]` is allowed for the `str` primitive +LL | | LL | | } | |_^ | @@ -10,7 +10,7 @@ help: consider using a trait to implement these methods --> $DIR/single-primitive-inherent-impl.rs:11:1 | LL | / impl str { -LL | | //~^ error: only a single inherent implementation marked with `#[lang = "str"]` is allowed for the `str` primitive +LL | | LL | | } | |_^ diff --git a/src/test/ui/single-use-lifetime/fn-types.stderr b/src/test/ui/single-use-lifetime/fn-types.stderr index 7e23d75c4e58..bec24be07af6 100644 --- a/src/test/ui/single-use-lifetime/fn-types.stderr +++ b/src/test/ui/single-use-lifetime/fn-types.stderr @@ -1,7 +1,7 @@ error: lifetime parameter `'a` only used once --> $DIR/fn-types.rs:9:10 | -LL | a: for<'a> fn(&'a u32), //~ ERROR `'a` only used once +LL | a: for<'a> fn(&'a u32), | ^^ -- ...is used only here | | | this lifetime... diff --git a/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr b/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr index 0199074ad64d..4bf08534b8c4 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-fn-argument.stderr @@ -1,7 +1,7 @@ error: lifetime parameter `'a` only used once --> $DIR/one-use-in-fn-argument.rs:8:6 | -LL | fn a<'a>(x: &'a u32) { //~ ERROR `'a` only used once +LL | fn a<'a>(x: &'a u32) { | ^^ -- ...is used only here | | | this lifetime... @@ -13,7 +13,7 @@ LL | #![deny(single_use_lifetimes)] | ^^^^^^^^^^^^^^^^^^^^ help: elide the single-use lifetime | -LL | fn a(x: &u32) { //~ ERROR `'a` only used once +LL | fn a(x: &u32) { | -- -- error: aborting due to previous error diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr b/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr index 094894bf2d1e..8115a1e64011 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-inherent-impl-header.stderr @@ -1,7 +1,7 @@ error: lifetime parameter `'f` only used once --> $DIR/one-use-in-inherent-impl-header.rs:12:6 | -LL | impl<'f> Foo<'f> { //~ ERROR `'f` only used once +LL | impl<'f> Foo<'f> { | ^^ -- ...is used only here | | | this lifetime... diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr index 5bd4efb6bb1e..48bd9f19126b 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-argument.stderr @@ -1,7 +1,7 @@ error: lifetime parameter `'a` only used once --> $DIR/one-use-in-inherent-method-argument.rs:12:19 | -LL | fn inherent_a<'a>(&self, data: &'a u32) { //~ ERROR `'a` only used once +LL | fn inherent_a<'a>(&self, data: &'a u32) { | ^^ -- ...is used only here | | | this lifetime... @@ -13,13 +13,13 @@ LL | #![deny(single_use_lifetimes)] | ^^^^^^^^^^^^^^^^^^^^ help: elide the single-use lifetime | -LL | fn inherent_a(&self, data: &u32) { //~ ERROR `'a` only used once +LL | fn inherent_a(&self, data: &u32) { | -- -- error: lifetime parameter `'f` only used once --> $DIR/one-use-in-inherent-method-argument.rs:11:6 | -LL | impl<'f> Foo<'f> { //~ ERROR `'f` only used once +LL | impl<'f> Foo<'f> { | ^^ -- ...is used only here | | | this lifetime... diff --git a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr index f0e4ac411c2b..9c93da462715 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-inherent-method-return.stderr @@ -1,7 +1,7 @@ error: lifetime parameter `'f` only used once --> $DIR/one-use-in-inherent-method-return.rs:12:6 | -LL | impl<'f> Foo<'f> { //~ ERROR `'f` only used once +LL | impl<'f> Foo<'f> { | ^^ -- ...is used only here | | | this lifetime... diff --git a/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr b/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr index 7d3fc82abf40..047e0591e4b9 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr +++ b/src/test/ui/single-use-lifetime/one-use-in-trait-method-argument.stderr @@ -1,7 +1,7 @@ error: lifetime parameter `'g` only used once --> $DIR/one-use-in-trait-method-argument.rs:15:13 | -LL | fn next<'g>(&'g mut self) -> Option { //~ ERROR `'g` only used once +LL | fn next<'g>(&'g mut self) -> Option { | ^^ -- ...is used only here | | | this lifetime... @@ -13,7 +13,7 @@ LL | #![deny(single_use_lifetimes)] | ^^^^^^^^^^^^^^^^^^^^ help: elide the single-use lifetime | -LL | fn next(&mut self) -> Option { //~ ERROR `'g` only used once +LL | fn next(&mut self) -> Option { | ---- error: aborting due to previous error diff --git a/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr b/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr index 7a1af1323d8d..6f0ba02b5067 100644 --- a/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr +++ b/src/test/ui/single-use-lifetime/two-uses-in-inherent-method-argument-and-return.stderr @@ -1,7 +1,7 @@ error: lifetime parameter `'f` only used once --> $DIR/two-uses-in-inherent-method-argument-and-return.rs:12:6 | -LL | impl<'f> Foo<'f> { //~ ERROR `'f` only used once +LL | impl<'f> Foo<'f> { | ^^ -- ...is used only here | | | this lifetime... diff --git a/src/test/ui/single-use-lifetime/zero-uses-in-impl.stderr b/src/test/ui/single-use-lifetime/zero-uses-in-impl.stderr index 3f9d907ade67..650a9b4600ea 100644 --- a/src/test/ui/single-use-lifetime/zero-uses-in-impl.stderr +++ b/src/test/ui/single-use-lifetime/zero-uses-in-impl.stderr @@ -1,7 +1,7 @@ error: lifetime parameter `'a` never used --> $DIR/zero-uses-in-impl.rs:8:6 | -LL | impl<'a> Foo {} //~ ERROR `'a` never used +LL | impl<'a> Foo {} | -^^- help: elide the unused lifetime | note: lint level defined here diff --git a/src/test/ui/slice-2.stderr b/src/test/ui/slice-2.stderr index ef0eeb7a8da3..561feb90f0a5 100644 --- a/src/test/ui/slice-2.stderr +++ b/src/test/ui/slice-2.stderr @@ -1,25 +1,25 @@ error[E0608]: cannot index into a value of type `Foo` --> $DIR/slice-2.rs:7:6 | -LL | &x[..]; //~ ERROR cannot index into a value of type `Foo` +LL | &x[..]; | ^^^^^ error[E0608]: cannot index into a value of type `Foo` --> $DIR/slice-2.rs:8:6 | -LL | &x[Foo..]; //~ ERROR cannot index into a value of type `Foo` +LL | &x[Foo..]; | ^^^^^^^^ error[E0608]: cannot index into a value of type `Foo` --> $DIR/slice-2.rs:9:6 | -LL | &x[..Foo]; //~ ERROR cannot index into a value of type `Foo` +LL | &x[..Foo]; | ^^^^^^^^ error[E0608]: cannot index into a value of type `Foo` --> $DIR/slice-2.rs:10:6 | -LL | &x[Foo..Foo]; //~ ERROR cannot index into a value of type `Foo` +LL | &x[Foo..Foo]; | ^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/slice-mut-2.nll.stderr b/src/test/ui/slice-mut-2.nll.stderr index eeef23e694b7..bad0268772b7 100644 --- a/src/test/ui/slice-mut-2.nll.stderr +++ b/src/test/ui/slice-mut-2.nll.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference LL | let x: &[isize] = &[1, 2, 3, 4, 5]; | ---------------- help: consider changing this to be a mutable reference: `&mut [1, 2, 3, 4, 5]` ... -LL | let _ = &mut x[2..4]; //~ERROR cannot borrow immutable borrowed content `*x` as mutable +LL | let _ = &mut x[2..4]; | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to previous error diff --git a/src/test/ui/slice-mut-2.stderr b/src/test/ui/slice-mut-2.stderr index 07a8bd7699ec..78dbfa56d45d 100644 --- a/src/test/ui/slice-mut-2.stderr +++ b/src/test/ui/slice-mut-2.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow immutable borrowed content `*x` as mutable --> $DIR/slice-mut-2.rs:7:18 | -LL | let _ = &mut x[2..4]; //~ERROR cannot borrow immutable borrowed content `*x` as mutable +LL | let _ = &mut x[2..4]; | ^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/span/E0057.stderr b/src/test/ui/span/E0057.stderr index 5906a05c32c9..6b5890cac36c 100644 --- a/src/test/ui/span/E0057.stderr +++ b/src/test/ui/span/E0057.stderr @@ -1,13 +1,13 @@ error[E0057]: this function takes 1 parameter but 0 parameters were supplied --> $DIR/E0057.rs:3:13 | -LL | let a = f(); //~ ERROR E0057 +LL | let a = f(); | ^^^ expected 1 parameter error[E0057]: this function takes 1 parameter but 2 parameters were supplied --> $DIR/E0057.rs:5:13 | -LL | let c = f(2, 3); //~ ERROR E0057 +LL | let c = f(2, 3); | ^^^^^^^ expected 1 parameter error: aborting due to 2 previous errors diff --git a/src/test/ui/span/E0072.stderr b/src/test/ui/span/E0072.stderr index 4cb9eb308022..d4a5e7400d2a 100644 --- a/src/test/ui/span/E0072.stderr +++ b/src/test/ui/span/E0072.stderr @@ -1,7 +1,7 @@ error[E0072]: recursive type `ListNode` has infinite size --> $DIR/E0072.rs:1:1 | -LL | struct ListNode { //~ ERROR has infinite size +LL | struct ListNode { | ^^^^^^^^^^^^^^^ recursive type has infinite size LL | head: u8, LL | tail: Option, diff --git a/src/test/ui/span/E0204.stderr b/src/test/ui/span/E0204.stderr index acb7cd2a557d..5a981a4a6e48 100644 --- a/src/test/ui/span/E0204.stderr +++ b/src/test/ui/span/E0204.stderr @@ -4,13 +4,13 @@ error[E0204]: the trait `Copy` may not be implemented for this type LL | foo: Vec, | ------------- this field does not implement `Copy` ... -LL | impl Copy for Foo { } //~ ERROR may not be implemented for this type +LL | impl Copy for Foo { } | ^^^^ error[E0204]: the trait `Copy` may not be implemented for this type --> $DIR/E0204.rs:7:10 | -LL | #[derive(Copy)] //~ ERROR may not be implemented for this type +LL | #[derive(Copy)] | ^^^^ LL | struct Foo2<'a> { LL | ty: &'a mut bool, @@ -22,13 +22,13 @@ error[E0204]: the trait `Copy` may not be implemented for this type LL | Bar { x: Vec }, | ----------- this field does not implement `Copy` ... -LL | impl Copy for EFoo { } //~ ERROR may not be implemented for this type +LL | impl Copy for EFoo { } | ^^^^ error[E0204]: the trait `Copy` may not be implemented for this type --> $DIR/E0204.rs:19:10 | -LL | #[derive(Copy)] //~ ERROR may not be implemented for this type +LL | #[derive(Copy)] | ^^^^ LL | enum EFoo2<'a> { LL | Bar(&'a mut bool), diff --git a/src/test/ui/span/E0535.stderr b/src/test/ui/span/E0535.stderr index 8502776eb168..f52c3f9f2c04 100644 --- a/src/test/ui/span/E0535.stderr +++ b/src/test/ui/span/E0535.stderr @@ -1,7 +1,7 @@ error[E0535]: invalid argument --> $DIR/E0535.rs:1:10 | -LL | #[inline(unknown)] //~ ERROR E0535 +LL | #[inline(unknown)] | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/span/E0536.stderr b/src/test/ui/span/E0536.stderr index 18e2104f7ad8..820b0d7441b4 100644 --- a/src/test/ui/span/E0536.stderr +++ b/src/test/ui/span/E0536.stderr @@ -1,7 +1,7 @@ error[E0536]: expected 1 cfg-pattern --> $DIR/E0536.rs:1:7 | -LL | #[cfg(not())] //~ ERROR E0536 +LL | #[cfg(not())] | ^^^^^ error: aborting due to previous error diff --git a/src/test/ui/span/E0537.stderr b/src/test/ui/span/E0537.stderr index 53e8637ea302..5478c3fbcdda 100644 --- a/src/test/ui/span/E0537.stderr +++ b/src/test/ui/span/E0537.stderr @@ -1,7 +1,7 @@ error[E0537]: invalid predicate `unknown` --> $DIR/E0537.rs:1:7 | -LL | #[cfg(unknown())] //~ ERROR E0537 +LL | #[cfg(unknown())] | ^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr index 0aa44fa3a3ae..0a9bc3ac51c6 100644 --- a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr +++ b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | fn deref_mut_field1(x: Own) { | - help: consider changing this to be mutable: `mut x` -LL | let __isize = &mut x.y; //~ ERROR cannot borrow +LL | let __isize = &mut x.y; | ^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference @@ -11,7 +11,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference | LL | fn deref_extend_mut_field1(x: &Own) -> &mut isize { | ----------- help: consider changing this to be a mutable reference: `&mut Own` -LL | &mut x.y //~ ERROR cannot borrow +LL | &mut x.y | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0499]: cannot borrow `*x` as mutable more than once at a time @@ -19,7 +19,7 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time | LL | let _x = &mut x.x; | - first mutable borrow occurs here -LL | let _y = &mut x.y; //~ ERROR cannot borrow +LL | let _y = &mut x.y; | ^ second mutable borrow occurs here LL | use_mut(_x); | -- first borrow later used here @@ -29,7 +29,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | fn assign_field1<'a>(x: Own) { | - help: consider changing this to be mutable: `mut x` -LL | x.y = 3; //~ ERROR cannot borrow +LL | x.y = 3; | ^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference @@ -37,7 +37,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference | LL | fn assign_field2<'a>(x: &'a Own) { | -------------- help: consider changing this to be a mutable reference: `&'a mut Own` -LL | x.y = 3; //~ ERROR cannot borrow +LL | x.y = 3; | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0499]: cannot borrow `*x` as mutable more than once at a time @@ -45,7 +45,7 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time | LL | let _p: &mut Point = &mut **x; | -- first mutable borrow occurs here -LL | x.y = 3; //~ ERROR cannot borrow +LL | x.y = 3; | ^ second mutable borrow occurs here LL | use_mut(_p); | -- first borrow later used here @@ -55,7 +55,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | fn deref_mut_method1(x: Own) { | - help: consider changing this to be mutable: `mut x` -LL | x.set(0, 0); //~ ERROR cannot borrow +LL | x.set(0, 0); | ^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference @@ -63,7 +63,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference | LL | fn deref_extend_mut_method1(x: &Own) -> &mut isize { | ----------- help: consider changing this to be a mutable reference: `&mut Own` -LL | x.y_mut() //~ ERROR cannot borrow +LL | x.y_mut() | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable @@ -71,7 +71,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | fn assign_method1<'a>(x: Own) { | - help: consider changing this to be mutable: `mut x` -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference @@ -79,7 +79,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference | LL | fn assign_method2<'a>(x: &'a Own) { | -------------- help: consider changing this to be a mutable reference: `&'a mut Own` -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to 10 previous errors diff --git a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr index e0524be6b0c4..63baa7c8cb52 100644 --- a/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr +++ b/src/test/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable argument `x` as mutable | LL | fn deref_mut_field1(x: Own) { | - help: make this binding mutable: `mut x` -LL | let __isize = &mut x.y; //~ ERROR cannot borrow +LL | let __isize = &mut x.y; | ^ cannot borrow mutably error[E0596]: cannot borrow immutable borrowed content `*x` as mutable @@ -11,7 +11,7 @@ error[E0596]: cannot borrow immutable borrowed content `*x` as mutable | LL | fn deref_extend_mut_field1(x: &Own) -> &mut isize { | ----------- use `&mut Own` here to make mutable -LL | &mut x.y //~ ERROR cannot borrow +LL | &mut x.y | ^ cannot borrow as mutable error[E0499]: cannot borrow `*x` as mutable more than once at a time @@ -19,7 +19,7 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time | LL | let _x = &mut x.x; | - first mutable borrow occurs here -LL | let _y = &mut x.y; //~ ERROR cannot borrow +LL | let _y = &mut x.y; | ^ second mutable borrow occurs here LL | use_mut(_x); LL | } @@ -30,7 +30,7 @@ error[E0596]: cannot borrow immutable argument `x` as mutable | LL | fn assign_field1<'a>(x: Own) { | - help: make this binding mutable: `mut x` -LL | x.y = 3; //~ ERROR cannot borrow +LL | x.y = 3; | ^ cannot borrow mutably error[E0596]: cannot borrow immutable borrowed content `*x` as mutable @@ -38,7 +38,7 @@ error[E0596]: cannot borrow immutable borrowed content `*x` as mutable | LL | fn assign_field2<'a>(x: &'a Own) { | -------------- use `&'a mut Own` here to make mutable -LL | x.y = 3; //~ ERROR cannot borrow +LL | x.y = 3; | ^ cannot borrow as mutable error[E0499]: cannot borrow `*x` as mutable more than once at a time @@ -46,7 +46,7 @@ error[E0499]: cannot borrow `*x` as mutable more than once at a time | LL | let _p: &mut Point = &mut **x; | -- first mutable borrow occurs here -LL | x.y = 3; //~ ERROR cannot borrow +LL | x.y = 3; | ^ second mutable borrow occurs here LL | use_mut(_p); LL | } @@ -57,7 +57,7 @@ error[E0596]: cannot borrow immutable argument `x` as mutable | LL | fn deref_mut_method1(x: Own) { | - help: make this binding mutable: `mut x` -LL | x.set(0, 0); //~ ERROR cannot borrow +LL | x.set(0, 0); | ^ cannot borrow mutably error[E0596]: cannot borrow immutable borrowed content `*x` as mutable @@ -65,7 +65,7 @@ error[E0596]: cannot borrow immutable borrowed content `*x` as mutable | LL | fn deref_extend_mut_method1(x: &Own) -> &mut isize { | ----------- use `&mut Own` here to make mutable -LL | x.y_mut() //~ ERROR cannot borrow +LL | x.y_mut() | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable argument `x` as mutable @@ -73,7 +73,7 @@ error[E0596]: cannot borrow immutable argument `x` as mutable | LL | fn assign_method1<'a>(x: Own) { | - help: make this binding mutable: `mut x` -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ cannot borrow mutably error[E0596]: cannot borrow immutable borrowed content `*x` as mutable @@ -81,7 +81,7 @@ error[E0596]: cannot borrow immutable borrowed content `*x` as mutable | LL | fn assign_method2<'a>(x: &'a Own) { | -------------- use `&'a mut Own` here to make mutable -LL | *x.y_mut() = 3; //~ ERROR cannot borrow +LL | *x.y_mut() = 3; | ^ cannot borrow as mutable error: aborting due to 10 previous errors diff --git a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.nll.stderr b/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.nll.stderr index ef80e4bc3d64..3ebfba7e4deb 100644 --- a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.nll.stderr +++ b/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | fn deref_mut1(x: Own) { | - help: consider changing this to be mutable: `mut x` -LL | let __isize = &mut *x; //~ ERROR cannot borrow +LL | let __isize = &mut *x; | ^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference @@ -11,7 +11,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference | LL | fn deref_extend_mut1<'a>(x: &'a Own) -> &'a mut isize { | -------------- help: consider changing this to be a mutable reference: `&'a mut Own` -LL | &mut **x //~ ERROR cannot borrow +LL | &mut **x | ^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable @@ -19,7 +19,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | fn assign1<'a>(x: Own) { | - help: consider changing this to be mutable: `mut x` -LL | *x = 3; //~ ERROR cannot borrow +LL | *x = 3; | ^ cannot borrow as mutable error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference @@ -27,7 +27,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference | LL | fn assign2<'a>(x: &'a Own) { | -------------- help: consider changing this to be a mutable reference: `&'a mut Own` -LL | **x = 3; //~ ERROR cannot borrow +LL | **x = 3; | ^^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to 4 previous errors diff --git a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.stderr b/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.stderr index 46d11065a86e..77f3982b2b41 100644 --- a/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.stderr +++ b/src/test/ui/span/borrowck-borrow-overloaded-deref-mut.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable argument `x` as mutable | LL | fn deref_mut1(x: Own) { | - help: make this binding mutable: `mut x` -LL | let __isize = &mut *x; //~ ERROR cannot borrow +LL | let __isize = &mut *x; | ^ cannot borrow mutably error[E0596]: cannot borrow immutable borrowed content `*x` as mutable @@ -11,7 +11,7 @@ error[E0596]: cannot borrow immutable borrowed content `*x` as mutable | LL | fn deref_extend_mut1<'a>(x: &'a Own) -> &'a mut isize { | -------------- use `&'a mut Own` here to make mutable -LL | &mut **x //~ ERROR cannot borrow +LL | &mut **x | ^^ cannot borrow as mutable error[E0596]: cannot borrow immutable argument `x` as mutable @@ -19,7 +19,7 @@ error[E0596]: cannot borrow immutable argument `x` as mutable | LL | fn assign1<'a>(x: Own) { | - help: make this binding mutable: `mut x` -LL | *x = 3; //~ ERROR cannot borrow +LL | *x = 3; | ^ cannot borrow mutably error[E0596]: cannot borrow immutable borrowed content `*x` as mutable @@ -27,7 +27,7 @@ error[E0596]: cannot borrow immutable borrowed content `*x` as mutable | LL | fn assign2<'a>(x: &'a Own) { | -------------- use `&'a mut Own` here to make mutable -LL | **x = 3; //~ ERROR cannot borrow +LL | **x = 3; | ^^ cannot borrow as mutable error: aborting due to 4 previous errors diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr index e752a467edcf..80dc3ef2f80f 100644 --- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr +++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr @@ -6,7 +6,7 @@ LL | f(Box::new(|| { | | | first mutable borrow occurs here | first borrow later used by call -LL | //~^ ERROR: cannot borrow `f` as mutable more than once +LL | LL | f((Box::new(|| {}))) | - second borrow occurs due to use of `f` in closure diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr index d81d402fce73..6c8f477e3106 100644 --- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr +++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.stderr @@ -5,7 +5,7 @@ LL | f(Box::new(|| { | - ^^ second mutable borrow occurs here | | | first mutable borrow occurs here -LL | //~^ ERROR: cannot borrow `f` as mutable more than once +LL | LL | f((Box::new(|| {}))) | - borrow occurs due to use of `f` in closure LL | })); diff --git a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.nll.stderr b/src/test/ui/span/borrowck-call-method-from-mut-aliasable.nll.stderr index 16c482b575aa..6b5e0779e5fa 100644 --- a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.nll.stderr +++ b/src/test/ui/span/borrowck-call-method-from-mut-aliasable.nll.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference LL | fn b(x: &Foo) { | ---- help: consider changing this to be a mutable reference: `&mut Foo` LL | x.f(); -LL | x.h(); //~ ERROR cannot borrow +LL | x.h(); | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to previous error diff --git a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.stderr b/src/test/ui/span/borrowck-call-method-from-mut-aliasable.stderr index 4875e27ef455..440c5c9c7c9d 100644 --- a/src/test/ui/span/borrowck-call-method-from-mut-aliasable.stderr +++ b/src/test/ui/span/borrowck-call-method-from-mut-aliasable.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable borrowed content `*x` as mutable LL | fn b(x: &Foo) { | ---- use `&mut Foo` here to make mutable LL | x.f(); -LL | x.h(); //~ ERROR cannot borrow +LL | x.h(); | ^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/span/borrowck-object-mutability.nll.stderr b/src/test/ui/span/borrowck-object-mutability.nll.stderr index 1a5802e98114..fe6014cd5ad8 100644 --- a/src/test/ui/span/borrowck-object-mutability.nll.stderr +++ b/src/test/ui/span/borrowck-object-mutability.nll.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference LL | fn borrowed_receiver(x: &Foo) { | ---- help: consider changing this to be a mutable reference: `&mut dyn Foo` LL | x.borrowed(); -LL | x.borrowed_mut(); //~ ERROR cannot borrow +LL | x.borrowed_mut(); | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable @@ -13,7 +13,7 @@ error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable LL | fn owned_receiver(x: Box) { | - help: consider changing this to be mutable: `mut x` LL | x.borrowed(); -LL | x.borrowed_mut(); //~ ERROR cannot borrow +LL | x.borrowed_mut(); | ^ cannot borrow as mutable error: aborting due to 2 previous errors diff --git a/src/test/ui/span/borrowck-object-mutability.stderr b/src/test/ui/span/borrowck-object-mutability.stderr index e846331dc0b8..073a70e36106 100644 --- a/src/test/ui/span/borrowck-object-mutability.stderr +++ b/src/test/ui/span/borrowck-object-mutability.stderr @@ -4,7 +4,7 @@ error[E0596]: cannot borrow immutable borrowed content `*x` as mutable LL | fn borrowed_receiver(x: &Foo) { | ---- use `&mut Foo` here to make mutable LL | x.borrowed(); -LL | x.borrowed_mut(); //~ ERROR cannot borrow +LL | x.borrowed_mut(); | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable `Box` content `*x` as mutable @@ -13,7 +13,7 @@ error[E0596]: cannot borrow immutable `Box` content `*x` as mutable LL | fn owned_receiver(x: Box) { | - help: make this binding mutable: `mut x` LL | x.borrowed(); -LL | x.borrowed_mut(); //~ ERROR cannot borrow +LL | x.borrowed_mut(); | ^ cannot borrow as mutable error: aborting due to 2 previous errors diff --git a/src/test/ui/span/destructor-restrictions.nll.stderr b/src/test/ui/span/destructor-restrictions.nll.stderr index 981c5a23816f..a3c6cfb6ae44 100644 --- a/src/test/ui/span/destructor-restrictions.nll.stderr +++ b/src/test/ui/span/destructor-restrictions.nll.stderr @@ -6,7 +6,7 @@ LL | *a.borrow() + 1 | | | borrowed value does not live long enough | a temporary with access to the borrow is created here ... -LL | }; //~^ ERROR `*a` does not live long enough +LL | }; | -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `std::cell::Ref<'_, i32>` | | | `*a` dropped here while still borrowed diff --git a/src/test/ui/span/destructor-restrictions.stderr b/src/test/ui/span/destructor-restrictions.stderr index 8fec87746781..a82e24b9391e 100644 --- a/src/test/ui/span/destructor-restrictions.stderr +++ b/src/test/ui/span/destructor-restrictions.stderr @@ -3,7 +3,7 @@ error[E0597]: `*a` does not live long enough | LL | *a.borrow() + 1 | ^ borrowed value does not live long enough -LL | }; //~^ ERROR `*a` does not live long enough +LL | }; | -- borrowed value needs to live until here | | | `*a` dropped here while still borrowed diff --git a/src/test/ui/span/dropck_arr_cycle_checked.stderr b/src/test/ui/span/dropck_arr_cycle_checked.stderr index aae71799e30f..b2bacc7f6789 100644 --- a/src/test/ui/span/dropck_arr_cycle_checked.stderr +++ b/src/test/ui/span/dropck_arr_cycle_checked.stderr @@ -58,7 +58,7 @@ error[E0597]: `b2` does not live long enough | LL | b3.a[1].v.set(Some(&b2)); | ^^ borrowed value does not live long enough -LL | //~^ ERROR `b2` does not live long enough +LL | LL | } | - `b2` dropped here while still borrowed | diff --git a/src/test/ui/span/dropck_direct_cycle_with_drop.nll.stderr b/src/test/ui/span/dropck_direct_cycle_with_drop.nll.stderr index 5774ac13cb7e..07ae138ac71e 100644 --- a/src/test/ui/span/dropck_direct_cycle_with_drop.nll.stderr +++ b/src/test/ui/span/dropck_direct_cycle_with_drop.nll.stderr @@ -17,7 +17,7 @@ error[E0597]: `d1` does not live long enough | LL | d2.p.set(Some(&d1)); | ^^^ borrowed value does not live long enough -LL | //~^ ERROR `d1` does not live long enough +LL | LL | } | - | | diff --git a/src/test/ui/span/dropck_direct_cycle_with_drop.stderr b/src/test/ui/span/dropck_direct_cycle_with_drop.stderr index bc4b517c51d6..497924208ab7 100644 --- a/src/test/ui/span/dropck_direct_cycle_with_drop.stderr +++ b/src/test/ui/span/dropck_direct_cycle_with_drop.stderr @@ -14,7 +14,7 @@ error[E0597]: `d1` does not live long enough | LL | d2.p.set(Some(&d1)); | ^^ borrowed value does not live long enough -LL | //~^ ERROR `d1` does not live long enough +LL | LL | } | - `d1` dropped here while still borrowed | diff --git a/src/test/ui/span/dropck_vec_cycle_checked.stderr b/src/test/ui/span/dropck_vec_cycle_checked.stderr index 35e4314d0c66..7f902388fac1 100644 --- a/src/test/ui/span/dropck_vec_cycle_checked.stderr +++ b/src/test/ui/span/dropck_vec_cycle_checked.stderr @@ -58,7 +58,7 @@ error[E0597]: `c2` does not live long enough | LL | c3.v[1].v.set(Some(&c2)); | ^^ borrowed value does not live long enough -LL | //~^ ERROR `c2` does not live long enough +LL | LL | } | - `c2` dropped here while still borrowed | diff --git a/src/test/ui/span/gated-features-attr-spans.stderr b/src/test/ui/span/gated-features-attr-spans.stderr index 9c4c12ba0768..45d14f32f96e 100644 --- a/src/test/ui/span/gated-features-attr-spans.stderr +++ b/src/test/ui/span/gated-features-attr-spans.stderr @@ -1,7 +1,7 @@ error[E0658]: SIMD types are experimental and possibly buggy (see issue #27731) --> $DIR/gated-features-attr-spans.rs:1:1 | -LL | #[repr(simd)] //~ ERROR are experimental +LL | #[repr(simd)] | ^^^^^^^^^^^^^ | = help: add #![feature(repr_simd)] to the crate attributes to enable diff --git a/src/test/ui/span/import-ty-params.stderr b/src/test/ui/span/import-ty-params.stderr index cff71bf2e62d..a02a1edc1349 100644 --- a/src/test/ui/span/import-ty-params.stderr +++ b/src/test/ui/span/import-ty-params.stderr @@ -1,13 +1,13 @@ error: unexpected generic arguments in path --> $DIR/import-ty-params.rs:14:15 | -LL | import! { a::b::c::S } //~ ERROR unexpected generic arguments in path +LL | import! { a::b::c::S } | ^^^^^^^^^^^^^^ error: unexpected generic arguments in path --> $DIR/import-ty-params.rs:17:15 | -LL | import! { a::b::c::S<> } //~ ERROR unexpected generic arguments in path +LL | import! { a::b::c::S<> } | ^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/span/issue-11925.nll.stderr b/src/test/ui/span/issue-11925.nll.stderr index f5e329f6c397..1d317fc331f7 100644 --- a/src/test/ui/span/issue-11925.nll.stderr +++ b/src/test/ui/span/issue-11925.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return reference to local data `x` --> $DIR/issue-11925.rs:8:35 | -LL | let f = to_fn_once(move|| &x); //~ ERROR does not live long enough +LL | let f = to_fn_once(move|| &x); | ^^ returns a reference to data owned by the current function error: aborting due to previous error diff --git a/src/test/ui/span/issue-11925.stderr b/src/test/ui/span/issue-11925.stderr index 46e2a41b3c34..c75022261a80 100644 --- a/src/test/ui/span/issue-11925.stderr +++ b/src/test/ui/span/issue-11925.stderr @@ -1,7 +1,7 @@ error[E0597]: `x` does not live long enough --> $DIR/issue-11925.rs:8:36 | -LL | let f = to_fn_once(move|| &x); //~ ERROR does not live long enough +LL | let f = to_fn_once(move|| &x); | ^ | | | borrowed value does not live long enough diff --git a/src/test/ui/span/issue-24690.stderr b/src/test/ui/span/issue-24690.stderr index 964e323b83ed..0864497911d3 100644 --- a/src/test/ui/span/issue-24690.stderr +++ b/src/test/ui/span/issue-24690.stderr @@ -1,7 +1,7 @@ warning: unused variable: `theOtherTwo` --> $DIR/issue-24690.rs:13:9 | -LL | let theOtherTwo = 2; //~ WARN should have a snake case name +LL | let theOtherTwo = 2; | ^^^^^^^^^^^ help: consider prefixing with an underscore: `_theOtherTwo` | note: lint level defined here @@ -14,7 +14,7 @@ LL | #![warn(unused)] warning: variable `theTwo` should have a snake case name --> $DIR/issue-24690.rs:12:9 | -LL | let theTwo = 2; //~ WARN should have a snake case name +LL | let theTwo = 2; | ^^^^^^ help: convert the identifier to snake case: `the_two` | = note: #[warn(non_snake_case)] on by default @@ -22,6 +22,6 @@ LL | let theTwo = 2; //~ WARN should have a snake case name warning: variable `theOtherTwo` should have a snake case name --> $DIR/issue-24690.rs:13:9 | -LL | let theOtherTwo = 2; //~ WARN should have a snake case name +LL | let theOtherTwo = 2; | ^^^^^^^^^^^ help: convert the identifier to snake case: `the_other_two` diff --git a/src/test/ui/span/issue-25199.stderr b/src/test/ui/span/issue-25199.stderr index 135d8150c34e..6d8320bc053c 100644 --- a/src/test/ui/span/issue-25199.stderr +++ b/src/test/ui/span/issue-25199.stderr @@ -14,7 +14,7 @@ error[E0597]: `container` does not live long enough | LL | container.store(test); | ^^^^^^^^^ borrowed value does not live long enough -LL | //~^ ERROR `container` does not live long enough +LL | LL | } | - `container` dropped here while still borrowed | diff --git a/src/test/ui/span/issue-27522.stderr b/src/test/ui/span/issue-27522.stderr index 1fcb839d1705..c99231a5336b 100644 --- a/src/test/ui/span/issue-27522.stderr +++ b/src/test/ui/span/issue-27522.stderr @@ -1,7 +1,7 @@ error[E0307]: invalid method receiver type: &SomeType --> $DIR/issue-27522.rs:6:22 | -LL | fn handler(self: &SomeType); //~ ERROR invalid method receiver type +LL | fn handler(self: &SomeType); | ^^^^^^^^^ | = note: type must be `Self` or a type that dereferences to it diff --git a/src/test/ui/span/issue-29595.stderr b/src/test/ui/span/issue-29595.stderr index dbb1743ec0ef..24dfdf8ebc29 100644 --- a/src/test/ui/span/issue-29595.stderr +++ b/src/test/ui/span/issue-29595.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `u8: Tr` is not satisfied --> $DIR/issue-29595.rs:6:17 | -LL | let a: u8 = Tr::C; //~ ERROR the trait bound `u8: Tr` is not satisfied +LL | let a: u8 = Tr::C; | ^^^^^ the trait `Tr` is not implemented for `u8` | note: required by `Tr::C` diff --git a/src/test/ui/span/issue-34264.stderr b/src/test/ui/span/issue-34264.stderr index 9b3b68f6ff46..c5b6245572c6 100644 --- a/src/test/ui/span/issue-34264.stderr +++ b/src/test/ui/span/issue-34264.stderr @@ -1,34 +1,34 @@ error: expected one of `:` or `@`, found `<` --> $DIR/issue-34264.rs:1:14 | -LL | fn foo(Option, String) {} //~ ERROR expected one of +LL | fn foo(Option, String) {} | ^ expected one of `:` or `@` here error: expected one of `:` or `@`, found `)` --> $DIR/issue-34264.rs:1:27 | -LL | fn foo(Option, String) {} //~ ERROR expected one of +LL | fn foo(Option, String) {} | ^ expected one of `:` or `@` here error: expected one of `:` or `@`, found `,` --> $DIR/issue-34264.rs:3:9 | -LL | fn bar(x, y: usize) {} //~ ERROR expected one of +LL | fn bar(x, y: usize) {} | ^ expected one of `:` or `@` here error[E0061]: this function takes 2 parameters but 3 parameters were supplied --> $DIR/issue-34264.rs:7:5 | -LL | fn foo(Option, String) {} //~ ERROR expected one of +LL | fn foo(Option, String) {} | --------------------------- defined here ... -LL | foo(Some(42), 2, ""); //~ ERROR this function takes +LL | foo(Some(42), 2, ""); | ^^^^^^^^^^^^^^^^^^^^ expected 2 parameters error[E0308]: mismatched types --> $DIR/issue-34264.rs:8:13 | -LL | bar("", ""); //~ ERROR mismatched types +LL | bar("", ""); | ^^ expected usize, found reference | = note: expected type `usize` @@ -37,10 +37,10 @@ LL | bar("", ""); //~ ERROR mismatched types error[E0061]: this function takes 2 parameters but 3 parameters were supplied --> $DIR/issue-34264.rs:10:5 | -LL | fn bar(x, y: usize) {} //~ ERROR expected one of +LL | fn bar(x, y: usize) {} | ------------------- defined here ... -LL | bar(1, 2, 3); //~ ERROR this function takes +LL | bar(1, 2, 3); | ^^^^^^^^^^^^ expected 2 parameters error: aborting due to 6 previous errors diff --git a/src/test/ui/span/issue-36530.stderr b/src/test/ui/span/issue-36530.stderr index b2b494a2c9c3..05b2ca90570e 100644 --- a/src/test/ui/span/issue-36530.stderr +++ b/src/test/ui/span/issue-36530.stderr @@ -1,7 +1,7 @@ error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/issue-36530.rs:3:3 | -LL | #[foo] //~ ERROR is currently unknown to the compiler +LL | #[foo] | ^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #[foo] //~ ERROR is currently unknown to the compiler error[E0658]: non-builtin inner attributes are unstable (see issue #54726) --> $DIR/issue-36530.rs:5:5 | -LL | #![foo] //~ ERROR is currently unknown to the compiler +LL | #![foo] | ^^^^^^^ | = help: add #![feature(custom_inner_attributes)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | #![foo] //~ ERROR is currently unknown to the compiler error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/issue-36530.rs:5:8 | -LL | #![foo] //~ ERROR is currently unknown to the compiler +LL | #![foo] | ^^^ | = help: add #![feature(custom_attribute)] to the crate attributes to enable diff --git a/src/test/ui/span/issue-37767.stderr b/src/test/ui/span/issue-37767.stderr index f91f2a50e859..0bbff45436c2 100644 --- a/src/test/ui/span/issue-37767.stderr +++ b/src/test/ui/span/issue-37767.stderr @@ -1,7 +1,7 @@ error[E0034]: multiple applicable items in scope --> $DIR/issue-37767.rs:10:7 | -LL | a.foo() //~ ERROR multiple applicable items +LL | a.foo() | ^^^ multiple `foo` found | note: candidate #1 is defined in the trait `A` @@ -20,7 +20,7 @@ LL | fn foo(&mut self) {} error[E0034]: multiple applicable items in scope --> $DIR/issue-37767.rs:22:7 | -LL | a.foo() //~ ERROR multiple applicable items +LL | a.foo() | ^^^ multiple `foo` found | note: candidate #1 is defined in the trait `C` @@ -39,7 +39,7 @@ LL | fn foo(&self) {} error[E0034]: multiple applicable items in scope --> $DIR/issue-37767.rs:34:7 | -LL | a.foo() //~ ERROR multiple applicable items +LL | a.foo() | ^^^ multiple `foo` found | note: candidate #1 is defined in the trait `E` diff --git a/src/test/ui/span/issue-42234-unknown-receiver-type.stderr b/src/test/ui/span/issue-42234-unknown-receiver-type.stderr index 1899a4e55d5a..8923de5705b1 100644 --- a/src/test/ui/span/issue-42234-unknown-receiver-type.stderr +++ b/src/test/ui/span/issue-42234-unknown-receiver-type.stderr @@ -11,7 +11,7 @@ LL | x.unwrap().method_that_could_exist_on_some_type(); error[E0282]: type annotations needed --> $DIR/issue-42234-unknown-receiver-type.rs:12:5 | -LL | / data.iter() //~ ERROR type annotations needed +LL | / data.iter() LL | | .sum::<_>() | |___________________^ cannot infer type | diff --git a/src/test/ui/span/issue28498-reject-ex1.stderr b/src/test/ui/span/issue28498-reject-ex1.stderr index 8daef82f8bbd..1438b95d7334 100644 --- a/src/test/ui/span/issue28498-reject-ex1.stderr +++ b/src/test/ui/span/issue28498-reject-ex1.stderr @@ -14,7 +14,7 @@ error[E0597]: `foo.data` does not live long enough | LL | foo.data[1].1.set(Some(&foo.data[0])); | ^^^^^^^^ borrowed value does not live long enough -LL | //~^ ERROR `foo.data` does not live long enough +LL | LL | } | - `foo.data` dropped here while still borrowed | diff --git a/src/test/ui/span/lint-unused-unsafe.stderr b/src/test/ui/span/lint-unused-unsafe.stderr index 7f16cfae859e..ac8107990c2b 100644 --- a/src/test/ui/span/lint-unused-unsafe.stderr +++ b/src/test/ui/span/lint-unused-unsafe.stderr @@ -1,7 +1,7 @@ error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:16:13 | -LL | fn bad1() { unsafe {} } //~ ERROR: unnecessary `unsafe` block +LL | fn bad1() { unsafe {} } | ^^^^^^ unnecessary `unsafe` block | note: lint level defined here @@ -13,13 +13,13 @@ LL | #![deny(unused_unsafe)] error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:17:13 | -LL | fn bad2() { unsafe { bad1() } } //~ ERROR: unnecessary `unsafe` block +LL | fn bad2() { unsafe { bad1() } } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:18:20 | -LL | unsafe fn bad3() { unsafe {} } //~ ERROR: unnecessary `unsafe` block +LL | unsafe fn bad3() { unsafe {} } | ---------------- ^^^^^^ unnecessary `unsafe` block | | | because it's nested under this `unsafe` fn @@ -27,13 +27,13 @@ LL | unsafe fn bad3() { unsafe {} } //~ ERROR: unnecessary `unsafe` bl error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:19:13 | -LL | fn bad4() { unsafe { callback(||{}) } } //~ ERROR: unnecessary `unsafe` block +LL | fn bad4() { unsafe { callback(||{}) } } | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block --> $DIR/lint-unused-unsafe.rs:20:20 | -LL | unsafe fn bad5() { unsafe { unsf() } } //~ ERROR: unnecessary `unsafe` block +LL | unsafe fn bad5() { unsafe { unsf() } } | ---------------- ^^^^^^ unnecessary `unsafe` block | | | because it's nested under this `unsafe` fn @@ -43,7 +43,7 @@ error: unnecessary `unsafe` block | LL | unsafe { // don't put the warning here | ------ because it's nested under this `unsafe` block -LL | unsafe { //~ ERROR: unnecessary `unsafe` block +LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block @@ -51,7 +51,7 @@ error: unnecessary `unsafe` block | LL | unsafe fn bad7() { | ---------------- because it's nested under this `unsafe` fn -LL | unsafe { //~ ERROR: unnecessary `unsafe` block +LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: unnecessary `unsafe` block @@ -59,8 +59,8 @@ error: unnecessary `unsafe` block | LL | unsafe fn bad7() { | ---------------- because it's nested under this `unsafe` fn -LL | unsafe { //~ ERROR: unnecessary `unsafe` block -LL | unsafe { //~ ERROR: unnecessary `unsafe` block +LL | unsafe { +LL | unsafe { | ^^^^^^ unnecessary `unsafe` block error: aborting due to 8 previous errors diff --git a/src/test/ui/span/macro-span-replacement.stderr b/src/test/ui/span/macro-span-replacement.stderr index f6c303164bfd..128e4ec1212c 100644 --- a/src/test/ui/span/macro-span-replacement.stderr +++ b/src/test/ui/span/macro-span-replacement.stderr @@ -1,7 +1,7 @@ warning: struct is never constructed: `S` --> $DIR/macro-span-replacement.rs:7:14 | -LL | $b $a; //~ WARN struct is never constructed +LL | $b $a; | ^ ... LL | m!(S struct); diff --git a/src/test/ui/span/macro-ty-params.stderr b/src/test/ui/span/macro-ty-params.stderr index 965ca7000be8..39b3edc67033 100644 --- a/src/test/ui/span/macro-ty-params.stderr +++ b/src/test/ui/span/macro-ty-params.stderr @@ -1,25 +1,25 @@ error: generic arguments in macro path --> $DIR/macro-ty-params.rs:10:10 | -LL | foo::!(); //~ ERROR generic arguments in macro path +LL | foo::!(); | ^^^ error: generic arguments in macro path --> $DIR/macro-ty-params.rs:11:10 | -LL | foo::<>!(); //~ ERROR generic arguments in macro path +LL | foo::<>!(); | ^^ error: unexpected generic arguments in path --> $DIR/macro-ty-params.rs:12:8 | -LL | m!(Default<>); //~ ERROR generic arguments in macro path +LL | m!(Default<>); | ^^^^^^^^^ error: generic arguments in macro path --> $DIR/macro-ty-params.rs:12:15 | -LL | m!(Default<>); //~ ERROR generic arguments in macro path +LL | m!(Default<>); | ^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/span/missing-unit-argument.stderr b/src/test/ui/span/missing-unit-argument.stderr index bf19eb694618..f1a29bed32b1 100644 --- a/src/test/ui/span/missing-unit-argument.stderr +++ b/src/test/ui/span/missing-unit-argument.stderr @@ -1,11 +1,11 @@ error[E0061]: this function takes 1 parameter but 0 parameters were supplied --> $DIR/missing-unit-argument.rs:11:33 | -LL | let _: Result<(), String> = Ok(); //~ ERROR this function takes +LL | let _: Result<(), String> = Ok(); | ^^^^ help: expected the unit value `()`; create it with empty parentheses | -LL | let _: Result<(), String> = Ok(()); //~ ERROR this function takes +LL | let _: Result<(), String> = Ok(()); | ^^ error[E0061]: this function takes 2 parameters but 0 parameters were supplied @@ -14,7 +14,7 @@ error[E0061]: this function takes 2 parameters but 0 parameters were supplied LL | fn foo(():(), ():()) {} | -------------------- defined here ... -LL | foo(); //~ ERROR this function takes +LL | foo(); | ^^^^^ expected 2 parameters error[E0061]: this function takes 2 parameters but 1 parameter was supplied @@ -23,7 +23,7 @@ error[E0061]: this function takes 2 parameters but 1 parameter was supplied LL | fn foo(():(), ():()) {} | -------------------- defined here ... -LL | foo(()); //~ ERROR this function takes +LL | foo(()); | ^^^^^^^ expected 2 parameters error[E0061]: this function takes 1 parameter but 0 parameters were supplied @@ -32,11 +32,11 @@ error[E0061]: this function takes 1 parameter but 0 parameters were supplied LL | fn bar(():()) {} | ------------- defined here ... -LL | bar(); //~ ERROR this function takes +LL | bar(); | ^^^^^ help: expected the unit value `()`; create it with empty parentheses | -LL | bar(()); //~ ERROR this function takes +LL | bar(()); | ^^ error[E0061]: this function takes 1 parameter but 0 parameters were supplied @@ -45,11 +45,11 @@ error[E0061]: this function takes 1 parameter but 0 parameters were supplied LL | fn baz(self, (): ()) { } | -------------------- defined here ... -LL | S.baz(); //~ ERROR this function takes +LL | S.baz(); | ^^^ help: expected the unit value `()`; create it with empty parentheses | -LL | S.baz(()); //~ ERROR this function takes +LL | S.baz(()); | ^^ error[E0061]: this function takes 1 parameter but 0 parameters were supplied @@ -58,11 +58,11 @@ error[E0061]: this function takes 1 parameter but 0 parameters were supplied LL | fn generic(self, _: T) { } | ------------------------- defined here ... -LL | S.generic::<()>(); //~ ERROR this function takes +LL | S.generic::<()>(); | ^^^^^^^ help: expected the unit value `()`; create it with empty parentheses | -LL | S.generic::<()>(()); //~ ERROR this function takes +LL | S.generic::<()>(()); | ^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/span/move-closure.stderr b/src/test/ui/span/move-closure.stderr index f09e052f6530..e2226b197aeb 100644 --- a/src/test/ui/span/move-closure.stderr +++ b/src/test/ui/span/move-closure.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/move-closure.rs:5:17 | -LL | let x: () = move || (); //~ ERROR mismatched types +LL | let x: () = move || (); | ^^^^^^^^^^ expected (), found closure | = note: expected type `()` diff --git a/src/test/ui/span/multiline-span-E0072.stderr b/src/test/ui/span/multiline-span-E0072.stderr index ee392f5994c8..dd322fe833b4 100644 --- a/src/test/ui/span/multiline-span-E0072.stderr +++ b/src/test/ui/span/multiline-span-E0072.stderr @@ -1,7 +1,7 @@ error[E0072]: recursive type `ListNode` has infinite size --> $DIR/multiline-span-E0072.rs:2:1 | -LL | / struct //~ ERROR has infinite size +LL | / struct LL | | ListNode LL | | { LL | | head: u8, diff --git a/src/test/ui/span/multiline-span-simple.stderr b/src/test/ui/span/multiline-span-simple.stderr index 18b6cd06afbb..6495d9bc7397 100644 --- a/src/test/ui/span/multiline-span-simple.stderr +++ b/src/test/ui/span/multiline-span-simple.stderr @@ -1,7 +1,7 @@ error[E0277]: cannot add `()` to `u32` --> $DIR/multiline-span-simple.rs:13:18 | -LL | foo(1 as u32 + //~ ERROR cannot add `()` to `u32` +LL | foo(1 as u32 + | ^ no implementation for `u32 + ()` | = help: the trait `std::ops::Add<()>` is not implemented for `u32` diff --git a/src/test/ui/span/mut-arg-hint.nll.stderr b/src/test/ui/span/mut-arg-hint.nll.stderr index e0fa3c3a1e6f..8027cf69cf4b 100644 --- a/src/test/ui/span/mut-arg-hint.nll.stderr +++ b/src/test/ui/span/mut-arg-hint.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference | LL | fn foo(mut a: &String) { | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` -LL | a.push_str("bar"); //~ ERROR cannot borrow immutable borrowed content +LL | a.push_str("bar"); | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference @@ -11,7 +11,7 @@ error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference | LL | pub fn foo<'a>(mut a: &'a String) { | ---------- help: consider changing this to be a mutable reference: `&'a mut String` -LL | a.push_str("foo"); //~ ERROR cannot borrow immutable borrowed content +LL | a.push_str("foo"); | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference @@ -19,7 +19,7 @@ error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference | LL | pub fn foo(mut a: &String) { | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` -LL | a.push_str("foo"); //~ ERROR cannot borrow immutable borrowed content +LL | a.push_str("foo"); | ^ `a` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to 3 previous errors diff --git a/src/test/ui/span/mut-arg-hint.stderr b/src/test/ui/span/mut-arg-hint.stderr index ea6fc8bee637..ce5786186ea5 100644 --- a/src/test/ui/span/mut-arg-hint.stderr +++ b/src/test/ui/span/mut-arg-hint.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable borrowed content `*a` as mutable | LL | fn foo(mut a: &String) { | ------- use `&mut String` here to make mutable -LL | a.push_str("bar"); //~ ERROR cannot borrow immutable borrowed content +LL | a.push_str("bar"); | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content `*a` as mutable @@ -11,7 +11,7 @@ error[E0596]: cannot borrow immutable borrowed content `*a` as mutable | LL | pub fn foo<'a>(mut a: &'a String) { | ---------- use `&'a mut String` here to make mutable -LL | a.push_str("foo"); //~ ERROR cannot borrow immutable borrowed content +LL | a.push_str("foo"); | ^ cannot borrow as mutable error[E0596]: cannot borrow immutable borrowed content `*a` as mutable @@ -19,7 +19,7 @@ error[E0596]: cannot borrow immutable borrowed content `*a` as mutable | LL | pub fn foo(mut a: &String) { | ------- use `&mut String` here to make mutable -LL | a.push_str("foo"); //~ ERROR cannot borrow immutable borrowed content +LL | a.push_str("foo"); | ^ cannot borrow as mutable error: aborting due to 3 previous errors diff --git a/src/test/ui/span/mut-ptr-cant-outlive-ref.nll.stderr b/src/test/ui/span/mut-ptr-cant-outlive-ref.nll.stderr index d3ba848fe6bb..21b29464df50 100644 --- a/src/test/ui/span/mut-ptr-cant-outlive-ref.nll.stderr +++ b/src/test/ui/span/mut-ptr-cant-outlive-ref.nll.stderr @@ -5,7 +5,7 @@ LL | p = &*b; | ^ borrowed value does not live long enough LL | } | - `b` dropped here while still borrowed -LL | //~^^ ERROR `b` does not live long enough +LL | LL | p.use_ref(); | - borrow later used here diff --git a/src/test/ui/span/non-existing-module-import.stderr b/src/test/ui/span/non-existing-module-import.stderr index 5ac5df1b4c73..25c09959047a 100644 --- a/src/test/ui/span/non-existing-module-import.stderr +++ b/src/test/ui/span/non-existing-module-import.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `std::bar` --> $DIR/non-existing-module-import.rs:1:10 | -LL | use std::bar::{foo1, foo2}; //~ ERROR unresolved import +LL | use std::bar::{foo1, foo2}; | ^^^ could not find `bar` in `std` error: aborting due to previous error diff --git a/src/test/ui/span/pub-struct-field.stderr b/src/test/ui/span/pub-struct-field.stderr index 66afbf253c9b..065340f446a7 100644 --- a/src/test/ui/span/pub-struct-field.stderr +++ b/src/test/ui/span/pub-struct-field.stderr @@ -3,7 +3,7 @@ error[E0124]: field `bar` is already declared | LL | bar: u8, | ------- `bar` first declared here -LL | pub bar: u8, //~ ERROR is already declared +LL | pub bar: u8, | ^^^^^^^^^^^ field already declared error[E0124]: field `bar` is already declared @@ -11,8 +11,8 @@ error[E0124]: field `bar` is already declared | LL | bar: u8, | ------- `bar` first declared here -LL | pub bar: u8, //~ ERROR is already declared -LL | pub(crate) bar: u8, //~ ERROR is already declared +LL | pub bar: u8, +LL | pub(crate) bar: u8, | ^^^^^^^^^^^^^^^^^^ field already declared error: aborting due to 2 previous errors diff --git a/src/test/ui/span/recursive-type-field.stderr b/src/test/ui/span/recursive-type-field.stderr index 3a8f0e60038e..d240872647e5 100644 --- a/src/test/ui/span/recursive-type-field.stderr +++ b/src/test/ui/span/recursive-type-field.stderr @@ -1,7 +1,7 @@ error[E0072]: recursive type `Foo` has infinite size --> $DIR/recursive-type-field.rs:3:1 | -LL | struct Foo<'a> { //~ ERROR recursive type +LL | struct Foo<'a> { | ^^^^^^^^^^^^^^ recursive type has infinite size LL | bar: Bar<'a>, | ------------ recursive without indirection @@ -11,7 +11,7 @@ LL | bar: Bar<'a>, error[E0072]: recursive type `Bar` has infinite size --> $DIR/recursive-type-field.rs:8:1 | -LL | struct Bar<'a> { //~ ERROR recursive type +LL | struct Bar<'a> { | ^^^^^^^^^^^^^^ recursive type has infinite size LL | y: (Foo<'a>, Foo<'a>), | --------------------- recursive without indirection diff --git a/src/test/ui/span/regions-escape-loop-via-variable.stderr b/src/test/ui/span/regions-escape-loop-via-variable.stderr index e3870db0c668..ef36b81f4936 100644 --- a/src/test/ui/span/regions-escape-loop-via-variable.stderr +++ b/src/test/ui/span/regions-escape-loop-via-variable.stderr @@ -5,7 +5,7 @@ LL | p = &x; | ^ borrowed value does not live long enough LL | } | - `x` dropped here while still borrowed -LL | //~^^ ERROR `x` does not live long enough +LL | LL | } | - borrowed value needs to live until here diff --git a/src/test/ui/span/regions-escape-loop-via-vec.nll.stderr b/src/test/ui/span/regions-escape-loop-via-vec.nll.stderr index e07fb7277821..284981e93419 100644 --- a/src/test/ui/span/regions-escape-loop-via-vec.nll.stderr +++ b/src/test/ui/span/regions-escape-loop-via-vec.nll.stderr @@ -3,9 +3,9 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let mut _y = vec![&mut x]; | ------ borrow of `x` occurs here -LL | while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed +LL | while x < 10 { | ^ use of borrowed `x` -LL | let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed +LL | let mut z = x; LL | _y.push(&mut z); | -- borrow later used here @@ -14,8 +14,8 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let mut _y = vec![&mut x]; | ------ borrow of `x` occurs here -LL | while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed -LL | let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed +LL | while x < 10 { +LL | let mut z = x; | ^ use of borrowed `x` LL | _y.push(&mut z); | -- borrow later used here @@ -39,8 +39,8 @@ LL | let mut _y = vec![&mut x]; ... LL | _y.push(&mut z); | -- borrow later used here -LL | //~^ ERROR `z` does not live long enough -LL | x += 1; //~ ERROR cannot assign +LL | +LL | x += 1; | ^^^^^^ use of borrowed `x` error: aborting due to 4 previous errors diff --git a/src/test/ui/span/regions-escape-loop-via-vec.stderr b/src/test/ui/span/regions-escape-loop-via-vec.stderr index 09a7123d8f04..1d604b58d7e7 100644 --- a/src/test/ui/span/regions-escape-loop-via-vec.stderr +++ b/src/test/ui/span/regions-escape-loop-via-vec.stderr @@ -14,7 +14,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let mut _y = vec![&mut x]; | - borrow of `x` occurs here -LL | while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed +LL | while x < 10 { | ^ use of borrowed `x` error[E0503]: cannot use `x` because it was mutably borrowed @@ -22,8 +22,8 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let mut _y = vec![&mut x]; | - borrow of `x` occurs here -LL | while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed -LL | let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed +LL | while x < 10 { +LL | let mut z = x; | ^^^^^ use of borrowed `x` error[E0506]: cannot assign to `x` because it is borrowed @@ -32,7 +32,7 @@ error[E0506]: cannot assign to `x` because it is borrowed LL | let mut _y = vec![&mut x]; | - borrow of `x` occurs here ... -LL | x += 1; //~ ERROR cannot assign +LL | x += 1; | ^^^^^^ assignment to borrowed `x` occurs here error: aborting due to 4 previous errors diff --git a/src/test/ui/span/send-is-not-static-std-sync.nll.stderr b/src/test/ui/span/send-is-not-static-std-sync.nll.stderr index 54960c16405d..93473a86b5a5 100644 --- a/src/test/ui/span/send-is-not-static-std-sync.nll.stderr +++ b/src/test/ui/span/send-is-not-static-std-sync.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `y` because it is borrowed | LL | *lock.lock().unwrap() = &*y; | --- borrow of `*y` occurs here -LL | drop(y); //~ ERROR cannot move out +LL | drop(y); | ^ move out of `y` occurs here ... LL | *lock.lock().unwrap() = &z; @@ -16,7 +16,7 @@ LL | *lock.lock().unwrap() = &z; | ^^ borrowed value does not live long enough LL | } | - `z` dropped here while still borrowed -LL | //~^^ ERROR `z` does not live long enough +LL | LL | lock.use_ref(); // (Mutex is #[may_dangle] so its dtor does not use `z` => needs explicit use) | ---- borrow later used here @@ -25,7 +25,7 @@ error[E0505]: cannot move out of `y` because it is borrowed | LL | *lock.write().unwrap() = &*y; | --- borrow of `*y` occurs here -LL | drop(y); //~ ERROR cannot move out +LL | drop(y); | ^ move out of `y` occurs here ... LL | *lock.write().unwrap() = &z; @@ -38,7 +38,7 @@ LL | *lock.write().unwrap() = &z; | ^^ borrowed value does not live long enough LL | } | - `z` dropped here while still borrowed -LL | //~^^ ERROR `z` does not live long enough +LL | LL | lock.use_ref(); // (RwLock is #[may_dangle] so its dtor does not use `z` => needs explicit use) | ---- borrow later used here @@ -47,7 +47,7 @@ error[E0505]: cannot move out of `y` because it is borrowed | LL | tx.send(&*y); | --- borrow of `*y` occurs here -LL | drop(y); //~ ERROR cannot move out +LL | drop(y); | ^ move out of `y` occurs here ... LL | tx.send(&z).unwrap(); diff --git a/src/test/ui/span/send-is-not-static-std-sync.stderr b/src/test/ui/span/send-is-not-static-std-sync.stderr index 74c2bad24dea..aa9e1c2de221 100644 --- a/src/test/ui/span/send-is-not-static-std-sync.stderr +++ b/src/test/ui/span/send-is-not-static-std-sync.stderr @@ -14,7 +14,7 @@ error[E0505]: cannot move out of `y` because it is borrowed | LL | *lock.lock().unwrap() = &*y; | -- borrow of `*y` occurs here -LL | drop(y); //~ ERROR cannot move out +LL | drop(y); | ^ move out of `y` occurs here error[E0597]: `z` does not live long enough @@ -33,7 +33,7 @@ error[E0505]: cannot move out of `y` because it is borrowed | LL | *lock.write().unwrap() = &*y; | -- borrow of `*y` occurs here -LL | drop(y); //~ ERROR cannot move out +LL | drop(y); | ^ move out of `y` occurs here error[E0597]: `z` does not live long enough @@ -52,7 +52,7 @@ error[E0505]: cannot move out of `y` because it is borrowed | LL | tx.send(&*y); | -- borrow of `*y` occurs here -LL | drop(y); //~ ERROR cannot move out +LL | drop(y); | ^ move out of `y` occurs here error: aborting due to 6 previous errors diff --git a/src/test/ui/span/suggestion-non-ascii.stderr b/src/test/ui/span/suggestion-non-ascii.stderr index 40b11695d752..b14632d4e1bd 100644 --- a/src/test/ui/span/suggestion-non-ascii.stderr +++ b/src/test/ui/span/suggestion-non-ascii.stderr @@ -1,7 +1,7 @@ error[E0608]: cannot index into a value of type `({integer},)` --> $DIR/suggestion-non-ascii.rs:3:21 | -LL | println!("β˜ƒ{}", tup[0]); //~ ERROR cannot index into a value of type +LL | println!("β˜ƒ{}", tup[0]); | ^^^^^^ help: to access tuple elements, use: `tup.0` error: aborting due to previous error diff --git a/src/test/ui/span/typo-suggestion.stderr b/src/test/ui/span/typo-suggestion.stderr index 7b12c4430ed4..61d4e06119c4 100644 --- a/src/test/ui/span/typo-suggestion.stderr +++ b/src/test/ui/span/typo-suggestion.stderr @@ -1,13 +1,13 @@ error[E0425]: cannot find value `bar` in this scope --> $DIR/typo-suggestion.rs:5:26 | -LL | println!("Hello {}", bar); //~ ERROR cannot find value +LL | println!("Hello {}", bar); | ^^^ not found in this scope error[E0425]: cannot find value `fob` in this scope --> $DIR/typo-suggestion.rs:8:26 | -LL | println!("Hello {}", fob); //~ ERROR cannot find value +LL | println!("Hello {}", fob); | ^^^ help: a local variable with a similar name exists: `foo` error: aborting due to 2 previous errors diff --git a/src/test/ui/span/unused-warning-point-at-signature.stderr b/src/test/ui/span/unused-warning-point-at-signature.stderr index e07548121b52..3007d90c9900 100644 --- a/src/test/ui/span/unused-warning-point-at-signature.stderr +++ b/src/test/ui/span/unused-warning-point-at-signature.stderr @@ -1,7 +1,7 @@ warning: enum is never used: `Enum` --> $DIR/unused-warning-point-at-signature.rs:5:1 | -LL | enum Enum { //~ WARN enum is never used +LL | enum Enum { | ^^^^^^^^^ | note: lint level defined here @@ -14,19 +14,19 @@ LL | #![warn(unused)] warning: struct is never constructed: `Struct` --> $DIR/unused-warning-point-at-signature.rs:12:1 | -LL | struct Struct { //~ WARN struct is never constructed +LL | struct Struct { | ^^^^^^^^^^^^^ warning: function is never used: `func` --> $DIR/unused-warning-point-at-signature.rs:19:1 | -LL | fn func() -> usize { //~ WARN function is never used +LL | fn func() -> usize { | ^^^^^^^^^^^^^^^^^^ warning: function is never used: `func_complete_span` --> $DIR/unused-warning-point-at-signature.rs:23:1 | -LL | / fn //~ WARN function is never used +LL | / fn LL | | func_complete_span() LL | | -> usize LL | | { diff --git a/src/test/ui/span/vec-must-not-hide-type-from-dropck.nll.stderr b/src/test/ui/span/vec-must-not-hide-type-from-dropck.nll.stderr index c5e2ca2e28f3..f87c32d1ad0c 100644 --- a/src/test/ui/span/vec-must-not-hide-type-from-dropck.nll.stderr +++ b/src/test/ui/span/vec-must-not-hide-type-from-dropck.nll.stderr @@ -17,7 +17,7 @@ error[E0597]: `c1` does not live long enough | LL | c2.v[0].v.set(Some(&c1)); | ^^^ borrowed value does not live long enough -LL | //~^ ERROR `c1` does not live long enough +LL | LL | } | - | | diff --git a/src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr b/src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr index 1eee88ad21af..b957243018de 100644 --- a/src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr +++ b/src/test/ui/span/vec-must-not-hide-type-from-dropck.stderr @@ -14,7 +14,7 @@ error[E0597]: `c1` does not live long enough | LL | c2.v[0].v.set(Some(&c1)); | ^^ borrowed value does not live long enough -LL | //~^ ERROR `c1` does not live long enough +LL | LL | } | - `c1` dropped here while still borrowed | diff --git a/src/test/ui/span/visibility-ty-params.stderr b/src/test/ui/span/visibility-ty-params.stderr index d7914528f468..ddc13bb1c76a 100644 --- a/src/test/ui/span/visibility-ty-params.stderr +++ b/src/test/ui/span/visibility-ty-params.stderr @@ -1,19 +1,19 @@ error: unexpected generic arguments in path --> $DIR/visibility-ty-params.rs:6:5 | -LL | m!{ S } //~ ERROR unexpected generic arguments in path +LL | m!{ S } | ^^^^^ error: unexpected generic arguments in path --> $DIR/visibility-ty-params.rs:10:9 | -LL | m!{ m<> } //~ ERROR unexpected generic arguments in path +LL | m!{ m<> } | ^^^ error[E0577]: expected module, found struct `S` --> $DIR/visibility-ty-params.rs:6:5 | -LL | m!{ S } //~ ERROR unexpected generic arguments in path +LL | m!{ S } | -^^^^ | | | help: a module with a similar name exists: `m` diff --git a/src/test/ui/specialization/defaultimpl/specialization-feature-gate-default.stderr b/src/test/ui/specialization/defaultimpl/specialization-feature-gate-default.stderr index 3b3076cc6723..0b20a19d2e1c 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-feature-gate-default.stderr +++ b/src/test/ui/specialization/defaultimpl/specialization-feature-gate-default.stderr @@ -1,7 +1,7 @@ error[E0658]: specialization is unstable (see issue #31844) --> $DIR/specialization-feature-gate-default.rs:7:1 | -LL | / default impl Foo for T { //~ ERROR specialization is unstable +LL | / default impl Foo for T { LL | | fn foo(&self) {} LL | | } | |_^ diff --git a/src/test/ui/specialization/defaultimpl/specialization-no-default.stderr b/src/test/ui/specialization/defaultimpl/specialization-no-default.stderr index 7ca9df9f5d93..91690f64d948 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-no-default.stderr +++ b/src/test/ui/specialization/defaultimpl/specialization-no-default.stderr @@ -7,7 +7,7 @@ LL | | fn bar(&self) {} LL | | } | |_- parent `impl` is here ... -LL | fn foo(&self) {} //~ ERROR E0520 +LL | fn foo(&self) {} | ^^^^^^^^^^^^^^^^ cannot specialize default item `foo` | = note: to specialize, `foo` in the parent `impl` must be marked `default` @@ -21,7 +21,7 @@ LL | | fn bar(&self) {} LL | | } | |_- parent `impl` is here ... -LL | fn bar(&self) {} //~ ERROR E0520 +LL | fn bar(&self) {} | ^^^^^^^^^^^^^^^^ cannot specialize default item `bar` | = note: to specialize, `bar` in the parent `impl` must be marked `default` @@ -34,7 +34,7 @@ LL | | type T = u8; LL | | } | |_- parent `impl` is here ... -LL | type T = (); //~ ERROR E0520 +LL | type T = (); | ^^^^^^^^^^^^ cannot specialize default item `T` | = note: to specialize, `T` in the parent `impl` must be marked `default` @@ -47,7 +47,7 @@ LL | | fn baz(&self) {} LL | | } | |_- parent `impl` is here ... -LL | fn baz(&self) {} //~ ERROR E0520 +LL | fn baz(&self) {} | ^^^^^^^^^^^^^^^^ cannot specialize default item `baz` | = note: to specialize, `baz` in the parent `impl` must be marked `default` @@ -60,7 +60,7 @@ LL | | fn redundant(&self) {} LL | | } | |_- parent `impl` is here ... -LL | fn redundant(&self) {} //~ ERROR E0520 +LL | fn redundant(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `redundant` | = note: to specialize, `redundant` in the parent `impl` must be marked `default` diff --git a/src/test/ui/specialization/defaultimpl/validation.stderr b/src/test/ui/specialization/defaultimpl/validation.stderr index 2778cac7ae57..14a06c39088d 100644 --- a/src/test/ui/specialization/defaultimpl/validation.stderr +++ b/src/test/ui/specialization/defaultimpl/validation.stderr @@ -1,7 +1,7 @@ error: inherent impls cannot be default --> $DIR/validation.rs:7:1 | -LL | default impl S {} //~ ERROR inherent impls cannot be default +LL | default impl S {} | ^^^^^^^^^^^^^^^^^ | = note: only trait implementations may be annotated with default @@ -9,19 +9,19 @@ LL | default impl S {} //~ ERROR inherent impls cannot be default error: impls of auto traits cannot be default --> $DIR/validation.rs:9:1 | -LL | default unsafe impl Send for S {} //~ ERROR impls of auto traits cannot be default +LL | default unsafe impl Send for S {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: impls of auto traits cannot be default --> $DIR/validation.rs:10:1 | -LL | default impl !Send for Z {} //~ ERROR impls of auto traits cannot be default +LL | default impl !Send for Z {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0192]: negative impls are only allowed for auto traits (e.g., `Send` and `Sync`) --> $DIR/validation.rs:13:1 | -LL | default impl !Tr for S {} //~ ERROR negative impls are only allowed for auto traits +LL | default impl !Tr for S {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/specialization/issue-39448.stderr b/src/test/ui/specialization/issue-39448.stderr index 0b0fd2c4af59..861a1d9e8fc6 100644 --- a/src/test/ui/specialization/issue-39448.stderr +++ b/src/test/ui/specialization/issue-39448.stderr @@ -1,7 +1,7 @@ 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 +LL | x.foo(y.to()).to() | ^^ | = note: required because of the requirements on the impl of `FromA` for `T` diff --git a/src/test/ui/specialization/issue-52050.stderr b/src/test/ui/specialization/issue-52050.stderr index 9187d04cfce6..dcb34f3ad483 100644 --- a/src/test/ui/specialization/issue-52050.stderr +++ b/src/test/ui/specialization/issue-52050.stderr @@ -8,7 +8,7 @@ LL | | { LL | | } | |_- first implementation here LL | -LL | impl IntoPyDictPointer for () //~ ERROR conflicting implementations +LL | impl IntoPyDictPointer for () | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()` | = note: upstream crates may add new impl of trait `std::iter::Iterator` for type `()` in future versions diff --git a/src/test/ui/specialization/specialization-default-projection.stderr b/src/test/ui/specialization/specialization-default-projection.stderr index b781c35ea391..ab0bdc44cff1 100644 --- a/src/test/ui/specialization/specialization-default-projection.stderr +++ b/src/test/ui/specialization/specialization-default-projection.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn generic() -> ::Assoc { | ----------------- expected `::Assoc` because of return type ... -LL | () //~ ERROR mismatched types +LL | () | ^^ expected associated type, found () | = note: expected type `::Assoc` @@ -16,7 +16,7 @@ error[E0308]: mismatched types LL | fn monomorphic() -> () { | -- expected `()` because of return type ... -LL | generic::<()>() //~ ERROR mismatched types +LL | generic::<()>() | ^^^^^^^^^^^^^^^- help: try adding a semicolon: `;` | | | expected (), found associated type diff --git a/src/test/ui/specialization/specialization-default-types.stderr b/src/test/ui/specialization/specialization-default-types.stderr index 3b4ae2d82177..1192b0e5cfa5 100644 --- a/src/test/ui/specialization/specialization-default-types.stderr +++ b/src/test/ui/specialization/specialization-default-types.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | default fn generate(self) -> Self::Output { | ------------ expected `::Output` because of return type -LL | Box::new(self) //~ ERROR mismatched types +LL | Box::new(self) | ^^^^^^^^^^^^^^ expected associated type, found struct `std::boxed::Box` | = note: expected type `::Output` @@ -14,7 +14,7 @@ error[E0308]: mismatched types | LL | fn trouble(t: T) -> Box { | ------ expected `std::boxed::Box` because of return type -LL | Example::generate(t) //~ ERROR mismatched types +LL | Example::generate(t) | ^^^^^^^^^^^^^^^^^^^^ expected struct `std::boxed::Box`, found associated type | = note: expected type `std::boxed::Box` diff --git a/src/test/ui/specialization/specialization-feature-gate-default.stderr b/src/test/ui/specialization/specialization-feature-gate-default.stderr index 13d656bd060e..ad33908eff63 100644 --- a/src/test/ui/specialization/specialization-feature-gate-default.stderr +++ b/src/test/ui/specialization/specialization-feature-gate-default.stderr @@ -1,7 +1,7 @@ error[E0658]: specialization is unstable (see issue #31844) --> $DIR/specialization-feature-gate-default.rs:10:5 | -LL | default fn foo(&self) {} //~ ERROR specialization is unstable +LL | default fn foo(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(specialization)] to the crate attributes to enable diff --git a/src/test/ui/specialization/specialization-feature-gate-overlap.stderr b/src/test/ui/specialization/specialization-feature-gate-overlap.stderr index d6714375d16e..baaf7aa43321 100644 --- a/src/test/ui/specialization/specialization-feature-gate-overlap.stderr +++ b/src/test/ui/specialization/specialization-feature-gate-overlap.stderr @@ -4,7 +4,7 @@ error[E0119]: conflicting implementations of trait `Foo` for type `u8`: LL | impl Foo for T { | ----------------- first implementation here ... -LL | impl Foo for u8 { //~ ERROR E0119 +LL | impl Foo for u8 { | ^^^^^^^^^^^^^^^ conflicting implementation for `u8` error: aborting due to previous error diff --git a/src/test/ui/specialization/specialization-no-default.stderr b/src/test/ui/specialization/specialization-no-default.stderr index c57f98ac74de..c39986de38dc 100644 --- a/src/test/ui/specialization/specialization-no-default.stderr +++ b/src/test/ui/specialization/specialization-no-default.stderr @@ -7,7 +7,7 @@ LL | | fn bar(&self) {} LL | | } | |_- parent `impl` is here ... -LL | fn foo(&self) {} //~ ERROR E0520 +LL | fn foo(&self) {} | ^^^^^^^^^^^^^^^^ cannot specialize default item `foo` | = note: to specialize, `foo` in the parent `impl` must be marked `default` @@ -21,7 +21,7 @@ LL | | fn bar(&self) {} LL | | } | |_- parent `impl` is here ... -LL | fn bar(&self) {} //~ ERROR E0520 +LL | fn bar(&self) {} | ^^^^^^^^^^^^^^^^ cannot specialize default item `bar` | = note: to specialize, `bar` in the parent `impl` must be marked `default` @@ -34,7 +34,7 @@ LL | | type T = u8; LL | | } | |_- parent `impl` is here ... -LL | type T = (); //~ ERROR E0520 +LL | type T = (); | ^^^^^^^^^^^^ cannot specialize default item `T` | = note: to specialize, `T` in the parent `impl` must be marked `default` @@ -47,7 +47,7 @@ LL | | fn baz(&self) {} LL | | } | |_- parent `impl` is here ... -LL | fn baz(&self) {} //~ ERROR E0520 +LL | fn baz(&self) {} | ^^^^^^^^^^^^^^^^ cannot specialize default item `baz` | = note: to specialize, `baz` in the parent `impl` must be marked `default` @@ -60,7 +60,7 @@ LL | | fn redundant(&self) {} LL | | } | |_- parent `impl` is here ... -LL | default fn redundant(&self) {} //~ ERROR E0520 +LL | default fn redundant(&self) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `redundant` | = note: to specialize, `redundant` in the parent `impl` must be marked `default` diff --git a/src/test/ui/specialization/specialization-overlap-negative.stderr b/src/test/ui/specialization/specialization-overlap-negative.stderr index b9ab1bd637cc..947aad824ea8 100644 --- a/src/test/ui/specialization/specialization-overlap-negative.stderr +++ b/src/test/ui/specialization/specialization-overlap-negative.stderr @@ -3,7 +3,7 @@ error[E0119]: conflicting implementations of trait `std::marker::Send` for type | LL | unsafe impl Send for TestType {} | ------------------------------------------ first implementation here -LL | impl !Send for TestType {} //~ ERROR E0119 +LL | impl !Send for TestType {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>` error: aborting due to previous error diff --git a/src/test/ui/specialization/specialization-overlap.stderr b/src/test/ui/specialization/specialization-overlap.stderr index eef8cb44b888..4275e7bdd85e 100644 --- a/src/test/ui/specialization/specialization-overlap.stderr +++ b/src/test/ui/specialization/specialization-overlap.stderr @@ -3,7 +3,7 @@ error[E0119]: conflicting implementations of trait `Foo` for type `std::vec::Vec | LL | impl Foo for T {} | ------------------------ first implementation here -LL | impl Foo for Vec {} //~ ERROR E0119 +LL | impl Foo for Vec {} | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::vec::Vec<_>` error[E0119]: conflicting implementations of trait `Bar` for type `(u8, u8)`: @@ -11,7 +11,7 @@ error[E0119]: conflicting implementations of trait `Bar` for type `(u8, u8)`: | LL | impl Bar for (T, u8) {} | ----------------------- first implementation here -LL | impl Bar for (u8, T) {} //~ ERROR E0119 +LL | impl Bar for (u8, T) {} | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(u8, u8)` error[E0119]: conflicting implementations of trait `Baz` for type `u8`: @@ -19,7 +19,7 @@ error[E0119]: conflicting implementations of trait `Baz` for type `u8`: | LL | impl Baz for u8 {} | --------------------- first implementation here -LL | impl Baz for T {} //~ ERROR E0119 +LL | impl Baz for T {} | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u8` error[E0119]: conflicting implementations of trait `Qux`: @@ -27,7 +27,7 @@ error[E0119]: conflicting implementations of trait `Qux`: | LL | impl Qux for T {} | ------------------------ first implementation here -LL | impl Qux for T {} //~ ERROR E0119 +LL | impl Qux for T {} | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation error: aborting due to 4 previous errors diff --git a/src/test/ui/specialization/specialization-polarity.stderr b/src/test/ui/specialization/specialization-polarity.stderr index d1f48b78864c..bc1b2aeb70fc 100644 --- a/src/test/ui/specialization/specialization-polarity.stderr +++ b/src/test/ui/specialization/specialization-polarity.stderr @@ -3,7 +3,7 @@ error[E0119]: conflicting implementations of trait `Foo` for type `u8`: | LL | impl Foo for T {} | ----------------- first implementation here -LL | impl !Foo for u8 {} //~ ERROR E0119 +LL | impl !Foo for u8 {} | ^^^^^^^^^^^^^^^^ conflicting implementation for `u8` error[E0119]: conflicting implementations of trait `Bar` for type `u8`: @@ -11,7 +11,7 @@ error[E0119]: conflicting implementations of trait `Bar` for type `u8`: | LL | impl !Bar for T {} | ------------------ first implementation here -LL | impl Bar for u8 {} //~ ERROR E0119 +LL | impl Bar for u8 {} | ^^^^^^^^^^^^^^^ conflicting implementation for `u8` error: aborting due to 2 previous errors diff --git a/src/test/ui/stability-attribute/missing-stability-attr-at-top-level.stderr b/src/test/ui/stability-attribute/missing-stability-attr-at-top-level.stderr index f67479769455..b6c9564e904c 100644 --- a/src/test/ui/stability-attribute/missing-stability-attr-at-top-level.stderr +++ b/src/test/ui/stability-attribute/missing-stability-attr-at-top-level.stderr @@ -2,7 +2,7 @@ error: crate has missing stability attribute --> $DIR/missing-stability-attr-at-top-level.rs:1:1 | LL | / #![feature(staged_api)] -LL | | //~^ ERROR crate has missing stability attribute +LL | | LL | | LL | | fn main() {} | |____________^ diff --git a/src/test/ui/stability-attribute/stability-attribute-issue-43027.stderr b/src/test/ui/stability-attribute/stability-attribute-issue-43027.stderr index 7ffb4bb487a7..280c72acccb1 100644 --- a/src/test/ui/stability-attribute/stability-attribute-issue-43027.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-issue-43027.stderr @@ -1,7 +1,7 @@ error: field has missing stability attribute --> $DIR/stability-attribute-issue-43027.rs:5:23 | -LL | pub struct Reverse(pub T); //~ ERROR field has missing stability attribute +LL | pub struct Reverse(pub T); | ^^^^^ error: aborting due to previous error diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr index cd8ea921d303..77f896a86d58 100644 --- a/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr @@ -1,19 +1,19 @@ error: stability attributes may not be used outside of the standard library --> $DIR/stability-attribute-non-staged-force-unstable.rs:3:1 | -LL | #[unstable()] //~ ERROR: stability attributes may not be used +LL | #[unstable()] | ^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/stability-attribute-non-staged-force-unstable.rs:4:1 | -LL | #[stable()] //~ ERROR: stability attributes may not be used +LL | #[stable()] | ^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/stability-attribute-non-staged-force-unstable.rs:5:1 | -LL | #[rustc_deprecated()] //~ ERROR: stability attributes may not be used +LL | #[rustc_deprecated()] | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr b/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr index 67f6ef857f17..e98f789f54c7 100644 --- a/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr @@ -1,19 +1,19 @@ error: stability attributes may not be used outside of the standard library --> $DIR/stability-attribute-non-staged.rs:1:1 | -LL | #[unstable()] //~ ERROR: stability attributes may not be used +LL | #[unstable()] | ^^^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/stability-attribute-non-staged.rs:2:1 | -LL | #[stable()] //~ ERROR: stability attributes may not be used +LL | #[stable()] | ^^^^^^^^^^^ error: stability attributes may not be used outside of the standard library --> $DIR/stability-attribute-non-staged.rs:3:1 | -LL | #[rustc_deprecated()] //~ ERROR: stability attributes may not be used +LL | #[rustc_deprecated()] | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-2.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity-2.stderr index 6f5c844a6571..2bc544d107da 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity-2.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-sanity-2.stderr @@ -1,19 +1,19 @@ error[E0538]: multiple 'feature' items --> $DIR/stability-attribute-sanity-2.rs:7:25 | -LL | #[stable(feature = "a", feature = "b", since = "1.0.0")] //~ ERROR multiple 'feature' items +LL | #[stable(feature = "a", feature = "b", since = "1.0.0")] | ^^^^^^^^^^^^^ error[E0541]: unknown meta item 'sinse' --> $DIR/stability-attribute-sanity-2.rs:10:25 | -LL | #[stable(feature = "a", sinse = "1.0.0")] //~ ERROR unknown meta item 'sinse' +LL | #[stable(feature = "a", sinse = "1.0.0")] | ^^^^^^^^^^^^^^^ expected one of `since`, `note` error[E0545]: incorrect 'issue' --> $DIR/stability-attribute-sanity-2.rs:13:1 | -LL | #[unstable(feature = "a", issue = "no")] //~ ERROR incorrect 'issue' +LL | #[unstable(feature = "a", issue = "no")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-3.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity-3.stderr index 1c759d49b994..b1c56ef224ae 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity-3.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-sanity-3.stderr @@ -1,7 +1,7 @@ error: macro has missing stability attribute --> $DIR/stability-attribute-sanity-3.rs:8:1 | -LL | / macro_rules! mac { //~ ERROR macro has missing stability attribute +LL | / macro_rules! mac { LL | | () => () LL | | } | |_^ diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-4.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity-4.stderr index 4b4efe9d8cad..d85b628c3c34 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity-4.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-sanity-4.stderr @@ -1,37 +1,37 @@ error: attribute must be of the form `#[unstable(feature = "name", reason = "...", issue = "N")]` --> $DIR/stability-attribute-sanity-4.rs:8:5 | -LL | #[unstable] //~ ERROR attribute must be of the form +LL | #[unstable] | ^^^^^^^^^^^ error: attribute must be of the form `#[unstable(feature = "name", reason = "...", issue = "N")]` --> $DIR/stability-attribute-sanity-4.rs:11:5 | -LL | #[unstable = "b"] //~ ERROR attribute must be of the form +LL | #[unstable = "b"] | ^^^^^^^^^^^^^^^^^ error: attribute must be of the form `#[stable(feature = "name", since = "version")]` --> $DIR/stability-attribute-sanity-4.rs:14:5 | -LL | #[stable] //~ ERROR attribute must be of the form +LL | #[stable] | ^^^^^^^^^ error: attribute must be of the form `#[stable(feature = "name", since = "version")]` --> $DIR/stability-attribute-sanity-4.rs:17:5 | -LL | #[stable = "a"] //~ ERROR attribute must be of the form +LL | #[stable = "a"] | ^^^^^^^^^^^^^^^ error: attribute must be of the form `#[rustc_deprecated(since = "version", reason = "...")]` --> $DIR/stability-attribute-sanity-4.rs:21:5 | -LL | #[rustc_deprecated] //~ ERROR attribute must be of the form +LL | #[rustc_deprecated] | ^^^^^^^^^^^^^^^^^^^ error: attribute must be of the form `#[rustc_deprecated(since = "version", reason = "...")]` --> $DIR/stability-attribute-sanity-4.rs:25:5 | -LL | #[rustc_deprecated = "a"] //~ ERROR attribute must be of the form +LL | #[rustc_deprecated = "a"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity.stderr index 74c1bbfed6f7..5343e3bd537f 100644 --- a/src/test/ui/stability-attribute/stability-attribute-sanity.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-sanity.stderr @@ -1,97 +1,97 @@ error[E0541]: unknown meta item 'reason' --> $DIR/stability-attribute-sanity.rs:8:42 | -LL | #[stable(feature = "a", since = "b", reason)] //~ ERROR unknown meta item 'reason' [E0541] +LL | #[stable(feature = "a", since = "b", reason)] | ^^^^^^ expected one of `since`, `note` error[E0539]: incorrect meta item --> $DIR/stability-attribute-sanity.rs:11:29 | -LL | #[stable(feature = "a", since)] //~ ERROR incorrect meta item [E0539] +LL | #[stable(feature = "a", since)] | ^^^^^ error[E0539]: incorrect meta item --> $DIR/stability-attribute-sanity.rs:14:14 | -LL | #[stable(feature, since = "a")] //~ ERROR incorrect meta item [E0539] +LL | #[stable(feature, since = "a")] | ^^^^^^^ error[E0539]: incorrect meta item --> $DIR/stability-attribute-sanity.rs:17:29 | -LL | #[stable(feature = "a", since(b))] //~ ERROR incorrect meta item [E0539] +LL | #[stable(feature = "a", since(b))] | ^^^^^^^^ error[E0539]: incorrect meta item --> $DIR/stability-attribute-sanity.rs:20:14 | -LL | #[stable(feature(b), since = "a")] //~ ERROR incorrect meta item [E0539] +LL | #[stable(feature(b), since = "a")] | ^^^^^^^^^^ error[E0546]: missing 'feature' --> $DIR/stability-attribute-sanity.rs:25:5 | -LL | #[unstable(issue = "0")] //~ ERROR missing 'feature' [E0546] +LL | #[unstable(issue = "0")] | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0547]: missing 'issue' --> $DIR/stability-attribute-sanity.rs:28:5 | -LL | #[unstable(feature = "b")] //~ ERROR missing 'issue' [E0547] +LL | #[unstable(feature = "b")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0546]: missing 'feature' --> $DIR/stability-attribute-sanity.rs:31:5 | -LL | #[stable(since = "a")] //~ ERROR missing 'feature' [E0546] +LL | #[stable(since = "a")] | ^^^^^^^^^^^^^^^^^^^^^^ error[E0542]: missing 'since' --> $DIR/stability-attribute-sanity.rs:36:5 | -LL | #[stable(feature = "a")] //~ ERROR missing 'since' [E0542] +LL | #[stable(feature = "a")] | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0542]: missing 'since' --> $DIR/stability-attribute-sanity.rs:40:5 | -LL | #[rustc_deprecated(reason = "a")] //~ ERROR missing 'since' [E0542] +LL | #[rustc_deprecated(reason = "a")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0544]: multiple stability levels --> $DIR/stability-attribute-sanity.rs:45:1 | -LL | #[stable(feature = "a", since = "b")] //~ ERROR multiple stability levels [E0544] +LL | #[stable(feature = "a", since = "b")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0544]: multiple stability levels --> $DIR/stability-attribute-sanity.rs:49:1 | -LL | #[unstable(feature = "b", issue = "0")] //~ ERROR multiple stability levels [E0544] +LL | #[unstable(feature = "b", issue = "0")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0544]: multiple stability levels --> $DIR/stability-attribute-sanity.rs:53:1 | -LL | #[stable(feature = "a", since = "b")] //~ ERROR multiple stability levels [E0544] +LL | #[stable(feature = "a", since = "b")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0540]: multiple rustc_deprecated attributes --> $DIR/stability-attribute-sanity.rs:61:1 | -LL | pub const fn multiple4() { } //~ ERROR multiple rustc_deprecated attributes [E0540] +LL | pub const fn multiple4() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0553]: multiple rustc_const_unstable attributes --> $DIR/stability-attribute-sanity.rs:61:1 | -LL | pub const fn multiple4() { } //~ ERROR multiple rustc_deprecated attributes [E0540] +LL | pub const fn multiple4() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: Invalid stability or deprecation version found --> $DIR/stability-attribute-sanity.rs:61:1 | -LL | pub const fn multiple4() { } //~ ERROR multiple rustc_deprecated attributes [E0540] +LL | pub const fn multiple4() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0549]: rustc_deprecated attribute must be paired with either stable or unstable attribute diff --git a/src/test/ui/static/static-items-cant-move.stderr b/src/test/ui/static/static-items-cant-move.stderr index 1ac772a46018..fc1ed9b8d613 100644 --- a/src/test/ui/static/static-items-cant-move.stderr +++ b/src/test/ui/static/static-items-cant-move.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of static item --> $DIR/static-items-cant-move.rs:18:10 | -LL | test(BAR); //~ ERROR cannot move out of static item +LL | test(BAR); | ^^^ cannot move out of static item error: aborting due to previous error diff --git a/src/test/ui/static/static-lifetime-bound.nll.stderr b/src/test/ui/static/static-lifetime-bound.nll.stderr index 9a8a344cbd87..90d728204e70 100644 --- a/src/test/ui/static/static-lifetime-bound.nll.stderr +++ b/src/test/ui/static/static-lifetime-bound.nll.stderr @@ -1,7 +1,7 @@ warning: unnecessary lifetime parameter `'a` --> $DIR/static-lifetime-bound.rs:1:6 | -LL | fn f<'a: 'static>(_: &'a i32) {} //~WARN unnecessary lifetime parameter `'a` +LL | fn f<'a: 'static>(_: &'a i32) {} | ^^^^^^^^^^^ | = help: you can use the `'static` lifetime directly, in place of `'a` @@ -9,7 +9,7 @@ LL | fn f<'a: 'static>(_: &'a i32) {} //~WARN unnecessary lifetime parameter `'a error[E0597]: `x` does not live long enough --> $DIR/static-lifetime-bound.rs:5:7 | -LL | f(&x); //~ERROR does not live long enough +LL | f(&x); | --^^- | | | | | borrowed value does not live long enough diff --git a/src/test/ui/static/static-lifetime-bound.stderr b/src/test/ui/static/static-lifetime-bound.stderr index dc8e83610d4b..b9aa4d8722bf 100644 --- a/src/test/ui/static/static-lifetime-bound.stderr +++ b/src/test/ui/static/static-lifetime-bound.stderr @@ -1,7 +1,7 @@ warning: unnecessary lifetime parameter `'a` --> $DIR/static-lifetime-bound.rs:1:6 | -LL | fn f<'a: 'static>(_: &'a i32) {} //~WARN unnecessary lifetime parameter `'a` +LL | fn f<'a: 'static>(_: &'a i32) {} | ^^^^^^^^^^^ | = help: you can use the `'static` lifetime directly, in place of `'a` @@ -9,7 +9,7 @@ LL | fn f<'a: 'static>(_: &'a i32) {} //~WARN unnecessary lifetime parameter `'a error[E0597]: `x` does not live long enough --> $DIR/static-lifetime-bound.rs:5:8 | -LL | f(&x); //~ERROR does not live long enough +LL | f(&x); | ^ borrowed value does not live long enough LL | } | - borrowed value only lives until here diff --git a/src/test/ui/static/static-lifetime.stderr b/src/test/ui/static/static-lifetime.stderr index 65c60ceb2e37..8516ac07b6cf 100644 --- a/src/test/ui/static/static-lifetime.stderr +++ b/src/test/ui/static/static-lifetime.stderr @@ -1,13 +1,13 @@ error[E0478]: lifetime bound not satisfied --> $DIR/static-lifetime.rs:3:20 | -LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} //~ ERROR lifetime bound +LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} | ^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime 'a as defined on the impl at 3:6 --> $DIR/static-lifetime.rs:3:6 | -LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} //~ ERROR lifetime bound +LL | impl<'a, A: Clone> Arbitrary for ::std::borrow::Cow<'a, A> {} | ^^ = note: but lifetime parameter must outlive the static lifetime diff --git a/src/test/ui/static/static-method-privacy.stderr b/src/test/ui/static/static-method-privacy.stderr index c72295f97ca1..14ca9f58301e 100644 --- a/src/test/ui/static/static-method-privacy.stderr +++ b/src/test/ui/static/static-method-privacy.stderr @@ -1,7 +1,7 @@ error[E0624]: method `new` is private --> $DIR/static-method-privacy.rs:9:13 | -LL | let _ = a::S::new(); //~ ERROR method `new` is private +LL | let _ = a::S::new(); | ^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/static/static-mut-bad-types.stderr b/src/test/ui/static/static-mut-bad-types.stderr index e97165705ca7..88d62011fc4e 100644 --- a/src/test/ui/static/static-mut-bad-types.stderr +++ b/src/test/ui/static/static-mut-bad-types.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/static-mut-bad-types.rs:5:13 | -LL | a = true; //~ ERROR: mismatched types +LL | a = true; | ^^^^ expected isize, found bool error: aborting due to previous error diff --git a/src/test/ui/static/static-mut-foreign-requires-unsafe.stderr b/src/test/ui/static/static-mut-foreign-requires-unsafe.stderr index 9964e1d98b11..e7ed0b710b2f 100644 --- a/src/test/ui/static/static-mut-foreign-requires-unsafe.stderr +++ b/src/test/ui/static/static-mut-foreign-requires-unsafe.stderr @@ -1,7 +1,7 @@ error[E0133]: use of mutable static is unsafe and requires unsafe function or block --> $DIR/static-mut-foreign-requires-unsafe.rs:6:5 | -LL | a += 3; //~ ERROR: requires unsafe +LL | a += 3; | ^^^^^^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior @@ -9,7 +9,7 @@ LL | a += 3; //~ ERROR: requires unsafe error[E0133]: use of mutable static is unsafe and requires unsafe function or block --> $DIR/static-mut-foreign-requires-unsafe.rs:7:5 | -LL | a = 4; //~ ERROR: requires unsafe +LL | a = 4; | ^^^^^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior @@ -17,7 +17,7 @@ LL | a = 4; //~ ERROR: requires unsafe error[E0133]: use of mutable static is unsafe and requires unsafe function or block --> $DIR/static-mut-foreign-requires-unsafe.rs:8:14 | -LL | let _b = a; //~ ERROR: requires unsafe +LL | let _b = a; | ^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior diff --git a/src/test/ui/static/static-mut-not-pat.stderr b/src/test/ui/static/static-mut-not-pat.stderr index 0714df0d11dc..33c1cd6a5950 100644 --- a/src/test/ui/static/static-mut-not-pat.stderr +++ b/src/test/ui/static/static-mut-not-pat.stderr @@ -4,7 +4,7 @@ error[E0530]: match bindings cannot shadow statics LL | static mut a: isize = 3; | ------------------------ the static `a` is defined here ... -LL | a => {} //~ ERROR match bindings cannot shadow statics +LL | a => {} | ^ cannot be named the same as a static error[E0530]: match bindings cannot shadow statics diff --git a/src/test/ui/static/static-mut-requires-unsafe.stderr b/src/test/ui/static/static-mut-requires-unsafe.stderr index 66ee6989b01e..85e468b333c2 100644 --- a/src/test/ui/static/static-mut-requires-unsafe.stderr +++ b/src/test/ui/static/static-mut-requires-unsafe.stderr @@ -1,7 +1,7 @@ error[E0133]: use of mutable static is unsafe and requires unsafe function or block --> $DIR/static-mut-requires-unsafe.rs:4:5 | -LL | a += 3; //~ ERROR: requires unsafe +LL | a += 3; | ^^^^^^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior @@ -9,7 +9,7 @@ LL | a += 3; //~ ERROR: requires unsafe error[E0133]: use of mutable static is unsafe and requires unsafe function or block --> $DIR/static-mut-requires-unsafe.rs:5:5 | -LL | a = 4; //~ ERROR: requires unsafe +LL | a = 4; | ^^^^^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior @@ -17,7 +17,7 @@ LL | a = 4; //~ ERROR: requires unsafe error[E0133]: use of mutable static is unsafe and requires unsafe function or block --> $DIR/static-mut-requires-unsafe.rs:6:14 | -LL | let _b = a; //~ ERROR: requires unsafe +LL | let _b = a; | ^ use of mutable static | = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior diff --git a/src/test/ui/static/static-reference-to-fn-1.stderr b/src/test/ui/static/static-reference-to-fn-1.stderr index 84cd6db4c4a9..f6d2385ac69a 100644 --- a/src/test/ui/static/static-reference-to-fn-1.stderr +++ b/src/test/ui/static/static-reference-to-fn-1.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/static-reference-to-fn-1.rs:17:15 | -LL | func: &foo, //~ ERROR mismatched types +LL | func: &foo, | ^^^^ expected fn pointer, found fn item | = note: expected type `&fn() -> std::option::Option` diff --git a/src/test/ui/static/static-reference-to-fn-2.nll.stderr b/src/test/ui/static/static-reference-to-fn-2.nll.stderr index 2e00c9491d7c..07c8b48eb1d9 100644 --- a/src/test/ui/static/static-reference-to-fn-2.nll.stderr +++ b/src/test/ui/static/static-reference-to-fn-2.nll.stderr @@ -37,7 +37,7 @@ error[E0515]: cannot return value referencing temporary value LL | / StateMachineIter { LL | | statefn: &id(state1 as StateMachineFunc) | | ------------------------------ temporary value created here -LL | | //~^ ERROR borrowed value does not live long enough +LL | | LL | | } | |_____^ returns a value referencing data owned by the current function diff --git a/src/test/ui/static/static-reference-to-fn-2.stderr b/src/test/ui/static/static-reference-to-fn-2.stderr index d94913c7e222..17d4a3612578 100644 --- a/src/test/ui/static/static-reference-to-fn-2.stderr +++ b/src/test/ui/static/static-reference-to-fn-2.stderr @@ -11,7 +11,7 @@ note: borrowed value must be valid for the anonymous lifetime #2 defined on the | LL | / fn state1(self_: &mut StateMachineIter) -> Option<&'static str> { LL | | self_.statefn = &id(state2 as StateMachineFunc); -LL | | //~^ ERROR borrowed value does not live long enough +LL | | LL | | return Some("state1"); LL | | } | |_^ @@ -30,7 +30,7 @@ note: borrowed value must be valid for the anonymous lifetime #2 defined on the | LL | / fn state2(self_: &mut StateMachineIter) -> Option<(&'static str)> { LL | | self_.statefn = &id(state3 as StateMachineFunc); -LL | | //~^ ERROR borrowed value does not live long enough +LL | | LL | | return Some("state2"); LL | | } | |_^ @@ -49,7 +49,7 @@ note: borrowed value must be valid for the anonymous lifetime #2 defined on the | LL | / fn state3(self_: &mut StateMachineIter) -> Option<(&'static str)> { LL | | self_.statefn = &id(finished as StateMachineFunc); -LL | | //~^ ERROR borrowed value does not live long enough +LL | | LL | | return Some("state3"); LL | | } | |_^ diff --git a/src/test/ui/static/static-region-bound.nll.stderr b/src/test/ui/static/static-region-bound.nll.stderr index 0a5686051cda..15261259ed41 100644 --- a/src/test/ui/static/static-region-bound.nll.stderr +++ b/src/test/ui/static/static-region-bound.nll.stderr @@ -1,7 +1,7 @@ error[E0716]: temporary value dropped while borrowed --> $DIR/static-region-bound.rs:10:14 | -LL | let x = &id(3); //~ ERROR borrowed value does not live long enough +LL | let x = &id(3); | ^^^^^ creates a temporary which is freed while still in use LL | f(x); | ---- argument requires that borrow lasts for `'static` diff --git a/src/test/ui/static/static-region-bound.stderr b/src/test/ui/static/static-region-bound.stderr index 611f47ddfde7..f6bbfcecf6f1 100644 --- a/src/test/ui/static/static-region-bound.stderr +++ b/src/test/ui/static/static-region-bound.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/static-region-bound.rs:10:14 | -LL | let x = &id(3); //~ ERROR borrowed value does not live long enough +LL | let x = &id(3); | ^^^^^ temporary value does not live long enough LL | f(x); LL | } diff --git a/src/test/ui/std-uncopyable-atomics.nll.stderr b/src/test/ui/std-uncopyable-atomics.nll.stderr index 0a5e7c64b1a8..8241f6f1fdbc 100644 --- a/src/test/ui/std-uncopyable-atomics.nll.stderr +++ b/src/test/ui/std-uncopyable-atomics.nll.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:9:13 | -LL | let x = *&x; //~ ERROR: cannot move out of borrowed content +LL | let x = *&x; | ^^^ | | | cannot move out of borrowed content @@ -10,7 +10,7 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:11:13 | -LL | let x = *&x; //~ ERROR: cannot move out of borrowed content +LL | let x = *&x; | ^^^ | | | cannot move out of borrowed content @@ -19,7 +19,7 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:13:13 | -LL | let x = *&x; //~ ERROR: cannot move out of borrowed content +LL | let x = *&x; | ^^^ | | | cannot move out of borrowed content @@ -28,7 +28,7 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:15:13 | -LL | let x = *&x; //~ ERROR: cannot move out of borrowed content +LL | let x = *&x; | ^^^ | | | cannot move out of borrowed content diff --git a/src/test/ui/std-uncopyable-atomics.stderr b/src/test/ui/std-uncopyable-atomics.stderr index ecf9963c145f..7f01434838c1 100644 --- a/src/test/ui/std-uncopyable-atomics.stderr +++ b/src/test/ui/std-uncopyable-atomics.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:9:13 | -LL | let x = *&x; //~ ERROR: cannot move out of borrowed content +LL | let x = *&x; | ^^^ | | | cannot move out of borrowed content @@ -10,7 +10,7 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:11:13 | -LL | let x = *&x; //~ ERROR: cannot move out of borrowed content +LL | let x = *&x; | ^^^ | | | cannot move out of borrowed content @@ -19,7 +19,7 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:13:13 | -LL | let x = *&x; //~ ERROR: cannot move out of borrowed content +LL | let x = *&x; | ^^^ | | | cannot move out of borrowed content @@ -28,7 +28,7 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:15:13 | -LL | let x = *&x; //~ ERROR: cannot move out of borrowed content +LL | let x = *&x; | ^^^ | | | cannot move out of borrowed content diff --git a/src/test/ui/stmt_expr_attrs_no_feature.stderr b/src/test/ui/stmt_expr_attrs_no_feature.stderr index c4d735915a16..c644126535d3 100644 --- a/src/test/ui/stmt_expr_attrs_no_feature.stderr +++ b/src/test/ui/stmt_expr_attrs_no_feature.stderr @@ -1,7 +1,7 @@ error[E0658]: attributes on expressions are experimental. (see issue #15701) --> $DIR/stmt_expr_attrs_no_feature.rs:13:5 | -LL | #[attr] //~ ERROR attributes on expressions are experimental +LL | #[attr] | ^^^^^^^ | = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #[attr] //~ ERROR attributes on expressions are experimental error[E0658]: attributes on expressions are experimental. (see issue #15701) --> $DIR/stmt_expr_attrs_no_feature.rs:94:18 | -LL | fn y(a: [u8; #[attr] 5]); //~ ERROR 15701 +LL | fn y(a: [u8; #[attr] 5]); | ^^^^^^^ | = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | fn y(a: [u8; #[attr] 5]); //~ ERROR 15701 error[E0658]: attributes on expressions are experimental. (see issue #15701) --> $DIR/stmt_expr_attrs_no_feature.rs:101:19 | -LL | const Y: u8 = #[attr] 5; //~ ERROR 15701 +LL | const Y: u8 = #[attr] 5; | ^^^^^^^ | = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | const Y: u8 = #[attr] 5; //~ ERROR 15701 error[E0658]: attributes on expressions are experimental. (see issue #15701) --> $DIR/stmt_expr_attrs_no_feature.rs:107:19 | -LL | const Y: [u8; #[attr] 5]; //~ ERROR 15701 +LL | const Y: [u8; #[attr] 5]; | ^^^^^^^ | = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable @@ -33,7 +33,7 @@ LL | const Y: [u8; #[attr] 5]; //~ ERROR 15701 error[E0658]: attributes on expressions are experimental. (see issue #15701) --> $DIR/stmt_expr_attrs_no_feature.rs:113:18 | -LL | field2: [u8; #[attr] 5] //~ ERROR 15701 +LL | field2: [u8; #[attr] 5] | ^^^^^^^ | = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable @@ -41,7 +41,7 @@ LL | field2: [u8; #[attr] 5] //~ ERROR 15701 error[E0658]: attributes on expressions are experimental. (see issue #15701) --> $DIR/stmt_expr_attrs_no_feature.rs:118:10 | -LL | [u8; #[attr] 5] //~ ERROR 15701 +LL | [u8; #[attr] 5] | ^^^^^^^ | = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable @@ -49,7 +49,7 @@ LL | [u8; #[attr] 5] //~ ERROR 15701 error[E0658]: attributes on expressions are experimental. (see issue #15701) --> $DIR/stmt_expr_attrs_no_feature.rs:124:14 | -LL | [u8; #[attr] 5] //~ ERROR 15701 +LL | [u8; #[attr] 5] | ^^^^^^^ | = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable @@ -57,7 +57,7 @@ LL | [u8; #[attr] 5] //~ ERROR 15701 error[E0658]: attributes on expressions are experimental. (see issue #15701) --> $DIR/stmt_expr_attrs_no_feature.rs:129:22 | -LL | field2: [u8; #[attr] 5] //~ ERROR 15701 +LL | field2: [u8; #[attr] 5] | ^^^^^^^ | = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable @@ -65,7 +65,7 @@ LL | field2: [u8; #[attr] 5] //~ ERROR 15701 error[E0658]: attributes on expressions are experimental. (see issue #15701) --> $DIR/stmt_expr_attrs_no_feature.rs:137:14 | -LL | 6 => #[attr] (), //~ ERROR 15701 +LL | 6 => #[attr] (), | ^^^^^^^ | = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable diff --git a/src/test/ui/str/str-as-char.stderr b/src/test/ui/str/str-as-char.stderr index 4ca430a4cde9..162f0888a294 100644 --- a/src/test/ui/str/str-as-char.stderr +++ b/src/test/ui/str/str-as-char.stderr @@ -1,21 +1,21 @@ error: character literal may only contain one codepoint --> $DIR/str-as-char.rs:4:14 | -LL | println!('●●'); //~ ERROR character literal may only contain one codepoint +LL | println!('●●'); | ^^^^ help: if you meant to write a `str` literal, use double quotes | -LL | println!("●●"); //~ ERROR character literal may only contain one codepoint +LL | println!("●●"); | ^^^^ error: format argument must be a string literal --> $DIR/str-as-char.rs:4:14 | -LL | println!('●●'); //~ ERROR character literal may only contain one codepoint +LL | println!('●●'); | ^^^^ help: you might be missing a string literal to format with | -LL | println!("{}", '●●'); //~ ERROR character literal may only contain one codepoint +LL | println!("{}", '●●'); | ^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/str/str-idx.stderr b/src/test/ui/str/str-idx.stderr index 99df85d92fd9..e388534f132d 100644 --- a/src/test/ui/str/str-idx.stderr +++ b/src/test/ui/str/str-idx.stderr @@ -1,7 +1,7 @@ error[E0277]: the type `str` cannot be indexed by `{integer}` --> $DIR/str-idx.rs:3:17 | -LL | let _: u8 = s[4]; //~ ERROR the type `str` cannot be indexed by `{integer}` +LL | let _: u8 = s[4]; | ^^^^ string indices are ranges of `usize` | = help: the trait `std::slice::SliceIndex` is not implemented for `{integer}` @@ -12,7 +12,7 @@ LL | let _: u8 = s[4]; //~ ERROR the type `str` cannot be indexed by `{integ error[E0277]: the type `str` cannot be indexed by `{integer}` --> $DIR/str-idx.rs:4:15 | -LL | let _ = s.get(4); //~ ERROR the type `str` cannot be indexed by `{integer}` +LL | let _ = s.get(4); | ^^^ string indices are ranges of `usize` | = help: the trait `std::slice::SliceIndex` is not implemented for `{integer}` @@ -22,7 +22,7 @@ LL | let _ = s.get(4); //~ ERROR the type `str` cannot be indexed by `{integ error[E0277]: the type `str` cannot be indexed by `{integer}` --> $DIR/str-idx.rs:5:15 | -LL | let _ = s.get_unchecked(4); //~ ERROR the type `str` cannot be indexed by `{integer}` +LL | let _ = s.get_unchecked(4); | ^^^^^^^^^^^^^ string indices are ranges of `usize` | = help: the trait `std::slice::SliceIndex` is not implemented for `{integer}` @@ -32,7 +32,7 @@ LL | let _ = s.get_unchecked(4); //~ ERROR the type `str` cannot be indexed error[E0277]: the type `str` cannot be indexed by `char` --> $DIR/str-idx.rs:6:17 | -LL | let _: u8 = s['c']; //~ ERROR the type `str` cannot be indexed by `char` +LL | let _: u8 = s['c']; | ^^^^^^ string indices are ranges of `usize` | = help: the trait `std::slice::SliceIndex` is not implemented for `char` diff --git a/src/test/ui/str/str-lit-type-mismatch.stderr b/src/test/ui/str/str-lit-type-mismatch.stderr index c14e9090fef9..ef40faa8e26e 100644 --- a/src/test/ui/str/str-lit-type-mismatch.stderr +++ b/src/test/ui/str/str-lit-type-mismatch.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/str-lit-type-mismatch.rs:2:20 | -LL | let x: &[u8] = "foo"; //~ ERROR mismatched types +LL | let x: &[u8] = "foo"; | ^^^^^ | | | expected slice, found str @@ -13,7 +13,7 @@ LL | let x: &[u8] = "foo"; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/str-lit-type-mismatch.rs:3:23 | -LL | let y: &[u8; 4] = "baaa"; //~ ERROR mismatched types +LL | let y: &[u8; 4] = "baaa"; | ^^^^^^ | | | expected array of 4 elements, found str @@ -25,7 +25,7 @@ LL | let y: &[u8; 4] = "baaa"; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/str-lit-type-mismatch.rs:4:19 | -LL | let z: &str = b"foo"; //~ ERROR mismatched types +LL | let z: &str = b"foo"; | ^^^^^^ | | | expected str, found array of 3 elements diff --git a/src/test/ui/structs/struct-base-wrong-type-2.stderr b/src/test/ui/structs/struct-base-wrong-type-2.stderr index b15ea51bb2d4..d02ed205e927 100644 --- a/src/test/ui/structs/struct-base-wrong-type-2.stderr +++ b/src/test/ui/structs/struct-base-wrong-type-2.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/struct-base-wrong-type-2.rs:11:27 | -LL | let f = Foo { a: 2, ..b }; //~ ERROR mismatched types +LL | let f = Foo { a: 2, ..b }; | ^ expected struct `Foo`, found struct `Bar` | = note: expected type `Foo` @@ -10,7 +10,7 @@ LL | let f = Foo { a: 2, ..b }; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/struct-base-wrong-type-2.rs:15:34 | -LL | let f__isize = Foo { a: 2, ..4 }; //~ ERROR mismatched types +LL | let f__isize = Foo { a: 2, ..4 }; | ^ expected struct `Foo`, found integer | = note: expected type `Foo` diff --git a/src/test/ui/structs/struct-base-wrong-type.stderr b/src/test/ui/structs/struct-base-wrong-type.stderr index 045eb610f7d1..2491296c5eff 100644 --- a/src/test/ui/structs/struct-base-wrong-type.stderr +++ b/src/test/ui/structs/struct-base-wrong-type.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/struct-base-wrong-type.rs:10:33 | -LL | static foo: Foo = Foo { a: 2, ..bar }; //~ ERROR mismatched types +LL | static foo: Foo = Foo { a: 2, ..bar }; | ^^^ expected struct `Foo`, found struct `Bar` | = note: expected type `Foo` @@ -10,7 +10,7 @@ LL | static foo: Foo = Foo { a: 2, ..bar }; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/struct-base-wrong-type.rs:14:35 | -LL | static foo_i: Foo = Foo { a: 2, ..4 }; //~ ERROR mismatched types +LL | static foo_i: Foo = Foo { a: 2, ..4 }; | ^ expected struct `Foo`, found integer | = note: expected type `Foo` diff --git a/src/test/ui/structs/struct-field-privacy.stderr b/src/test/ui/structs/struct-field-privacy.stderr index 5e30a4e403de..91d000b8672e 100644 --- a/src/test/ui/structs/struct-field-privacy.stderr +++ b/src/test/ui/structs/struct-field-privacy.stderr @@ -1,31 +1,31 @@ error[E0616]: field `a` of struct `inner::A` is private --> $DIR/struct-field-privacy.rs:23:5 | -LL | b.a; //~ ERROR: field `a` of struct `inner::A` is private +LL | b.a; | ^^^ error[E0616]: field `b` of struct `inner::B` is private --> $DIR/struct-field-privacy.rs:26:5 | -LL | c.b; //~ ERROR: field `b` of struct `inner::B` is private +LL | c.b; | ^^^ error[E0616]: field `a` of struct `xc::A` is private --> $DIR/struct-field-privacy.rs:28:5 | -LL | d.a; //~ ERROR: field `a` of struct `xc::A` is private +LL | d.a; | ^^^ error[E0616]: field `b` of struct `xc::B` is private --> $DIR/struct-field-privacy.rs:32:5 | -LL | e.b; //~ ERROR: field `b` of struct `xc::B` is private +LL | e.b; | ^^^ error[E0616]: field `1` of struct `inner::Z` is private --> $DIR/struct-field-privacy.rs:35:5 | -LL | z.1; //~ ERROR: field `1` of struct `inner::Z` is private +LL | z.1; | ^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/structs/struct-fields-dupe.stderr b/src/test/ui/structs/struct-fields-dupe.stderr index 7739ef80fc87..aaf2533dc011 100644 --- a/src/test/ui/structs/struct-fields-dupe.stderr +++ b/src/test/ui/structs/struct-fields-dupe.stderr @@ -3,7 +3,7 @@ error[E0062]: field `foo` specified more than once | LL | foo: 0, | ------ first use of `foo` -LL | foo: 0 //~ ERROR field `foo` specified more than once +LL | foo: 0 | ^^^ used more than once error: aborting due to previous error diff --git a/src/test/ui/structs/struct-fields-missing.stderr b/src/test/ui/structs/struct-fields-missing.stderr index edbac000dea0..b3e42a94809d 100644 --- a/src/test/ui/structs/struct-fields-missing.stderr +++ b/src/test/ui/structs/struct-fields-missing.stderr @@ -1,7 +1,7 @@ error[E0063]: missing field `bar` in initializer of `BuildData` --> $DIR/struct-fields-missing.rs:7:15 | -LL | let foo = BuildData { //~ ERROR missing field `bar` in initializer of `BuildData` +LL | let foo = BuildData { | ^^^^^^^^^ missing `bar` error: aborting due to previous error diff --git a/src/test/ui/structs/struct-fields-shorthand-unresolved.stderr b/src/test/ui/structs/struct-fields-shorthand-unresolved.stderr index 37ec6c0f015f..09fc4f7ee586 100644 --- a/src/test/ui/structs/struct-fields-shorthand-unresolved.stderr +++ b/src/test/ui/structs/struct-fields-shorthand-unresolved.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find value `y` in this scope --> $DIR/struct-fields-shorthand-unresolved.rs:10:9 | -LL | y //~ ERROR cannot find value `y` in this scope +LL | y | ^ help: a local variable with a similar name exists: `x` error: aborting due to previous error diff --git a/src/test/ui/structs/struct-fields-shorthand.stderr b/src/test/ui/structs/struct-fields-shorthand.stderr index 0d3d633f61cf..a285a392168c 100644 --- a/src/test/ui/structs/struct-fields-shorthand.stderr +++ b/src/test/ui/structs/struct-fields-shorthand.stderr @@ -1,7 +1,7 @@ error[E0560]: struct `Foo` has no field named `z` --> $DIR/struct-fields-shorthand.rs:9:15 | -LL | x, y, z //~ ERROR struct `Foo` has no field named `z` +LL | x, y, z | ^ `Foo` does not have this field | = note: available fields are: `x`, `y` diff --git a/src/test/ui/structs/struct-fields-typo.stderr b/src/test/ui/structs/struct-fields-typo.stderr index c2fab714f7c1..6949a0a4a682 100644 --- a/src/test/ui/structs/struct-fields-typo.stderr +++ b/src/test/ui/structs/struct-fields-typo.stderr @@ -1,7 +1,7 @@ error[E0609]: no field `baa` on type `BuildData` --> $DIR/struct-fields-typo.rs:11:17 | -LL | let x = foo.baa; //~ ERROR no field `baa` on type `BuildData` +LL | let x = foo.baa; | ^^^ help: a field with a similar name exists: `bar` error: aborting due to previous error diff --git a/src/test/ui/structs/struct-like-enum-nonexhaustive.stderr b/src/test/ui/structs/struct-like-enum-nonexhaustive.stderr index d651ea0b4e2d..d6b5af179640 100644 --- a/src/test/ui/structs/struct-like-enum-nonexhaustive.stderr +++ b/src/test/ui/structs/struct-like-enum-nonexhaustive.stderr @@ -1,8 +1,17 @@ error[E0004]: non-exhaustive patterns: `B { x: Some(_) }` not covered --> $DIR/struct-like-enum-nonexhaustive.rs:8:11 | -LL | match x { //~ ERROR non-exhaustive patterns - | ^ pattern `B { x: Some(_) }` not covered +LL | / enum A { +LL | | B { x: Option }, + | | - not covered +LL | | C +LL | | } + | |_- `A` defined here +... +LL | match x { + | ^ pattern `B { x: Some(_) }` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/structs/struct-missing-comma.stderr b/src/test/ui/structs/struct-missing-comma.stderr index 00ef1a7ff926..f5b79f54001e 100644 --- a/src/test/ui/structs/struct-missing-comma.stderr +++ b/src/test/ui/structs/struct-missing-comma.stderr @@ -1,7 +1,7 @@ error: expected `,`, or `}`, found `bar` --> $DIR/struct-missing-comma.rs:4:13 | -LL | foo: u32 //~ expected `,`, or `}`, found `bar` +LL | foo: u32 | ^ help: try adding a comma: `,` error: aborting due to previous error diff --git a/src/test/ui/structs/struct-pat-derived-error.stderr b/src/test/ui/structs/struct-pat-derived-error.stderr index dd1dc71f7fd8..92a88defc52d 100644 --- a/src/test/ui/structs/struct-pat-derived-error.stderr +++ b/src/test/ui/structs/struct-pat-derived-error.stderr @@ -1,19 +1,19 @@ error[E0609]: no field `d` on type `&A` --> $DIR/struct-pat-derived-error.rs:8:31 | -LL | let A { x, y } = self.d; //~ ERROR no field `d` on type `&A` +LL | let A { x, y } = self.d; | ^ error[E0026]: struct `A` does not have fields named `x`, `y` --> $DIR/struct-pat-derived-error.rs:8:17 | -LL | let A { x, y } = self.d; //~ ERROR no field `d` on type `&A` +LL | let A { x, y } = self.d; | ^ ^ struct `A` does not have these fields error[E0027]: pattern does not mention fields `b`, `c` --> $DIR/struct-pat-derived-error.rs:8:13 | -LL | let A { x, y } = self.d; //~ ERROR no field `d` on type `&A` +LL | let A { x, y } = self.d; | ^^^^^^^^^^ missing fields `b`, `c` error: aborting due to 3 previous errors diff --git a/src/test/ui/structs/struct-path-associated-type.stderr b/src/test/ui/structs/struct-path-associated-type.stderr index 80824d984783..0ca64ed40a50 100644 --- a/src/test/ui/structs/struct-path-associated-type.stderr +++ b/src/test/ui/structs/struct-path-associated-type.stderr @@ -25,31 +25,31 @@ LL | T::A {} => {} error[E0109]: type arguments are not allowed on this entity --> $DIR/struct-path-associated-type.rs:25:20 | -LL | let z = T::A:: {}; //~ ERROR type arguments are not allowed on this entity +LL | let z = T::A:: {}; | ^^ type argument not allowed error[E0223]: ambiguous associated type --> $DIR/struct-path-associated-type.rs:32:13 | -LL | let s = S::A {}; //~ ERROR ambiguous associated type +LL | let s = S::A {}; | ^^^^ help: use fully-qualified syntax: `::A` error[E0109]: type arguments are not allowed on this entity --> $DIR/struct-path-associated-type.rs:33:20 | -LL | let z = S::A:: {}; //~ ERROR ambiguous associated type +LL | let z = S::A:: {}; | ^^ type argument not allowed error[E0223]: ambiguous associated type --> $DIR/struct-path-associated-type.rs:33:13 | -LL | let z = S::A:: {}; //~ ERROR ambiguous associated type +LL | let z = S::A:: {}; | ^^^^^^^^^^ help: use fully-qualified syntax: `::A` error[E0223]: ambiguous associated type --> $DIR/struct-path-associated-type.rs:36:9 | -LL | S::A {} => {} //~ ERROR ambiguous associated type +LL | S::A {} => {} | ^^^^ help: use fully-qualified syntax: `::A` error: aborting due to 9 previous errors diff --git a/src/test/ui/structs/struct-path-self-type-mismatch.stderr b/src/test/ui/structs/struct-path-self-type-mismatch.stderr index 0b1b1e83400a..72c6d7ae22b4 100644 --- a/src/test/ui/structs/struct-path-self-type-mismatch.stderr +++ b/src/test/ui/structs/struct-path-self-type-mismatch.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/struct-path-self-type-mismatch.rs:7:23 | -LL | Self { inner: 1.5f32 }; //~ ERROR mismatched types +LL | Self { inner: 1.5f32 }; | ^^^^^^ expected i32, found f32 error[E0308]: mismatched types @@ -19,9 +19,9 @@ error[E0308]: mismatched types LL | fn new(u: U) -> Foo { | ------ expected `Foo` because of return type LL | / Self { -LL | | //~^ ERROR mismatched types +LL | | LL | | inner: u -LL | | //~^ ERROR mismatched types +LL | | LL | | } | |_________^ expected type parameter, found a different type parameter | diff --git a/src/test/ui/structs/struct-path-self.stderr b/src/test/ui/structs/struct-path-self.stderr index cda6b7a533f6..0fb02b9c44b5 100644 --- a/src/test/ui/structs/struct-path-self.stderr +++ b/src/test/ui/structs/struct-path-self.stderr @@ -25,13 +25,13 @@ LL | Self { .. } => {} error[E0109]: type arguments are not allowed on this entity --> $DIR/struct-path-self.rs:20:24 | -LL | let z = Self:: {}; //~ ERROR type arguments are not allowed on this entity +LL | let z = Self:: {}; | ^^ type argument not allowed error[E0109]: type arguments are not allowed on this entity --> $DIR/struct-path-self.rs:30:24 | -LL | let z = Self:: {}; //~ ERROR type arguments are not allowed on this entity +LL | let z = Self:: {}; | ^^ type argument not allowed error: aborting due to 6 previous errors diff --git a/src/test/ui/structs/struct-pattern-match-useless.stderr b/src/test/ui/structs/struct-pattern-match-useless.stderr index 561964bcb24b..5b0c9305448a 100644 --- a/src/test/ui/structs/struct-pattern-match-useless.stderr +++ b/src/test/ui/structs/struct-pattern-match-useless.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/struct-pattern-match-useless.rs:12:9 | -LL | Foo { .. } => () //~ ERROR unreachable pattern +LL | Foo { .. } => () | ^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/structs/struct-variant-privacy-xc.stderr b/src/test/ui/structs/struct-variant-privacy-xc.stderr index da61fc83c262..39241b6b3fc1 100644 --- a/src/test/ui/structs/struct-variant-privacy-xc.stderr +++ b/src/test/ui/structs/struct-variant-privacy-xc.stderr @@ -1,13 +1,13 @@ error[E0603]: enum `Bar` is private --> $DIR/struct-variant-privacy-xc.rs:4:33 | -LL | fn f(b: struct_variant_privacy::Bar) { //~ ERROR enum `Bar` is private +LL | fn f(b: struct_variant_privacy::Bar) { | ^^^ error[E0603]: enum `Bar` is private --> $DIR/struct-variant-privacy-xc.rs:6:33 | -LL | struct_variant_privacy::Bar::Baz { a: _a } => {} //~ ERROR enum `Bar` is private +LL | struct_variant_privacy::Bar::Baz { a: _a } => {} | ^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/structs/struct-variant-privacy.stderr b/src/test/ui/structs/struct-variant-privacy.stderr index 0895b52998c4..127a65010448 100644 --- a/src/test/ui/structs/struct-variant-privacy.stderr +++ b/src/test/ui/structs/struct-variant-privacy.stderr @@ -1,13 +1,13 @@ error[E0603]: enum `Bar` is private --> $DIR/struct-variant-privacy.rs:7:14 | -LL | fn f(b: foo::Bar) { //~ ERROR enum `Bar` is private +LL | fn f(b: foo::Bar) { | ^^^ error[E0603]: enum `Bar` is private --> $DIR/struct-variant-privacy.rs:9:14 | -LL | foo::Bar::Baz { a: _a } => {} //~ ERROR enum `Bar` is private +LL | foo::Bar::Baz { a: _a } => {} | ^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/structs/structure-constructor-type-mismatch.stderr b/src/test/ui/structs/structure-constructor-type-mismatch.stderr index cc62316bec18..375678b7cee5 100644 --- a/src/test/ui/structs/structure-constructor-type-mismatch.stderr +++ b/src/test/ui/structs/structure-constructor-type-mismatch.stderr @@ -73,13 +73,13 @@ LL | x: 7, error[E0107]: wrong number of type arguments: expected 0, found 1 --> $DIR/structure-constructor-type-mismatch.rs:48:24 | -LL | let pt3 = PointF:: { //~ ERROR wrong number of type arguments +LL | let pt3 = PointF:: { | ^^^ unexpected type argument error[E0308]: mismatched types --> $DIR/structure-constructor-type-mismatch.rs:49:12 | -LL | x: 9, //~ ERROR mismatched types +LL | x: 9, | ^ | | | expected f32, found integer @@ -91,7 +91,7 @@ LL | x: 9, //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/structure-constructor-type-mismatch.rs:50:12 | -LL | y: 10, //~ ERROR mismatched types +LL | y: 10, | ^^ | | | expected f32, found integer @@ -103,7 +103,7 @@ LL | y: 10, //~ ERROR mismatched types error[E0107]: wrong number of type arguments: expected 0, found 1 --> $DIR/structure-constructor-type-mismatch.rs:54:18 | -LL | PointF:: { .. } => {} //~ ERROR wrong number of type arguments +LL | PointF:: { .. } => {} | ^^^ unexpected type argument error[E0308]: mismatched types @@ -111,7 +111,7 @@ error[E0308]: mismatched types | LL | match (Point { x: 1, y: 2 }) { | ---------------------- this match expression has type `Point<{integer}>` -LL | PointF:: { .. } => {} //~ ERROR wrong number of type arguments +LL | PointF:: { .. } => {} | ^^^^^^^^^^^^^^^^^^^^ expected integer, found f32 | = note: expected type `Point<{integer}>` @@ -122,7 +122,7 @@ error[E0308]: mismatched types | LL | match (Point { x: 1, y: 2 }) { | ---------------------- this match expression has type `Point<{integer}>` -LL | PointF { .. } => {} //~ ERROR mismatched types +LL | PointF { .. } => {} | ^^^^^^^^^^^^^ expected integer, found f32 | = note: expected type `Point<{integer}>` @@ -133,7 +133,7 @@ error[E0308]: mismatched types | LL | match (Pair { x: 1, y: 2 }) { | --------------------- this match expression has type `Pair<{integer}, {integer}>` -LL | PairF:: { .. } => {} //~ ERROR mismatched types +LL | PairF:: { .. } => {} | ^^^^^^^^^^^^^^^^^^^ expected integer, found f32 | = note: expected type `Pair<{integer}, {integer}>` diff --git a/src/test/ui/suffixed-literal-meta.stderr b/src/test/ui/suffixed-literal-meta.stderr index 265aa78d53f1..495404af3e8a 100644 --- a/src/test/ui/suffixed-literal-meta.stderr +++ b/src/test/ui/suffixed-literal-meta.stderr @@ -1,7 +1,7 @@ error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:3:13 | -LL | #[my_attr = 1usize] //~ ERROR: suffixed literals are not allowed in attributes +LL | #[my_attr = 1usize] | ^^^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). @@ -9,7 +9,7 @@ LL | #[my_attr = 1usize] //~ ERROR: suffixed literals are not allowed in attribu error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:4:13 | -LL | #[my_attr = 1u8] //~ ERROR: suffixed literals are not allowed in attributes +LL | #[my_attr = 1u8] | ^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). @@ -17,7 +17,7 @@ LL | #[my_attr = 1u8] //~ ERROR: suffixed literals are not allowed in attributes error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:5:13 | -LL | #[my_attr = 1u16] //~ ERROR: suffixed literals are not allowed in attributes +LL | #[my_attr = 1u16] | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). @@ -25,7 +25,7 @@ LL | #[my_attr = 1u16] //~ ERROR: suffixed literals are not allowed in attribute error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:6:13 | -LL | #[my_attr = 1u32] //~ ERROR: suffixed literals are not allowed in attributes +LL | #[my_attr = 1u32] | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). @@ -33,7 +33,7 @@ LL | #[my_attr = 1u32] //~ ERROR: suffixed literals are not allowed in attribute error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:7:13 | -LL | #[my_attr = 1u64] //~ ERROR: suffixed literals are not allowed in attributes +LL | #[my_attr = 1u64] | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). @@ -41,7 +41,7 @@ LL | #[my_attr = 1u64] //~ ERROR: suffixed literals are not allowed in attribute error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:8:13 | -LL | #[my_attr = 1isize] //~ ERROR: suffixed literals are not allowed in attributes +LL | #[my_attr = 1isize] | ^^^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). @@ -49,7 +49,7 @@ LL | #[my_attr = 1isize] //~ ERROR: suffixed literals are not allowed in attribu error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:9:13 | -LL | #[my_attr = 1i8] //~ ERROR: suffixed literals are not allowed in attributes +LL | #[my_attr = 1i8] | ^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). @@ -57,7 +57,7 @@ LL | #[my_attr = 1i8] //~ ERROR: suffixed literals are not allowed in attributes error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:10:13 | -LL | #[my_attr = 1i16] //~ ERROR: suffixed literals are not allowed in attributes +LL | #[my_attr = 1i16] | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). @@ -65,7 +65,7 @@ LL | #[my_attr = 1i16] //~ ERROR: suffixed literals are not allowed in attribute error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:11:13 | -LL | #[my_attr = 1i32] //~ ERROR: suffixed literals are not allowed in attributes +LL | #[my_attr = 1i32] | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). @@ -73,7 +73,7 @@ LL | #[my_attr = 1i32] //~ ERROR: suffixed literals are not allowed in attribute error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:12:13 | -LL | #[my_attr = 1i64] //~ ERROR: suffixed literals are not allowed in attributes +LL | #[my_attr = 1i64] | ^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). @@ -81,7 +81,7 @@ LL | #[my_attr = 1i64] //~ ERROR: suffixed literals are not allowed in attribute error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:13:13 | -LL | #[my_attr = 1.0f32] //~ ERROR: suffixed literals are not allowed in attributes +LL | #[my_attr = 1.0f32] | ^^^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). @@ -89,7 +89,7 @@ LL | #[my_attr = 1.0f32] //~ ERROR: suffixed literals are not allowed in attribu error: suffixed literals are not allowed in attributes --> $DIR/suffixed-literal-meta.rs:14:13 | -LL | #[my_attr = 1.0f64] //~ ERROR: suffixed literals are not allowed in attributes +LL | #[my_attr = 1.0f64] | ^^^^^^ | = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.). diff --git a/src/test/ui/suggestions/attribute-typos.stderr b/src/test/ui/suggestions/attribute-typos.stderr index e40da787e96c..077c955431ab 100644 --- a/src/test/ui/suggestions/attribute-typos.stderr +++ b/src/test/ui/suggestions/attribute-typos.stderr @@ -1,7 +1,7 @@ error[E0658]: unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics (see issue #29642) --> $DIR/attribute-typos.rs:11:3 | -LL | #[rustc_err] //~ ERROR E0658 +LL | #[rustc_err] | ^^^^^^^^^ | = help: add #![feature(rustc_attrs)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | #[rustc_err] //~ ERROR E0658 error[E0658]: The attribute `tests` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/attribute-typos.rs:6:3 | -LL | #[tests] //~ ERROR E0658 +LL | #[tests] | ^^^^^ help: a built-in attribute with a similar name exists: `test` | = help: add #![feature(custom_attribute)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | #[tests] //~ ERROR E0658 error[E0658]: The attribute `deprcated` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) --> $DIR/attribute-typos.rs:1:3 | -LL | #[deprcated] //~ ERROR E0658 +LL | #[deprcated] | ^^^^^^^^^ help: a built-in attribute with a similar name exists: `deprecated` | = help: add #![feature(custom_attribute)] to the crate attributes to enable diff --git a/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr b/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr index 4b51294f86a0..b1aaab6a7544 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr +++ b/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr @@ -51,7 +51,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &(Either::One(_t), Either::Two(_u)) => (), | -- -- ...and here | | @@ -82,7 +82,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &(Either::One(_t), Either::Two(_u)) | ----------------------------------- | | | | @@ -101,7 +101,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &(Either::One(_t), Either::Two(_u)) => (), | ----------------------------------- | | | | @@ -120,7 +120,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &(e.clone(), e.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &(Either::One(_t), Either::Two(_u)) => (), | ----------------------------------- | | | | @@ -187,7 +187,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut (Either::One(_t), Either::Two(_u)) => (), | -- -- ...and here | | @@ -218,7 +218,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut (Either::One(_t), Either::Two(_u)) | --------------------------------------- | | | | @@ -237,7 +237,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut (Either::One(_t), Either::Two(_u)) => (), | --------------------------------------- | | | | @@ -256,7 +256,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut (Either::One(_t), Either::Two(_u)) => (), | --------------------------------------- | | | | @@ -275,7 +275,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &mut (em.clone(), em.clone()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut (Either::One(_t), Either::Two(_u)) => (), | --------------------------------------- | | | | diff --git a/src/test/ui/suggestions/dont-suggest-ref/simple.stderr b/src/test/ui/suggestions/dont-suggest-ref/simple.stderr index 296fcef0c4a3..6a8b17ca8704 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/simple.stderr +++ b/src/test/ui/suggestions/dont-suggest-ref/simple.stderr @@ -420,7 +420,7 @@ error[E0507]: cannot move out of borrowed content | LL | match r { | ^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &Either::One(_t) | ---------------- | | | @@ -438,7 +438,7 @@ error[E0507]: cannot move out of borrowed content | LL | match r { | ^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &Either::One(_t) => (), | ---------------- | | | @@ -456,7 +456,7 @@ error[E0507]: cannot move out of borrowed content | LL | match r { | ^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &Either::One(_t) => (), | ---------------- | | | @@ -519,7 +519,7 @@ error[E0507]: cannot move out of borrowed content | LL | match rm { | ^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut Either::One(_t) => (), | -- data moved here ... @@ -548,7 +548,7 @@ error[E0507]: cannot move out of borrowed content | LL | match rm { | ^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut Either::One(_t) => (), | -------------------- | | | @@ -566,7 +566,7 @@ error[E0507]: cannot move out of borrowed content | LL | match rm { | ^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut Either::One(_t) => (), | -------------------- | | | @@ -584,7 +584,7 @@ error[E0507]: cannot move out of borrowed content | LL | match rm { | ^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut Either::One(_t) => (), | -------------------- | | | @@ -644,7 +644,7 @@ error[E0507]: cannot move out of borrowed content | LL | match (&e.clone(),) { | ^^^^^^^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | (&Either::One(_t),) | -- data moved here | @@ -701,7 +701,7 @@ error[E0507]: cannot move out of borrowed content | LL | match (&mut em.clone(),) { | ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | (&mut Either::One(_t),) => (), | -- data moved here LL | (&mut Either::Two(_t),) => (), @@ -765,7 +765,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &e { | ^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &Either::One(_t) | ---------------- | | | @@ -783,7 +783,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &e { | ^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &Either::One(_t) => (), | ---------------- | | | @@ -801,7 +801,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &e { | ^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &Either::One(_t) => (), | ---------------- | | | @@ -864,7 +864,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &mut em { | ^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut Either::One(_t) | -------------------- | | | @@ -882,7 +882,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &mut em { | ^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut Either::One(_t) => (), | -------------------- | | | @@ -900,7 +900,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &mut em { | ^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut Either::One(_t) => (), | -------------------- | | | @@ -918,7 +918,7 @@ error[E0507]: cannot move out of borrowed content | LL | match &mut em { | ^^^^^^^ cannot move out of borrowed content -LL | //~^ ERROR cannot move +LL | LL | &mut Either::One(_t) => (), | -------------------- | | | diff --git a/src/test/ui/suggestions/format-borrow.rs b/src/test/ui/suggestions/format-borrow.rs new file mode 100644 index 000000000000..63930e7f787f --- /dev/null +++ b/src/test/ui/suggestions/format-borrow.rs @@ -0,0 +1,6 @@ +fn main() { + let a: String = &String::from("a"); + //~^ ERROR mismatched types + let b: String = &format!("b"); + //~^ ERROR mismatched types +} diff --git a/src/test/ui/suggestions/format-borrow.stderr b/src/test/ui/suggestions/format-borrow.stderr new file mode 100644 index 000000000000..44bb11faa7f3 --- /dev/null +++ b/src/test/ui/suggestions/format-borrow.stderr @@ -0,0 +1,27 @@ +error[E0308]: mismatched types + --> $DIR/format-borrow.rs:2:21 + | +LL | let a: String = &String::from("a"); + | ^^^^^^^^^^^^^^^^^^ + | | + | expected struct `std::string::String`, found reference + | help: consider removing the borrow: `String::from("a")` + | + = note: expected type `std::string::String` + found type `&std::string::String` + +error[E0308]: mismatched types + --> $DIR/format-borrow.rs:4:21 + | +LL | let b: String = &format!("b"); + | ^^^^^^^^^^^^^ + | | + | expected struct `std::string::String`, found reference + | help: consider removing the borrow: `format!("b")` + | + = note: expected type `std::string::String` + found type `&std::string::String` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/suggestions/impl-trait-return-trailing-semicolon.rs b/src/test/ui/suggestions/impl-trait-return-trailing-semicolon.rs new file mode 100644 index 000000000000..e72a2d8ccc62 --- /dev/null +++ b/src/test/ui/suggestions/impl-trait-return-trailing-semicolon.rs @@ -0,0 +1,7 @@ +trait Bar {} +impl Bar for u8 {} +fn foo() -> impl Bar { + 5; //~^ ERROR the trait bound `(): Bar` is not satisfied +} + +fn main() {} diff --git a/src/test/ui/suggestions/impl-trait-return-trailing-semicolon.stderr b/src/test/ui/suggestions/impl-trait-return-trailing-semicolon.stderr new file mode 100644 index 000000000000..cc3a2b9419ca --- /dev/null +++ b/src/test/ui/suggestions/impl-trait-return-trailing-semicolon.stderr @@ -0,0 +1,13 @@ +error[E0277]: the trait bound `(): Bar` is not satisfied + --> $DIR/impl-trait-return-trailing-semicolon.rs:3:13 + | +LL | fn foo() -> impl Bar { + | ^^^^^^^^ the trait `Bar` is not implemented for `()` +LL | 5; + | - consider removing this semicolon + | + = note: the return type of a function must have a statically known size + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/suggestions/issue-51055-missing-semicolon-between-call-and-tuple.stderr b/src/test/ui/suggestions/issue-51055-missing-semicolon-between-call-and-tuple.stderr index 40ddb5ec53c2..f81c45e2f8da 100644 --- a/src/test/ui/suggestions/issue-51055-missing-semicolon-between-call-and-tuple.stderr +++ b/src/test/ui/suggestions/issue-51055-missing-semicolon-between-call-and-tuple.stderr @@ -4,7 +4,7 @@ error[E0618]: expected function, found `bool` LL | fn vindictive() -> bool { true } | -------------------------------- `vindictive` defined here returns `bool` ... -LL | vindictive() //~ ERROR expected function, found `bool` +LL | vindictive() | -^^^^^^^^^^^- help: try adding a semicolon: `;` | _____| | | diff --git a/src/test/ui/suggestions/suggest-labels.stderr b/src/test/ui/suggestions/suggest-labels.stderr index 88a0f9698877..ead8f94209bd 100644 --- a/src/test/ui/suggestions/suggest-labels.stderr +++ b/src/test/ui/suggestions/suggest-labels.stderr @@ -1,19 +1,19 @@ error[E0426]: use of undeclared label `'fo` --> $DIR/suggest-labels.rs:4:15 | -LL | break 'fo; //~ ERROR use of undeclared label +LL | break 'fo; | ^^^ did you mean `'foo`? error[E0426]: use of undeclared label `'bor` --> $DIR/suggest-labels.rs:8:18 | -LL | continue 'bor; //~ ERROR use of undeclared label +LL | continue 'bor; | ^^^^ did you mean `'bar`? error[E0426]: use of undeclared label `'longlable` --> $DIR/suggest-labels.rs:13:19 | -LL | break 'longlable; //~ ERROR use of undeclared label +LL | break 'longlable; | ^^^^^^^^^^ did you mean `'longlabel1`? error: aborting due to 3 previous errors diff --git a/src/test/ui/suggestions/suggest-methods.stderr b/src/test/ui/suggestions/suggest-methods.stderr index b7727cf03a4e..09d58575d97d 100644 --- a/src/test/ui/suggestions/suggest-methods.stderr +++ b/src/test/ui/suggestions/suggest-methods.stderr @@ -4,25 +4,25 @@ error[E0599]: no method named `bat` found for type `Foo` in the current scope LL | struct Foo; | ----------- method `bat` not found for this ... -LL | f.bat(1.0); //~ ERROR no method named +LL | f.bat(1.0); | ^^^ help: did you mean: `bar` error[E0599]: no method named `is_emtpy` found for type `std::string::String` in the current scope --> $DIR/suggest-methods.rs:21:15 | -LL | let _ = s.is_emtpy(); //~ ERROR no method named +LL | let _ = s.is_emtpy(); | ^^^^^^^^ help: did you mean: `is_empty` error[E0599]: no method named `count_eos` found for type `u32` in the current scope --> $DIR/suggest-methods.rs:25:19 | -LL | let _ = 63u32.count_eos(); //~ ERROR no method named +LL | let _ = 63u32.count_eos(); | ^^^^^^^^^ help: did you mean: `count_zeros` error[E0599]: no method named `count_o` found for type `u32` in the current scope --> $DIR/suggest-methods.rs:28:19 | -LL | let _ = 63u32.count_o(); //~ ERROR no method named +LL | let _ = 63u32.count_o(); | ^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/suggestions/suggest-move-lifetimes.stderr b/src/test/ui/suggestions/suggest-move-lifetimes.stderr index 2d6dee062166..657914d1c8c0 100644 --- a/src/test/ui/suggestions/suggest-move-lifetimes.stderr +++ b/src/test/ui/suggestions/suggest-move-lifetimes.stderr @@ -1,25 +1,25 @@ error: lifetime parameters must be declared prior to type parameters --> $DIR/suggest-move-lifetimes.rs:1:13 | -LL | struct A { //~ ERROR lifetime parameters must be declared +LL | struct A { | ----^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T>` error: lifetime parameters must be declared prior to type parameters --> $DIR/suggest-move-lifetimes.rs:5:13 | -LL | struct B { //~ ERROR lifetime parameters must be declared +LL | struct B { | ----^^---- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T, U>` error: lifetime parameters must be declared prior to type parameters --> $DIR/suggest-move-lifetimes.rs:10:16 | -LL | struct C { //~ ERROR lifetime parameters must be declared +LL | struct C { | -------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T, U>` error: lifetime parameters must be declared prior to type parameters --> $DIR/suggest-move-lifetimes.rs:15:16 | -LL | struct D { //~ ERROR lifetime parameters must be declared +LL | struct D { | -------^^--^^-----^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, 'c, T, U, V>` error: aborting due to 4 previous errors diff --git a/src/test/ui/suggestions/suggest-move-types.stderr b/src/test/ui/suggestions/suggest-move-types.stderr index 0901b71911d4..552fb78cd3fd 100644 --- a/src/test/ui/suggestions/suggest-move-types.stderr +++ b/src/test/ui/suggestions/suggest-move-types.stderr @@ -1,7 +1,7 @@ error: associated type bindings must be declared after generic parameters --> $DIR/suggest-move-types.rs:28:20 | -LL | struct A> { //~ ERROR associated type bindings must be declared after generic parameters +LL | struct A> { | ----^^^ | | | this associated type binding should be moved after the generic parameters @@ -17,7 +17,7 @@ LL | struct Al<'a, T, M: OneWithLifetime> { error: associated type bindings must be declared after generic parameters --> $DIR/suggest-move-types.rs:41:28 | -LL | struct B> { //~ ERROR associated type bindings must be declared after generic parameters +LL | struct B> { | ----^^----^^----^^^^^^^^^ | | | | | | | this associated type binding should be moved after the generic parameters @@ -37,7 +37,7 @@ LL | struct Bl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime $DIR/suggest-move-types.rs:57:28 | -LL | struct C> { //~ ERROR associated type bindings must be declared after generic parameters +LL | struct C> { | ^^^----^^----^^----^^^^^^ | | | | | | | this associated type binding should be moved after the generic parameters @@ -57,7 +57,7 @@ LL | struct Cl<'a, 'b, 'c, T, U, V, M: ThreeWithLifetime $DIR/suggest-move-types.rs:73:28 | -LL | struct D> { //~ ERROR associated type bindings must be declared after generic parameters +LL | struct D> { | ^^^----^^----^^^^^----^^^ | | | | | | | this associated type binding should be moved after the generic parameters diff --git a/src/test/ui/suggestions/suggest-variants.stderr b/src/test/ui/suggestions/suggest-variants.stderr index 36abda2a89bb..08ae68ea7130 100644 --- a/src/test/ui/suggestions/suggest-variants.stderr +++ b/src/test/ui/suggestions/suggest-variants.stderr @@ -1,19 +1,19 @@ error: no variant `Squareee` on enum `Shape` --> $DIR/suggest-variants.rs:12:34 | -LL | println!("My shape is {:?}", Shape::Squareee { size: 5}); //~ ERROR no variant `Squareee` +LL | println!("My shape is {:?}", Shape::Squareee { size: 5}); | ^^^^^^^^^^^^^^^ help: did you mean: `Shape::Square` error: no variant `Circl` on enum `Shape` --> $DIR/suggest-variants.rs:13:34 | -LL | println!("My shape is {:?}", Shape::Circl { size: 5}); //~ ERROR no variant `Circl` +LL | println!("My shape is {:?}", Shape::Circl { size: 5}); | ^^^^^^^^^^^^ help: did you mean: `Shape::Circle` error: no variant `Rombus` on enum `Shape` --> $DIR/suggest-variants.rs:14:34 | -LL | println!("My shape is {:?}", Shape::Rombus{ size: 5}); //~ ERROR no variant `Rombus` +LL | println!("My shape is {:?}", Shape::Rombus{ size: 5}); | ^^^^^^^^^^^^^ unknown variant error: aborting due to 3 previous errors diff --git a/src/test/ui/suggestions/unused-closure-argument.rs b/src/test/ui/suggestions/unused-closure-argument.rs new file mode 100644 index 000000000000..677003ebf225 --- /dev/null +++ b/src/test/ui/suggestions/unused-closure-argument.rs @@ -0,0 +1,20 @@ +#![deny(unused_variables)] + +struct Point { + x: i32, + y: i32, +} + +fn main() { + let points = vec!(Point { x: 1, y: 2 }, Point { x: 3, y: 4 }); + + let _: i32 = points.iter() + .map(|Point { x, y }| y) + //~^ ERROR unused variable + .sum(); + + let _: i32 = points.iter() + .map(|x| 4) + //~^ ERROR unused variable + .sum(); +} diff --git a/src/test/ui/suggestions/unused-closure-argument.stderr b/src/test/ui/suggestions/unused-closure-argument.stderr new file mode 100644 index 000000000000..5cfdd79659b2 --- /dev/null +++ b/src/test/ui/suggestions/unused-closure-argument.stderr @@ -0,0 +1,20 @@ +error: unused variable: `x` + --> $DIR/unused-closure-argument.rs:12:23 + | +LL | .map(|Point { x, y }| y) + | ^ help: try ignoring the field: `x: _` + | +note: lint level defined here + --> $DIR/unused-closure-argument.rs:1:9 + | +LL | #![deny(unused_variables)] + | ^^^^^^^^^^^^^^^^ + +error: unused variable: `x` + --> $DIR/unused-closure-argument.rs:17:15 + | +LL | .map(|x| 4) + | ^ help: consider prefixing with an underscore: `_x` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/super-at-top-level.stderr b/src/test/ui/super-at-top-level.stderr index ce7a39339767..d04ce384fe88 100644 --- a/src/test/ui/super-at-top-level.stderr +++ b/src/test/ui/super-at-top-level.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: there are too many initial `super`s. --> $DIR/super-at-top-level.rs:1:5 | -LL | use super::f; //~ ERROR there are too many initial `super`s +LL | use super::f; | ^^^^^ there are too many initial `super`s. error: aborting due to previous error diff --git a/src/test/ui/svh/svh-change-lit.stderr b/src/test/ui/svh/svh-change-lit.stderr index ebb39224caa5..1b1501331b70 100644 --- a/src/test/ui/svh/svh-change-lit.stderr +++ b/src/test/ui/svh/svh-change-lit.stderr @@ -1,7 +1,7 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on --> $DIR/svh-change-lit.rs:10:1 | -LL | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on +LL | extern crate b; | ^^^^^^^^^^^^^^^ | = note: perhaps that crate needs to be recompiled? diff --git a/src/test/ui/svh/svh-change-significant-cfg.stderr b/src/test/ui/svh/svh-change-significant-cfg.stderr index d7196fc21f84..2357a4387d41 100644 --- a/src/test/ui/svh/svh-change-significant-cfg.stderr +++ b/src/test/ui/svh/svh-change-significant-cfg.stderr @@ -1,7 +1,7 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on --> $DIR/svh-change-significant-cfg.rs:10:1 | -LL | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on +LL | extern crate b; | ^^^^^^^^^^^^^^^ | = note: perhaps that crate needs to be recompiled? diff --git a/src/test/ui/svh/svh-change-trait-bound.stderr b/src/test/ui/svh/svh-change-trait-bound.stderr index 38678d7ec2ce..9fe949b2e7d1 100644 --- a/src/test/ui/svh/svh-change-trait-bound.stderr +++ b/src/test/ui/svh/svh-change-trait-bound.stderr @@ -1,7 +1,7 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on --> $DIR/svh-change-trait-bound.rs:10:1 | -LL | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on +LL | extern crate b; | ^^^^^^^^^^^^^^^ | = note: perhaps that crate needs to be recompiled? diff --git a/src/test/ui/svh/svh-change-type-arg.stderr b/src/test/ui/svh/svh-change-type-arg.stderr index 037d7867b0dc..a8b35d29c997 100644 --- a/src/test/ui/svh/svh-change-type-arg.stderr +++ b/src/test/ui/svh/svh-change-type-arg.stderr @@ -1,7 +1,7 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on --> $DIR/svh-change-type-arg.rs:10:1 | -LL | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on +LL | extern crate b; | ^^^^^^^^^^^^^^^ | = note: perhaps that crate needs to be recompiled? diff --git a/src/test/ui/svh/svh-change-type-ret.stderr b/src/test/ui/svh/svh-change-type-ret.stderr index 184ac9e0e7c7..ebe44a7bee59 100644 --- a/src/test/ui/svh/svh-change-type-ret.stderr +++ b/src/test/ui/svh/svh-change-type-ret.stderr @@ -1,7 +1,7 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on --> $DIR/svh-change-type-ret.rs:10:1 | -LL | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on +LL | extern crate b; | ^^^^^^^^^^^^^^^ | = note: perhaps that crate needs to be recompiled? diff --git a/src/test/ui/svh/svh-change-type-static.stderr b/src/test/ui/svh/svh-change-type-static.stderr index d3aeb073cd7a..da09c3230a1c 100644 --- a/src/test/ui/svh/svh-change-type-static.stderr +++ b/src/test/ui/svh/svh-change-type-static.stderr @@ -1,7 +1,7 @@ error[E0460]: found possibly newer version of crate `a` which `b` depends on --> $DIR/svh-change-type-static.rs:10:1 | -LL | extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on +LL | extern crate b; | ^^^^^^^^^^^^^^^ | = note: perhaps that crate needs to be recompiled? diff --git a/src/test/ui/svh/svh-use-trait.stderr b/src/test/ui/svh/svh-use-trait.stderr index 0af44502375f..4676143a06e2 100644 --- a/src/test/ui/svh/svh-use-trait.stderr +++ b/src/test/ui/svh/svh-use-trait.stderr @@ -1,7 +1,7 @@ error[E0460]: found possibly newer version of crate `uta` which `utb` depends on --> $DIR/svh-use-trait.rs:15:1 | -LL | extern crate utb; //~ ERROR: found possibly newer version of crate `uta` which `utb` depends +LL | extern crate utb; | ^^^^^^^^^^^^^^^^^ | = note: perhaps that crate needs to be recompiled? diff --git a/src/test/ui/switched-expectations.stderr b/src/test/ui/switched-expectations.stderr index bbb9b51650e0..043d130051d7 100644 --- a/src/test/ui/switched-expectations.stderr +++ b/src/test/ui/switched-expectations.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/switched-expectations.rs:3:30 | -LL | let ref string: String = var; //~ ERROR mismatched types [E0308] +LL | let ref string: String = var; | ^^^ expected struct `std::string::String`, found i32 | = note: expected type `std::string::String` diff --git a/src/test/ui/symbol-names/basic.stderr b/src/test/ui/symbol-names/basic.stderr index ca789df9bd18..e23a326d5f88 100644 --- a/src/test/ui/symbol-names/basic.stderr +++ b/src/test/ui/symbol-names/basic.stderr @@ -1,13 +1,13 @@ error: symbol-name(_ZN5basic4main17h08bcaf310214ed52E) --> $DIR/basic.rs:3:1 | -LL | #[rustc_symbol_name] //~ ERROR _ZN5basic4main +LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: item-path(main) --> $DIR/basic.rs:4:1 | -LL | #[rustc_item_path] //~ ERROR item-path(main) +LL | #[rustc_item_path] | ^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/symbol-names/impl1.stderr b/src/test/ui/symbol-names/impl1.stderr index 75d3e40e1b2f..e4fefeb601fe 100644 --- a/src/test/ui/symbol-names/impl1.stderr +++ b/src/test/ui/symbol-names/impl1.stderr @@ -1,25 +1,25 @@ error: symbol-name(_ZN5impl13foo3Foo3bar17hc487d6ec13fe9124E) --> $DIR/impl1.rs:8:9 | -LL | #[rustc_symbol_name] //~ ERROR _ZN5impl13foo3Foo3bar +LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: item-path(foo::Foo::bar) --> $DIR/impl1.rs:9:9 | -LL | #[rustc_item_path] //~ ERROR item-path(foo::Foo::bar) +LL | #[rustc_item_path] | ^^^^^^^^^^^^^^^^^^ error: symbol-name(_ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz17h38577281258e1527E) --> $DIR/impl1.rs:18:9 | -LL | #[rustc_symbol_name] //~ ERROR _ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz +LL | #[rustc_symbol_name] | ^^^^^^^^^^^^^^^^^^^^ error: item-path(bar::::baz) --> $DIR/impl1.rs:19:9 | -LL | #[rustc_item_path] //~ ERROR item-path(bar::::baz) +LL | #[rustc_item_path] | ^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/synthetic-param.stderr b/src/test/ui/synthetic-param.stderr index 7bdab439572b..b63a57a20183 100644 --- a/src/test/ui/synthetic-param.stderr +++ b/src/test/ui/synthetic-param.stderr @@ -1,19 +1,19 @@ error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position. --> $DIR/synthetic-param.rs:20:5 | -LL | func::(42); //~ ERROR cannot provide explicit type parameters +LL | func::(42); | ^^^^^^^^^^ error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position. --> $DIR/synthetic-param.rs:23:5 | -LL | Foo::func::(42); //~ ERROR cannot provide explicit type parameters +LL | Foo::func::(42); | ^^^^^^^^^^^^^^^ error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position. --> $DIR/synthetic-param.rs:26:5 | -LL | Bar::::func::(42); //~ ERROR cannot provide explicit type parameters +LL | Bar::::func::(42); | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/tag-that-dare-not-speak-its-name.rs b/src/test/ui/tag-that-dare-not-speak-its-name.rs index 0a7f405746c8..9f47b2e9b9f4 100644 --- a/src/test/ui/tag-that-dare-not-speak-its-name.rs +++ b/src/test/ui/tag-that-dare-not-speak-its-name.rs @@ -1,10 +1,9 @@ // Issue #876 -#![no_implicit_prelude] use std::vec::Vec; fn last(v: Vec<&T> ) -> std::option::Option { - panic!(); + ::std::panic!(); } fn main() { diff --git a/src/test/ui/tag-that-dare-not-speak-its-name.stderr b/src/test/ui/tag-that-dare-not-speak-its-name.stderr index a0d6b0007d7d..23e3d6652621 100644 --- a/src/test/ui/tag-that-dare-not-speak-its-name.stderr +++ b/src/test/ui/tag-that-dare-not-speak-its-name.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/tag-that-dare-not-speak-its-name.rs:12:20 + --> $DIR/tag-that-dare-not-speak-its-name.rs:11:20 | LL | let x : char = last(y); | ^^^^^^^ expected char, found enum `std::option::Option` diff --git a/src/test/ui/tag-type-args.stderr b/src/test/ui/tag-type-args.stderr index 40523ee907b8..ac44dad4a888 100644 --- a/src/test/ui/tag-type-args.stderr +++ b/src/test/ui/tag-type-args.stderr @@ -1,7 +1,7 @@ error[E0107]: wrong number of type arguments: expected 1, found 0 --> $DIR/tag-type-args.rs:3:11 | -LL | fn foo(c: Quux) { assert!((false)); } //~ ERROR wrong number of type arguments +LL | fn foo(c: Quux) { assert!((false)); } | ^^^^ expected 1 type argument error: aborting due to previous error diff --git a/src/test/ui/tag-variant-cast-non-nullary.stderr b/src/test/ui/tag-variant-cast-non-nullary.stderr index 797a55f65fe1..87ec20f20d78 100644 --- a/src/test/ui/tag-variant-cast-non-nullary.stderr +++ b/src/test/ui/tag-variant-cast-non-nullary.stderr @@ -1,7 +1,7 @@ error[E0605]: non-primitive cast: `NonNullary` as `isize` --> $DIR/tag-variant-cast-non-nullary.rs:8:15 | -LL | let val = v as isize; //~ ERROR non-primitive cast: `NonNullary` as `isize` [E0605] +LL | let val = v as isize; | ^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait diff --git a/src/test/ui/tag-variant-disr-dup.stderr b/src/test/ui/tag-variant-disr-dup.stderr index b3de25e87b35..ca12894c0429 100644 --- a/src/test/ui/tag-variant-disr-dup.stderr +++ b/src/test/ui/tag-variant-disr-dup.stderr @@ -3,7 +3,7 @@ error[E0081]: discriminant value `0` already exists | LL | Black = 0x000000, | -------- first use of `0` -LL | White = 0x000000, //~ ERROR discriminant value `0` already exists +LL | White = 0x000000, | ^^^^^^^^ enum already has `0` error: aborting due to previous error diff --git a/src/test/ui/target-feature-wrong.stderr b/src/test/ui/target-feature-wrong.stderr index 236f5c4afec3..3662ea976a46 100644 --- a/src/test/ui/target-feature-wrong.stderr +++ b/src/test/ui/target-feature-wrong.stderr @@ -33,7 +33,7 @@ error: attribute should be applied to a function | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | //~^ ERROR: should be applied to a function +LL | LL | mod another {} | -------------- not a function diff --git a/src/test/ui/terr-in-field.stderr b/src/test/ui/terr-in-field.stderr index 5a9c0898aad1..91c3b3014a20 100644 --- a/src/test/ui/terr-in-field.stderr +++ b/src/test/ui/terr-in-field.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/terr-in-field.rs:13:14 | -LL | want_foo(b); //~ ERROR mismatched types +LL | want_foo(b); | ^ expected struct `Foo`, found struct `Bar` | = note: expected type `Foo` diff --git a/src/test/ui/terr-sorts.stderr b/src/test/ui/terr-sorts.stderr index dfaf8186fc38..05b9fb43fe1b 100644 --- a/src/test/ui/terr-sorts.stderr +++ b/src/test/ui/terr-sorts.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/terr-sorts.rs:10:14 | -LL | want_foo(b); //~ ERROR mismatched types +LL | want_foo(b); | ^ expected struct `Foo`, found struct `std::boxed::Box` | = note: expected type `Foo` diff --git a/src/test/ui/test-attr-non-associated-functions.stderr b/src/test/ui/test-attr-non-associated-functions.stderr index 8a1cc6fa367f..6176aa03d84d 100644 --- a/src/test/ui/test-attr-non-associated-functions.stderr +++ b/src/test/ui/test-attr-non-associated-functions.stderr @@ -1,7 +1,7 @@ error: #[test] attribute is only allowed on non associated functions --> $DIR/test-attr-non-associated-functions.rs:9:5 | -LL | / fn new() -> A { //~ ERROR #[test] attribute is only allowed on non associated functions +LL | / fn new() -> A { LL | | A {} LL | | } | |_____^ diff --git a/src/test/ui/test-cfg.stderr b/src/test/ui/test-cfg.stderr index 93ca9a27de23..c35fe2f9458d 100644 --- a/src/test/ui/test-cfg.stderr +++ b/src/test/ui/test-cfg.stderr @@ -1,7 +1,7 @@ error[E0425]: cannot find function `foo` in this scope --> $DIR/test-cfg.rs:7:5 | -LL | foo(); //~ ERROR cannot find function `foo` in this scope +LL | foo(); | ^^^ not found in this scope error: aborting due to previous error diff --git a/src/test/ui/test-warns-dead-code.stderr b/src/test/ui/test-warns-dead-code.stderr index fe74ad133405..62e99225dd90 100644 --- a/src/test/ui/test-warns-dead-code.stderr +++ b/src/test/ui/test-warns-dead-code.stderr @@ -1,7 +1,7 @@ error: function is never used: `dead` --> $DIR/test-warns-dead-code.rs:5:1 | -LL | fn dead() {} //~ error: function is never used: `dead` +LL | fn dead() {} | ^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/thread-local-mutation.nll.stderr b/src/test/ui/thread-local-mutation.nll.stderr index 0a3664b0d9d4..e5dc0e72edfc 100644 --- a/src/test/ui/thread-local-mutation.nll.stderr +++ b/src/test/ui/thread-local-mutation.nll.stderr @@ -1,7 +1,7 @@ error[E0594]: cannot assign to immutable static item `S` --> $DIR/thread-local-mutation.rs:11:5 | -LL | S = "after"; //~ ERROR cannot assign to immutable +LL | S = "after"; | ^^^^^^^^^^^ cannot assign error: aborting due to previous error diff --git a/src/test/ui/thread-local-mutation.stderr b/src/test/ui/thread-local-mutation.stderr index bf298523e1b7..685e7c6585a0 100644 --- a/src/test/ui/thread-local-mutation.stderr +++ b/src/test/ui/thread-local-mutation.stderr @@ -1,7 +1,7 @@ error[E0594]: cannot assign to immutable thread-local static item --> $DIR/thread-local-mutation.rs:11:5 | -LL | S = "after"; //~ ERROR cannot assign to immutable +LL | S = "after"; | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/tool-attributes/tool-attributes-misplaced-1.stderr b/src/test/ui/tool-attributes/tool-attributes-misplaced-1.stderr index dd1de22f3da0..1e9d1609f02b 100644 --- a/src/test/ui/tool-attributes/tool-attributes-misplaced-1.stderr +++ b/src/test/ui/tool-attributes/tool-attributes-misplaced-1.stderr @@ -1,37 +1,37 @@ error: cannot find derive macro `rustfmt` in this scope --> $DIR/tool-attributes-misplaced-1.rs:6:10 | -LL | #[derive(rustfmt)] //~ ERROR cannot find derive macro `rustfmt` in this scope +LL | #[derive(rustfmt)] | ^^^^^^^ error: cannot find macro `rustfmt!` in this scope --> $DIR/tool-attributes-misplaced-1.rs:15:5 | -LL | rustfmt!(); //~ ERROR cannot find macro `rustfmt!` in this scope +LL | rustfmt!(); | ^^^^^^^ error[E0573]: expected type, found tool module `rustfmt` --> $DIR/tool-attributes-misplaced-1.rs:3:10 | -LL | type A = rustfmt; //~ ERROR expected type, found tool module `rustfmt` +LL | type A = rustfmt; | ^^^^^^^ not a type error[E0573]: expected type, found tool attribute `rustfmt::skip` --> $DIR/tool-attributes-misplaced-1.rs:4:10 | -LL | type B = rustfmt::skip; //~ ERROR expected type, found tool attribute `rustfmt::skip` +LL | type B = rustfmt::skip; | ^^^^^^^^^^^^^ not a type error[E0423]: expected value, found tool module `rustfmt` --> $DIR/tool-attributes-misplaced-1.rs:14:5 | -LL | rustfmt; //~ ERROR expected value, found tool module `rustfmt` +LL | rustfmt; | ^^^^^^^ not a value error[E0423]: expected value, found tool attribute `rustfmt::skip` --> $DIR/tool-attributes-misplaced-1.rs:17:5 | -LL | rustfmt::skip; //~ ERROR expected value, found tool attribute `rustfmt::skip` +LL | rustfmt::skip; | ^^^^^^^^^^^^^ not a value error: aborting due to 6 previous errors diff --git a/src/test/ui/tool-attributes/tool-attributes-misplaced-2.stderr b/src/test/ui/tool-attributes/tool-attributes-misplaced-2.stderr index 50a7b5973283..c5f5f59c32c3 100644 --- a/src/test/ui/tool-attributes/tool-attributes-misplaced-2.stderr +++ b/src/test/ui/tool-attributes/tool-attributes-misplaced-2.stderr @@ -1,13 +1,13 @@ error: expected a macro, found tool attribute --> $DIR/tool-attributes-misplaced-2.rs:1:10 | -LL | #[derive(rustfmt::skip)] //~ ERROR expected a macro, found tool attribute +LL | #[derive(rustfmt::skip)] | ^^^^^^^^^^^^^ error: expected a macro, found tool attribute --> $DIR/tool-attributes-misplaced-2.rs:5:5 | -LL | rustfmt::skip!(); //~ ERROR expected a macro, found tool attribute +LL | rustfmt::skip!(); | ^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/tool-attributes/tool-attributes-shadowing.stderr b/src/test/ui/tool-attributes/tool-attributes-shadowing.stderr index 62b5b8e2ac23..98ad109a07e8 100644 --- a/src/test/ui/tool-attributes/tool-attributes-shadowing.stderr +++ b/src/test/ui/tool-attributes/tool-attributes-shadowing.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: could not find `skip` in `rustfmt` --> $DIR/tool-attributes-shadowing.rs:3:12 | -LL | #[rustfmt::skip] //~ ERROR failed to resolve: could not find `skip` in `rustfmt` +LL | #[rustfmt::skip] | ^^^^ could not find `skip` in `rustfmt` error: aborting due to previous error diff --git a/src/test/ui/tool_lints-fail.stderr b/src/test/ui/tool_lints-fail.stderr index 6b027eecf268..a61157f21b8e 100644 --- a/src/test/ui/tool_lints-fail.stderr +++ b/src/test/ui/tool_lints-fail.stderr @@ -1,7 +1,7 @@ error: unknown lint: `clippy` --> $DIR/tool_lints-fail.rs:6:9 | -LL | #![deny(clippy)] //~ ERROR: unknown lint: `clippy` +LL | #![deny(clippy)] | ^^^^^^ | note: lint level defined here diff --git a/src/test/ui/trace_macros-format.stderr b/src/test/ui/trace_macros-format.stderr index a180c360b4a7..650b87076981 100644 --- a/src/test/ui/trace_macros-format.stderr +++ b/src/test/ui/trace_macros-format.stderr @@ -1,37 +1,37 @@ error: trace_macros! accepts only `true` or `false` --> $DIR/trace_macros-format.rs:4:5 | -LL | trace_macros!(); //~ ERROR trace_macros! accepts only `true` or `false` +LL | trace_macros!(); | ^^^^^^^^^^^^^^^^ error: trace_macros! accepts only `true` or `false` --> $DIR/trace_macros-format.rs:5:5 | -LL | trace_macros!(1); //~ ERROR trace_macros! accepts only `true` or `false` +LL | trace_macros!(1); | ^^^^^^^^^^^^^^^^^ error: trace_macros! accepts only `true` or `false` --> $DIR/trace_macros-format.rs:6:5 | -LL | trace_macros!(ident); //~ ERROR trace_macros! accepts only `true` or `false` +LL | trace_macros!(ident); | ^^^^^^^^^^^^^^^^^^^^^ error: trace_macros! accepts only `true` or `false` --> $DIR/trace_macros-format.rs:7:5 | -LL | trace_macros!(for); //~ ERROR trace_macros! accepts only `true` or `false` +LL | trace_macros!(for); | ^^^^^^^^^^^^^^^^^^^ error: trace_macros! accepts only `true` or `false` --> $DIR/trace_macros-format.rs:8:5 | -LL | trace_macros!(true,); //~ ERROR trace_macros! accepts only `true` or `false` +LL | trace_macros!(true,); | ^^^^^^^^^^^^^^^^^^^^^ error: trace_macros! accepts only `true` or `false` --> $DIR/trace_macros-format.rs:9:5 | -LL | trace_macros!(false 1); //~ ERROR trace_macros! accepts only `true` or `false` +LL | trace_macros!(false 1); | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/trace_macros-gate.stderr b/src/test/ui/trace_macros-gate.stderr index 4831aa158dbc..4d2fd554a06d 100644 --- a/src/test/ui/trace_macros-gate.stderr +++ b/src/test/ui/trace_macros-gate.stderr @@ -1,7 +1,7 @@ error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598) --> $DIR/trace_macros-gate.rs:4:5 | -LL | trace_macros!(); //~ ERROR `trace_macros` is not stable +LL | trace_macros!(); | ^^^^^^^^^^^^^^^^ | = help: add #![feature(trace_macros)] to the crate attributes to enable @@ -9,13 +9,13 @@ LL | trace_macros!(); //~ ERROR `trace_macros` is not stable error: trace_macros! accepts only `true` or `false` --> $DIR/trace_macros-gate.rs:4:5 | -LL | trace_macros!(); //~ ERROR `trace_macros` is not stable +LL | trace_macros!(); | ^^^^^^^^^^^^^^^^ error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598) --> $DIR/trace_macros-gate.rs:6:5 | -LL | trace_macros!(true); //~ ERROR `trace_macros` is not stable +LL | trace_macros!(true); | ^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(trace_macros)] to the crate attributes to enable @@ -23,7 +23,7 @@ LL | trace_macros!(true); //~ ERROR `trace_macros` is not stable error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598) --> $DIR/trace_macros-gate.rs:7:5 | -LL | trace_macros!(false); //~ ERROR `trace_macros` is not stable +LL | trace_macros!(false); | ^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(trace_macros)] to the crate attributes to enable @@ -31,7 +31,7 @@ LL | trace_macros!(false); //~ ERROR `trace_macros` is not stable error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598) --> $DIR/trace_macros-gate.rs:10:26 | -LL | ($x: ident) => { trace_macros!($x) } //~ ERROR `trace_macros` is not stable +LL | ($x: ident) => { trace_macros!($x) } | ^^^^^^^^^^^^^^^^^ ... LL | expando!(true); diff --git a/src/test/ui/trait-method-number-parameters.stderr b/src/test/ui/trait-method-number-parameters.stderr index 32101239e66c..e47fe1a8026d 100644 --- a/src/test/ui/trait-method-number-parameters.stderr +++ b/src/test/ui/trait-method-number-parameters.stderr @@ -4,7 +4,7 @@ error[E0050]: method `foo` has 2 parameters but the declaration in trait `Foo::f LL | fn foo(&mut self, x: i32, y: i32) -> i32; | ------------------------- trait requires 3 parameters ... -LL | / &mut self, //~ ERROR +LL | / &mut self, LL | | x: i32, | |______________^ expected 3 parameters, found 2 diff --git a/src/test/ui/traits/trait-alias-impl.stderr b/src/test/ui/traits/trait-alias-impl.stderr index 6a6cedb014a7..301db4fb71c6 100644 --- a/src/test/ui/traits/trait-alias-impl.stderr +++ b/src/test/ui/traits/trait-alias-impl.stderr @@ -1,7 +1,7 @@ error[E0404]: expected trait, found trait alias `DefaultAlias` --> $DIR/trait-alias-impl.rs:5:6 | -LL | impl DefaultAlias for () {} //~ ERROR expected trait, found trait alias +LL | impl DefaultAlias for () {} | ^^^^^^^^^^^^ not a trait error: aborting due to previous error diff --git a/src/test/ui/traits/trait-alias-object.stderr b/src/test/ui/traits/trait-alias-object.stderr index 604db6f7e189..c6b61eae4a1b 100644 --- a/src/test/ui/traits/trait-alias-object.stderr +++ b/src/test/ui/traits/trait-alias-object.stderr @@ -1,7 +1,7 @@ error[E0038]: the trait `EqAlias` cannot be made into an object --> $DIR/trait-alias-object.rs:7:13 | -LL | let _: &dyn EqAlias = &123; //~ ERROR `EqAlias` cannot be made into an object +LL | let _: &dyn EqAlias = &123; | ^^^^^^^^^^^ the trait `EqAlias` cannot be made into an object | = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses @@ -9,7 +9,7 @@ LL | let _: &dyn EqAlias = &123; //~ ERROR `EqAlias` cannot be made into an error[E0191]: the value of the associated type `Item` (from the trait `std::iter::Iterator`) must be specified --> $DIR/trait-alias-object.rs:8:13 | -LL | let _: &dyn IteratorAlias = &vec![123].into_iter(); //~ ERROR must be specified +LL | let _: &dyn IteratorAlias = &vec![123].into_iter(); | ^^^^^^^^^^^^^^^^^ associated type `Item` must be specified error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/trait-alias-syntax.stderr b/src/test/ui/traits/trait-alias-syntax.stderr index fc96f6274393..f99cc45d8ae9 100644 --- a/src/test/ui/traits/trait-alias-syntax.stderr +++ b/src/test/ui/traits/trait-alias-syntax.stderr @@ -1,13 +1,13 @@ error: trait aliases cannot be `auto` --> $DIR/trait-alias-syntax.rs:4:19 | -LL | auto trait A = Foo; //~ ERROR trait aliases cannot be `auto` +LL | auto trait A = Foo; | ^ trait aliases cannot be `auto` error: trait aliases cannot be `unsafe` --> $DIR/trait-alias-syntax.rs:5:21 | -LL | unsafe trait B = Foo; //~ ERROR trait aliases cannot be `unsafe` +LL | unsafe trait B = Foo; | ^ trait aliases cannot be `unsafe` error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/trait-alias-wf.stderr b/src/test/ui/traits/trait-alias-wf.stderr index 1f64ce76dc6b..ee2dd5b24afe 100644 --- a/src/test/ui/traits/trait-alias-wf.stderr +++ b/src/test/ui/traits/trait-alias-wf.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: Foo` is not satisfied --> $DIR/trait-alias-wf.rs:5:1 | -LL | trait B = A; //~ ERROR `T: Foo` is not satisfied +LL | trait B = A; | ^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `T` | = help: consider adding a `where T: Foo` bound diff --git a/src/test/ui/traits/trait-bounds-not-on-struct.stderr b/src/test/ui/traits/trait-bounds-not-on-struct.stderr index 1595fff618f0..a649a4eee557 100644 --- a/src/test/ui/traits/trait-bounds-not-on-struct.stderr +++ b/src/test/ui/traits/trait-bounds-not-on-struct.stderr @@ -1,13 +1,13 @@ error[E0404]: expected trait, found struct `Foo` --> $DIR/trait-bounds-not-on-struct.rs:5:16 | -LL | fn foo(_x: Box) { } //~ ERROR expected trait, found struct `Foo` +LL | fn foo(_x: Box) { } | ^^^ not a trait error[E0404]: expected trait, found struct `Vec` --> $DIR/trait-bounds-not-on-struct.rs:7:21 | -LL | type A = Box>; //~ ERROR expected trait, found struct `Vec` +LL | type A = Box>; | ^^^^^^ not a trait error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr b/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr index 5429029c1ec9..9a4cc90f3a5e 100644 --- a/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr +++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr @@ -14,7 +14,7 @@ LL | struct Foo { error[E0277]: the trait bound `isize: Trait` is not satisfied --> $DIR/trait-bounds-on-structs-and-enums.rs:19:5 | -LL | a: Foo, //~ ERROR E0277 +LL | a: Foo, | ^^^^^^^^^^^^^ the trait `Trait` is not implemented for `isize` | note: required by `Foo` @@ -26,7 +26,7 @@ LL | struct Foo { error[E0277]: the trait bound `usize: Trait` is not satisfied --> $DIR/trait-bounds-on-structs-and-enums.rs:23:10 | -LL | Quux(Bar), //~ ERROR E0277 +LL | Quux(Bar), | ^^^^^^^^^^ the trait `Trait` is not implemented for `usize` | note: required by `Bar` @@ -38,7 +38,7 @@ LL | enum Bar { error[E0277]: the trait bound `U: Trait` is not satisfied --> $DIR/trait-bounds-on-structs-and-enums.rs:27:5 | -LL | b: Foo, //~ ERROR E0277 +LL | b: Foo, | ^^^^^^^^^ the trait `Trait` is not implemented for `U` | = help: consider adding a `where U: Trait` bound @@ -51,7 +51,7 @@ LL | struct Foo { error[E0277]: the trait bound `V: Trait` is not satisfied --> $DIR/trait-bounds-on-structs-and-enums.rs:31:21 | -LL | EvenMoreBadness(Bar), //~ ERROR E0277 +LL | EvenMoreBadness(Bar), | ^^^^^^ the trait `Trait` is not implemented for `V` | = help: consider adding a `where V: Trait` bound @@ -64,7 +64,7 @@ LL | enum Bar { error[E0277]: the trait bound `i32: Trait` is not satisfied --> $DIR/trait-bounds-on-structs-and-enums.rs:35:5 | -LL | Foo, //~ ERROR E0277 +LL | Foo, | ^^^^^^^^ the trait `Trait` is not implemented for `i32` | note: required by `Foo` @@ -76,7 +76,7 @@ LL | struct Foo { error[E0277]: the trait bound `u8: Trait` is not satisfied --> $DIR/trait-bounds-on-structs-and-enums.rs:39:22 | -LL | DictionaryLike { field: Bar }, //~ ERROR E0277 +LL | DictionaryLike { field: Bar }, | ^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `u8` | note: required by `Bar` diff --git a/src/test/ui/traits/trait-bounds-sugar.stderr b/src/test/ui/traits/trait-bounds-sugar.stderr index eb45a16afb1c..2aa025cb7a68 100644 --- a/src/test/ui/traits/trait-bounds-sugar.stderr +++ b/src/test/ui/traits/trait-bounds-sugar.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/trait-bounds-sugar.rs:12:7 | -LL | a(x); //~ ERROR mismatched types +LL | a(x); | ^ expected trait `Foo + std::marker::Send`, found trait `Foo + std::marker::Sync` | = note: expected type `std::boxed::Box<(dyn Foo + std::marker::Send + 'static)>` diff --git a/src/test/ui/traits/trait-coercion-generic-regions.nll.stderr b/src/test/ui/traits/trait-coercion-generic-regions.nll.stderr index 6092a9dc10d3..4ee3e4cacc37 100644 --- a/src/test/ui/traits/trait-coercion-generic-regions.nll.stderr +++ b/src/test/ui/traits/trait-coercion-generic-regions.nll.stderr @@ -1,7 +1,7 @@ error[E0597]: `person` does not live long enough --> $DIR/trait-coercion-generic-regions.rs:17:24 | -LL | let person: &str = &person; //~ ERROR `person` does not live long enough +LL | let person: &str = &person; | ^^^^^^^ | | | borrowed value does not live long enough diff --git a/src/test/ui/traits/trait-coercion-generic-regions.stderr b/src/test/ui/traits/trait-coercion-generic-regions.stderr index 23c2a72743ee..2a9ca4f95f0b 100644 --- a/src/test/ui/traits/trait-coercion-generic-regions.stderr +++ b/src/test/ui/traits/trait-coercion-generic-regions.stderr @@ -1,7 +1,7 @@ error[E0597]: `person` does not live long enough --> $DIR/trait-coercion-generic-regions.rs:17:25 | -LL | let person: &str = &person; //~ ERROR `person` does not live long enough +LL | let person: &str = &person; | ^^^^^^ borrowed value does not live long enough LL | let s: Box> = Box::new(Struct { person: person }); LL | } diff --git a/src/test/ui/traits/trait-duplicate-methods.stderr b/src/test/ui/traits/trait-duplicate-methods.stderr index bb6d0b6d7f14..7cba4cb63e6b 100644 --- a/src/test/ui/traits/trait-duplicate-methods.stderr +++ b/src/test/ui/traits/trait-duplicate-methods.stderr @@ -3,7 +3,7 @@ error[E0428]: the name `orange` is defined multiple times | LL | fn orange(&self); | ----------------- previous definition of the value `orange` here -LL | fn orange(&self); //~ ERROR the name `orange` is defined multiple times +LL | fn orange(&self); | ^^^^^^^^^^^^^^^^^ `orange` redefined here | = note: `orange` must be defined only once in the value namespace of this trait diff --git a/src/test/ui/traits/trait-impl-1.stderr b/src/test/ui/traits/trait-impl-1.stderr index 8ee642974b72..71d5cc26bf14 100644 --- a/src/test/ui/traits/trait-impl-1.stderr +++ b/src/test/ui/traits/trait-impl-1.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `foo` found for type `&i32` in the current scope --> $DIR/trait-impl-1.rs:15:7 | -LL | x.foo(); //~ERROR: no method named `foo` found for type `&i32` in the current scope +LL | x.foo(); | ^^^ error: aborting due to previous error diff --git a/src/test/ui/traits/trait-impl-can-not-have-untraitful-items.stderr b/src/test/ui/traits/trait-impl-can-not-have-untraitful-items.stderr index 5a50a1108632..84565bdaa135 100644 --- a/src/test/ui/traits/trait-impl-can-not-have-untraitful-items.stderr +++ b/src/test/ui/traits/trait-impl-can-not-have-untraitful-items.stderr @@ -1,19 +1,19 @@ error[E0438]: const `BAR` is not a member of trait `A` --> $DIR/trait-impl-can-not-have-untraitful-items.rs:4:5 | -LL | const BAR: () = (); //~ ERROR const `BAR` is not a member of trait `A` +LL | const BAR: () = (); | ^^^^^^^^^^^^^^^^^^^ not a member of trait `A` error[E0437]: type `Baz` is not a member of trait `A` --> $DIR/trait-impl-can-not-have-untraitful-items.rs:5:5 | -LL | type Baz = (); //~ ERROR type `Baz` is not a member of trait `A` +LL | type Baz = (); | ^^^^^^^^^^^^^^ not a member of trait `A` error[E0407]: method `foo` is not a member of trait `A` --> $DIR/trait-impl-can-not-have-untraitful-items.rs:6:5 | -LL | fn foo(&self) { } //~ ERROR method `foo` is not a member of trait `A` +LL | fn foo(&self) { } | ^^^^^^^^^^^^^^^^^ not a member of trait `A` error: aborting due to 3 previous errors diff --git a/src/test/ui/traits/trait-impl-for-module.stderr b/src/test/ui/traits/trait-impl-for-module.stderr index 99da4b7c87af..c62bcfca94de 100644 --- a/src/test/ui/traits/trait-impl-for-module.stderr +++ b/src/test/ui/traits/trait-impl-for-module.stderr @@ -1,7 +1,7 @@ error[E0573]: expected type, found module `a` --> $DIR/trait-impl-for-module.rs:7:12 | -LL | impl A for a { //~ ERROR expected type, found module +LL | impl A for a { | ^ help: a trait with a similar name exists: `A` error: aborting due to previous error diff --git a/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr b/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr index 95dc6364e13c..4c63d6097758 100644 --- a/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr +++ b/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr @@ -1,18 +1,18 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements --> $DIR/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs:24:13 | -LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { //~ ERROR cannot infer an appropriate lifetime +LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { | ^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime 'a as defined on the impl at 24:6... --> $DIR/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs:24:6 | -LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { //~ ERROR cannot infer an appropriate lifetime +LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { | ^^ note: ...but the lifetime must also be valid for the lifetime 'b as defined on the impl at 24:9... --> $DIR/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs:24:9 | -LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { //~ ERROR cannot infer an appropriate lifetime +LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { | ^^ = note: ...so that the types are compatible: expected T1<'a> diff --git a/src/test/ui/traits/trait-item-privacy.stderr b/src/test/ui/traits/trait-item-privacy.stderr index c65a9a3ed945..97e7ed0ebb07 100644 --- a/src/test/ui/traits/trait-item-privacy.stderr +++ b/src/test/ui/traits/trait-item-privacy.stderr @@ -4,7 +4,7 @@ error[E0599]: no method named `a` found for type `S` in the current scope LL | struct S; | --------- method `a` not found for this ... -LL | S.a(); //~ ERROR no method named `a` found for type `S` in the current scope +LL | S.a(); | ^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -17,7 +17,7 @@ error[E0599]: no method named `b` found for type `S` in the current scope LL | struct S; | --------- method `b` not found for this ... -LL | S.b(); //~ ERROR no method named `b` found for type `S` in the current scope +LL | S.b(); | ^ | = help: items from traits can only be used if the trait is in scope @@ -29,7 +29,7 @@ LL | use method::B; error[E0624]: method `a` is private --> $DIR/trait-item-privacy.rs:72:7 | -LL | c.a(); //~ ERROR method `a` is private +LL | c.a(); | ^ error[E0599]: no function or associated item named `a` found for type `S` in the current scope @@ -67,7 +67,7 @@ LL | use method::B; error[E0624]: method `a` is private --> $DIR/trait-item-privacy.rs:84:5 | -LL | C::a(&S); //~ ERROR method `a` is private +LL | C::a(&S); | ^^^^ error[E0599]: no associated item named `A` found for type `S` in the current scope @@ -76,7 +76,7 @@ error[E0599]: no associated item named `A` found for type `S` in the current sco LL | struct S; | --------- associated item `A` not found for this ... -LL | S::A; //~ ERROR no associated item named `A` found for type `S` in the current scope +LL | S::A; | ---^ | | | associated item not found in `S` @@ -91,7 +91,7 @@ error[E0599]: no associated item named `B` found for type `S` in the current sco LL | struct S; | --------- associated item `B` not found for this ... -LL | S::B; //~ ERROR no associated item named `B` found for type `S` in the current scope +LL | S::B; | ---^ | | | associated item not found in `S` @@ -105,13 +105,13 @@ LL | use assoc_const::B; error[E0624]: associated constant `A` is private --> $DIR/trait-item-privacy.rs:101:5 | -LL | C::A; //~ ERROR associated constant `A` is private +LL | C::A; | ^^^^ error[E0038]: the trait `assoc_const::C` cannot be made into an object --> $DIR/trait-item-privacy.rs:101:5 | -LL | C::A; //~ ERROR associated constant `A` is private +LL | C::A; | ^^^^ the trait `assoc_const::C` cannot be made into an object | = note: the trait cannot contain associated consts like `C` @@ -121,31 +121,31 @@ LL | C::A; //~ ERROR associated constant `A` is private error[E0223]: ambiguous associated type --> $DIR/trait-item-privacy.rs:115:12 | -LL | let _: S::A; //~ ERROR ambiguous associated type +LL | let _: S::A; | ^^^^ help: use fully-qualified syntax: `::A` error[E0223]: ambiguous associated type --> $DIR/trait-item-privacy.rs:116:12 | -LL | let _: S::B; //~ ERROR ambiguous associated type +LL | let _: S::B; | ^^^^ help: use fully-qualified syntax: `::B` error[E0223]: ambiguous associated type --> $DIR/trait-item-privacy.rs:117:12 | -LL | let _: S::C; //~ ERROR ambiguous associated type +LL | let _: S::C; | ^^^^ help: use fully-qualified syntax: `::C` error: associated type `A` is private --> $DIR/trait-item-privacy.rs:119:12 | -LL | let _: T::A; //~ ERROR associated type `A` is private +LL | let _: T::A; | ^^^^ error: associated type `A` is private --> $DIR/trait-item-privacy.rs:128:9 | -LL | A = u8, //~ ERROR associated type `A` is private +LL | A = u8, | ^^^^^^ error: aborting due to 15 previous errors diff --git a/src/test/ui/traits/trait-method-private.stderr b/src/test/ui/traits/trait-method-private.stderr index ed6aeeb9c898..c1dd9387ebc4 100644 --- a/src/test/ui/traits/trait-method-private.stderr +++ b/src/test/ui/traits/trait-method-private.stderr @@ -1,7 +1,7 @@ error[E0624]: method `method` is private --> $DIR/trait-method-private.rs:19:9 | -LL | foo.method(); //~ ERROR is private +LL | foo.method(); | ^^^^^^ | = help: items from traits can only be used if the trait is in scope diff --git a/src/test/ui/traits/trait-object-auto-dedup-in-impl.stderr b/src/test/ui/traits/trait-object-auto-dedup-in-impl.stderr index 2d2c3843548e..2570db0212aa 100644 --- a/src/test/ui/traits/trait-object-auto-dedup-in-impl.stderr +++ b/src/test/ui/traits/trait-object-auto-dedup-in-impl.stderr @@ -1,7 +1,7 @@ error[E0592]: duplicate definitions with name `test` --> $DIR/trait-object-auto-dedup-in-impl.rs:14:5 | -LL | fn test(&self) { println!("one"); } //~ ERROR duplicate definitions with name `test` +LL | fn test(&self) { println!("one"); } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate definitions for `test` ... LL | fn test(&self) { println!("two"); } diff --git a/src/test/ui/traits/trait-object-macro-matcher.stderr b/src/test/ui/traits/trait-object-macro-matcher.stderr index 678f4fb59557..3a6bf3dcc8ce 100644 --- a/src/test/ui/traits/trait-object-macro-matcher.stderr +++ b/src/test/ui/traits/trait-object-macro-matcher.stderr @@ -1,13 +1,13 @@ error[E0224]: at least one non-builtin trait is required for an object type --> $DIR/trait-object-macro-matcher.rs:10:8 | -LL | m!('static +); //~ ERROR at least one non-builtin trait is required for an object type +LL | m!('static +); | ^^^^^^^^^ error[E0038]: the trait `std::marker::Copy` cannot be made into an object --> $DIR/trait-object-macro-matcher.rs:8:8 | -LL | m!(Copy + Send + 'static); //~ ERROR the trait `std::marker::Copy` cannot be made into an object +LL | m!(Copy + Send + 'static); | ^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` cannot be made into an object | = note: the trait cannot require that `Self : Sized` diff --git a/src/test/ui/traits/trait-object-safety.stderr b/src/test/ui/traits/trait-object-safety.stderr index 0a0c5ff086b5..a7fe83cb7564 100644 --- a/src/test/ui/traits/trait-object-safety.stderr +++ b/src/test/ui/traits/trait-object-safety.stderr @@ -1,7 +1,7 @@ error[E0038]: the trait `Tr` cannot be made into an object --> $DIR/trait-object-safety.rs:15:18 | -LL | let _: &Tr = &St; //~ ERROR E0038 +LL | let _: &Tr = &St; | ^^^ the trait `Tr` cannot be made into an object | = note: method `foo` has no receiver @@ -10,7 +10,7 @@ LL | let _: &Tr = &St; //~ ERROR E0038 error[E0038]: the trait `Tr` cannot be made into an object --> $DIR/trait-object-safety.rs:15:12 | -LL | let _: &Tr = &St; //~ ERROR E0038 +LL | let _: &Tr = &St; | ^^^ the trait `Tr` cannot be made into an object | = note: method `foo` has no receiver diff --git a/src/test/ui/traits/trait-or-new-type-instead.stderr b/src/test/ui/traits/trait-or-new-type-instead.stderr index e8bd20019a89..4726b0668e51 100644 --- a/src/test/ui/traits/trait-or-new-type-instead.stderr +++ b/src/test/ui/traits/trait-or-new-type-instead.stderr @@ -2,7 +2,7 @@ error[E0116]: cannot define inherent `impl` for a type outside of the crate wher --> $DIR/trait-or-new-type-instead.rs:1:1 | LL | / impl Option { -LL | | //~^ ERROR cannot define inherent `impl` for a type outside of the crate where the type is defined +LL | | LL | | pub fn foo(&self) { } LL | | } | |_^ impl for type defined outside of crate. diff --git a/src/test/ui/traits/trait-resolution-in-overloaded-op.stderr b/src/test/ui/traits/trait-resolution-in-overloaded-op.stderr index 2c644480f0a5..3b10632b818c 100644 --- a/src/test/ui/traits/trait-resolution-in-overloaded-op.stderr +++ b/src/test/ui/traits/trait-resolution-in-overloaded-op.stderr @@ -1,7 +1,7 @@ error[E0369]: binary operation `*` cannot be applied to type `&T` --> $DIR/trait-resolution-in-overloaded-op.rs:8:5 | -LL | a * b //~ ERROR binary operation `*` cannot be applied to type `&T` +LL | a * b | ^^^^^ | = note: an implementation of `std::ops::Mul` might be missing for `&T` diff --git a/src/test/ui/traits/trait-safety-inherent-impl.stderr b/src/test/ui/traits/trait-safety-inherent-impl.stderr index 969b16633ce3..3911261083ec 100644 --- a/src/test/ui/traits/trait-safety-inherent-impl.stderr +++ b/src/test/ui/traits/trait-safety-inherent-impl.stderr @@ -1,7 +1,7 @@ error[E0197]: inherent impls cannot be unsafe --> $DIR/trait-safety-inherent-impl.rs:5:1 | -LL | / unsafe impl SomeStruct { //~ ERROR inherent impls cannot be unsafe +LL | / unsafe impl SomeStruct { LL | | fn foo(self) { } LL | | } | |_^ diff --git a/src/test/ui/traits/trait-safety-trait-impl-cc.stderr b/src/test/ui/traits/trait-safety-trait-impl-cc.stderr index 3be72fbfdd72..5234e205a84b 100644 --- a/src/test/ui/traits/trait-safety-trait-impl-cc.stderr +++ b/src/test/ui/traits/trait-safety-trait-impl-cc.stderr @@ -1,7 +1,7 @@ error[E0200]: the trait `lib::Foo` requires an `unsafe impl` declaration --> $DIR/trait-safety-trait-impl-cc.rs:9:1 | -LL | / impl lib::Foo for Bar { //~ ERROR requires an `unsafe impl` declaration +LL | / impl lib::Foo for Bar { LL | | fn foo(&self) -> isize { LL | | panic!(); LL | | } diff --git a/src/test/ui/traits/trait-safety-trait-impl.stderr b/src/test/ui/traits/trait-safety-trait-impl.stderr index 22e9b4d4035e..c83a2cd71e55 100644 --- a/src/test/ui/traits/trait-safety-trait-impl.stderr +++ b/src/test/ui/traits/trait-safety-trait-impl.stderr @@ -1,13 +1,13 @@ error[E0200]: the trait `UnsafeTrait` requires an `unsafe impl` declaration --> $DIR/trait-safety-trait-impl.rs:14:1 | -LL | impl UnsafeTrait for u16 { } //~ ERROR requires an `unsafe impl` declaration +LL | impl UnsafeTrait for u16 { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0199]: implementing the trait `SafeTrait` is not unsafe --> $DIR/trait-safety-trait-impl.rs:16:1 | -LL | unsafe impl SafeTrait for u32 { } //~ ERROR the trait `SafeTrait` is not unsafe +LL | unsafe impl SafeTrait for u32 { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/traits/trait-test-2.stderr b/src/test/ui/traits/trait-test-2.stderr index c01317f3d5b9..4d61ac67deda 100644 --- a/src/test/ui/traits/trait-test-2.stderr +++ b/src/test/ui/traits/trait-test-2.stderr @@ -1,13 +1,13 @@ error[E0107]: wrong number of type arguments: expected 0, found 1 --> $DIR/trait-test-2.rs:9:14 | -LL | 10.dup::(); //~ ERROR wrong number of type arguments: expected 0, found 1 +LL | 10.dup::(); | ^^^ unexpected type argument error[E0107]: wrong number of type arguments: expected 1, found 2 --> $DIR/trait-test-2.rs:10:20 | -LL | 10.blah::(); //~ ERROR wrong number of type arguments: expected 1, found 2 +LL | 10.blah::(); | ^^^ unexpected type argument error[E0038]: the trait `bar` cannot be made into an object diff --git a/src/test/ui/traits/trait-test.stderr b/src/test/ui/traits/trait-test.stderr index 2383175d513b..f5e47e51526c 100644 --- a/src/test/ui/traits/trait-test.stderr +++ b/src/test/ui/traits/trait-test.stderr @@ -1,7 +1,7 @@ error[E0404]: expected trait, found builtin type `isize` --> $DIR/trait-test.rs:4:6 | -LL | impl isize for usize { fn foo(&self) {} } //~ ERROR trait +LL | impl isize for usize { fn foo(&self) {} } | ^^^^^ not a trait error: aborting due to previous error diff --git a/src/test/ui/traits/traits-assoc-type-in-supertrait-bad.stderr b/src/test/ui/traits/traits-assoc-type-in-supertrait-bad.stderr index ce1aadca597c..44643e8c8de4 100644 --- a/src/test/ui/traits/traits-assoc-type-in-supertrait-bad.stderr +++ b/src/test/ui/traits/traits-assoc-type-in-supertrait-bad.stderr @@ -1,7 +1,7 @@ error[E0271]: type mismatch resolving ` as std::iter::Iterator>::Item == u32` --> $DIR/traits-assoc-type-in-supertrait-bad.rs:11:6 | -LL | impl Foo for IntoIter { //~ ERROR type mismatch +LL | impl Foo for IntoIter { | ^^^ expected i32, found u32 | = note: expected type `i32` diff --git a/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr b/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr index 7aa9809c0745..a91be8e69ac3 100644 --- a/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr +++ b/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr @@ -1,13 +1,13 @@ error[E0568]: auto traits cannot have super traits --> $DIR/traits-inductive-overflow-supertrait-oibit.rs:7:1 | -LL | auto trait Magic: Copy {} //~ ERROR E0568 +LL | auto trait Magic: Copy {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `NoClone: std::marker::Copy` is not satisfied --> $DIR/traits-inductive-overflow-supertrait-oibit.rs:15:18 | -LL | let (a, b) = copy(NoClone); //~ ERROR +LL | let (a, b) = copy(NoClone); | ^^^^ the trait `std::marker::Copy` is not implemented for `NoClone` | = note: required because of the requirements on the impl of `Magic` for `NoClone` diff --git a/src/test/ui/traits/traits-inductive-overflow-supertrait.stderr b/src/test/ui/traits/traits-inductive-overflow-supertrait.stderr index d4b3b6b7d716..769582a778bc 100644 --- a/src/test/ui/traits/traits-inductive-overflow-supertrait.stderr +++ b/src/test/ui/traits/traits-inductive-overflow-supertrait.stderr @@ -1,7 +1,7 @@ error[E0275]: overflow evaluating the requirement `NoClone: Magic` --> $DIR/traits-inductive-overflow-supertrait.rs:13:18 | -LL | let (a, b) = copy(NoClone); //~ ERROR E0275 +LL | let (a, b) = copy(NoClone); | ^^^^ | = note: required because of the requirements on the impl of `Magic` for `NoClone` diff --git a/src/test/ui/traits/traits-inductive-overflow-two-traits.stderr b/src/test/ui/traits/traits-inductive-overflow-two-traits.stderr index cee9aa348c38..61adbf00f718 100644 --- a/src/test/ui/traits/traits-inductive-overflow-two-traits.stderr +++ b/src/test/ui/traits/traits-inductive-overflow-two-traits.stderr @@ -1,7 +1,7 @@ error[E0275]: overflow evaluating the requirement `*mut (): Magic` --> $DIR/traits-inductive-overflow-two-traits.rs:19:5 | -LL | wizard::<*mut ()>(); //~ ERROR E0275 +LL | wizard::<*mut ()>(); | ^^^^^^^^^^^^^^^^^ | note: required by `wizard` diff --git a/src/test/ui/traits/traits-multidispatch-bad.stderr b/src/test/ui/traits/traits-multidispatch-bad.stderr index d6c6697c3c0e..5b800114aa8d 100644 --- a/src/test/ui/traits/traits-multidispatch-bad.stderr +++ b/src/test/ui/traits/traits-multidispatch-bad.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/traits-multidispatch-bad.rs:19:17 | -LL | test(22i32, 44i32); //~ ERROR mismatched types +LL | test(22i32, 44i32); | ^^^^^ expected u32, found i32 error: aborting due to previous error diff --git a/src/test/ui/traits/traits-repeated-supertrait-ambig.stderr b/src/test/ui/traits/traits-repeated-supertrait-ambig.stderr index f906378eb3cb..5d1c91376868 100644 --- a/src/test/ui/traits/traits-repeated-supertrait-ambig.stderr +++ b/src/test/ui/traits/traits-repeated-supertrait-ambig.stderr @@ -1,13 +1,13 @@ error[E0277]: the trait bound `dyn CompareToInts: CompareTo` is not satisfied --> $DIR/traits-repeated-supertrait-ambig.rs:26:7 | -LL | c.same_as(22) //~ ERROR `dyn CompareToInts: CompareTo` is not satisfied +LL | c.same_as(22) | ^^^^^^^ the trait `CompareTo` is not implemented for `dyn CompareToInts` error[E0277]: the trait bound `C: CompareTo` is not satisfied --> $DIR/traits-repeated-supertrait-ambig.rs:30:7 | -LL | c.same_as(22) //~ ERROR `C: CompareTo` is not satisfied +LL | c.same_as(22) | ^^^^^^^ the trait `CompareTo` is not implemented for `C` | = help: consider adding a `where C: CompareTo` bound @@ -15,7 +15,7 @@ LL | c.same_as(22) //~ ERROR `C: CompareTo` is not satisfied error[E0277]: the trait bound `dyn CompareToInts: CompareTo` is not satisfied --> $DIR/traits-repeated-supertrait-ambig.rs:34:5 | -LL | CompareToInts::same_as(c, 22) //~ ERROR `dyn CompareToInts: CompareTo` is not satisfied +LL | CompareToInts::same_as(c, 22) | ^^^^^^^^^^^^^^^^^^^^^^ the trait `CompareTo` is not implemented for `dyn CompareToInts` | note: required by `CompareTo::same_as` @@ -27,7 +27,7 @@ LL | fn same_as(&self, t: T) -> bool; error[E0277]: the trait bound `C: CompareTo` is not satisfied --> $DIR/traits-repeated-supertrait-ambig.rs:38:5 | -LL | CompareTo::same_as(c, 22) //~ ERROR `C: CompareTo` is not satisfied +LL | CompareTo::same_as(c, 22) | ^^^^^^^^^^^^^^^^^^ the trait `CompareTo` is not implemented for `C` | = help: consider adding a `where C: CompareTo` bound @@ -40,7 +40,7 @@ LL | fn same_as(&self, t: T) -> bool; error[E0277]: the trait bound `i64: CompareTo` is not satisfied --> $DIR/traits-repeated-supertrait-ambig.rs:42:23 | -LL | assert_eq!(22_i64.same_as(22), true); //~ ERROR `i64: CompareTo` is not satisfied +LL | assert_eq!(22_i64.same_as(22), true); | ^^^^^^^ the trait `CompareTo` is not implemented for `i64` | = help: the following implementations were found: diff --git a/src/test/ui/transmute-equal-assoc-types.stderr b/src/test/ui/transmute-equal-assoc-types.stderr index 46bbf1c18588..ce7657f9640b 100644 --- a/src/test/ui/transmute-equal-assoc-types.stderr +++ b/src/test/ui/transmute-equal-assoc-types.stderr @@ -1,7 +1,7 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/transmute-equal-assoc-types.rs:6:5 | -LL | ::std::mem::transmute(foo) //~ ERROR cannot transmute between types of different sizes +LL | ::std::mem::transmute(foo) | ^^^^^^^^^^^^^^^^^^^^^ | = note: `::Bar` does not have a fixed size diff --git a/src/test/ui/transmute/main.stderr b/src/test/ui/transmute/main.stderr index f4e88fc860ac..c72876e050f0 100644 --- a/src/test/ui/transmute/main.stderr +++ b/src/test/ui/transmute/main.stderr @@ -1,7 +1,7 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/main.rs:16:5 | -LL | transmute(x) //~ ERROR cannot transmute between types of different sizes +LL | transmute(x) | ^^^^^^^^^ | = note: source type: `>::T` (size can vary because of ::T) @@ -10,7 +10,7 @@ LL | transmute(x) //~ ERROR cannot transmute between types of different size error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/main.rs:20:17 | -LL | let x: u8 = transmute(10u16); //~ ERROR cannot transmute between types of different sizes +LL | let x: u8 = transmute(10u16); | ^^^^^^^^^ | = note: source type: `u16` (16 bits) @@ -19,7 +19,7 @@ LL | let x: u8 = transmute(10u16); //~ ERROR cannot transmute between types error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/main.rs:24:17 | -LL | let x: u8 = transmute("test"); //~ ERROR cannot transmute between types of different sizes +LL | let x: u8 = transmute("test"); | ^^^^^^^^^ | = note: source type: `&str` ($STR bits) @@ -28,7 +28,7 @@ LL | let x: u8 = transmute("test"); //~ ERROR cannot transmute between types error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/main.rs:29:18 | -LL | let x: Foo = transmute(10); //~ ERROR cannot transmute between types of different sizes +LL | let x: Foo = transmute(10); | ^^^^^^^^^ | = note: source type: `i32` (32 bits) diff --git a/src/test/ui/transmute/transmute-fat-pointers.stderr b/src/test/ui/transmute/transmute-fat-pointers.stderr index 4b34950881a4..e8335fcbed9d 100644 --- a/src/test/ui/transmute/transmute-fat-pointers.stderr +++ b/src/test/ui/transmute/transmute-fat-pointers.stderr @@ -1,7 +1,7 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/transmute-fat-pointers.rs:10:14 | -LL | unsafe { transmute(x) } //~ ERROR cannot transmute between types of different sizes +LL | unsafe { transmute(x) } | ^^^^^^^^^ | = note: source type: `&[T]` (N bits) @@ -10,7 +10,7 @@ LL | unsafe { transmute(x) } //~ ERROR cannot transmute between types of dif error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/transmute-fat-pointers.rs:14:14 | -LL | unsafe { transmute(x) } //~ ERROR cannot transmute between types of different sizes +LL | unsafe { transmute(x) } | ^^^^^^^^^ | = note: source type: `&T` (pointer to `T`) @@ -19,7 +19,7 @@ LL | unsafe { transmute(x) } //~ ERROR cannot transmute between types of dif error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/transmute-fat-pointers.rs:26:14 | -LL | unsafe { transmute(x) } //~ ERROR cannot transmute between types of different sizes +LL | unsafe { transmute(x) } | ^^^^^^^^^ | = note: source type: `&T` (pointer to `T`) @@ -28,7 +28,7 @@ LL | unsafe { transmute(x) } //~ ERROR cannot transmute between types of dif error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/transmute-fat-pointers.rs:30:14 | -LL | unsafe { transmute(x) } //~ ERROR cannot transmute between types of different sizes +LL | unsafe { transmute(x) } | ^^^^^^^^^ | = note: source type: `&T` (N bits) diff --git a/src/test/ui/transmute/transmute-impl.stderr b/src/test/ui/transmute/transmute-impl.stderr index 8acc0aaf3ab5..dd19bcd54e32 100644 --- a/src/test/ui/transmute/transmute-impl.stderr +++ b/src/test/ui/transmute/transmute-impl.stderr @@ -1,7 +1,7 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> $DIR/transmute-impl.rs:21:18 | -LL | unsafe { transmute(x) } //~ ERROR cannot transmute between types of different sizes +LL | unsafe { transmute(x) } | ^^^^^^^^^ | = note: source type: `&T` (pointer to `T`) diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.nll.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.nll.stderr index 8b86dd9a4c92..aac119afda54 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.nll.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `**t` as mutable, as it is behind a `&` reference | LL | fn reborrow_mut<'a>(t: &'a &'a mut i32) -> &'a mut i32 where &'a mut i32: Copy { | --------------- help: consider changing this to be a mutable reference: `&'a mut &'a mut i32` -LL | *t //~ ERROR +LL | *t | ^^ `t` is a `&` reference, so the data it refers to cannot be borrowed as mutable error[E0596]: cannot borrow `**t` as mutable, as it is behind a `&` reference @@ -11,7 +11,7 @@ error[E0596]: cannot borrow `**t` as mutable, as it is behind a `&` reference | LL | fn copy_reborrow_mut<'a>(t: &'a &'a mut i32) -> &'a mut i32 where &'a mut i32: Copy { | --------------- help: consider changing this to be a mutable reference: `&'a mut &'a mut i32` -LL | {*t} //~ ERROR +LL | {*t} | ^^ `t` is a `&` reference, so the data it refers to cannot be borrowed as mutable error: aborting due to 2 previous errors diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.stderr index a3995b7edefa..adaeb9b5d5da 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.stderr @@ -3,7 +3,7 @@ error[E0389]: cannot borrow data mutably in a `&` reference | LL | fn reborrow_mut<'a>(t: &'a &'a mut i32) -> &'a mut i32 where &'a mut i32: Copy { | --------------- use `&'a mut &'a mut i32` here to make mutable -LL | *t //~ ERROR +LL | *t | ^^ assignment into an immutable reference error[E0389]: cannot borrow data mutably in a `&` reference @@ -11,7 +11,7 @@ error[E0389]: cannot borrow data mutably in a `&` reference | LL | fn copy_reborrow_mut<'a>(t: &'a &'a mut i32) -> &'a mut i32 where &'a mut i32: Copy { | --------------- use `&'a mut &'a mut i32` here to make mutable -LL | {*t} //~ ERROR +LL | {*t} | ^^ assignment into an immutable reference error: aborting due to 2 previous errors diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection-error.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection-error.stderr index f769f23f115f..7c1a83344274 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection-error.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection-error.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn global_bound_is_hidden() -> u8 | -- expected `u8` because of return type ... -LL | B::get_x() //~ ERROR +LL | B::get_x() | ^^^^^^^^^^ expected u8, found i32 error: aborting due to previous error diff --git a/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.stderr b/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.stderr index b8e669d4a7c3..68d8129843e6 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of borrowed content --> $DIR/trivial-bounds-leak-copy.rs:9:5 | -LL | *t //~ ERROR +LL | *t | ^^ cannot move out of borrowed content error: aborting due to previous error diff --git a/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr b/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr index aa055d3dc03f..3de683e5661a 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr @@ -1,7 +1,7 @@ error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/trivial-bounds-leak.rs:12:25 | -LL | fn cant_return_str() -> str { //~ ERROR +LL | fn cant_return_str() -> str { | ^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `str` @@ -11,7 +11,7 @@ LL | fn cant_return_str() -> str { //~ ERROR error[E0599]: no method named `test` found for type `i32` in the current scope --> $DIR/trivial-bounds-leak.rs:24:10 | -LL | 3i32.test(); //~ ERROR +LL | 3i32.test(); | ^^^^ | = help: items from traits can only be used if the trait is implemented and in scope @@ -21,7 +21,7 @@ LL | 3i32.test(); //~ ERROR error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/trivial-bounds-leak.rs:25:5 | -LL | Foo::test(&4i32); //~ ERROR +LL | Foo::test(&4i32); | ^^^^^^^^^ the trait `Foo` is not implemented for `i32` | note: required by `Foo::test` @@ -33,7 +33,7 @@ LL | fn test(&self); error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/trivial-bounds-leak.rs:26:5 | -LL | generic_function(5i32); //~ ERROR +LL | generic_function(5i32); | ^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32` | note: required by `generic_function` diff --git a/src/test/ui/trivial-bounds/trivial-bounds-lint.stderr b/src/test/ui/trivial-bounds/trivial-bounds-lint.stderr index 6518e9028788..2f4b2df24cd5 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-lint.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-lint.stderr @@ -1,7 +1,7 @@ error: Trait bound i32: std::marker::Copy does not depend on any type or lifetime parameters --> $DIR/trivial-bounds-lint.rs:5:21 | -LL | struct A where i32: Copy; //~ ERROR +LL | struct A where i32: Copy; | ^^^^ | note: lint level defined here @@ -13,13 +13,13 @@ LL | #![deny(trivial_bounds)] error: Trait bound i32: X<()> does not depend on any type or lifetime parameters --> $DIR/trivial-bounds-lint.rs:18:30 | -LL | fn global_param() where i32: X<()> {} //~ ERROR +LL | fn global_param() where i32: X<()> {} | ^^^^^ error: Trait bound i32: Z does not depend on any type or lifetime parameters --> $DIR/trivial-bounds-lint.rs:22:35 | -LL | fn global_projection() where i32: Z {} //~ ERROR +LL | fn global_projection() where i32: Z {} | ^^^^^^^^^^ error: Lifetime bound i32 : 'static does not depend on any type or lifetime parameters @@ -37,13 +37,13 @@ LL | fn global_lifetimes() where i32: 'static, &'static str: 'static {} error: Lifetime bound 'static : 'static does not depend on any type or lifetime parameters --> $DIR/trivial-bounds-lint.rs:35:37 | -LL | fn global_outlives() where 'static: 'static {} //~ ERROR +LL | fn global_outlives() where 'static: 'static {} | ^^^^^^^ error: Trait bound i32: std::marker::Copy does not depend on any type or lifetime parameters --> $DIR/trivial-bounds-lint.rs:38:46 | -LL | fn mixed_bounds() where i32: X + Copy {} //~ ERROR +LL | fn mixed_bounds() where i32: X + Copy {} | ^^^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/trivial_casts.stderr b/src/test/ui/trivial_casts.stderr index fb1db76b1389..524eb7feaafb 100644 --- a/src/test/ui/trivial_casts.stderr +++ b/src/test/ui/trivial_casts.stderr @@ -1,7 +1,7 @@ error: trivial numeric cast: `i32` as `i32` --> $DIR/trivial_casts.rs:16:13 | -LL | let _ = 42_i32 as i32; //~ ERROR trivial numeric cast: `i32` as `i32` +LL | let _ = 42_i32 as i32; | ^^^^^^^^^^^^^ | note: lint level defined here @@ -14,7 +14,7 @@ LL | #![deny(trivial_casts, trivial_numeric_casts)] error: trivial numeric cast: `u8` as `u8` --> $DIR/trivial_casts.rs:19:13 | -LL | let _ = 42_u8 as u8; //~ ERROR trivial numeric cast: `u8` as `u8` +LL | let _ = 42_u8 as u8; | ^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -22,7 +22,7 @@ LL | let _ = 42_u8 as u8; //~ ERROR trivial numeric cast: `u8` as `u8` error: trivial cast: `&u32` as `*const u32` --> $DIR/trivial_casts.rs:24:13 | -LL | let _ = x as *const u32; //~ERROR trivial cast: `&u32` as `*const u32` +LL | let _ = x as *const u32; | ^^^^^^^^^^^^^^^ | note: lint level defined here @@ -35,7 +35,7 @@ LL | #![deny(trivial_casts, trivial_numeric_casts)] error: trivial cast: `&mut u32` as `*mut u32` --> $DIR/trivial_casts.rs:28:13 | -LL | let _ = x as *mut u32; //~ERROR trivial cast: `&mut u32` as `*mut u32` +LL | let _ = x as *mut u32; | ^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -43,7 +43,7 @@ LL | let _ = x as *mut u32; //~ERROR trivial cast: `&mut u32` as `*mut u32` error: trivial cast: `&[u32; 3]` as `&[u32]` --> $DIR/trivial_casts.rs:33:13 | -LL | let _ = x as &[u32]; //~ERROR trivial cast: `&[u32; 3]` as `&[u32]` +LL | let _ = x as &[u32]; | ^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -51,7 +51,7 @@ LL | let _ = x as &[u32]; //~ERROR trivial cast: `&[u32; 3]` as `&[u32]` error: trivial cast: `&[u32; 3]` as `*const [u32]` --> $DIR/trivial_casts.rs:34:13 | -LL | let _ = x as *const [u32]; //~ERROR trivial cast: `&[u32; 3]` as `*const [u32]` +LL | let _ = x as *const [u32]; | ^^^^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -59,7 +59,7 @@ LL | let _ = x as *const [u32]; //~ERROR trivial cast: `&[u32; 3]` as `*cons error: trivial cast: `&mut [u32; 3]` as `&mut [u32]` --> $DIR/trivial_casts.rs:39:13 | -LL | let _ = x as &mut [u32]; //~ERROR trivial cast: `&mut [u32; 3]` as `&mut [u32]` +LL | let _ = x as &mut [u32]; | ^^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -67,7 +67,7 @@ LL | let _ = x as &mut [u32]; //~ERROR trivial cast: `&mut [u32; 3]` as `&mu error: trivial cast: `&mut [u32; 3]` as `*mut [u32]` --> $DIR/trivial_casts.rs:40:13 | -LL | let _ = x as *mut [u32]; //~ERROR trivial cast: `&mut [u32; 3]` as `*mut [u32]` +LL | let _ = x as *mut [u32]; | ^^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -83,7 +83,7 @@ LL | let _ = x as Box<[u32]>; error: trivial cast: `&Bar` as `&dyn Foo` --> $DIR/trivial_casts.rs:52:13 | -LL | let _ = x as &Foo; //~ERROR trivial cast: `&Bar` as `&dyn Foo` +LL | let _ = x as &Foo; | ^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -91,7 +91,7 @@ LL | let _ = x as &Foo; //~ERROR trivial cast: `&Bar` as `&dyn Foo` error: trivial cast: `&Bar` as `*const dyn Foo` --> $DIR/trivial_casts.rs:53:13 | -LL | let _ = x as *const Foo; //~ERROR trivial cast: `&Bar` as `*const dyn Foo` +LL | let _ = x as *const Foo; | ^^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -99,7 +99,7 @@ LL | let _ = x as *const Foo; //~ERROR trivial cast: `&Bar` as `*const dyn F error: trivial cast: `&mut Bar` as `&mut dyn Foo` --> $DIR/trivial_casts.rs:58:13 | -LL | let _ = x as &mut Foo; //~ERROR trivial cast: `&mut Bar` as `&mut dyn Foo` +LL | let _ = x as &mut Foo; | ^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -107,7 +107,7 @@ LL | let _ = x as &mut Foo; //~ERROR trivial cast: `&mut Bar` as `&mut dyn F error: trivial cast: `&mut Bar` as `*mut dyn Foo` --> $DIR/trivial_casts.rs:59:13 | -LL | let _ = x as *mut Foo; //~ERROR trivial cast: `&mut Bar` as `*mut dyn Foo` +LL | let _ = x as *mut Foo; | ^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -115,7 +115,7 @@ LL | let _ = x as *mut Foo; //~ERROR trivial cast: `&mut Bar` as `*mut dyn F error: trivial cast: `std::boxed::Box` as `std::boxed::Box` --> $DIR/trivial_casts.rs:64:13 | -LL | let _ = x as Box; //~ERROR `std::boxed::Box` as `std::boxed::Box` +LL | let _ = x as Box; | ^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -123,7 +123,7 @@ LL | let _ = x as Box; //~ERROR `std::boxed::Box` as `std::boxed:: error: trivial cast: `&fn(i32) {main::baz}` as `&dyn std::ops::Fn(i32)` --> $DIR/trivial_casts.rs:70:13 | -LL | let _ = &baz as &Fn(i32); //~ERROR `&fn(i32) {main::baz}` as `&dyn std::ops::Fn(i32)` +LL | let _ = &baz as &Fn(i32); | ^^^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -131,7 +131,7 @@ LL | let _ = &baz as &Fn(i32); //~ERROR `&fn(i32) {main::baz}` as `&dyn std: error: trivial cast: `&[closure@$DIR/trivial_casts.rs:72:13: 72:25]` as `&dyn std::ops::Fn(i32)` --> $DIR/trivial_casts.rs:73:13 | -LL | let _ = &x as &Fn(i32); //~ERROR trivial cast +LL | let _ = &x as &Fn(i32); | ^^^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -139,7 +139,7 @@ LL | let _ = &x as &Fn(i32); //~ERROR trivial cast error: trivial cast: `&'a Bar` as `&'a Bar` --> $DIR/trivial_casts.rs:79:13 | -LL | let _ = a as &'a Bar; //~ERROR trivial cast +LL | let _ = a as &'a Bar; | ^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -147,7 +147,7 @@ LL | let _ = a as &'a Bar; //~ERROR trivial cast error: trivial cast: `&'b Bar` as `&'a Bar` --> $DIR/trivial_casts.rs:81:13 | -LL | let _ = b as &'a Bar; //~ERROR trivial cast +LL | let _ = b as &'a Bar; | ^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable @@ -155,7 +155,7 @@ LL | let _ = b as &'a Bar; //~ERROR trivial cast error: trivial cast: `&'b Bar` as `&'b Bar` --> $DIR/trivial_casts.rs:83:13 | -LL | let _ = b as &'b Bar; //~ERROR trivial cast +LL | let _ = b as &'b Bar; | ^^^^^^^^^^^^ | = help: cast can be replaced by coercion; this might require a temporary variable diff --git a/src/test/ui/try-block/try-block-bad-lifetime.stderr b/src/test/ui/try-block/try-block-bad-lifetime.stderr index b1b925d694ff..a236cb90557b 100644 --- a/src/test/ui/try-block/try-block-bad-lifetime.stderr +++ b/src/test/ui/try-block/try-block-bad-lifetime.stderr @@ -16,10 +16,10 @@ error[E0506]: cannot assign to `i` because it is borrowed LL | let k = &mut i; | ------ borrow of `i` occurs here ... -LL | i = 10; //~ ERROR cannot assign to `i` because it is borrowed +LL | i = 10; | ^^^^^^ assignment to borrowed `i` occurs here LL | }; -LL | ::std::mem::drop(k); //~ ERROR use of moved value: `k` +LL | ::std::mem::drop(k); | - borrow later used here error[E0382]: use of moved value: `k` @@ -31,7 +31,7 @@ LL | let mut j: Result<(), &mut i32> = try { LL | Err(k) ?; | - value moved here ... -LL | ::std::mem::drop(k); //~ ERROR use of moved value: `k` +LL | ::std::mem::drop(k); | ^ value used here after move error[E0506]: cannot assign to `i` because it is borrowed @@ -40,7 +40,7 @@ error[E0506]: cannot assign to `i` because it is borrowed LL | let k = &mut i; | ------ borrow of `i` occurs here ... -LL | i = 40; //~ ERROR cannot assign to `i` because it is borrowed +LL | i = 40; | ^^^^^^ assignment to borrowed `i` occurs here LL | LL | let i_ptr = if let Err(i_ptr) = j { i_ptr } else { panic ! ("") }; diff --git a/src/test/ui/try-block/try-block-bad-type.stderr b/src/test/ui/try-block/try-block-bad-type.stderr index df8e646280c9..6687bd9d9e1f 100644 --- a/src/test/ui/try-block/try-block-bad-type.stderr +++ b/src/test/ui/try-block/try-block-bad-type.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `i32: std::convert::From<&str>` is not satisfied --> $DIR/try-block-bad-type.rs:7:9 | -LL | Err("")?; //~ ERROR the trait bound `i32: std::convert::From<&str>` is not satisfied +LL | Err("")?; | ^^^^^^^^ the trait `std::convert::From<&str>` is not implemented for `i32` | = help: the following implementations were found: @@ -15,7 +15,7 @@ LL | Err("")?; //~ ERROR the trait bound `i32: std::convert::From<&str>` error[E0271]: type mismatch resolving ` as std::ops::Try>::Ok == &str` --> $DIR/try-block-bad-type.rs:12:9 | -LL | "" //~ ERROR type mismatch +LL | "" | ^^ expected i32, found &str | = note: expected type `i32` @@ -24,7 +24,7 @@ LL | "" //~ ERROR type mismatch error[E0271]: type mismatch resolving ` as std::ops::Try>::Ok == ()` --> $DIR/try-block-bad-type.rs:15:39 | -LL | let res: Result = try { }; //~ ERROR type mismatch +LL | let res: Result = try { }; | ^ expected i32, found () | = note: expected type `i32` @@ -33,7 +33,7 @@ LL | let res: Result = try { }; //~ ERROR type mismatch error[E0277]: the trait bound `(): std::ops::Try` is not satisfied --> $DIR/try-block-bad-type.rs:17:23 | -LL | let res: () = try { }; //~ the trait bound `(): std::ops::Try` is not satisfied +LL | let res: () = try { }; | ^^^ the trait `std::ops::Try` is not implemented for `()` | = note: required by `std::ops::Try::from_ok` @@ -41,7 +41,7 @@ LL | let res: () = try { }; //~ the trait bound `(): std::ops::Try` is not s error[E0277]: the trait bound `i32: std::ops::Try` is not satisfied --> $DIR/try-block-bad-type.rs:19:24 | -LL | let res: i32 = try { 5 }; //~ ERROR the trait bound `i32: std::ops::Try` is not satisfied +LL | let res: i32 = try { 5 }; | ^^^^^ the trait `std::ops::Try` is not implemented for `i32` | = note: required by `std::ops::Try::from_ok` diff --git a/src/test/ui/try-block/try-block-in-edition2015.stderr b/src/test/ui/try-block/try-block-in-edition2015.stderr index 7394fec6f366..c94e43131faf 100644 --- a/src/test/ui/try-block/try-block-in-edition2015.stderr +++ b/src/test/ui/try-block/try-block-in-edition2015.stderr @@ -3,12 +3,12 @@ error: expected identifier, found keyword `let` | LL | let try_result: Option<_> = try { | --- while parsing this struct -LL | //~^ ERROR expected struct, variant or union type, found macro `try` -LL | let x = 5; //~ ERROR expected identifier, found keyword +LL | +LL | let x = 5; | ^^^ expected identifier, found keyword help: you can escape reserved keywords to use them as identifiers | -LL | r#let x = 5; //~ ERROR expected identifier, found keyword +LL | r#let x = 5; | ^^^^^ error[E0574]: expected struct, variant or union type, found macro `try` diff --git a/src/test/ui/try-block/try-block-in-match.stderr b/src/test/ui/try-block/try-block-in-match.stderr index 089347073b5c..936e0fe19baf 100644 --- a/src/test/ui/try-block/try-block-in-match.stderr +++ b/src/test/ui/try-block/try-block-in-match.stderr @@ -1,7 +1,7 @@ error: expected expression, found reserved keyword `try` --> $DIR/try-block-in-match.rs:6:11 | -LL | match try { false } { _ => {} } //~ ERROR expected expression, found reserved keyword `try` +LL | match try { false } { _ => {} } | ----- ^^^ expected expression | | | while parsing this match expression diff --git a/src/test/ui/try-block/try-block-in-while.stderr b/src/test/ui/try-block/try-block-in-while.stderr index b4f17778b298..026df15eb877 100644 --- a/src/test/ui/try-block/try-block-in-while.stderr +++ b/src/test/ui/try-block/try-block-in-while.stderr @@ -1,7 +1,7 @@ error: expected expression, found reserved keyword `try` --> $DIR/try-block-in-while.rs:6:11 | -LL | while try { false } {} //~ ERROR expected expression, found reserved keyword `try` +LL | while try { false } {} | ^^^ expected expression error: aborting due to previous error diff --git a/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr b/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr index dafbde6a5150..665a6262d3ae 100644 --- a/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr +++ b/src/test/ui/try-block/try-block-maybe-bad-lifetime.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `i` because it is borrowed LL | &i | -- borrow of `i` occurs here LL | }; -LL | i = 0; //~ ERROR cannot assign to `i` because it is borrowed +LL | i = 0; | ^^^^^ assignment to borrowed `i` occurs here LL | let _ = i; LL | do_something_with(x); @@ -19,7 +19,7 @@ LL | let x = String::new(); LL | ::std::mem::drop(x); | - value moved here LL | }; -LL | println!("{}", x); //~ ERROR borrow of moved value: `x` +LL | println!("{}", x); | ^ value borrowed here after move error[E0506]: cannot assign to `i` because it is borrowed @@ -28,7 +28,7 @@ error[E0506]: cannot assign to `i` because it is borrowed LL | j = &i; | -- borrow of `i` occurs here LL | }; -LL | i = 0; //~ ERROR cannot assign to `i` because it is borrowed +LL | i = 0; | ^^^^^ assignment to borrowed `i` occurs here LL | let _ = i; LL | do_something_with(j); diff --git a/src/test/ui/try-block/try-block-opt-init.stderr b/src/test/ui/try-block/try-block-opt-init.stderr index a0bc45d4fcd5..ec0128dbdf0f 100644 --- a/src/test/ui/try-block/try-block-opt-init.stderr +++ b/src/test/ui/try-block/try-block-opt-init.stderr @@ -1,7 +1,7 @@ error[E0381]: borrow of possibly uninitialized variable: `cfg_res` --> $DIR/try-block-opt-init.rs:15:5 | -LL | assert_eq!(cfg_res, 5); //~ ERROR borrow of possibly uninitialized variable: `cfg_res` +LL | assert_eq!(cfg_res, 5); | ^^^^^^^^^^^^^^^^^^^^^^^ use of possibly uninitialized `cfg_res` | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/src/test/ui/try-on-option.stderr b/src/test/ui/try-on-option.stderr index 438b3c2e343f..7dfa1a7d3a0c 100644 --- a/src/test/ui/try-on-option.stderr +++ b/src/test/ui/try-on-option.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `(): std::convert::From` is not satisfied --> $DIR/try-on-option.rs:7:5 | -LL | x?; //~ the trait bound +LL | x?; | ^^ the trait `std::convert::From` is not implemented for `()` | = note: required by `std::convert::From::from` @@ -9,7 +9,7 @@ LL | x?; //~ the trait bound error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `std::ops::Try`) --> $DIR/try-on-option.rs:13:5 | -LL | x?; //~ the `?` operator +LL | x?; | ^^ cannot use the `?` operator in a function that returns `u32` | = help: the trait `std::ops::Try` is not implemented for `u32` diff --git a/src/test/ui/try-operator-on-main.stderr b/src/test/ui/try-operator-on-main.stderr index 9a2052f72835..9f120e009485 100644 --- a/src/test/ui/try-operator-on-main.stderr +++ b/src/test/ui/try-operator-on-main.stderr @@ -1,7 +1,7 @@ error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `std::ops::Try`) --> $DIR/try-operator-on-main.rs:9:5 | -LL | std::fs::File::open("foo")?; //~ ERROR the `?` operator can only +LL | std::fs::File::open("foo")?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot use the `?` operator in a function that returns `()` | = help: the trait `std::ops::Try` is not implemented for `()` @@ -10,7 +10,7 @@ LL | std::fs::File::open("foo")?; //~ ERROR the `?` operator can only error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try` --> $DIR/try-operator-on-main.rs:12:5 | -LL | ()?; //~ ERROR the `?` operator can only +LL | ()?; | ^^^ the `?` operator cannot be applied to type `()` | = help: the trait `std::ops::Try` is not implemented for `()` @@ -19,7 +19,7 @@ LL | ()?; //~ ERROR the `?` operator can only error[E0277]: the trait bound `(): std::ops::Try` is not satisfied --> $DIR/try-operator-on-main.rs:15:5 | -LL | try_trait_generic::<()>(); //~ ERROR the trait bound +LL | try_trait_generic::<()>(); | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::ops::Try` is not implemented for `()` | note: required by `try_trait_generic` @@ -31,7 +31,7 @@ LL | fn try_trait_generic() -> T { error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try` --> $DIR/try-operator-on-main.rs:22:5 | -LL | ()?; //~ ERROR the `?` operator can only +LL | ()?; | ^^^ the `?` operator cannot be applied to type `()` | = help: the trait `std::ops::Try` is not implemented for `()` diff --git a/src/test/ui/tuple/tuple-float-index.stderr b/src/test/ui/tuple/tuple-float-index.stderr index 9a3e384b9d1c..a0ea0e0a30a7 100644 --- a/src/test/ui/tuple/tuple-float-index.stderr +++ b/src/test/ui/tuple/tuple-float-index.stderr @@ -1,7 +1,7 @@ error: unexpected token: `1.1` --> $DIR/tuple-float-index.rs:4:17 | -LL | (1, (2, 3)).1.1; //~ ERROR unexpected token: `1.1` +LL | (1, (2, 3)).1.1; | ------------^^^ | | | | | unexpected token diff --git a/src/test/ui/tuple/tuple-struct-fields/test2.stderr b/src/test/ui/tuple/tuple-struct-fields/test2.stderr index 80f0ddc0e4fc..78176c67ed20 100644 --- a/src/test/ui/tuple/tuple-struct-fields/test2.stderr +++ b/src/test/ui/tuple/tuple-struct-fields/test2.stderr @@ -4,13 +4,13 @@ error: expected one of `)` or `,`, found `(` LL | struct S3(pub $t ()); | ^ expected one of `)` or `,` here ... -LL | define_struct! { (foo) } //~ ERROR cannot find type `foo` in this scope +LL | define_struct! { (foo) } | ------------------------ in this macro invocation error[E0412]: cannot find type `foo` in this scope --> $DIR/test2.rs:11:23 | -LL | define_struct! { (foo) } //~ ERROR cannot find type `foo` in this scope +LL | define_struct! { (foo) } | ^^^ not found in this scope error: aborting due to 2 previous errors diff --git a/src/test/ui/tuple/tuple-struct-fields/test3.stderr b/src/test/ui/tuple/tuple-struct-fields/test3.stderr index fbc01744fe44..e105aad09e6b 100644 --- a/src/test/ui/tuple/tuple-struct-fields/test3.stderr +++ b/src/test/ui/tuple/tuple-struct-fields/test3.stderr @@ -4,13 +4,13 @@ error: expected one of `)` or `,`, found `(` LL | struct S3(pub($t) ()); | ^ expected one of `)` or `,` here ... -LL | define_struct! { foo } //~ ERROR cannot find type `foo` in this scope +LL | define_struct! { foo } | ---------------------- in this macro invocation error[E0412]: cannot find type `foo` in this scope --> $DIR/test3.rs:11:22 | -LL | define_struct! { foo } //~ ERROR cannot find type `foo` in this scope +LL | define_struct! { foo } | ^^^ not found in this scope error: aborting due to 2 previous errors diff --git a/src/test/ui/tuple/tuple-struct-nonexhaustive.stderr b/src/test/ui/tuple/tuple-struct-nonexhaustive.stderr index 8d627fc2a8d7..bbdf9ceed23a 100644 --- a/src/test/ui/tuple/tuple-struct-nonexhaustive.stderr +++ b/src/test/ui/tuple/tuple-struct-nonexhaustive.stderr @@ -1,8 +1,13 @@ error[E0004]: non-exhaustive patterns: `Foo(_, _)` not covered --> $DIR/tuple-struct-nonexhaustive.rs:5:11 | -LL | match x { //~ ERROR non-exhaustive +LL | struct Foo(isize, isize); + | ------------------------- `Foo` defined here +... +LL | match x { | ^ pattern `Foo(_, _)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error: aborting due to previous error diff --git a/src/test/ui/type-alias-enum-variants-priority-2.stderr b/src/test/ui/type-alias-enum-variants-priority-2.stderr index c6ec96ebb7d3..10a4b44084a4 100644 --- a/src/test/ui/type-alias-enum-variants-priority-2.stderr +++ b/src/test/ui/type-alias-enum-variants-priority-2.stderr @@ -4,7 +4,7 @@ error[E0061]: this function takes 1 parameter but 0 parameters were supplied LL | V(u8) | ----- defined here ... -LL | ::V(); //~ ERROR this function takes 1 parameter but 0 parameters were supplied +LL | ::V(); | ^^^^^^^^ expected 1 parameter error: aborting due to previous error diff --git a/src/test/ui/type/type-alias-bounds.stderr b/src/test/ui/type/type-alias-bounds.stderr index b13e40010521..3cc844365fdd 100644 --- a/src/test/ui/type/type-alias-bounds.stderr +++ b/src/test/ui/type/type-alias-bounds.stderr @@ -42,33 +42,33 @@ LL | type W2Vec<'b, T> where T: 'b, T: 'b = (&'b u32, Vec); warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias-bounds.rs:47:12 | -LL | type T1 = U::Assoc; //~ WARN not enforced in type aliases +LL | type T1 = U::Assoc; | ^^^^^ | = help: the bound will not be checked when the type alias is used, and should be removed help: use fully disambiguated paths (i.e., `::Assoc`) to refer to associated types in type aliases --> $DIR/type-alias-bounds.rs:47:21 | -LL | type T1 = U::Assoc; //~ WARN not enforced in type aliases +LL | type T1 = U::Assoc; | ^^^^^^^^ warning: where clauses are not enforced in type aliases --> $DIR/type-alias-bounds.rs:48:18 | -LL | type T2 where U: Bound = U::Assoc; //~ WARN not enforced in type aliases +LL | type T2 where U: Bound = U::Assoc; | ^^^^^^^^ | = help: the clause will not be checked when the type alias is used, and should be removed help: use fully disambiguated paths (i.e., `::Assoc`) to refer to associated types in type aliases --> $DIR/type-alias-bounds.rs:48:29 | -LL | type T2 where U: Bound = U::Assoc; //~ WARN not enforced in type aliases +LL | type T2 where U: Bound = U::Assoc; | ^^^^^^^^ warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias-bounds.rs:56:12 | -LL | type T5 = ::Assoc; //~ WARN not enforced in type aliases +LL | type T5 = ::Assoc; | ^^^^^ | = help: the bound will not be checked when the type alias is used, and should be removed @@ -76,7 +76,7 @@ LL | type T5 = ::Assoc; //~ WARN not enforced in type ali warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias-bounds.rs:57:12 | -LL | type T6 = ::std::vec::Vec; //~ WARN not enforced in type aliases +LL | type T6 = ::std::vec::Vec; | ^^^^^ | = help: the bound will not be checked when the type alias is used, and should be removed diff --git a/src/test/ui/type/type-ascription-instead-of-initializer.stderr b/src/test/ui/type/type-ascription-instead-of-initializer.stderr index 8ce367d70f01..a22d25697d8b 100644 --- a/src/test/ui/type/type-ascription-instead-of-initializer.stderr +++ b/src/test/ui/type/type-ascription-instead-of-initializer.stderr @@ -1,7 +1,7 @@ error: expected type, found `10` --> $DIR/type-ascription-instead-of-initializer.rs:2:31 | -LL | let x: Vec::with_capacity(10, 20); //~ ERROR expected type, found `10` +LL | let x: Vec::with_capacity(10, 20); | -- ^^ | || | |help: use `=` if you meant to assign @@ -10,7 +10,7 @@ LL | let x: Vec::with_capacity(10, 20); //~ ERROR expected type, found `10` error[E0061]: this function takes 1 parameter but 2 parameters were supplied --> $DIR/type-ascription-instead-of-initializer.rs:2:12 | -LL | let x: Vec::with_capacity(10, 20); //~ ERROR expected type, found `10` +LL | let x: Vec::with_capacity(10, 20); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 parameter error: aborting due to 2 previous errors diff --git a/src/test/ui/type/type-ascription-instead-of-statement-end.stderr b/src/test/ui/type/type-ascription-instead-of-statement-end.stderr index db99d1ec07be..bc5a923a3f32 100644 --- a/src/test/ui/type/type-ascription-instead-of-statement-end.stderr +++ b/src/test/ui/type/type-ascription-instead-of-statement-end.stderr @@ -3,13 +3,13 @@ error: expected type, found `0` | LL | println!("test"): | - help: try using a semicolon: `;` -LL | 0; //~ ERROR expected type, found `0` +LL | 0; | ^ expecting a type here because of type ascription error: expected type, found `0` --> $DIR/type-ascription-instead-of-statement-end.rs:9:23 | -LL | println!("test"): 0; //~ ERROR expected type, found `0` +LL | println!("test"): 0; | ^ expecting a type here because of type ascription error: aborting due to 2 previous errors diff --git a/src/test/ui/type/type-ascription-precedence.stderr b/src/test/ui/type/type-ascription-precedence.stderr index e52e2bc5e9a7..992974eef642 100644 --- a/src/test/ui/type/type-ascription-precedence.stderr +++ b/src/test/ui/type/type-ascription-precedence.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/type-ascription-precedence.rs:31:7 | -LL | &(S: &S); //~ ERROR mismatched types +LL | &(S: &S); | ^ expected &S, found struct `S` | = note: expected type `&S` @@ -10,7 +10,7 @@ LL | &(S: &S); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-ascription-precedence.rs:35:7 | -LL | *(S: Z); //~ ERROR mismatched types +LL | *(S: Z); | ^ expected struct `Z`, found struct `S` | = note: expected type `Z` @@ -19,13 +19,13 @@ LL | *(S: Z); //~ ERROR mismatched types error[E0614]: type `Z` cannot be dereferenced --> $DIR/type-ascription-precedence.rs:35:5 | -LL | *(S: Z); //~ ERROR mismatched types +LL | *(S: Z); | ^^^^^^^ error[E0308]: mismatched types --> $DIR/type-ascription-precedence.rs:40:7 | -LL | -(S: Z); //~ ERROR mismatched types +LL | -(S: Z); | ^ expected struct `Z`, found struct `S` | = note: expected type `Z` @@ -34,7 +34,7 @@ LL | -(S: Z); //~ ERROR mismatched types error[E0600]: cannot apply unary operator `-` to type `Z` --> $DIR/type-ascription-precedence.rs:40:5 | -LL | -(S: Z); //~ ERROR mismatched types +LL | -(S: Z); | ^^^^^^^ cannot apply unary operator `-` | = note: an implementation of `std::ops::Neg` might be missing for `Z` @@ -42,7 +42,7 @@ LL | -(S: Z); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-ascription-precedence.rs:45:5 | -LL | (S + Z): Z; //~ ERROR mismatched types +LL | (S + Z): Z; | ^^^^^^^ expected struct `Z`, found struct `S` | = note: expected type `Z` @@ -51,7 +51,7 @@ LL | (S + Z): Z; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-ascription-precedence.rs:49:5 | -LL | (S * Z): Z; //~ ERROR mismatched types +LL | (S * Z): Z; | ^^^^^^^ expected struct `Z`, found struct `S` | = note: expected type `Z` @@ -60,7 +60,7 @@ LL | (S * Z): Z; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-ascription-precedence.rs:53:5 | -LL | (S .. S): S; //~ ERROR mismatched types +LL | (S .. S): S; | ^^^^^^^^ expected struct `S`, found struct `std::ops::Range` | = note: expected type `S` diff --git a/src/test/ui/type/type-ascription-soundness.stderr b/src/test/ui/type/type-ascription-soundness.stderr index f681a0423024..150e19020fea 100644 --- a/src/test/ui/type/type-ascription-soundness.stderr +++ b/src/test/ui/type/type-ascription-soundness.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/type-ascription-soundness.rs:7:17 | -LL | let ref x = arr: &[u8]; //~ ERROR mismatched types +LL | let ref x = arr: &[u8]; | ^^^ expected slice, found array of 3 elements | = note: expected type `&[u8]` @@ -10,7 +10,7 @@ LL | let ref x = arr: &[u8]; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-ascription-soundness.rs:8:21 | -LL | let ref mut x = arr: &[u8]; //~ ERROR mismatched types +LL | let ref mut x = arr: &[u8]; | ^^^ expected slice, found array of 3 elements | = note: expected type `&[u8]` @@ -19,7 +19,7 @@ LL | let ref mut x = arr: &[u8]; //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-ascription-soundness.rs:9:11 | -LL | match arr: &[u8] { //~ ERROR mismatched types +LL | match arr: &[u8] { | ^^^ expected slice, found array of 3 elements | = note: expected type `&[u8]` @@ -28,7 +28,7 @@ LL | match arr: &[u8] { //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-ascription-soundness.rs:12:17 | -LL | let _len = (arr: &[u8]).len(); //~ ERROR mismatched types +LL | let _len = (arr: &[u8]).len(); | ^^^ expected slice, found array of 3 elements | = note: expected type `&[u8]` diff --git a/src/test/ui/type/type-ascription-with-fn-call.stderr b/src/test/ui/type/type-ascription-with-fn-call.stderr index a290e69e0cb6..eeaca5300f9b 100644 --- a/src/test/ui/type/type-ascription-with-fn-call.stderr +++ b/src/test/ui/type/type-ascription-with-fn-call.stderr @@ -3,7 +3,7 @@ error[E0573]: expected type, found function `f` | LL | f() : | - help: did you mean to use `;` here instead? -LL | f(); //~ ERROR expected type, found function +LL | f(); | ^^^ | | | not a type diff --git a/src/test/ui/type/type-check/cannot_infer_local_or_array.stderr b/src/test/ui/type/type-check/cannot_infer_local_or_array.stderr index a2df3dcd8e70..17be67c6c3a0 100644 --- a/src/test/ui/type/type-check/cannot_infer_local_or_array.stderr +++ b/src/test/ui/type/type-check/cannot_infer_local_or_array.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/cannot_infer_local_or_array.rs:2:13 | -LL | let x = []; //~ ERROR type annotations needed +LL | let x = []; | - ^^ cannot infer type | | | consider giving `x` a type diff --git a/src/test/ui/type/type-check/issue-22897.stderr b/src/test/ui/type/type-check/issue-22897.stderr index a4f1c4d5d4df..2b3f0696f3c2 100644 --- a/src/test/ui/type/type-check/issue-22897.stderr +++ b/src/test/ui/type/type-check/issue-22897.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/issue-22897.rs:4:5 | -LL | []; //~ ERROR type annotations needed +LL | []; | ^^ cannot infer type for `[_; 0]` error: aborting due to previous error diff --git a/src/test/ui/type/type-check/issue-40294.stderr b/src/test/ui/type/type-check/issue-40294.stderr index d63abdbeb5d4..254875fcaab3 100644 --- a/src/test/ui/type/type-check/issue-40294.stderr +++ b/src/test/ui/type/type-check/issue-40294.stderr @@ -1,7 +1,7 @@ error[E0283]: type annotations required: cannot resolve `&'a T: Foo` --> $DIR/issue-40294.rs:5:1 | -LL | / fn foo<'a,'b,T>(x: &'a T, y: &'b T) //~ ERROR type annotations required +LL | / fn foo<'a,'b,T>(x: &'a T, y: &'b T) LL | | where &'a T : Foo, LL | | &'b T : Foo LL | | { diff --git a/src/test/ui/type/type-check/issue-41314.stderr b/src/test/ui/type/type-check/issue-41314.stderr index a4ae2a97134e..3461ab4df60b 100644 --- a/src/test/ui/type/type-check/issue-41314.stderr +++ b/src/test/ui/type/type-check/issue-41314.stderr @@ -1,13 +1,13 @@ error[E0026]: variant `X::Y` does not have a field named `number` --> $DIR/issue-41314.rs:7:16 | -LL | X::Y { number } => {} //~ ERROR does not have a field named `number` +LL | X::Y { number } => {} | ^^^^^^ variant `X::Y` does not have this field error[E0027]: pattern does not mention field `0` --> $DIR/issue-41314.rs:7:9 | -LL | X::Y { number } => {} //~ ERROR does not have a field named `number` +LL | X::Y { number } => {} | ^^^^^^^^^^^^^^^ missing field `0` | = note: trying to match a tuple variant with a struct variant pattern diff --git a/src/test/ui/type/type-check/missing_trait_impl.stderr b/src/test/ui/type/type-check/missing_trait_impl.stderr index 9f59e7162e07..69b531d0c846 100644 --- a/src/test/ui/type/type-check/missing_trait_impl.stderr +++ b/src/test/ui/type/type-check/missing_trait_impl.stderr @@ -1,7 +1,7 @@ error[E0369]: binary operation `+` cannot be applied to type `T` --> $DIR/missing_trait_impl.rs:5:13 | -LL | let z = x + y; //~ ERROR binary operation `+` cannot be applied to type `T` +LL | let z = x + y; | ^^^^^ | = note: `T` might need a bound for `std::ops::Add` @@ -9,7 +9,7 @@ LL | let z = x + y; //~ ERROR binary operation `+` cannot be applied to type error[E0368]: binary assignment operation `+=` cannot be applied to type `T` --> $DIR/missing_trait_impl.rs:9:5 | -LL | x += x; //~ ERROR binary assignment operation `+=` cannot be applied to type `T` +LL | x += x; | -^^^^^ | | | cannot use `+=` on type `T` diff --git a/src/test/ui/type/type-check/unknown_type_for_closure.stderr b/src/test/ui/type/type-check/unknown_type_for_closure.stderr index 45142b556ecd..5971f56c97f7 100644 --- a/src/test/ui/type/type-check/unknown_type_for_closure.stderr +++ b/src/test/ui/type/type-check/unknown_type_for_closure.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/unknown_type_for_closure.rs:2:14 | -LL | let x = |_| { }; //~ ERROR type annotations needed +LL | let x = |_| { }; | ^ consider giving this closure parameter a type error: aborting due to previous error diff --git a/src/test/ui/type/type-dependent-def-issue-49241.stderr b/src/test/ui/type/type-dependent-def-issue-49241.stderr index 0af777fdcf90..5040b728c539 100644 --- a/src/test/ui/type/type-dependent-def-issue-49241.stderr +++ b/src/test/ui/type/type-dependent-def-issue-49241.stderr @@ -1,7 +1,7 @@ error[E0435]: attempt to use a non-constant value in a constant --> $DIR/type-dependent-def-issue-49241.rs:3:22 | -LL | const l: usize = v.count(); //~ ERROR attempt to use a non-constant value in a constant +LL | const l: usize = v.count(); | ^ non-constant value error[E0080]: evaluation of constant value failed diff --git a/src/test/ui/type/type-mismatch.stderr b/src/test/ui/type/type-mismatch.stderr index 0b239e91eb80..7aea9db6167a 100644 --- a/src/test/ui/type/type-mismatch.stderr +++ b/src/test/ui/type/type-mismatch.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:17:17 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected struct `foo`, found usize | = note: expected type `foo` @@ -10,7 +10,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:18:17 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected struct `bar`, found usize | = note: expected type `bar` @@ -19,7 +19,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:19:24 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `Foo`, found usize | = note: expected type `Foo` @@ -28,7 +28,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:20:27 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `Foo`, found usize | = note: expected type `Foo` @@ -37,7 +37,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:21:22 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `Foo`, found usize | = note: expected type `Foo` @@ -46,7 +46,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:22:25 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `Foo`, found usize | = note: expected type `Foo` @@ -55,7 +55,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:23:22 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `Foo`, found usize | = note: expected type `Foo` @@ -64,7 +64,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:24:25 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `Foo`, found usize | = note: expected type `Foo` @@ -73,7 +73,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:28:19 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected usize, found struct `foo` | = note: expected type `usize` @@ -82,7 +82,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:29:17 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected struct `bar`, found struct `foo` | = note: expected type `bar` @@ -91,7 +91,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:30:24 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `Foo`, found struct `foo` | = note: expected type `Foo` @@ -100,7 +100,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:31:27 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `Foo`, found struct `foo` | = note: expected type `Foo` @@ -109,7 +109,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:32:22 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `Foo`, found struct `foo` | = note: expected type `Foo` @@ -118,7 +118,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:33:25 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `Foo`, found struct `foo` | = note: expected type `Foo` @@ -127,7 +127,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:34:22 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `Foo`, found struct `foo` | = note: expected type `Foo` @@ -136,7 +136,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:35:25 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `Foo`, found struct `foo` | = note: expected type `Foo` @@ -145,7 +145,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:39:19 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected usize, found struct `Foo` | = note: expected type `usize` @@ -154,7 +154,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:40:17 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected struct `foo`, found struct `Foo` | = note: expected type `foo` @@ -163,7 +163,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:41:17 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected struct `bar`, found struct `Foo` | = note: expected type `bar` @@ -172,7 +172,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:42:24 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected usize, found struct `foo` | = note: expected type `Foo` @@ -181,7 +181,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:43:27 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected usize, found struct `foo` | = note: expected type `Foo` @@ -190,7 +190,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:44:25 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `B`, found struct `A` | = note: expected type `Foo<_, B>` @@ -199,7 +199,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:45:22 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `bar`, found struct `foo` | = note: expected type `Foo` @@ -208,7 +208,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:46:25 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `bar`, found struct `foo` | = note: expected type `Foo` @@ -217,7 +217,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:47:23 | -LL | want::<&Foo>(f); //~ ERROR mismatched types +LL | want::<&Foo>(f); | ^ | | | expected &Foo, found struct `Foo` @@ -229,7 +229,7 @@ LL | want::<&Foo>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:48:26 | -LL | want::<&Foo>(f); //~ ERROR mismatched types +LL | want::<&Foo>(f); | ^ expected reference, found struct `Foo` | = note: expected type `&Foo` @@ -238,7 +238,7 @@ LL | want::<&Foo>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:52:19 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected usize, found struct `Foo` | = note: expected type `usize` @@ -247,7 +247,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:53:17 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected struct `foo`, found struct `Foo` | = note: expected type `foo` @@ -256,7 +256,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:54:17 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected struct `bar`, found struct `Foo` | = note: expected type `bar` @@ -265,7 +265,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:55:24 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected usize, found struct `foo` | = note: expected type `Foo` @@ -274,7 +274,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:56:27 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected usize, found struct `foo` | = note: expected type `Foo` @@ -283,7 +283,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:57:22 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `A`, found struct `B` | = note: expected type `Foo<_, A>` @@ -292,7 +292,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:58:22 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `bar`, found struct `foo` | = note: expected type `Foo` @@ -301,7 +301,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:59:25 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `bar`, found struct `foo` | = note: expected type `Foo` @@ -310,7 +310,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:60:23 | -LL | want::<&Foo>(f); //~ ERROR mismatched types +LL | want::<&Foo>(f); | ^ expected &Foo, found struct `Foo` | = note: expected type `&Foo` @@ -319,7 +319,7 @@ LL | want::<&Foo>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:61:26 | -LL | want::<&Foo>(f); //~ ERROR mismatched types +LL | want::<&Foo>(f); | ^ | | | expected reference, found struct `Foo` @@ -331,7 +331,7 @@ LL | want::<&Foo>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:65:19 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected usize, found struct `Foo` | = note: expected type `usize` @@ -340,7 +340,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:66:17 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected struct `foo`, found struct `Foo` | = note: expected type `foo` @@ -349,7 +349,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:67:17 | -LL | want::(f); //~ ERROR mismatched types +LL | want::(f); | ^ expected struct `bar`, found struct `Foo` | = note: expected type `bar` @@ -358,7 +358,7 @@ LL | want::(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:68:24 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected usize, found struct `foo` | = note: expected type `Foo` @@ -367,7 +367,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:69:27 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected usize, found struct `foo` | = note: expected type `Foo` @@ -376,7 +376,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:70:22 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `A`, found struct `B` | = note: expected type `Foo<_, A, B>` @@ -385,7 +385,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:71:25 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `B`, found struct `A` | = note: expected type `Foo<_, _, B>` @@ -394,7 +394,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:72:22 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `bar`, found struct `foo` | = note: expected type `Foo` @@ -403,7 +403,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:73:25 | -LL | want::>(f); //~ ERROR mismatched types +LL | want::>(f); | ^ expected struct `bar`, found struct `foo` | = note: expected type `Foo` @@ -412,7 +412,7 @@ LL | want::>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:74:23 | -LL | want::<&Foo>(f); //~ ERROR mismatched types +LL | want::<&Foo>(f); | ^ expected &Foo, found struct `Foo` | = note: expected type `&Foo` @@ -421,7 +421,7 @@ LL | want::<&Foo>(f); //~ ERROR mismatched types error[E0308]: mismatched types --> $DIR/type-mismatch.rs:75:26 | -LL | want::<&Foo>(f); //~ ERROR mismatched types +LL | want::<&Foo>(f); | ^ expected reference, found struct `Foo` | = note: expected type `&Foo` diff --git a/src/test/ui/type/type-params-in-different-spaces-1.stderr b/src/test/ui/type/type-params-in-different-spaces-1.stderr index e1b8ff70a631..b3b78424fd90 100644 --- a/src/test/ui/type/type-params-in-different-spaces-1.stderr +++ b/src/test/ui/type/type-params-in-different-spaces-1.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/type-params-in-different-spaces-1.rs:5:17 | -LL | *self + rhs //~ ERROR mismatched types +LL | *self + rhs | ^^^ expected Self, found type parameter | = note: expected type `Self` diff --git a/src/test/ui/type/type-params-in-different-spaces-2.stderr b/src/test/ui/type/type-params-in-different-spaces-2.stderr index 3d50c2c8baf8..15db94ef1e3c 100644 --- a/src/test/ui/type/type-params-in-different-spaces-2.stderr +++ b/src/test/ui/type/type-params-in-different-spaces-2.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `Self: Tr` is not satisfied --> $DIR/type-params-in-different-spaces-2.rs:10:9 | -LL | Tr::op(u) //~ ERROR E0277 +LL | Tr::op(u) | ^^^^^^ the trait `Tr` is not implemented for `Self` | = help: consider adding a `where Self: Tr` bound @@ -14,7 +14,7 @@ LL | fn op(_: T) -> Self; error[E0277]: the trait bound `Self: Tr` is not satisfied --> $DIR/type-params-in-different-spaces-2.rs:16:9 | -LL | Tr::op(u) //~ ERROR E0277 +LL | Tr::op(u) | ^^^^^^ the trait `Tr` is not implemented for `Self` | = help: consider adding a `where Self: Tr` bound diff --git a/src/test/ui/type/type-params-in-different-spaces-3.stderr b/src/test/ui/type/type-params-in-different-spaces-3.stderr index 69288ea491da..4e8134da2ddf 100644 --- a/src/test/ui/type/type-params-in-different-spaces-3.stderr +++ b/src/test/ui/type/type-params-in-different-spaces-3.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | fn test(u: X) -> Self { | ---- expected `Self` because of return type -LL | u //~ ERROR mismatched types +LL | u | ^ expected Self, found type parameter | = note: expected type `Self` diff --git a/src/test/ui/type/type-path-err-node-types.stderr b/src/test/ui/type/type-path-err-node-types.stderr index e73b1fb029ce..29a438a23c7a 100644 --- a/src/test/ui/type/type-path-err-node-types.stderr +++ b/src/test/ui/type/type-path-err-node-types.stderr @@ -1,25 +1,25 @@ error[E0433]: failed to resolve: use of undeclared type or module `NonExistent` --> $DIR/type-path-err-node-types.rs:15:5 | -LL | NonExistent::Assoc::; //~ ERROR undeclared type or module `NonExistent` +LL | NonExistent::Assoc::; | ^^^^^^^^^^^ use of undeclared type or module `NonExistent` error[E0412]: cannot find type `Nonexistent` in this scope --> $DIR/type-path-err-node-types.rs:7:12 | -LL | let _: Nonexistent; //~ ERROR cannot find type `Nonexistent` in this scope +LL | let _: Nonexistent; | ^^^^^^^^^^^ not found in this scope error[E0576]: cannot find method or associated constant `nonexistent` in trait `Tr` --> $DIR/type-path-err-node-types.rs:11:21 | -LL | >::nonexistent(); //~ ERROR cannot find method or associated constant `nonexistent` +LL | >::nonexistent(); | ^^^^^^^^^^^ not found in `Tr` error[E0425]: cannot find value `nonexistent` in this scope --> $DIR/type-path-err-node-types.rs:19:5 | -LL | nonexistent.nonexistent::(); //~ ERROR cannot find value `nonexistent` +LL | nonexistent.nonexistent::(); | ^^^^^^^^^^^ not found in this scope error: aborting due to 4 previous errors diff --git a/src/test/ui/type/type-recursive.stderr b/src/test/ui/type/type-recursive.stderr index b1ecc1f91cbc..72bf372e561d 100644 --- a/src/test/ui/type/type-recursive.stderr +++ b/src/test/ui/type/type-recursive.stderr @@ -1,7 +1,7 @@ error[E0072]: recursive type `T1` has infinite size --> $DIR/type-recursive.rs:1:1 | -LL | struct T1 { //~ ERROR E0072 +LL | struct T1 { | ^^^^^^^^^ recursive type has infinite size LL | foo: isize, LL | foolish: T1 diff --git a/src/test/ui/type/type-shadow.stderr b/src/test/ui/type/type-shadow.stderr index 4c7aa00565ad..f15bdc16d514 100644 --- a/src/test/ui/type/type-shadow.stderr +++ b/src/test/ui/type/type-shadow.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/type-shadow.rs:6:20 | -LL | let y: Y = "hello"; //~ ERROR mismatched types +LL | let y: Y = "hello"; | ^^^^^^^ expected isize, found reference | = note: expected type `isize` diff --git a/src/test/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr b/src/test/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr index bb63917fc086..f1118709962a 100644 --- a/src/test/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr +++ b/src/test/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | fn ice(x: Box>) { | - possibly return type missing here? -LL | *x //~ ERROR mismatched types [E0308] +LL | *x | ^^ expected (), found trait std::iter::Iterator | = note: expected type `()` diff --git a/src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.stderr b/src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.stderr index 41bf3fd1c446..8755bcded9d2 100644 --- a/src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.stderr +++ b/src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.stderr @@ -1,7 +1,7 @@ error[E0568]: auto traits cannot have super traits --> $DIR/typeck-auto-trait-no-supertraits-2.rs:3:1 | -LL | auto trait Magic : Sized where Option : Magic {} //~ ERROR E0568 +LL | auto trait Magic : Sized where Option : Magic {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/typeck/typeck-auto-trait-no-supertraits.stderr b/src/test/ui/typeck/typeck-auto-trait-no-supertraits.stderr index bf40eaad6539..5a3888349095 100644 --- a/src/test/ui/typeck/typeck-auto-trait-no-supertraits.stderr +++ b/src/test/ui/typeck/typeck-auto-trait-no-supertraits.stderr @@ -1,7 +1,7 @@ error[E0568]: auto traits cannot have super traits --> $DIR/typeck-auto-trait-no-supertraits.rs:27:1 | -LL | auto trait Magic: Copy {} //~ ERROR E0568 +LL | auto trait Magic: Copy {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/typeck/typeck-default-trait-impl-assoc-type.stderr b/src/test/ui/typeck/typeck-default-trait-impl-assoc-type.stderr index 3f7e4a674e65..a31ee83ae1cc 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-assoc-type.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-assoc-type.stderr @@ -1,7 +1,7 @@ error[E0277]: `::AssocType` cannot be sent between threads safely --> $DIR/typeck-default-trait-impl-assoc-type.rs:9:5 | -LL | is_send::(); //~ ERROR E0277 +LL | is_send::(); | ^^^^^^^^^^^^^^^^^^^^^^^ `::AssocType` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `::AssocType` diff --git a/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr b/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr index 2bfb4110603f..154b4042c681 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr @@ -1,7 +1,7 @@ error[E0117]: only traits defined in the current crate can be implemented for arbitrary types --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:13:1 | -LL | impl DefaultedTrait for (A,) { } //~ ERROR E0117 +LL | impl DefaultedTrait for (A,) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | = note: the impl does not reference only types defined in this crate @@ -10,7 +10,7 @@ LL | impl DefaultedTrait for (A,) { } //~ ERROR E0117 error[E0117]: only traits defined in the current crate can be implemented for arbitrary types --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:16:1 | -LL | impl !DefaultedTrait for (B,) { } //~ ERROR E0117 +LL | impl !DefaultedTrait for (B,) { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | = note: the impl does not reference only types defined in this crate @@ -19,13 +19,13 @@ LL | impl !DefaultedTrait for (B,) { } //~ ERROR E0117 error[E0321]: cross-crate traits with a default impl, like `lib::DefaultedTrait`, can only be implemented for a struct/enum type defined in the current crate --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:20:1 | -LL | impl DefaultedTrait for Box { } //~ ERROR E0321 +LL | impl DefaultedTrait for Box { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait for type in another crate error[E0117]: only traits defined in the current crate can be implemented for arbitrary types --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:21:1 | -LL | impl DefaultedTrait for lib::Something { } //~ ERROR E0117 +LL | impl DefaultedTrait for lib::Something { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate | = note: the impl does not reference only types defined in this crate diff --git a/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr b/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr index 736e1b8da7f3..a850cc7b377d 100644 --- a/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr +++ b/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr @@ -1,7 +1,7 @@ error[E0277]: `T` cannot be sent between threads safely --> $DIR/typeck-default-trait-impl-send-param.rs:5:5 | -LL | is_send::() //~ ERROR E0277 +LL | is_send::() | ^^^^^^^^^^^^ `T` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `T` diff --git a/src/test/ui/ufcs/ufcs-explicit-self-bad.stderr b/src/test/ui/ufcs/ufcs-explicit-self-bad.stderr index 759a16cdafde..2187c61fabf1 100644 --- a/src/test/ui/ufcs/ufcs-explicit-self-bad.stderr +++ b/src/test/ui/ufcs/ufcs-explicit-self-bad.stderr @@ -28,7 +28,7 @@ LL | fn bar(self: &Bar, x: isize) -> isize { error[E0308]: mismatched method receiver --> $DIR/ufcs-explicit-self-bad.rs:37:21 | -LL | fn dummy2(self: &Bar) {} //~ ERROR mismatched method receiver +LL | fn dummy2(self: &Bar) {} | ^^^^^^^ lifetime mismatch | = note: expected type `&'a Bar` @@ -36,7 +36,7 @@ LL | fn dummy2(self: &Bar) {} //~ ERROR mismatched method receiver note: the anonymous lifetime #1 defined on the method body at 37:5... --> $DIR/ufcs-explicit-self-bad.rs:37:5 | -LL | fn dummy2(self: &Bar) {} //~ ERROR mismatched method receiver +LL | fn dummy2(self: &Bar) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 35:6 --> $DIR/ufcs-explicit-self-bad.rs:35:6 @@ -47,7 +47,7 @@ LL | impl<'a, T> SomeTrait for &'a Bar { error[E0308]: mismatched method receiver --> $DIR/ufcs-explicit-self-bad.rs:37:21 | -LL | fn dummy2(self: &Bar) {} //~ ERROR mismatched method receiver +LL | fn dummy2(self: &Bar) {} | ^^^^^^^ lifetime mismatch | = note: expected type `&'a Bar` @@ -60,7 +60,7 @@ LL | impl<'a, T> SomeTrait for &'a Bar { note: ...does not necessarily outlive the anonymous lifetime #1 defined on the method body at 37:5 --> $DIR/ufcs-explicit-self-bad.rs:37:5 | -LL | fn dummy2(self: &Bar) {} //~ ERROR mismatched method receiver +LL | fn dummy2(self: &Bar) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched method receiver diff --git a/src/test/ui/ufcs/ufcs-partially-resolved.stderr b/src/test/ui/ufcs/ufcs-partially-resolved.stderr index 3cd1cac71fa7..799dbf7a6d20 100644 --- a/src/test/ui/ufcs/ufcs-partially-resolved.stderr +++ b/src/test/ui/ufcs/ufcs-partially-resolved.stderr @@ -1,163 +1,163 @@ error[E0433]: failed to resolve: not a module `Y` --> $DIR/ufcs-partially-resolved.rs:48:22 | -LL | let _: ::NN; //~ ERROR failed to resolve: not a module `Y` +LL | let _: ::NN; | ^ not a module `Y` error[E0433]: failed to resolve: not a module `Y` --> $DIR/ufcs-partially-resolved.rs:50:15 | -LL | ::NN; //~ ERROR failed to resolve: not a module `Y` +LL | ::NN; | ^ not a module `Y` error[E0576]: cannot find associated type `N` in trait `Tr` --> $DIR/ufcs-partially-resolved.rs:19:24 | -LL | let _: ::N; //~ ERROR cannot find associated type `N` in trait `Tr` +LL | let _: ::N; | ^ help: an associated type with a similar name exists: `Y` error[E0576]: cannot find associated type `N` in enum `E` --> $DIR/ufcs-partially-resolved.rs:20:23 | -LL | let _: ::N; //~ ERROR cannot find associated type `N` in enum `E` +LL | let _: ::N; | ^ not found in `E` error[E0576]: cannot find associated type `N` in `A` --> $DIR/ufcs-partially-resolved.rs:21:23 | -LL | let _: ::N; //~ ERROR cannot find associated type `N` in `A` +LL | let _: ::N; | ^ not found in `A` error[E0576]: cannot find method or associated constant `N` in trait `Tr` --> $DIR/ufcs-partially-resolved.rs:22:17 | -LL | ::N; //~ ERROR cannot find method or associated constant `N` in trait `Tr` +LL | ::N; | ^ help: a method with a similar name exists: `Y` error[E0576]: cannot find method or associated constant `N` in enum `E` --> $DIR/ufcs-partially-resolved.rs:23:16 | -LL | ::N; //~ ERROR cannot find method or associated constant `N` in enum `E` +LL | ::N; | ^ not found in `E` error[E0576]: cannot find method or associated constant `N` in `A` --> $DIR/ufcs-partially-resolved.rs:24:16 | -LL | ::N; //~ ERROR cannot find method or associated constant `N` in `A` +LL | ::N; | ^ not found in `A` error[E0575]: expected associated type, found variant `E::Y` --> $DIR/ufcs-partially-resolved.rs:26:12 | -LL | let _: ::Y; //~ ERROR expected associated type, found variant `E::Y` +LL | let _: ::Y; | ^^^^^^^^^^^^ not a associated type error[E0575]: expected method or associated constant, found unit variant `E::Y` --> $DIR/ufcs-partially-resolved.rs:28:5 | -LL | ::Y; //~ ERROR expected method or associated constant, found unit variant `E::Y` +LL | ::Y; | ^^^^^^^^^^^^ not a method or associated constant error[E0576]: cannot find associated type `N` in trait `Tr` --> $DIR/ufcs-partially-resolved.rs:30:24 | -LL | let _: ::N::NN; //~ ERROR cannot find associated type `N` in trait `Tr` +LL | let _: ::N::NN; | ^ help: an associated type with a similar name exists: `Y` error[E0576]: cannot find associated type `N` in enum `E` --> $DIR/ufcs-partially-resolved.rs:31:23 | -LL | let _: ::N::NN; //~ ERROR cannot find associated type `N` in enum `E` +LL | let _: ::N::NN; | ^ not found in `E` error[E0576]: cannot find associated type `N` in `A` --> $DIR/ufcs-partially-resolved.rs:32:23 | -LL | let _: ::N::NN; //~ ERROR cannot find associated type `N` in `A` +LL | let _: ::N::NN; | ^ not found in `A` error[E0576]: cannot find associated type `N` in trait `Tr` --> $DIR/ufcs-partially-resolved.rs:33:17 | -LL | ::N::NN; //~ ERROR cannot find associated type `N` in trait `Tr` +LL | ::N::NN; | ^ help: an associated type with a similar name exists: `Y` error[E0576]: cannot find associated type `N` in enum `E` --> $DIR/ufcs-partially-resolved.rs:34:16 | -LL | ::N::NN; //~ ERROR cannot find associated type `N` in enum `E` +LL | ::N::NN; | ^ not found in `E` error[E0576]: cannot find associated type `N` in `A` --> $DIR/ufcs-partially-resolved.rs:35:16 | -LL | ::N::NN; //~ ERROR cannot find associated type `N` in `A` +LL | ::N::NN; | ^ not found in `A` error[E0575]: expected associated type, found variant `E::Y` --> $DIR/ufcs-partially-resolved.rs:37:12 | -LL | let _: ::Y::NN; //~ ERROR expected associated type, found variant `E::Y` +LL | let _: ::Y::NN; | ^^^^^^^^^^^^^^^^ not a associated type error[E0575]: expected associated type, found variant `E::Y` --> $DIR/ufcs-partially-resolved.rs:39:5 | -LL | ::Y::NN; //~ ERROR expected associated type, found variant `E::Y` +LL | ::Y::NN; | ^^^^^^^^^^^^^^^^ not a associated type error[E0576]: cannot find associated type `NN` in `Tr::N` --> $DIR/ufcs-partially-resolved.rs:41:27 | -LL | let _: ::NN; //~ ERROR cannot find associated type `NN` in `Tr::N` +LL | let _: ::NN; | ^^ not found in `Tr::N` error[E0576]: cannot find associated type `NN` in `E::N` --> $DIR/ufcs-partially-resolved.rs:42:26 | -LL | let _: ::NN; //~ ERROR cannot find associated type `NN` in `E::N` +LL | let _: ::NN; | ^^ not found in `E::N` error[E0576]: cannot find associated type `NN` in `A::N` --> $DIR/ufcs-partially-resolved.rs:43:26 | -LL | let _: ::NN; //~ ERROR cannot find associated type `NN` in `A::N` +LL | let _: ::NN; | ^^ not found in `A::N` error[E0576]: cannot find method or associated constant `NN` in `Tr::N` --> $DIR/ufcs-partially-resolved.rs:44:20 | -LL | ::NN; //~ ERROR cannot find method or associated constant `NN` in `Tr::N` +LL | ::NN; | ^^ not found in `Tr::N` error[E0576]: cannot find method or associated constant `NN` in `E::N` --> $DIR/ufcs-partially-resolved.rs:45:19 | -LL | ::NN; //~ ERROR cannot find method or associated constant `NN` in `E::N` +LL | ::NN; | ^^ not found in `E::N` error[E0576]: cannot find method or associated constant `NN` in `A::N` --> $DIR/ufcs-partially-resolved.rs:46:19 | -LL | ::NN; //~ ERROR cannot find method or associated constant `NN` in `A::N` +LL | ::NN; | ^^ not found in `A::N` error[E0576]: cannot find associated type `NN` in `Tr::Y` --> $DIR/ufcs-partially-resolved.rs:47:27 | -LL | let _: ::NN; //~ ERROR cannot find associated type `NN` in `Tr::Y` +LL | let _: ::NN; | ^^ not found in `Tr::Y` error[E0576]: cannot find method or associated constant `NN` in `Tr::Y` --> $DIR/ufcs-partially-resolved.rs:49:20 | -LL | ::NN; //~ ERROR cannot find method or associated constant `NN` in `Tr::Y` +LL | ::NN; | ^^ not found in `Tr::Y` error[E0575]: expected associated type, found method `Dr::Z` --> $DIR/ufcs-partially-resolved.rs:52:12 | -LL | let _: ::Z; //~ ERROR expected associated type, found method `Dr::Z` +LL | let _: ::Z; | ^^^^^^^^^^^^- | | | help: an associated type with a similar name exists: `X` @@ -165,7 +165,7 @@ LL | let _: ::Z; //~ ERROR expected associated type, found method error[E0575]: expected method or associated constant, found associated type `Dr::X` --> $DIR/ufcs-partially-resolved.rs:53:5 | -LL | ::X; //~ ERROR expected method or associated constant, found associated type `Dr::X` +LL | ::X; | ^^^^^^^^^^^^- | | | help: a method with a similar name exists: `Z` @@ -175,7 +175,7 @@ LL | ::X; //~ ERROR expected method or associated constant, found error[E0575]: expected associated type, found method `Dr::Z` --> $DIR/ufcs-partially-resolved.rs:54:12 | -LL | let _: ::Z::N; //~ ERROR expected associated type, found method `Dr::Z` +LL | let _: ::Z::N; | ^^^^^^^^^^^^-^^^ | | | help: an associated type with a similar name exists: `X` @@ -183,13 +183,13 @@ LL | let _: ::Z::N; //~ ERROR expected associated type, found meth error[E0223]: ambiguous associated type --> $DIR/ufcs-partially-resolved.rs:36:12 | -LL | let _: ::Y::NN; //~ ERROR ambiguous associated type +LL | let _: ::Y::NN; | ^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<::Y as Trait>::NN` error[E0599]: no associated item named `NN` found for type `::Y` in the current scope --> $DIR/ufcs-partially-resolved.rs:38:20 | -LL | ::Y::NN; //~ ERROR no associated item named `NN` found for type `::Y` +LL | ::Y::NN; | ---------------^^ | | | associated item not found in `::Y` @@ -197,7 +197,7 @@ LL | ::Y::NN; //~ ERROR no associated item named `NN` found for ty error[E0599]: no associated item named `N` found for type `::X` in the current scope --> $DIR/ufcs-partially-resolved.rs:55:20 | -LL | ::X::N; //~ ERROR no associated item named `N` found for type `::X` +LL | ::X::N; | ---------------^ | | | associated item not found in `::X` diff --git a/src/test/ui/ui-testing-optout.stderr b/src/test/ui/ui-testing-optout.stderr index 5a662e0ea89c..313e198e39e3 100644 --- a/src/test/ui/ui-testing-optout.stderr +++ b/src/test/ui/ui-testing-optout.stderr @@ -1,19 +1,19 @@ error[E0412]: cannot find type `B` in this scope --> $DIR/ui-testing-optout.rs:4:10 | -4 | type A = B; //~ ERROR +4 | type A = B; | ^ help: a type alias with a similar name exists: `A` error[E0412]: cannot find type `D` in this scope --> $DIR/ui-testing-optout.rs:10:10 | -10 | type C = D; //~ ERROR +10 | type C = D; | ^ help: a type alias with a similar name exists: `A` error[E0412]: cannot find type `F` in this scope --> $DIR/ui-testing-optout.rs:95:10 | -95 | type E = F; //~ ERROR +95 | type E = F; | ^ help: a type alias with a similar name exists: `A` error: aborting due to 3 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr index 0e996902d621..934d057ea092 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr @@ -3,7 +3,7 @@ error[E0507]: cannot move out of captured variable in an `Fn` closure | LL | let x = Box::new(0); | - captured outer variable -LL | let f = to_fn(|| drop(x)); //~ ERROR cannot move +LL | let f = to_fn(|| drop(x)); | ^ cannot move out of captured variable in an `Fn` closure error[E0507]: cannot move out of captured variable in an `FnMut` closure @@ -11,7 +11,7 @@ error[E0507]: cannot move out of captured variable in an `FnMut` closure | LL | let x = Box::new(0); | - captured outer variable -LL | let f = to_fn_mut(|| drop(x)); //~ ERROR cannot move +LL | let f = to_fn_mut(|| drop(x)); | ^ cannot move out of captured variable in an `FnMut` closure error[E0507]: cannot move out of captured variable in an `Fn` closure @@ -19,7 +19,7 @@ error[E0507]: cannot move out of captured variable in an `Fn` closure | LL | let x = Box::new(0); | - captured outer variable -LL | let f = to_fn(move || drop(x)); //~ ERROR cannot move +LL | let f = to_fn(move || drop(x)); | ^ cannot move out of captured variable in an `Fn` closure error[E0507]: cannot move out of captured variable in an `FnMut` closure @@ -27,7 +27,7 @@ error[E0507]: cannot move out of captured variable in an `FnMut` closure | LL | let x = Box::new(0); | - captured outer variable -LL | let f = to_fn_mut(move || drop(x)); //~ ERROR cannot move +LL | let f = to_fn_mut(move || drop(x)); | ^ cannot move out of captured variable in an `FnMut` closure error: aborting due to 4 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.stderr b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.stderr index ae83242d5349..7620f6a3cbee 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.stderr @@ -3,7 +3,7 @@ error[E0507]: cannot move out of captured outer variable in an `Fn` closure | LL | let x = Box::new(0); | - captured outer variable -LL | let f = to_fn(|| drop(x)); //~ ERROR cannot move +LL | let f = to_fn(|| drop(x)); | ^ cannot move out of captured outer variable in an `Fn` closure error[E0507]: cannot move out of captured outer variable in an `FnMut` closure @@ -11,7 +11,7 @@ error[E0507]: cannot move out of captured outer variable in an `FnMut` closure | LL | let x = Box::new(0); | - captured outer variable -LL | let f = to_fn_mut(|| drop(x)); //~ ERROR cannot move +LL | let f = to_fn_mut(|| drop(x)); | ^ cannot move out of captured outer variable in an `FnMut` closure error[E0507]: cannot move out of captured outer variable in an `Fn` closure @@ -19,7 +19,7 @@ error[E0507]: cannot move out of captured outer variable in an `Fn` closure | LL | let x = Box::new(0); | - captured outer variable -LL | let f = to_fn(move || drop(x)); //~ ERROR cannot move +LL | let f = to_fn(move || drop(x)); | ^ cannot move out of captured outer variable in an `Fn` closure error[E0507]: cannot move out of captured outer variable in an `FnMut` closure @@ -27,7 +27,7 @@ error[E0507]: cannot move out of captured outer variable in an `FnMut` closure | LL | let x = Box::new(0); | - captured outer variable -LL | let f = to_fn_mut(move || drop(x)); //~ ERROR cannot move +LL | let f = to_fn_mut(move || drop(x)); | ^ cannot move out of captured outer variable in an `FnMut` closure error: aborting due to 4 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr index 51a0a6e57564..3e7f79040fe8 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable | LL | let x = 0; | - help: consider changing this to be mutable: `mut x` -LL | move || x = 1; //~ ERROR cannot assign +LL | move || x = 1; | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable @@ -11,8 +11,8 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable | LL | let x = 0; | - help: consider changing this to be mutable: `mut x` -LL | move || x = 1; //~ ERROR cannot assign -LL | move || set(&mut x); //~ ERROR cannot borrow +LL | move || x = 1; +LL | move || set(&mut x); | ^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `x`, as it is not declared as mutable @@ -21,7 +21,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable LL | let x = 0; | - help: consider changing this to be mutable: `mut x` ... -LL | move || x = 1; //~ ERROR cannot assign +LL | move || x = 1; | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable @@ -30,7 +30,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable LL | let x = 0; | - help: consider changing this to be mutable: `mut x` ... -LL | move || set(&mut x); //~ ERROR cannot borrow +LL | move || set(&mut x); | ^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `x`, as it is not declared as mutable @@ -39,7 +39,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable LL | let x = 0; | - help: consider changing this to be mutable: `mut x` ... -LL | || x = 1; //~ ERROR cannot assign +LL | || x = 1; | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable @@ -48,7 +48,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable LL | let x = 0; | - help: consider changing this to be mutable: `mut x` ... -LL | || set(&mut x); //~ ERROR cannot assign +LL | || set(&mut x); | ^^^^^^ cannot borrow as mutable error[E0594]: cannot assign to `x`, as it is not declared as mutable @@ -57,7 +57,7 @@ error[E0594]: cannot assign to `x`, as it is not declared as mutable LL | let x = 0; | - help: consider changing this to be mutable: `mut x` ... -LL | || x = 1; //~ ERROR cannot assign +LL | || x = 1; | ^^^^^ cannot assign error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable @@ -66,7 +66,7 @@ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable LL | let x = 0; | - help: consider changing this to be mutable: `mut x` ... -LL | || set(&mut x); //~ ERROR cannot assign +LL | || set(&mut x); | ^^^^^^ cannot borrow as mutable error: aborting due to 8 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.stderr b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.stderr index 1865e2486f14..e4aa54032e3f 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.stderr @@ -4,7 +4,7 @@ error[E0595]: closure cannot assign to immutable local variable `x` LL | let x = 0; | - help: make this binding mutable: `mut x` ... -LL | || x = 1; //~ ERROR cannot assign +LL | || x = 1; | ^^ cannot borrow mutably error[E0595]: closure cannot assign to immutable local variable `x` @@ -13,7 +13,7 @@ error[E0595]: closure cannot assign to immutable local variable `x` LL | let x = 0; | - help: make this binding mutable: `mut x` ... -LL | || set(&mut x); //~ ERROR cannot assign +LL | || set(&mut x); | ^^ cannot borrow mutably error[E0595]: closure cannot assign to immutable local variable `x` @@ -22,7 +22,7 @@ error[E0595]: closure cannot assign to immutable local variable `x` LL | let x = 0; | - help: make this binding mutable: `mut x` ... -LL | || x = 1; //~ ERROR cannot assign +LL | || x = 1; | ^^ cannot borrow mutably error[E0595]: closure cannot assign to immutable local variable `x` @@ -31,7 +31,7 @@ error[E0595]: closure cannot assign to immutable local variable `x` LL | let x = 0; | - help: make this binding mutable: `mut x` ... -LL | || set(&mut x); //~ ERROR cannot assign +LL | || set(&mut x); | ^^ cannot borrow mutably error[E0594]: cannot assign to captured outer variable in an `FnMut` closure @@ -39,13 +39,13 @@ error[E0594]: cannot assign to captured outer variable in an `FnMut` closure | LL | let x = 0; | - help: consider making `x` mutable: `mut x` -LL | move || x = 1; //~ ERROR cannot assign +LL | move || x = 1; | ^^^^^ error[E0596]: cannot borrow captured outer variable in an `FnMut` closure as mutable --> $DIR/unboxed-closure-immutable-capture.rs:10:22 | -LL | move || set(&mut x); //~ ERROR cannot borrow +LL | move || set(&mut x); | ^ error[E0594]: cannot assign to captured outer variable in an `FnMut` closure @@ -54,13 +54,13 @@ error[E0594]: cannot assign to captured outer variable in an `FnMut` closure LL | let x = 0; | - help: consider making `x` mutable: `mut x` ... -LL | move || x = 1; //~ ERROR cannot assign +LL | move || x = 1; | ^^^^^ error[E0596]: cannot borrow captured outer variable in an `FnMut` closure as mutable --> $DIR/unboxed-closure-immutable-capture.rs:12:22 | -LL | move || set(&mut x); //~ ERROR cannot borrow +LL | move || set(&mut x); | ^ error: aborting due to 8 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr b/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr index fc4552085188..0d3766426bd2 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr @@ -1,7 +1,7 @@ error[E0644]: closure/generator type that references itself --> $DIR/unboxed-closure-no-cyclic-sig.rs:8:7 | -LL | g(|_| { }); //~ ERROR closure/generator type that references itself +LL | g(|_| { }); | ^^^^^^^^ cyclic type of infinite size | = note: closures cannot capture themselves or take themselves as argument; diff --git a/src/test/ui/unboxed-closures/unboxed-closure-region.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closure-region.nll.stderr index 1c55a6bb08eb..b40b2f67d9ba 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-region.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-region.nll.stderr @@ -4,7 +4,7 @@ error[E0597]: `x` does not live long enough LL | let _f = { | -- borrow later stored here LL | let x = 0; -LL | || x //~ ERROR `x` does not live long enough +LL | || x | -- ^ borrowed value does not live long enough | | | value captured here diff --git a/src/test/ui/unboxed-closures/unboxed-closure-region.stderr b/src/test/ui/unboxed-closures/unboxed-closure-region.stderr index a0f009c0689c..f710342e2ce5 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-region.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-region.stderr @@ -1,7 +1,7 @@ error[E0597]: `x` does not live long enough --> $DIR/unboxed-closure-region.rs:8:12 | -LL | || x //~ ERROR `x` does not live long enough +LL | || x | -- ^ borrowed value does not live long enough | | | capture occurs here diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr index e631c3367886..8c3480744fe3 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr @@ -1,7 +1,7 @@ error[E0106]: missing lifetime specifier --> $DIR/unboxed-closure-sugar-lifetime-elision.rs:26:35 | -LL | let _: Foo(&isize, &usize) -> &usize; //~ ERROR missing lifetime specifier +LL | let _: Foo(&isize, &usize) -> &usize; | ^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2 diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr index 84ed797450c2..304339c89e64 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr @@ -1,7 +1,7 @@ error[E0220]: associated type `Output` not found for `One<()>` --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs:5:15 | -LL | fn foo(_: &One()) //~ ERROR associated type `Output` not found for `One<()>` +LL | fn foo(_: &One()) | ^^ associated type `Output` not found error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.nll.stderr index a47d33d29e15..21d6b4fde7e9 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.nll.stderr @@ -5,7 +5,7 @@ LL | let f = || x += 1; | -- - borrow occurs due to use of `x` in closure | | | borrow of `x` occurs here -LL | let _y = x; //~ ERROR cannot use `x` because it was mutably borrowed +LL | let _y = x; | ^ use of borrowed `x` LL | f; | - borrow later used here diff --git a/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.stderr b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.stderr index 461eebc59c02..ac0e4ff13c7e 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.stderr @@ -3,7 +3,7 @@ error[E0503]: cannot use `x` because it was mutably borrowed | LL | let f = || x += 1; | -- borrow of `x` occurs here -LL | let _y = x; //~ ERROR cannot use `x` because it was mutably borrowed +LL | let _y = x; | ^^ use of borrowed `x` error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.nll.stderr index 1749c20b582b..19cb2cb73381 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.nll.stderr @@ -34,7 +34,7 @@ LL | let mut factorial: Option u32 + 'static>> = None; LL | LL | let f = |x: u32| -> u32 { | --------------- value captured here -LL | //~^ ERROR closure may outlive the current function, but it borrows `factorial` +LL | LL | let g = factorial.as_ref().unwrap(); | ^^^^^^^^^ borrowed value does not live long enough ... @@ -49,7 +49,7 @@ LL | let mut factorial: Option u32 + 'static>> = None; LL | LL | let f = |x: u32| -> u32 { | --------------- borrow of `factorial` occurs here -LL | //~^ ERROR closure may outlive the current function, but it borrows `factorial` +LL | LL | let g = factorial.as_ref().unwrap(); | --------- borrow occurs due to use in closure ... diff --git a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr index 85d98c18d7ff..47fe0ee72dc8 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr @@ -16,7 +16,7 @@ error[E0373]: closure may outlive the current function, but it borrows `factoria | LL | let f = |x: u32| -> u32 { | ^^^^^^^^^^^^^^^ may outlive borrowed value `factorial` -LL | //~^ ERROR closure may outlive the current function, but it borrows `factorial` +LL | LL | let g = factorial.as_ref().unwrap(); | --------- `factorial` is borrowed here help: to force the closure to take ownership of `factorial` (and any other referenced variables), use the `move` keyword diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr index bf43dc62744f..526055ba04b6 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr @@ -1,7 +1,7 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:17:15 | -LL | x.set(y); //~ ERROR E0312 +LL | x.set(y); | ^ | note: ...the reference is valid for the anonymous lifetime #3 defined on the body at 16:14... @@ -9,7 +9,7 @@ note: ...the reference is valid for the anonymous lifetime #3 defined on the bod | LL | doit(0, &|x, y| { | ______________^ -LL | | x.set(y); //~ ERROR E0312 +LL | | x.set(y); LL | | }); | |_____^ note: ...but the borrowed content is only valid for the anonymous lifetime #4 defined on the body at 16:14 @@ -17,7 +17,7 @@ note: ...but the borrowed content is only valid for the anonymous lifetime #4 de | LL | doit(0, &|x, y| { | ______________^ -LL | | x.set(y); //~ ERROR E0312 +LL | | x.set(y); LL | | }); | |_____^ diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr index 384cd090cb3c..9287353245e9 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr @@ -1,7 +1,7 @@ error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce` --> $DIR/unboxed-closures-infer-fn-once-move-from-projection.rs:14:13 | -LL | let c = || drop(y.0); //~ ERROR expected a closure that implements the `Fn` trait +LL | let c = || drop(y.0); | ^^^^^^^^-^^^ | | | | | closure is `FnOnce` because it moves the variable `y` out of its environment diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr index 89ac402b5e02..1e1172cdbf2f 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr @@ -10,10 +10,10 @@ LL | tick1(); error[E0596]: cannot borrow `tick2` as mutable, as it is not declared as mutable --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:20:5 | -LL | let tick2 = || { //~ ERROR closure cannot assign to immutable local variable `tick1` +LL | let tick2 = || { | ----- help: consider changing this to be mutable: `mut tick2` ... -LL | tick2(); //~ ERROR cannot borrow +LL | tick2(); | ^^^^^ cannot borrow as mutable error: aborting due to 2 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.stderr index bc839d7b5362..c90c15074988 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.stderr @@ -4,16 +4,16 @@ error[E0595]: closure cannot assign to immutable local variable `tick1` LL | let tick1 = || { | ----- help: make this binding mutable: `mut tick1` ... -LL | let tick2 = || { //~ ERROR closure cannot assign to immutable local variable `tick1` +LL | let tick2 = || { | ^^ cannot borrow mutably error[E0596]: cannot borrow immutable local variable `tick2` as mutable --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:20:5 | -LL | let tick2 = || { //~ ERROR closure cannot assign to immutable local variable `tick1` +LL | let tick2 = || { | ----- help: make this binding mutable: `mut tick2` ... -LL | tick2(); //~ ERROR cannot borrow +LL | tick2(); | ^^^^^ cannot borrow mutably error: aborting due to 2 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.nll.stderr index 9c0a71e73f52..eb398628846d 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `tick` as mutable, as it is not declared as mutable | LL | let tick = || counter += 1; | ---- help: consider changing this to be mutable: `mut tick` -LL | tick(); //~ ERROR cannot borrow immutable local variable `tick` as mutable +LL | tick(); | ^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.stderr index d4d285275e9e..33e215448585 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable local variable `tick` as mutable | LL | let tick = || counter += 1; | ---- help: make this binding mutable: `mut tick` -LL | tick(); //~ ERROR cannot borrow immutable local variable `tick` as mutable +LL | tick(); | ^^^^ cannot borrow mutably error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.nll.stderr index fa3426a1f709..b9d76d9a752c 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `tick` as mutable, as it is not declared as mutable | LL | let tick = move || counter += 1; | ---- help: consider changing this to be mutable: `mut tick` -LL | tick(); //~ ERROR cannot borrow immutable local variable `tick` as mutable +LL | tick(); | ^^^^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.stderr index 2137f9904ce1..585577ae82aa 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable local variable `tick` as mutable | LL | let tick = move || counter += 1; | ---- help: make this binding mutable: `mut tick` -LL | tick(); //~ ERROR cannot borrow immutable local variable `tick` as mutable +LL | tick(); | ^^^^ cannot borrow mutably error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.stderr index 52650903ba3f..0b9aa61a765f 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `tick` | LL | tick(); | ---- value moved here -LL | tick(); //~ ERROR use of moved value: `tick` +LL | tick(); | ^^^^ value used here after move | note: closure cannot be invoked more than once because it moves the variable `counter` out of its environment diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.stderr index 23d61c33ffe0..20773d561f9f 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `tick` | LL | tick(); | ---- value moved here -LL | tick(); //~ ERROR use of moved value: `tick` +LL | tick(); | ^^^^ value used here after move | note: closure cannot be invoked more than once because it moves the variable `counter` out of its environment diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr index 9b2f1cd4ae33..6bba38510b67 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr @@ -3,7 +3,7 @@ error[E0594]: cannot assign to `n`, as it is not declared as mutable | LL | let n = 0; | - help: consider changing this to be mutable: `mut n` -LL | let mut f = to_fn_mut(|| { //~ ERROR closure cannot assign +LL | let mut f = to_fn_mut(|| { LL | n += 1; | ^^^^^^ cannot assign @@ -13,7 +13,7 @@ error[E0594]: cannot assign to `n`, as it is not declared as mutable LL | let n = 0; | - help: consider changing this to be mutable: `mut n` ... -LL | n += 1; //~ ERROR cannot assign +LL | n += 1; | ^^^^^^ cannot assign error[E0594]: cannot assign to `n`, as it is not declared as mutable @@ -22,13 +22,13 @@ error[E0594]: cannot assign to `n`, as it is not declared as mutable LL | let n = 0; | - help: consider changing this to be mutable: `mut n` LL | let mut f = to_fn(move || { -LL | n += 1; //~ ERROR cannot assign +LL | n += 1; | ^^^^^^ cannot assign error[E0594]: cannot assign to `n`, as it is a captured variable in a `Fn` closure --> $DIR/unboxed-closures-mutate-upvar.rs:53:9 | -LL | n += 1; //~ ERROR cannot assign +LL | n += 1; | ^^^^^^ cannot assign | help: consider changing this to accept closures that implement `FnMut` @@ -36,7 +36,7 @@ help: consider changing this to accept closures that implement `FnMut` | LL | let mut f = to_fn(move || { | _______________________^ -LL | | n += 1; //~ ERROR cannot assign +LL | | n += 1; LL | | }); | |_____^ diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.stderr b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.stderr index 99fc287b1eef..055a1748db62 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.stderr @@ -3,7 +3,7 @@ error[E0595]: closure cannot assign to immutable local variable `n` | LL | let n = 0; | - help: make this binding mutable: `mut n` -LL | let mut f = to_fn_mut(|| { //~ ERROR closure cannot assign +LL | let mut f = to_fn_mut(|| { | ^^ cannot borrow mutably error[E0594]: cannot assign to captured outer variable in an `FnMut` closure @@ -12,13 +12,13 @@ error[E0594]: cannot assign to captured outer variable in an `FnMut` closure LL | let n = 0; | - help: consider making `n` mutable: `mut n` ... -LL | n += 1; //~ ERROR cannot assign +LL | n += 1; | ^^^^^^ error[E0594]: cannot assign to captured outer variable in an `Fn` closure --> $DIR/unboxed-closures-mutate-upvar.rs:46:9 | -LL | n += 1; //~ ERROR cannot assign +LL | n += 1; | ^^^^^^ | = note: `Fn` closures cannot capture their enclosing environment for modifications @@ -27,14 +27,14 @@ help: consider changing this closure to take self by mutable reference | LL | let mut f = to_fn(move || { | _______________________^ -LL | | n += 1; //~ ERROR cannot assign +LL | | n += 1; LL | | }); | |_____^ error[E0594]: cannot assign to captured outer variable in an `Fn` closure --> $DIR/unboxed-closures-mutate-upvar.rs:53:9 | -LL | n += 1; //~ ERROR cannot assign +LL | n += 1; | ^^^^^^ | = note: `Fn` closures cannot capture their enclosing environment for modifications @@ -43,7 +43,7 @@ help: consider changing this closure to take self by mutable reference | LL | let mut f = to_fn(move || { | _______________________^ -LL | | n += 1; //~ ERROR cannot assign +LL | | n += 1; LL | | }); | |_____^ diff --git a/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr b/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr index 1fccbb9c8572..2e1845888a2f 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `call` found for type `[closure@$DIR/unboxed-closures-static-call-wrong-trait.rs:6:26: 6:31]` in the current scope --> $DIR/unboxed-closures-static-call-wrong-trait.rs:7:10 | -LL | mut_.call((0, )); //~ ERROR no method named `call` found +LL | mut_.call((0, )); | ^^^^ | = note: mut_ is a function, perhaps you wish to call it diff --git a/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr b/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr index 82e8c63ce27e..df31a8d6104e 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/unboxed-closures-type-mismatch.rs:5:15 | -LL | let z = f(1_usize, 2); //~ ERROR mismatched types +LL | let z = f(1_usize, 2); | ^^^^^^^ expected isize, found usize error: aborting due to previous error diff --git a/src/test/ui/unconstrained-none.stderr b/src/test/ui/unconstrained-none.stderr index e0ddae4cc899..eb918b25d2be 100644 --- a/src/test/ui/unconstrained-none.stderr +++ b/src/test/ui/unconstrained-none.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/unconstrained-none.rs:4:5 | -LL | None; //~ ERROR type annotations needed [E0282] +LL | None; | ^^^^ cannot infer type for `T` error: aborting due to previous error diff --git a/src/test/ui/unconstrained-ref.stderr b/src/test/ui/unconstrained-ref.stderr index 7722963293f3..d9a129a2d7b2 100644 --- a/src/test/ui/unconstrained-ref.stderr +++ b/src/test/ui/unconstrained-ref.stderr @@ -1,7 +1,7 @@ error[E0282]: type annotations needed --> $DIR/unconstrained-ref.rs:6:5 | -LL | S { o: &None }; //~ ERROR type annotations needed [E0282] +LL | S { o: &None }; | ^ cannot infer type for `T` error: aborting due to previous error diff --git a/src/test/ui/underscore-ident-matcher.stderr b/src/test/ui/underscore-ident-matcher.stderr index 29fb9157b681..241c3d3d8ce6 100644 --- a/src/test/ui/underscore-ident-matcher.stderr +++ b/src/test/ui/underscore-ident-matcher.stderr @@ -4,7 +4,7 @@ error: no rules expected the token `_` LL | macro_rules! identity { | --------------------- when calling this macro ... -LL | let identity!(_) = 10; //~ ERROR no rules expected the token `_` +LL | let identity!(_) = 10; | ^ no rules expected this token in macro call error: aborting due to previous error diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore-in-struct.stderr b/src/test/ui/underscore-lifetime/dyn-trait-underscore-in-struct.stderr index 904c6c23def1..1ea9c423e5a6 100644 --- a/src/test/ui/underscore-lifetime/dyn-trait-underscore-in-struct.stderr +++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore-in-struct.stderr @@ -1,13 +1,13 @@ error[E0106]: missing lifetime specifier --> $DIR/dyn-trait-underscore-in-struct.rs:9:24 | -LL | x: Box, //~ ERROR missing lifetime specifier +LL | x: Box, | ^^ expected lifetime parameter error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound --> $DIR/dyn-trait-underscore-in-struct.rs:9:12 | -LL | x: Box, //~ ERROR missing lifetime specifier +LL | x: Box, | ^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr b/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr index 4eb959311ca4..69a9fd7a60c9 100644 --- a/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr +++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr @@ -1,7 +1,7 @@ error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements --> $DIR/dyn-trait-underscore.rs:8:20 | -LL | Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime +LL | Box::new(items.iter()) | ^^^^ | note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the function body at 6:1... @@ -9,13 +9,13 @@ note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on th | LL | / fn a(items: &[T]) -> Box> { LL | | // ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static` -LL | | Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime +LL | | Box::new(items.iter()) LL | | } | |_^ note: ...so that reference does not outlive borrowed content --> $DIR/dyn-trait-underscore.rs:8:14 | -LL | Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime +LL | Box::new(items.iter()) | ^^^^^ = note: but, the lifetime must be valid for the static lifetime... = note: ...so that the expression is assignable: diff --git a/src/test/ui/underscore-lifetime/in-fn-return-illegal.stderr b/src/test/ui/underscore-lifetime/in-fn-return-illegal.stderr index ec9fe6ad9ae1..ed61bdfdddab 100644 --- a/src/test/ui/underscore-lifetime/in-fn-return-illegal.stderr +++ b/src/test/ui/underscore-lifetime/in-fn-return-illegal.stderr @@ -1,7 +1,7 @@ error[E0106]: missing lifetime specifier --> $DIR/in-fn-return-illegal.rs:5:30 | -LL | fn foo(x: &u32, y: &u32) -> &'_ u32 { loop { } } //~ ERROR missing lifetime specifier +LL | fn foo(x: &u32, y: &u32) -> &'_ u32 { loop { } } | ^^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `x` or `y` diff --git a/src/test/ui/underscore-lifetime/in-struct.stderr b/src/test/ui/underscore-lifetime/in-struct.stderr index 2b19c6865dc0..6bbdc71195a5 100644 --- a/src/test/ui/underscore-lifetime/in-struct.stderr +++ b/src/test/ui/underscore-lifetime/in-struct.stderr @@ -1,13 +1,13 @@ error[E0106]: missing lifetime specifier --> $DIR/in-struct.rs:6:9 | -LL | x: &'_ u32, //~ ERROR missing lifetime specifier +LL | x: &'_ u32, | ^^ expected lifetime parameter error[E0106]: missing lifetime specifier --> $DIR/in-struct.rs:10:14 | -LL | Variant(&'_ u32), //~ ERROR missing lifetime specifier +LL | Variant(&'_ u32), | ^^ expected lifetime parameter error: aborting due to 2 previous errors diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr index e0c2c89c08c3..104e63884777 100644 --- a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr +++ b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr @@ -1,25 +1,25 @@ error[E0637]: `'_` cannot be used here --> $DIR/underscore-lifetime-binders.rs:4:8 | -LL | fn foo<'_> //~ ERROR cannot be used here +LL | fn foo<'_> | ^^ `'_` is a reserved lifetime name error[E0637]: `'_` cannot be used here --> $DIR/underscore-lifetime-binders.rs:10:21 | -LL | fn meh() -> Box Meh<'_>> //~ ERROR cannot be used here +LL | fn meh() -> Box Meh<'_>> | ^^ `'_` is a reserved lifetime name error[E0106]: missing lifetime specifier --> $DIR/underscore-lifetime-binders.rs:2:17 | -LL | struct Baz<'a>(&'_ &'a u8); //~ ERROR missing lifetime specifier +LL | struct Baz<'a>(&'_ &'a u8); | ^^ expected lifetime parameter error[E0106]: missing lifetime specifier --> $DIR/underscore-lifetime-binders.rs:10:29 | -LL | fn meh() -> Box Meh<'_>> //~ ERROR cannot be used here +LL | fn meh() -> Box Meh<'_>> | ^^ help: consider giving it a 'static lifetime: `'static` | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from @@ -27,7 +27,7 @@ LL | fn meh() -> Box Meh<'_>> //~ ERROR cannot be used here error[E0106]: missing lifetime specifier --> $DIR/underscore-lifetime-binders.rs:16:35 | -LL | fn foo2(_: &'_ u8, y: &'_ u8) -> &'_ u8 { y } //~ ERROR missing lifetime specifier +LL | fn foo2(_: &'_ u8, y: &'_ u8) -> &'_ u8 { y } | ^^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `_` or `y` diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr b/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr index b653b30bf6b7..76c14ccc14b4 100644 --- a/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr +++ b/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr @@ -1,7 +1,7 @@ error[E0623]: lifetime mismatch --> $DIR/underscore-lifetime-elison-mismatch.rs:1:49 | -LL | fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); } //~ ERROR lifetime mismatch +LL | fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); } | ------ ------ ^ ...but data from `y` flows into `x` here | | | these two types are declared with different lifetimes... diff --git a/src/test/ui/underscore-lifetime/underscore-outlives-bounds.stderr b/src/test/ui/underscore-lifetime/underscore-outlives-bounds.stderr index e4ff653f3ad4..4b38a26f957f 100644 --- a/src/test/ui/underscore-lifetime/underscore-outlives-bounds.stderr +++ b/src/test/ui/underscore-lifetime/underscore-outlives-bounds.stderr @@ -1,7 +1,7 @@ error[E0637]: `'_` cannot be used here --> $DIR/underscore-outlives-bounds.rs:7:10 | -LL | impl<'b: '_> Foo<'b> for i32 {} //~ ERROR `'_` cannot be used here +LL | impl<'b: '_> Foo<'b> for i32 {} | ^^ `'_` is a reserved lifetime name error: aborting due to previous error diff --git a/src/test/ui/underscore-lifetime/where-clauses.stderr b/src/test/ui/underscore-lifetime/where-clauses.stderr index 57fe2456f4cc..1a3ea4af7e12 100644 --- a/src/test/ui/underscore-lifetime/where-clauses.stderr +++ b/src/test/ui/underscore-lifetime/where-clauses.stderr @@ -1,13 +1,13 @@ error[E0637]: `'_` cannot be used here --> $DIR/where-clauses.rs:3:10 | -LL | impl<'b: '_> Foo<'b> for i32 {} //~ ERROR `'_` cannot be used here +LL | impl<'b: '_> Foo<'b> for i32 {} | ^^ `'_` is a reserved lifetime name error[E0637]: `'_` cannot be used here --> $DIR/where-clauses.rs:5:9 | -LL | impl Foo<'static> for Vec {} //~ ERROR `'_` cannot be used here +LL | impl Foo<'static> for Vec {} | ^^ `'_` is a reserved lifetime name error: aborting due to 2 previous errors diff --git a/src/test/ui/unevaluated_fixed_size_array_len.stderr b/src/test/ui/unevaluated_fixed_size_array_len.stderr index 200cf2a994d8..be6ed8d56232 100644 --- a/src/test/ui/unevaluated_fixed_size_array_len.stderr +++ b/src/test/ui/unevaluated_fixed_size_array_len.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `[(); 0]: Foo` is not satisfied --> $DIR/unevaluated_fixed_size_array_len.rs:12:5 | -LL | <[(); 0] as Foo>::foo() //~ ERROR E0277 +LL | <[(); 0] as Foo>::foo() | ^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `[(); 0]` | = help: the following implementations were found: diff --git a/src/test/ui/uninhabited/uninhabited-enum-cast.stderr b/src/test/ui/uninhabited/uninhabited-enum-cast.stderr index 36dab0c43eb7..a39af7832f8c 100644 --- a/src/test/ui/uninhabited/uninhabited-enum-cast.stderr +++ b/src/test/ui/uninhabited/uninhabited-enum-cast.stderr @@ -1,7 +1,7 @@ error[E0605]: non-primitive cast: `E` as `isize` --> $DIR/uninhabited-enum-cast.rs:4:20 | -LL | println!("{}", (e as isize).to_string()); //~ ERROR non-primitive cast +LL | println!("{}", (e as isize).to_string()); | ^^^^^^^^^^^^ | = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait diff --git a/src/test/ui/uninhabited/uninhabited-irrefutable.stderr b/src/test/ui/uninhabited/uninhabited-irrefutable.stderr index 63819bf949bd..45976f8ac56a 100644 --- a/src/test/ui/uninhabited/uninhabited-irrefutable.stderr +++ b/src/test/ui/uninhabited/uninhabited-irrefutable.stderr @@ -1,8 +1,16 @@ error[E0005]: refutable pattern in local binding: `A(_)` not covered --> $DIR/uninhabited-irrefutable.rs:27:9 | -LL | let Foo::D(_y) = x; //~ ERROR refutable pattern in local binding: `A(_)` not covered - | ^^^^^^^^^^ pattern `A(_)` not covered +LL | / enum Foo { +LL | | A(foo::SecretlyEmpty), +LL | | B(foo::NotSoSecretlyEmpty), +LL | | C(NotSoSecretlyEmpty), +LL | | D(u32), +LL | | } + | |_- `Foo` defined here +... +LL | let Foo::D(_y) = x; + | ^^^^^^^^^^ pattern `A(_)` not covered error: aborting due to previous error diff --git a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr index b88dcc9aea43..533cf595ef0c 100644 --- a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr +++ b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr @@ -1,56 +1,50 @@ error[E0004]: non-exhaustive patterns: `Err(_)` not covered --> $DIR/uninhabited-matches-feature-gated.rs:5:19 | -LL | let _ = match x { //~ ERROR non-exhaustive +LL | let _ = match x { | ^ pattern `Err(_)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: type `&Void` is non-empty --> $DIR/uninhabited-matches-feature-gated.rs:10:19 | -LL | let _ = match x {}; //~ ERROR non-exhaustive +LL | let _ = match x {}; | ^ | -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - --> $DIR/uninhabited-matches-feature-gated.rs:10:19 - | -LL | let _ = match x {}; //~ ERROR non-exhaustive - | ^ + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: type `(Void,)` is non-empty --> $DIR/uninhabited-matches-feature-gated.rs:13:19 | -LL | let _ = match x {}; //~ ERROR non-exhaustive +LL | let _ = match x {}; | ^ | -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - --> $DIR/uninhabited-matches-feature-gated.rs:13:19 - | -LL | let _ = match x {}; //~ ERROR non-exhaustive - | ^ + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: type `[Void; 1]` is non-empty --> $DIR/uninhabited-matches-feature-gated.rs:16:19 | -LL | let _ = match x {}; //~ ERROR non-exhaustive +LL | let _ = match x {}; | ^ | -help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms - --> $DIR/uninhabited-matches-feature-gated.rs:16:19 - | -LL | let _ = match x {}; //~ ERROR non-exhaustive - | ^ + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `&[_]` not covered --> $DIR/uninhabited-matches-feature-gated.rs:19:19 | -LL | let _ = match x { //~ ERROR non-exhaustive +LL | let _ = match x { | ^ pattern `&[_]` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0004]: non-exhaustive patterns: `Err(_)` not covered --> $DIR/uninhabited-matches-feature-gated.rs:27:19 | -LL | let _ = match x { //~ ERROR non-exhaustive +LL | let _ = match x { | ^ pattern `Err(_)` not covered + | + = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms error[E0005]: refutable pattern in local binding: `Err(_)` not covered --> $DIR/uninhabited-matches-feature-gated.rs:32:9 diff --git a/src/test/ui/uninhabited/uninhabited-patterns.stderr b/src/test/ui/uninhabited/uninhabited-patterns.stderr index eaae024cbf91..3e5329cfb301 100644 --- a/src/test/ui/uninhabited/uninhabited-patterns.stderr +++ b/src/test/ui/uninhabited/uninhabited-patterns.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/uninhabited-patterns.rs:27:9 | -LL | &[..] => (), //~ ERROR unreachable pattern +LL | &[..] => (), | ^^^^^ | note: lint level defined here @@ -13,19 +13,19 @@ LL | #![deny(unreachable_patterns)] error: unreachable pattern --> $DIR/uninhabited-patterns.rs:32:9 | -LL | Ok(box _) => (), //~ ERROR unreachable pattern +LL | Ok(box _) => (), | ^^^^^^^^^ error: unreachable pattern --> $DIR/uninhabited-patterns.rs:34:9 | -LL | Err(&[..]) => (), //~ ERROR unreachable pattern +LL | Err(&[..]) => (), | ^^^^^^^^^^ error: unreachable pattern --> $DIR/uninhabited-patterns.rs:41:9 | -LL | Err(Ok(_y)) => (), //~ ERROR unreachable pattern +LL | Err(Ok(_y)) => (), | ^^^^^^^^^^^ error: unreachable pattern diff --git a/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr b/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr index 29d161fe150e..70860c822ebd 100644 --- a/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr +++ b/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borr | LL | let a = &mut u.x.0; | ---------- mutable borrow occurs here (via `u.x.0`) -LL | let b = &u.y; //~ ERROR cannot borrow `u.y` +LL | let b = &u.y; | ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x.0` -- occurs here LL | use_borrow(a); | - mutable borrow later used here @@ -17,7 +17,7 @@ LL | let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) }; | - move occurs because `u` has type `U`, which does not implement the `Copy` trait LL | let a = u.x.0; | ----- value moved here -LL | let b = u.y; //~ ERROR use of moved value: `u.y` +LL | let b = u.y; | ^^^ value used here after move error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borrowed as mutable (via `u.x.0.0`) @@ -25,7 +25,7 @@ error[E0502]: cannot borrow `u` (via `u.y`) as immutable because it is also borr | LL | let a = &mut (u.x.0).0; | -------------- mutable borrow occurs here (via `u.x.0.0`) -LL | let b = &u.y; //~ ERROR cannot borrow `u.y` +LL | let b = &u.y; | ^^^^ immutable borrow of `u.y` -- which overlaps with `u.x.0.0` -- occurs here LL | use_borrow(a); | - mutable borrow later used here @@ -39,7 +39,7 @@ LL | let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) }; | - move occurs because `u` has type `U`, which does not implement the `Copy` trait LL | let a = (u.x.0).0; | --------- value moved here -LL | let b = u.y; //~ ERROR use of moved value: `u.y` +LL | let b = u.y; | ^^^ value used here after move error[E0502]: cannot borrow `u` (via `u.x`) as immutable because it is also borrowed as mutable (via `*u.y`) @@ -47,7 +47,7 @@ error[E0502]: cannot borrow `u` (via `u.x`) as immutable because it is also borr | LL | let a = &mut *u.y; | --------- mutable borrow occurs here (via `*u.y`) -LL | let b = &u.x; //~ ERROR cannot borrow `u` (via `u.x`) +LL | let b = &u.x; | ^^^^ immutable borrow of `u.x` -- which overlaps with `*u.y` -- occurs here LL | use_borrow(a); | - mutable borrow later used here @@ -61,7 +61,7 @@ LL | let u = U { x: ((Vec::new(), Vec::new()), Vec::new()) }; | - move occurs because `u` has type `U`, which does not implement the `Copy` trait LL | let a = *u.y; | ---- value moved here -LL | let b = u.x; //~ ERROR use of moved value: `u.x` +LL | let b = u.x; | ^^^ value used here after move error: aborting due to 6 previous errors diff --git a/src/test/ui/union/union-borrow-move-parent-sibling.stderr b/src/test/ui/union/union-borrow-move-parent-sibling.stderr index 9058707e5051..c1c6932e1e25 100644 --- a/src/test/ui/union/union-borrow-move-parent-sibling.stderr +++ b/src/test/ui/union/union-borrow-move-parent-sibling.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `u.y` as immutable because `u.x.0` is also borrowed | LL | let a = &mut u.x.0; | ----- mutable borrow occurs here -LL | let b = &u.y; //~ ERROR cannot borrow `u.y` +LL | let b = &u.y; | ^^^ immutable borrow occurs here LL | use_borrow(a); LL | } @@ -14,7 +14,7 @@ error[E0382]: use of moved value: `u.y` | LL | let a = u.x.0; | - value moved here -LL | let b = u.y; //~ ERROR use of moved value: `u.y` +LL | let b = u.y; | ^ value used here after move | = note: move occurs because `u.y` has type `[type error]`, which does not implement the `Copy` trait @@ -24,7 +24,7 @@ error[E0502]: cannot borrow `u.y` as immutable because `u.x.0.0` is also borrowe | LL | let a = &mut (u.x.0).0; | --------- mutable borrow occurs here -LL | let b = &u.y; //~ ERROR cannot borrow `u.y` +LL | let b = &u.y; | ^^^ immutable borrow occurs here LL | use_borrow(a); LL | } @@ -35,7 +35,7 @@ error[E0382]: use of moved value: `u.y` | LL | let a = (u.x.0).0; | - value moved here -LL | let b = u.y; //~ ERROR use of moved value: `u.y` +LL | let b = u.y; | ^ value used here after move | = note: move occurs because `u.y` has type `[type error]`, which does not implement the `Copy` trait @@ -45,7 +45,7 @@ error[E0502]: cannot borrow `u` (via `u.x`) as immutable because `u` is also bor | LL | let a = &mut *u.y; | ---- mutable borrow occurs here (via `*u.y`) -LL | let b = &u.x; //~ ERROR cannot borrow `u` (via `u.x`) +LL | let b = &u.x; | ^^^ immutable borrow of `u.x` -- which overlaps with `*u.y` -- occurs here LL | use_borrow(a); LL | } @@ -56,7 +56,7 @@ error[E0382]: use of moved value: `u.x` | LL | let a = *u.y; | - value moved here -LL | let b = u.x; //~ ERROR use of moved value: `u.x` +LL | let b = u.x; | ^ value used here after move | = note: move occurs because `u.x` has type `[type error]`, which does not implement the `Copy` trait diff --git a/src/test/ui/union/union-const-pat.stderr b/src/test/ui/union/union-const-pat.stderr index 5106721f310e..dc87f4de5219 100644 --- a/src/test/ui/union/union-const-pat.stderr +++ b/src/test/ui/union/union-const-pat.stderr @@ -1,7 +1,7 @@ error: cannot use unions in constant patterns --> $DIR/union-const-pat.rs:10:9 | -LL | C => {} //~ ERROR cannot use unions in constant patterns +LL | C => {} | ^ error: aborting due to previous error diff --git a/src/test/ui/union/union-copy.stderr b/src/test/ui/union/union-copy.stderr index b3991b5ba6a5..a875ff660f97 100644 --- a/src/test/ui/union/union-copy.stderr +++ b/src/test/ui/union/union-copy.stderr @@ -4,7 +4,7 @@ error[E0204]: the trait `Copy` may not be implemented for this type LL | a: String | --------- this field does not implement `Copy` ... -LL | impl Copy for W {} //~ ERROR the trait `Copy` may not be implemented for this type +LL | impl Copy for W {} | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/union/union-derive-clone.stderr b/src/test/ui/union/union-derive-clone.stderr index 9580a9710e1f..7421bb73ec9d 100644 --- a/src/test/ui/union/union-derive-clone.stderr +++ b/src/test/ui/union/union-derive-clone.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `U1: std::marker::Copy` is not satisfied --> $DIR/union-derive-clone.rs:3:10 | -LL | #[derive(Clone)] //~ ERROR the trait bound `U1: std::marker::Copy` is not satisfied +LL | #[derive(Clone)] | ^^^^^ the trait `std::marker::Copy` is not implemented for `U1` | = note: required by `std::clone::AssertParamIsCopy` @@ -12,7 +12,7 @@ error[E0599]: no method named `clone` found for type `U4` in the cu LL | union U4 { | ----------- method `clone` not found for this ... -LL | let w = u.clone(); //~ ERROR no method named `clone` found for type `U4` +LL | let w = u.clone(); | ^^^^^ | = note: the method `clone` exists but the following trait bounds were not satisfied: diff --git a/src/test/ui/union/union-derive-eq.stderr b/src/test/ui/union/union-derive-eq.stderr index d93dcd64efc0..f63ab1704c49 100644 --- a/src/test/ui/union/union-derive-eq.stderr +++ b/src/test/ui/union/union-derive-eq.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `PartialEqNotEq: std::cmp::Eq` is not satisfied --> $DIR/union-derive-eq.rs:15:5 | -LL | a: PartialEqNotEq, //~ ERROR the trait bound `PartialEqNotEq: std::cmp::Eq` is not satisfied +LL | a: PartialEqNotEq, | ^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `PartialEqNotEq` | = note: required by `std::cmp::AssertParamIsEq` diff --git a/src/test/ui/union/union-derive.stderr b/src/test/ui/union/union-derive.stderr index 0ec873553f30..919c6d5ceda6 100644 --- a/src/test/ui/union/union-derive.stderr +++ b/src/test/ui/union/union-derive.stderr @@ -1,37 +1,37 @@ error: this trait cannot be derived for unions --> $DIR/union-derive.rs:9:5 | -LL | Debug, //~ ERROR this trait cannot be derived for unions +LL | Debug, | ^^^^^ error: this trait cannot be derived for unions --> $DIR/union-derive.rs:8:5 | -LL | Default, //~ ERROR this trait cannot be derived for unions +LL | Default, | ^^^^^^^ error: this trait cannot be derived for unions --> $DIR/union-derive.rs:7:5 | -LL | Hash, //~ ERROR this trait cannot be derived for unions +LL | Hash, | ^^^^ error: this trait cannot be derived for unions --> $DIR/union-derive.rs:6:5 | -LL | Ord, //~ ERROR this trait cannot be derived for unions +LL | Ord, | ^^^ error: this trait cannot be derived for unions --> $DIR/union-derive.rs:5:5 | -LL | PartialOrd, //~ ERROR this trait cannot be derived for unions +LL | PartialOrd, | ^^^^^^^^^^ error: this trait cannot be derived for unions --> $DIR/union-derive.rs:4:5 | -LL | PartialEq, //~ ERROR this trait cannot be derived for unions +LL | PartialEq, | ^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/union/union-empty.stderr b/src/test/ui/union/union-empty.stderr index 71bba8fda2eb..a80b27e6eb56 100644 --- a/src/test/ui/union/union-empty.stderr +++ b/src/test/ui/union/union-empty.stderr @@ -1,7 +1,7 @@ error: unions cannot have zero fields --> $DIR/union-empty.rs:1:1 | -LL | union U {} //~ ERROR unions cannot have zero fields +LL | union U {} | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/union/union-fields-1.stderr b/src/test/ui/union/union-fields-1.stderr index 3f165db4763e..f848db726f9e 100644 --- a/src/test/ui/union/union-fields-1.stderr +++ b/src/test/ui/union/union-fields-1.stderr @@ -1,7 +1,7 @@ error: field is never used: `c` --> $DIR/union-fields-1.rs:6:5 | -LL | c: u8, //~ ERROR field is never used +LL | c: u8, | ^^^^^ | note: lint level defined here @@ -13,19 +13,19 @@ LL | #![deny(dead_code)] error: field is never used: `a` --> $DIR/union-fields-1.rs:9:5 | -LL | a: u8, //~ ERROR field is never used +LL | a: u8, | ^^^^^ error: field is never used: `a` --> $DIR/union-fields-1.rs:13:20 | -LL | union NoDropLike { a: u8 } //~ ERROR field is never used +LL | union NoDropLike { a: u8 } | ^^^^^ error: field is never used: `c` --> $DIR/union-fields-1.rs:18:5 | -LL | c: u8, //~ ERROR field is never used +LL | c: u8, | ^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/union/union-fields-2.stderr b/src/test/ui/union/union-fields-2.stderr index 959554f6d220..b4d6ed9b0201 100644 --- a/src/test/ui/union/union-fields-2.stderr +++ b/src/test/ui/union/union-fields-2.stderr @@ -1,19 +1,19 @@ error: union expressions should have exactly one field --> $DIR/union-fields-2.rs:7:13 | -LL | let u = U {}; //~ ERROR union expressions should have exactly one field +LL | let u = U {}; | ^ error: union expressions should have exactly one field --> $DIR/union-fields-2.rs:9:13 | -LL | let u = U { a: 0, b: 1 }; //~ ERROR union expressions should have exactly one field +LL | let u = U { a: 0, b: 1 }; | ^ error[E0560]: union `U` has no field named `c` --> $DIR/union-fields-2.rs:10:29 | -LL | let u = U { a: 0, b: 1, c: 2 }; //~ ERROR union expressions should have exactly one field +LL | let u = U { a: 0, b: 1, c: 2 }; | ^ `U` does not have this field | = note: available fields are: `a`, `b` @@ -21,61 +21,61 @@ LL | let u = U { a: 0, b: 1, c: 2 }; //~ ERROR union expressions should have error: union expressions should have exactly one field --> $DIR/union-fields-2.rs:10:13 | -LL | let u = U { a: 0, b: 1, c: 2 }; //~ ERROR union expressions should have exactly one field +LL | let u = U { a: 0, b: 1, c: 2 }; | ^ error: union expressions should have exactly one field --> $DIR/union-fields-2.rs:12:13 | -LL | let u = U { ..u }; //~ ERROR union expressions should have exactly one field +LL | let u = U { ..u }; | ^ error[E0436]: functional record update syntax requires a struct --> $DIR/union-fields-2.rs:12:19 | -LL | let u = U { ..u }; //~ ERROR union expressions should have exactly one field +LL | let u = U { ..u }; | ^ error: union patterns should have exactly one field --> $DIR/union-fields-2.rs:15:9 | -LL | let U {} = u; //~ ERROR union patterns should have exactly one field +LL | let U {} = u; | ^^^^ error: union patterns should have exactly one field --> $DIR/union-fields-2.rs:17:9 | -LL | let U { a, b } = u; //~ ERROR union patterns should have exactly one field +LL | let U { a, b } = u; | ^^^^^^^^^^ error[E0026]: union `U` does not have a field named `c` --> $DIR/union-fields-2.rs:18:19 | -LL | let U { a, b, c } = u; //~ ERROR union patterns should have exactly one field +LL | let U { a, b, c } = u; | ^ union `U` does not have this field error: union patterns should have exactly one field --> $DIR/union-fields-2.rs:18:9 | -LL | let U { a, b, c } = u; //~ ERROR union patterns should have exactly one field +LL | let U { a, b, c } = u; | ^^^^^^^^^^^^^ error: union patterns should have exactly one field --> $DIR/union-fields-2.rs:20:9 | -LL | let U { .. } = u; //~ ERROR union patterns should have exactly one field +LL | let U { .. } = u; | ^^^^^^^^ error: `..` cannot be used in union patterns --> $DIR/union-fields-2.rs:20:9 | -LL | let U { .. } = u; //~ ERROR union patterns should have exactly one field +LL | let U { .. } = u; | ^^^^^^^^ error: `..` cannot be used in union patterns --> $DIR/union-fields-2.rs:22:9 | -LL | let U { a, .. } = u; //~ ERROR `..` cannot be used in union patterns +LL | let U { a, .. } = u; | ^^^^^^^^^^^ error: aborting due to 13 previous errors diff --git a/src/test/ui/union/union-lint-dead-code.stderr b/src/test/ui/union/union-lint-dead-code.stderr index 6551523c54df..79c38a468144 100644 --- a/src/test/ui/union/union-lint-dead-code.stderr +++ b/src/test/ui/union/union-lint-dead-code.stderr @@ -1,7 +1,7 @@ error: field is never used: `b` --> $DIR/union-lint-dead-code.rs:5:5 | -LL | b: bool, //~ ERROR: field is never used +LL | b: bool, | ^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/union/union-nonrepresentable.stderr b/src/test/ui/union/union-nonrepresentable.stderr index 1a7603a46374..746c1033ea34 100644 --- a/src/test/ui/union/union-nonrepresentable.stderr +++ b/src/test/ui/union/union-nonrepresentable.stderr @@ -1,7 +1,7 @@ error[E0072]: recursive type `U` has infinite size --> $DIR/union-nonrepresentable.rs:3:1 | -LL | union U { //~ ERROR recursive type `U` has infinite size +LL | union U { | ^^^^^^^ recursive type has infinite size LL | a: u8, LL | b: U, diff --git a/src/test/ui/union/union-repr-c.stderr b/src/test/ui/union/union-repr-c.stderr index bac09c34b8b1..40d9a50f1fa4 100644 --- a/src/test/ui/union/union-repr-c.stderr +++ b/src/test/ui/union/union-repr-c.stderr @@ -1,7 +1,7 @@ error: `extern` block uses type `W` which is not FFI-safe: this union has unspecified layout --> $DIR/union-repr-c.rs:15:22 | -LL | static FOREIGN2: W; //~ ERROR union has unspecified layout +LL | static FOREIGN2: W; | ^ | note: lint level defined here diff --git a/src/test/ui/union/union-suggest-field.stderr b/src/test/ui/union/union-suggest-field.stderr index 8ea07360d0f2..c737bc29d947 100644 --- a/src/test/ui/union/union-suggest-field.stderr +++ b/src/test/ui/union/union-suggest-field.stderr @@ -7,13 +7,13 @@ LL | let u = U { principle: 0 }; error[E0609]: no field `principial` on type `U` --> $DIR/union-suggest-field.rs:14:15 | -LL | let w = u.principial; //~ ERROR no field `principial` on type `U` +LL | let w = u.principial; | ^^^^^^^^^^ help: a field with a similar name exists: `principal` error[E0615]: attempted to take value of method `calculate` on type `U` --> $DIR/union-suggest-field.rs:18:15 | -LL | let y = u.calculate; //~ ERROR attempted to take value of method `calculate` on type `U` +LL | let y = u.calculate; | ^^^^^^^^^ help: use parentheses to call the method: `calculate()` error: aborting due to 3 previous errors diff --git a/src/test/ui/union/union-unsafe.stderr b/src/test/ui/union/union-unsafe.stderr index 35051485f6ad..ab62508fcf66 100644 --- a/src/test/ui/union/union-unsafe.stderr +++ b/src/test/ui/union/union-unsafe.stderr @@ -1,7 +1,7 @@ error[E0133]: assignment to non-`Copy` union field is unsafe and requires unsafe function or block --> $DIR/union-unsafe.rs:21:5 | -LL | u3.a = T::default(); //~ ERROR assignment to non-`Copy` union field is unsafe +LL | u3.a = T::default(); | ^^^^ assignment to non-`Copy` union field | = note: the previous content of the field will be dropped, which causes undefined behavior if the field was not properly initialized @@ -9,7 +9,7 @@ LL | u3.a = T::default(); //~ ERROR assignment to non-`Copy` union field is error[E0133]: access to union field is unsafe and requires unsafe function or block --> $DIR/union-unsafe.rs:33:13 | -LL | let a = u1.a; //~ ERROR access to union field is unsafe +LL | let a = u1.a; | ^^^^ access to union field | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior @@ -17,7 +17,7 @@ LL | let a = u1.a; //~ ERROR access to union field is unsafe error[E0133]: access to union field is unsafe and requires unsafe function or block --> $DIR/union-unsafe.rs:35:14 | -LL | let U1 { a } = u1; //~ ERROR access to union field is unsafe +LL | let U1 { a } = u1; | ^ access to union field | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior @@ -25,7 +25,7 @@ LL | let U1 { a } = u1; //~ ERROR access to union field is unsafe error[E0133]: access to union field is unsafe and requires unsafe function or block --> $DIR/union-unsafe.rs:36:20 | -LL | if let U1 { a: 12 } = u1 {} //~ ERROR access to union field is unsafe +LL | if let U1 { a: 12 } = u1 {} | ^^ access to union field | = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior @@ -33,7 +33,7 @@ LL | if let U1 { a: 12 } = u1 {} //~ ERROR access to union field is unsafe error[E0133]: assignment to non-`Copy` union field is unsafe and requires unsafe function or block --> $DIR/union-unsafe.rs:40:5 | -LL | u2.a = String::from("new"); //~ ERROR assignment to non-`Copy` union field is unsafe +LL | u2.a = String::from("new"); | ^^^^ assignment to non-`Copy` union field | = note: the previous content of the field will be dropped, which causes undefined behavior if the field was not properly initialized @@ -41,7 +41,7 @@ LL | u2.a = String::from("new"); //~ ERROR assignment to non-`Copy` union fi error[E0133]: assignment to non-`Copy` union field is unsafe and requires unsafe function or block --> $DIR/union-unsafe.rs:44:5 | -LL | u3.a = String::from("new"); //~ ERROR assignment to non-`Copy` union field is unsafe +LL | u3.a = String::from("new"); | ^^^^ assignment to non-`Copy` union field | = note: the previous content of the field will be dropped, which causes undefined behavior if the field was not properly initialized diff --git a/src/test/ui/union/union-with-drop-fields-lint.stderr b/src/test/ui/union/union-with-drop-fields-lint.stderr index d8f456f2aefb..2f90f240d2e1 100644 --- a/src/test/ui/union/union-with-drop-fields-lint.stderr +++ b/src/test/ui/union/union-with-drop-fields-lint.stderr @@ -1,7 +1,7 @@ error: union contains a field with possibly non-trivial drop code, drop code of union fields is ignored when dropping the union --> $DIR/union-with-drop-fields-lint.rs:10:5 | -LL | a: String, //~ ERROR union contains a field with possibly non-trivial drop code +LL | a: String, | ^^^^^^^^^ | note: lint level defined here @@ -13,13 +13,13 @@ LL | #![deny(unions_with_drop_fields)] error: union contains a field with possibly non-trivial drop code, drop code of union fields is ignored when dropping the union --> $DIR/union-with-drop-fields-lint.rs:18:5 | -LL | a: S, //~ ERROR union contains a field with possibly non-trivial drop code +LL | a: S, | ^^^^ error: union contains a field with possibly non-trivial drop code, drop code of union fields is ignored when dropping the union --> $DIR/union-with-drop-fields-lint.rs:23:5 | -LL | a: T, //~ ERROR union contains a field with possibly non-trivial drop code +LL | a: T, | ^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/unique-object-noncopyable.stderr b/src/test/ui/unique-object-noncopyable.stderr index 78b46027c95e..407905f52e75 100644 --- a/src/test/ui/unique-object-noncopyable.stderr +++ b/src/test/ui/unique-object-noncopyable.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `clone` found for type `std::boxed::Box` in the current scope --> $DIR/unique-object-noncopyable.rs:24:16 | -LL | let _z = y.clone(); //~ ERROR no method named `clone` found +LL | let _z = y.clone(); | ^^^^^ | = note: the method `clone` exists but the following trait bounds were not satisfied: diff --git a/src/test/ui/unique-pinned-nocopy.stderr b/src/test/ui/unique-pinned-nocopy.stderr index c7cabd172eb3..0f6ba90afacf 100644 --- a/src/test/ui/unique-pinned-nocopy.stderr +++ b/src/test/ui/unique-pinned-nocopy.stderr @@ -1,7 +1,7 @@ error[E0599]: no method named `clone` found for type `std::boxed::Box` in the current scope --> $DIR/unique-pinned-nocopy.rs:12:16 | -LL | let _j = i.clone(); //~ ERROR no method named `clone` found +LL | let _j = i.clone(); | ^^^^^ | = note: the method `clone` exists but the following trait bounds were not satisfied: diff --git a/src/test/ui/unknown-lint-tool-name.stderr b/src/test/ui/unknown-lint-tool-name.stderr index e9d44e2e3bce..a127af633dcf 100644 --- a/src/test/ui/unknown-lint-tool-name.stderr +++ b/src/test/ui/unknown-lint-tool-name.stderr @@ -1,13 +1,13 @@ error[E0710]: an unknown tool name found in scoped lint: `foo::bar` --> $DIR/unknown-lint-tool-name.rs:1:9 | -LL | #![deny(foo::bar)] //~ ERROR an unknown tool name found in scoped lint: `foo::bar` +LL | #![deny(foo::bar)] | ^^^ error[E0710]: an unknown tool name found in scoped lint: `foo::bar` --> $DIR/unknown-lint-tool-name.rs:3:9 | -LL | #[allow(foo::bar)] //~ ERROR an unknown tool name found in scoped lint: `foo::bar` +LL | #[allow(foo::bar)] | ^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/unknown-tool-name.stderr b/src/test/ui/unknown-tool-name.stderr index 7bd2da285980..7a6ed57bda6f 100644 --- a/src/test/ui/unknown-tool-name.stderr +++ b/src/test/ui/unknown-tool-name.stderr @@ -1,7 +1,7 @@ error[E0433]: failed to resolve: use of undeclared type or module `foo` --> $DIR/unknown-tool-name.rs:1:3 | -LL | #[foo::bar] //~ ERROR failed to resolve: use of undeclared type or module `foo` +LL | #[foo::bar] | ^^^ use of undeclared type or module `foo` error: aborting due to previous error diff --git a/src/test/ui/unop-move-semantics.nll.stderr b/src/test/ui/unop-move-semantics.nll.stderr index 58953d55b1fb..c11445c8adf5 100644 --- a/src/test/ui/unop-move-semantics.nll.stderr +++ b/src/test/ui/unop-move-semantics.nll.stderr @@ -8,7 +8,7 @@ LL | fn move_then_borrow + Clone>(x: T) { LL | !x; | - value moved here LL | -LL | x.clone(); //~ ERROR: use of moved value +LL | x.clone(); | ^ value borrowed here after move error[E0505]: cannot move out of `x` because it is borrowed @@ -17,7 +17,7 @@ error[E0505]: cannot move out of `x` because it is borrowed LL | let m = &x; | -- borrow of `x` occurs here ... -LL | !x; //~ ERROR: cannot move out of `x` because it is borrowed +LL | !x; | ^ move out of `x` occurs here ... LL | use_mut(n); use_imm(m); @@ -29,7 +29,7 @@ error[E0505]: cannot move out of `y` because it is borrowed LL | let n = &mut y; | ------ borrow of `y` occurs here ... -LL | !y; //~ ERROR: cannot move out of `y` because it is borrowed +LL | !y; | ^ move out of `y` occurs here LL | use_mut(n); use_imm(m); | - borrow later used here @@ -37,13 +37,13 @@ LL | use_mut(n); use_imm(m); error[E0507]: cannot move out of borrowed content --> $DIR/unop-move-semantics.rs:24:6 | -LL | !*m; //~ ERROR: cannot move out of borrowed content +LL | !*m; | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/unop-move-semantics.rs:26:6 | -LL | !*n; //~ ERROR: cannot move out of borrowed content +LL | !*n; | ^^ cannot move out of borrowed content error: aborting due to 5 previous errors diff --git a/src/test/ui/unop-move-semantics.stderr b/src/test/ui/unop-move-semantics.stderr index 65d2967c61ee..e2fb42549207 100644 --- a/src/test/ui/unop-move-semantics.stderr +++ b/src/test/ui/unop-move-semantics.stderr @@ -4,7 +4,7 @@ error[E0382]: use of moved value: `x` LL | !x; | - value moved here LL | -LL | x.clone(); //~ ERROR: use of moved value +LL | x.clone(); | ^ value used here after move | = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait @@ -15,7 +15,7 @@ error[E0505]: cannot move out of `x` because it is borrowed LL | let m = &x; | - borrow of `x` occurs here ... -LL | !x; //~ ERROR: cannot move out of `x` because it is borrowed +LL | !x; | ^ move out of `x` occurs here error[E0505]: cannot move out of `y` because it is borrowed @@ -24,19 +24,19 @@ error[E0505]: cannot move out of `y` because it is borrowed LL | let n = &mut y; | - borrow of `y` occurs here ... -LL | !y; //~ ERROR: cannot move out of `y` because it is borrowed +LL | !y; | ^ move out of `y` occurs here error[E0507]: cannot move out of borrowed content --> $DIR/unop-move-semantics.rs:24:6 | -LL | !*m; //~ ERROR: cannot move out of borrowed content +LL | !*m; | ^^ cannot move out of borrowed content error[E0507]: cannot move out of borrowed content --> $DIR/unop-move-semantics.rs:26:6 | -LL | !*n; //~ ERROR: cannot move out of borrowed content +LL | !*n; | ^^ cannot move out of borrowed content error: aborting due to 5 previous errors diff --git a/src/test/ui/unop-neg-bool.stderr b/src/test/ui/unop-neg-bool.stderr index c13c1a15a7cd..182730137492 100644 --- a/src/test/ui/unop-neg-bool.stderr +++ b/src/test/ui/unop-neg-bool.stderr @@ -1,7 +1,7 @@ error[E0600]: cannot apply unary operator `-` to type `bool` --> $DIR/unop-neg-bool.rs:2:5 | -LL | -true; //~ ERROR cannot apply unary operator `-` to type `bool` +LL | -true; | ^^^^^ cannot apply unary operator `-` | = note: an implementation of `std::ops::Neg` might be missing for `bool` diff --git a/src/test/ui/unreachable/unreachable-arm.stderr b/src/test/ui/unreachable/unreachable-arm.stderr index 5b34482b59bb..8e65745c7b09 100644 --- a/src/test/ui/unreachable/unreachable-arm.stderr +++ b/src/test/ui/unreachable/unreachable-arm.stderr @@ -1,7 +1,7 @@ error: unreachable pattern --> $DIR/unreachable-arm.rs:11:9 | -LL | Foo::A(_, 1) => { } //~ ERROR unreachable pattern +LL | Foo::A(_, 1) => { } | ^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/unreachable/unreachable-code.stderr b/src/test/ui/unreachable/unreachable-code.stderr index afb3629d5fda..803bb966be8f 100644 --- a/src/test/ui/unreachable/unreachable-code.stderr +++ b/src/test/ui/unreachable/unreachable-code.stderr @@ -1,7 +1,7 @@ error: unreachable statement --> $DIR/unreachable-code.rs:7:3 | -LL | let a = 3; //~ ERROR: unreachable statement +LL | let a = 3; | ^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/unreachable/unreachable-in-call.stderr b/src/test/ui/unreachable/unreachable-in-call.stderr index b78070d3fb12..f8dd54590f6a 100644 --- a/src/test/ui/unreachable/unreachable-in-call.stderr +++ b/src/test/ui/unreachable/unreachable-in-call.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/unreachable-in-call.rs:14:10 | -LL | get_u8()); //~ ERROR unreachable expression +LL | get_u8()); | ^^^^^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unreachable_code)] error: unreachable expression --> $DIR/unreachable-in-call.rs:17:5 | -LL | / call( //~ ERROR unreachable expression +LL | / call( LL | | get_u8(), LL | | diverge()); | |__________________^ diff --git a/src/test/ui/unreachable/unreachable-variant.stderr b/src/test/ui/unreachable/unreachable-variant.stderr index 60fdae5cbcee..276c77f9b424 100644 --- a/src/test/ui/unreachable/unreachable-variant.stderr +++ b/src/test/ui/unreachable/unreachable-variant.stderr @@ -1,7 +1,7 @@ error[E0603]: module `super_sekrit` is private --> $DIR/unreachable-variant.rs:6:21 | -LL | let _x = other::super_sekrit::sooper_sekrit::baz; //~ ERROR is private +LL | let _x = other::super_sekrit::sooper_sekrit::baz; | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/unreachable/unwarned-match-on-never.stderr b/src/test/ui/unreachable/unwarned-match-on-never.stderr index 8807e5f04e58..ccb70d743114 100644 --- a/src/test/ui/unreachable/unwarned-match-on-never.stderr +++ b/src/test/ui/unreachable/unwarned-match-on-never.stderr @@ -1,7 +1,7 @@ error: unreachable expression --> $DIR/unwarned-match-on-never.rs:10:5 | -LL | match x {} //~ ERROR unreachable expression +LL | match x {} | ^^^^^^^^^^ | note: lint level defined here @@ -13,13 +13,13 @@ LL | #![deny(unreachable_code)] error: unreachable arm --> $DIR/unwarned-match-on-never.rs:15:15 | -LL | () => () //~ ERROR unreachable arm +LL | () => () | ^^ error: unreachable expression --> $DIR/unwarned-match-on-never.rs:21:5 | -LL | / match () { //~ ERROR unreachable expression +LL | / match () { LL | | () => (), LL | | } | |_____^ diff --git a/src/test/ui/unresolved/unresolved-import-recovery.stderr b/src/test/ui/unresolved/unresolved-import-recovery.stderr index 0154d002efee..5e371b70bfa5 100644 --- a/src/test/ui/unresolved/unresolved-import-recovery.stderr +++ b/src/test/ui/unresolved/unresolved-import-recovery.stderr @@ -1,7 +1,7 @@ error[E0432]: unresolved import `unresolved` --> $DIR/unresolved-import-recovery.rs:4:13 | -LL | pub use unresolved; //~ ERROR unresolved import `unresolved` +LL | pub use unresolved; | ^^^^^^^^^^ no `unresolved` in the root error: aborting due to previous error diff --git a/src/test/ui/unresolved/unresolved-import.rs b/src/test/ui/unresolved/unresolved-import.rs index be2a2c75485f..4c7d4bb93533 100644 --- a/src/test/ui/unresolved/unresolved-import.rs +++ b/src/test/ui/unresolved/unresolved-import.rs @@ -1,16 +1,20 @@ -// ignore-tidy-linelength - use foo::bar; //~ ERROR unresolved import `foo` [E0432] //~^ maybe a missing `extern crate foo;`? use bar::Baz as x; //~ ERROR unresolved import `bar::Baz` [E0432] - //~^ no `Baz` in `bar`. Did you mean to use `Bar`? + //~| no `Baz` in `bar` + //~| HELP a similar name exists in the module + //~| SUGGESTION Bar use food::baz; //~ ERROR unresolved import `food::baz` - //~^ no `baz` in `food`. Did you mean to use `bag`? + //~| no `baz` in `food` + //~| HELP a similar name exists in the module + //~| SUGGESTION bag use food::{beens as Foo}; //~ ERROR unresolved import `food::beens` [E0432] - //~^ no `beens` in `food`. Did you mean to use `beans`? + //~| no `beens` in `food` + //~| HELP a similar name exists in the module + //~| SUGGESTION beans mod bar { pub struct Bar; @@ -32,7 +36,8 @@ mod m { } use MyEnum::*; //~ ERROR unresolved import `MyEnum` [E0432] - //~^ did you mean `self::MyEnum`? + //~| HELP a similar path exists + //~| SUGGESTION self::MyEnum } mod items { @@ -41,7 +46,8 @@ mod items { } use Enum::*; //~ ERROR unresolved import `Enum` [E0432] - //~^ did you mean `self::Enum`? + //~| HELP a similar path exists + //~| SUGGESTION self::Enum fn item() {} } diff --git a/src/test/ui/unresolved/unresolved-import.stderr b/src/test/ui/unresolved/unresolved-import.stderr index 0dc4b72208ac..fb5c0760d158 100644 --- a/src/test/ui/unresolved/unresolved-import.stderr +++ b/src/test/ui/unresolved/unresolved-import.stderr @@ -1,38 +1,47 @@ error[E0432]: unresolved import `foo` - --> $DIR/unresolved-import.rs:3:5 + --> $DIR/unresolved-import.rs:1:5 | -LL | use foo::bar; //~ ERROR unresolved import `foo` [E0432] +LL | use foo::bar; | ^^^ maybe a missing `extern crate foo;`? error[E0432]: unresolved import `bar::Baz` - --> $DIR/unresolved-import.rs:6:5 + --> $DIR/unresolved-import.rs:4:5 | -LL | use bar::Baz as x; //~ ERROR unresolved import `bar::Baz` [E0432] - | ^^^^^^^^^^^^^ no `Baz` in `bar`. Did you mean to use `Bar`? +LL | use bar::Baz as x; + | ^^^^^---^^^^^ + | | | + | | help: a similar name exists in the module: `Bar` + | no `Baz` in `bar` error[E0432]: unresolved import `food::baz` --> $DIR/unresolved-import.rs:9:5 | -LL | use food::baz; //~ ERROR unresolved import `food::baz` - | ^^^^^^^^^ no `baz` in `food`. Did you mean to use `bag`? +LL | use food::baz; + | ^^^^^^--- + | | | + | | help: a similar name exists in the module: `bag` + | no `baz` in `food` error[E0432]: unresolved import `food::beens` - --> $DIR/unresolved-import.rs:12:12 + --> $DIR/unresolved-import.rs:14:12 | -LL | use food::{beens as Foo}; //~ ERROR unresolved import `food::beens` [E0432] - | ^^^^^^^^^^^^ no `beens` in `food`. Did you mean to use `beans`? +LL | use food::{beens as Foo}; + | -----^^^^^^^ + | | + | no `beens` in `food` + | help: a similar name exists in the module: `beans` error[E0432]: unresolved import `MyEnum` - --> $DIR/unresolved-import.rs:34:9 + --> $DIR/unresolved-import.rs:38:9 | -LL | use MyEnum::*; //~ ERROR unresolved import `MyEnum` [E0432] - | ^^^^^^ did you mean `self::MyEnum`? +LL | use MyEnum::*; + | ^^^^^^ help: a similar path exists: `self::MyEnum` error[E0432]: unresolved import `Enum` - --> $DIR/unresolved-import.rs:43:9 + --> $DIR/unresolved-import.rs:48:9 | -LL | use Enum::*; //~ ERROR unresolved import `Enum` [E0432] - | ^^^^ did you mean `self::Enum`? +LL | use Enum::*; + | ^^^^ help: a similar path exists: `self::Enum` error: aborting due to 6 previous errors diff --git a/src/test/ui/unrestricted-attribute-tokens.rs b/src/test/ui/unrestricted-attribute-tokens.rs index 9d8ba03eca56..4798f7b396cd 100644 --- a/src/test/ui/unrestricted-attribute-tokens.rs +++ b/src/test/ui/unrestricted-attribute-tokens.rs @@ -1,6 +1,8 @@ // compile-pass -#![feature(custom_attribute, unrestricted_attribute_tokens)] +#![feature(custom_attribute)] #[my_attr(a b c d)] +#[my_attr[a b c d]] +#[my_attr{a b c d}] fn main() {} diff --git a/src/test/ui/unsafe/ranged_ints.stderr b/src/test/ui/unsafe/ranged_ints.stderr index f59a930b5a90..4e43df495c0d 100644 --- a/src/test/ui/unsafe/ranged_ints.stderr +++ b/src/test/ui/unsafe/ranged_ints.stderr @@ -1,7 +1,7 @@ error[E0133]: initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe function or block --> $DIR/ranged_ints.rs:7:14 | -LL | let _x = NonZero(0); //~ ERROR initializing type with `rustc_layout_scalar_valid_range` attr +LL | let _x = NonZero(0); | ^^^^^^^^^^ initializing type with `rustc_layout_scalar_valid_range` attr | = note: initializing a layout restricted type's field with a value outside the valid range is undefined behavior diff --git a/src/test/ui/unsafe/ranged_ints2.stderr b/src/test/ui/unsafe/ranged_ints2.stderr index ae63f47ed74a..ee1d1f10e71b 100644 --- a/src/test/ui/unsafe/ranged_ints2.stderr +++ b/src/test/ui/unsafe/ranged_ints2.stderr @@ -1,7 +1,7 @@ error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block --> $DIR/ranged_ints2.rs:8:13 | -LL | let y = &mut x.0; //~ ERROR mutation of layout constrained field is unsafe +LL | let y = &mut x.0; | ^^^^^^^^ mutation of layout constrained field | = note: mutating layout constrained fields cannot statically be checked for valid values diff --git a/src/test/ui/unsafe/ranged_ints2_const.stderr b/src/test/ui/unsafe/ranged_ints2_const.stderr index fb3841948f11..7d3e141ba709 100644 --- a/src/test/ui/unsafe/ranged_ints2_const.stderr +++ b/src/test/ui/unsafe/ranged_ints2_const.stderr @@ -1,7 +1,7 @@ error[E0723]: mutable references in const fn are unstable (see issue #57563) --> $DIR/ranged_ints2_const.rs:11:9 | -LL | let y = &mut x.0; //~ ERROR references in const fn are unstable +LL | let y = &mut x.0; | ^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | let y = &mut x.0; //~ ERROR references in const fn are unstable error[E0723]: mutable references in const fn are unstable (see issue #57563) --> $DIR/ranged_ints2_const.rs:18:9 | -LL | let y = unsafe { &mut x.0 }; //~ ERROR mutable references in const fn are unstable +LL | let y = unsafe { &mut x.0 }; | ^ | = help: add #![feature(const_fn)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | let y = unsafe { &mut x.0 }; //~ ERROR mutable references in const fn a error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block --> $DIR/ranged_ints2_const.rs:11:13 | -LL | let y = &mut x.0; //~ ERROR references in const fn are unstable +LL | let y = &mut x.0; | ^^^^^^^^ mutation of layout constrained field | = note: mutating layout constrained fields cannot statically be checked for valid values diff --git a/src/test/ui/unsafe/ranged_ints3.stderr b/src/test/ui/unsafe/ranged_ints3.stderr index 311a058fdb07..4d4c9167150e 100644 --- a/src/test/ui/unsafe/ranged_ints3.stderr +++ b/src/test/ui/unsafe/ranged_ints3.stderr @@ -1,7 +1,7 @@ error[E0133]: borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block --> $DIR/ranged_ints3.rs:10:13 | -LL | let y = &x.0; //~ ERROR borrow of layout constrained field with interior mutability +LL | let y = &x.0; | ^^^^ borrow of layout constrained field with interior mutability | = note: references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values diff --git a/src/test/ui/unsafe/ranged_ints3_const.stderr b/src/test/ui/unsafe/ranged_ints3_const.stderr index d83d75787d94..ea15cd5e901b 100644 --- a/src/test/ui/unsafe/ranged_ints3_const.stderr +++ b/src/test/ui/unsafe/ranged_ints3_const.stderr @@ -1,19 +1,19 @@ error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead --> $DIR/ranged_ints3_const.rs:12:13 | -LL | let y = &x.0; //~ ERROR cannot borrow a constant which may contain interior mutability +LL | let y = &x.0; | ^^^^ error[E0492]: cannot borrow a constant which may contain interior mutability, create a static instead --> $DIR/ranged_ints3_const.rs:19:22 | -LL | let y = unsafe { &x.0 }; //~ ERROR cannot borrow a constant which may contain interior mut +LL | let y = unsafe { &x.0 }; | ^^^^ error[E0133]: borrow of layout constrained field with interior mutability is unsafe and requires unsafe function or block --> $DIR/ranged_ints3_const.rs:12:13 | -LL | let y = &x.0; //~ ERROR cannot borrow a constant which may contain interior mutability +LL | let y = &x.0; | ^^^^ borrow of layout constrained field with interior mutability | = note: references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values diff --git a/src/test/ui/unsafe/ranged_ints4.stderr b/src/test/ui/unsafe/ranged_ints4.stderr index c6468b643b41..68c22589d3ff 100644 --- a/src/test/ui/unsafe/ranged_ints4.stderr +++ b/src/test/ui/unsafe/ranged_ints4.stderr @@ -1,7 +1,7 @@ error[E0133]: mutation of layout constrained field is unsafe and requires unsafe function or block --> $DIR/ranged_ints4.rs:8:5 | -LL | x.0 = 0; //~ ERROR mutation of layout constrained field is unsafe +LL | x.0 = 0; | ^^^^^^^ mutation of layout constrained field | = note: mutating layout constrained fields cannot statically be checked for valid values diff --git a/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr b/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr index 7751fe017b8e..28b18d50fff1 100644 --- a/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr +++ b/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr @@ -1,7 +1,7 @@ error: unnecessary `unsafe` block --> $DIR/unsafe-around-compiler-generated-unsafe.rs:6:5 | -LL | unsafe { println!("foo"); } //~ ERROR unnecessary `unsafe` +LL | unsafe { println!("foo"); } | ^^^^^^ unnecessary `unsafe` block | note: lint level defined here diff --git a/src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr b/src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr index 1e000062cc3e..8f621d6ed11c 100644 --- a/src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr +++ b/src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr @@ -1,7 +1,7 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block --> $DIR/unsafe-fn-assign-deref-ptr.rs:6:5 | -LL | *p = 0; //~ ERROR dereference of raw pointer is unsafe +LL | *p = 0; | ^^^^^^ dereference of raw pointer | = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior diff --git a/src/test/ui/unsafe/unsafe-fn-autoderef.stderr b/src/test/ui/unsafe/unsafe-fn-autoderef.stderr index ded64ba69e89..20a88c356108 100644 --- a/src/test/ui/unsafe/unsafe-fn-autoderef.stderr +++ b/src/test/ui/unsafe/unsafe-fn-autoderef.stderr @@ -1,7 +1,7 @@ error[E0609]: no field `f` on type `*const Rec` --> $DIR/unsafe-fn-autoderef.rs:19:14 | -LL | return p.f; //~ ERROR no field `f` on type `*const Rec` +LL | return p.f; | --^ | | | help: `p` is a raw pointer; try dereferencing it: `(*p).f` diff --git a/src/test/ui/unsafe/unsafe-fn-called-from-safe.stderr b/src/test/ui/unsafe/unsafe-fn-called-from-safe.stderr index 4ad7c6e5c75d..80d2c6ced24c 100644 --- a/src/test/ui/unsafe/unsafe-fn-called-from-safe.stderr +++ b/src/test/ui/unsafe/unsafe-fn-called-from-safe.stderr @@ -1,7 +1,7 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block --> $DIR/unsafe-fn-called-from-safe.rs:4:5 | -LL | f(); //~ ERROR call to unsafe function is unsafe +LL | f(); | ^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior diff --git a/src/test/ui/unsafe/unsafe-fn-deref-ptr.stderr b/src/test/ui/unsafe/unsafe-fn-deref-ptr.stderr index d48a7681cadc..e8e82dec0b0b 100644 --- a/src/test/ui/unsafe/unsafe-fn-deref-ptr.stderr +++ b/src/test/ui/unsafe/unsafe-fn-deref-ptr.stderr @@ -1,7 +1,7 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block --> $DIR/unsafe-fn-deref-ptr.rs:2:12 | -LL | return *p; //~ ERROR dereference of raw pointer is unsafe +LL | return *p; | ^^ dereference of raw pointer | = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior diff --git a/src/test/ui/unsafe/unsafe-fn-used-as-value.stderr b/src/test/ui/unsafe/unsafe-fn-used-as-value.stderr index f68e849341b9..a7b73ec53429 100644 --- a/src/test/ui/unsafe/unsafe-fn-used-as-value.stderr +++ b/src/test/ui/unsafe/unsafe-fn-used-as-value.stderr @@ -1,7 +1,7 @@ error[E0133]: call to unsafe function is unsafe and requires unsafe function or block --> $DIR/unsafe-fn-used-as-value.rs:5:5 | -LL | x(); //~ ERROR call to unsafe function is unsafe +LL | x(); | ^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior diff --git a/src/test/ui/unsafe/unsafe-subtyping.stderr b/src/test/ui/unsafe/unsafe-subtyping.stderr index 3db0bcba81bf..cac5ee07089e 100644 --- a/src/test/ui/unsafe/unsafe-subtyping.stderr +++ b/src/test/ui/unsafe/unsafe-subtyping.stderr @@ -3,7 +3,7 @@ error[E0308]: mismatched types | LL | fn foo(x: Option) -> Option { | ---------------------- expected `std::option::Option` because of return type -LL | x //~ ERROR mismatched types +LL | x | ^ expected unsafe fn, found normal fn | = note: expected type `std::option::Option` diff --git a/src/test/ui/unsized-locals/double-move.nll.stderr b/src/test/ui/unsized-locals/double-move.nll.stderr index c0c3e436f535..47fa0d4a437b 100644 --- a/src/test/ui/unsized-locals/double-move.nll.stderr +++ b/src/test/ui/unsized-locals/double-move.nll.stderr @@ -5,7 +5,7 @@ LL | let y = *x; | - move occurs because `y` has type `str`, which does not implement the `Copy` trait LL | drop_unsized(y); | - value moved here -LL | drop_unsized(y); //~ERROR use of moved value +LL | drop_unsized(y); | ^ value used here after move error[E0382]: use of moved value: `x` @@ -13,7 +13,7 @@ error[E0382]: use of moved value: `x` | LL | let _y = *x; | -- value moved here -LL | drop_unsized(x); //~ERROR use of moved value +LL | drop_unsized(x); | ^ value used here after partial move | = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait @@ -25,7 +25,7 @@ LL | let x = "hello".to_owned().into_boxed_str(); | - move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait LL | drop_unsized(x); | - value moved here -LL | let _y = *x; //~ERROR use of moved value +LL | let _y = *x; | ^^ value used here after move error[E0382]: use of moved value: `y` @@ -35,7 +35,7 @@ LL | let y = *x; | - move occurs because `y` has type `str`, which does not implement the `Copy` trait LL | y.foo(); | - value moved here -LL | y.foo(); //~ERROR use of moved value +LL | y.foo(); | ^ value used here after move error[E0382]: use of moved value: `*x` @@ -43,7 +43,7 @@ error[E0382]: use of moved value: `*x` | LL | let _y = *x; | -- value moved here -LL | x.foo(); //~ERROR use of moved value +LL | x.foo(); | ^ value used here after move | = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait @@ -53,7 +53,7 @@ error[E0382]: use of moved value: `*x` | LL | x.foo(); | - value moved here -LL | let _y = *x; //~ERROR use of moved value +LL | let _y = *x; | ^^ value used here after move | = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait diff --git a/src/test/ui/unsized-locals/double-move.stderr b/src/test/ui/unsized-locals/double-move.stderr index 1009e913b7b6..e6573af5a368 100644 --- a/src/test/ui/unsized-locals/double-move.stderr +++ b/src/test/ui/unsized-locals/double-move.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `y` | LL | drop_unsized(y); | - value moved here -LL | drop_unsized(y); //~ERROR use of moved value +LL | drop_unsized(y); | ^ value used here after move | = note: move occurs because `y` has type `str`, which does not implement the `Copy` trait @@ -13,7 +13,7 @@ error[E0382]: use of moved value: `x` | LL | let _y = *x; | -- value moved here -LL | drop_unsized(x); //~ERROR use of moved value +LL | drop_unsized(x); | ^ value used here after move | = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait @@ -23,7 +23,7 @@ error[E0382]: use of moved value: `*x` | LL | drop_unsized(x); | - value moved here -LL | let _y = *x; //~ERROR use of moved value +LL | let _y = *x; | ^^ value used here after move | = note: move occurs because `x` has type `std::boxed::Box`, which does not implement the `Copy` trait @@ -33,7 +33,7 @@ error[E0382]: use of moved value: `y` | LL | y.foo(); | - value moved here -LL | y.foo(); //~ERROR use of moved value +LL | y.foo(); | ^ value used here after move | = note: move occurs because `y` has type `str`, which does not implement the `Copy` trait @@ -43,7 +43,7 @@ error[E0382]: use of moved value: `*x` | LL | let _y = *x; | -- value moved here -LL | x.foo(); //~ERROR use of moved value +LL | x.foo(); | ^ value used here after move | = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait @@ -53,7 +53,7 @@ error[E0382]: use of moved value: `*x` | LL | x.foo(); | - value moved here -LL | let _y = *x; //~ERROR use of moved value +LL | let _y = *x; | ^^ value used here after move | = note: move occurs because `*x` has type `str`, which does not implement the `Copy` trait diff --git a/src/test/ui/unused/unused-attr.stderr b/src/test/ui/unused/unused-attr.stderr index 6d8a4dd84e65..6f096d741444 100644 --- a/src/test/ui/unused/unused-attr.stderr +++ b/src/test/ui/unused/unused-attr.stderr @@ -1,7 +1,7 @@ error: unused attribute --> $DIR/unused-attr.rs:7:1 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ | note: lint level defined here @@ -13,85 +13,85 @@ LL | #![deny(unused_attributes)] error: unused attribute --> $DIR/unused-attr.rs:10:1 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:15:5 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:13:1 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:23:9 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:21:5 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:19:1 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:31:9 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:28:1 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:38:5 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:36:1 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:44:5 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:46:5 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:42:1 | -LL | #[foo] //~ ERROR unused attribute +LL | #[foo] | ^^^^^^ error: unused attribute --> $DIR/unused-attr.rs:5:1 | -LL | #![foo] //~ ERROR unused attribute +LL | #![foo] | ^^^^^^^ error: aborting due to 15 previous errors diff --git a/src/test/ui/unused/unused-macro-rules.stderr b/src/test/ui/unused/unused-macro-rules.stderr index c6ec064096b1..5c0b9f262b8c 100644 --- a/src/test/ui/unused/unused-macro-rules.stderr +++ b/src/test/ui/unused/unused-macro-rules.stderr @@ -1,7 +1,7 @@ error: unused macro definition --> $DIR/unused-macro-rules.rs:4:1 | -LL | / macro_rules! unused { //~ ERROR: unused macro definition +LL | / macro_rules! unused { LL | | () => {}; LL | | } | |_^ @@ -15,7 +15,7 @@ LL | #![deny(unused_macros)] error: unused macro definition --> $DIR/unused-macro-rules.rs:11:9 | -LL | / macro_rules! m { //~ ERROR: unused macro definition +LL | / macro_rules! m { LL | | () => {}; LL | | } | |_________^ @@ -26,7 +26,7 @@ LL | create_macro!(); error: unused macro definition --> $DIR/unused-macro-rules.rs:24:5 | -LL | / macro_rules! unused { //~ ERROR: unused macro definition +LL | / macro_rules! unused { LL | | () => {}; LL | | } | |_____^ diff --git a/src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr b/src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr index e4624a5fe058..6edf0a2cf8d5 100644 --- a/src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr +++ b/src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr @@ -1,7 +1,7 @@ error: invalid fragment specifier `t_ty` --> $DIR/unused-macro-with-bad-frag-spec.rs:6:6 | -LL | ($wrong:t_ty) => () //~ ERROR invalid fragment specifier `t_ty` +LL | ($wrong:t_ty) => () | ^^^^^^^^^^^ | = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis` diff --git a/src/test/ui/unused/unused-macro-with-follow-violation.stderr b/src/test/ui/unused/unused-macro-with-follow-violation.stderr index dfeb3a407e58..5eced4f06c0c 100644 --- a/src/test/ui/unused/unused-macro-with-follow-violation.stderr +++ b/src/test/ui/unused/unused-macro-with-follow-violation.stderr @@ -1,7 +1,7 @@ error: `$e:expr` is followed by `+`, which is not allowed for `expr` fragments --> $DIR/unused-macro-with-follow-violation.rs:4:14 | -LL | ($e:expr +) => () //~ ERROR not allowed for `expr` fragments +LL | ($e:expr +) => () | ^ not allowed after `expr` fragments | = note: allowed there are: `=>`, `,` or `;` diff --git a/src/test/ui/unused/unused-macro.stderr b/src/test/ui/unused/unused-macro.stderr index a83b5be5fbf7..d18fe82564e0 100644 --- a/src/test/ui/unused/unused-macro.stderr +++ b/src/test/ui/unused/unused-macro.stderr @@ -1,7 +1,7 @@ error: unused macro definition --> $DIR/unused-macro.rs:5:1 | -LL | / macro unused { //~ ERROR: unused macro definition +LL | / macro unused { LL | | () => {} LL | | } | |_^ @@ -15,7 +15,7 @@ LL | #![deny(unused_macros)] error: unused macro definition --> $DIR/unused-macro.rs:15:5 | -LL | / macro unused { //~ ERROR: unused macro definition +LL | / macro unused { LL | | () => {} LL | | } | |_____^ @@ -29,7 +29,7 @@ LL | #[deny(unused_macros)] error: unused macro definition --> $DIR/unused-macro.rs:21:5 | -LL | / pub(crate) macro unused { //~ ERROR: unused macro definition +LL | / pub(crate) macro unused { LL | | () => {} LL | | } | |_____^ diff --git a/src/test/ui/unused/unused-result.stderr b/src/test/ui/unused/unused-result.stderr index 2eb53eac4064..e2aee75f3ed3 100644 --- a/src/test/ui/unused/unused-result.stderr +++ b/src/test/ui/unused/unused-result.stderr @@ -1,7 +1,7 @@ error: unused `MustUse` that must be used --> $DIR/unused-result.rs:21:5 | -LL | foo::(); //~ ERROR: unused `MustUse` that must be used +LL | foo::(); | ^^^^^^^^^^^^^^^^^ | note: lint level defined here @@ -13,7 +13,7 @@ LL | #![deny(unused_results, unused_must_use)] error: unused `MustUseMsg` that must be used --> $DIR/unused-result.rs:22:5 | -LL | foo::(); //~ ERROR: unused `MustUseMsg` that must be used +LL | foo::(); | ^^^^^^^^^^^^^^^^^^^^ | = note: some message @@ -21,7 +21,7 @@ LL | foo::(); //~ ERROR: unused `MustUseMsg` that must be used error: unused result --> $DIR/unused-result.rs:34:5 | -LL | foo::(); //~ ERROR: unused result +LL | foo::(); | ^^^^^^^^^^^^^^^ | note: lint level defined here @@ -33,13 +33,13 @@ LL | #![deny(unused_results, unused_must_use)] error: unused `MustUse` that must be used --> $DIR/unused-result.rs:35:5 | -LL | foo::(); //~ ERROR: unused `MustUse` that must be used +LL | foo::(); | ^^^^^^^^^^^^^^^^^ error: unused `MustUseMsg` that must be used --> $DIR/unused-result.rs:36:5 | -LL | foo::(); //~ ERROR: unused `MustUseMsg` that must be used +LL | foo::(); | ^^^^^^^^^^^^^^^^^^^^ | = note: some message diff --git a/src/test/ui/use/use-after-move-based-on-type.nll.stderr b/src/test/ui/use/use-after-move-based-on-type.nll.stderr index 8160ada9d62e..520f88f55dc1 100644 --- a/src/test/ui/use/use-after-move-based-on-type.nll.stderr +++ b/src/test/ui/use/use-after-move-based-on-type.nll.stderr @@ -5,7 +5,7 @@ LL | let x = "Hello!".to_string(); | - move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait LL | let _y = x; | - value moved here -LL | println!("{}", x); //~ ERROR use of moved value +LL | println!("{}", x); | ^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/use/use-after-move-based-on-type.stderr b/src/test/ui/use/use-after-move-based-on-type.stderr index 2282cdfad14d..b9e0aaf1f848 100644 --- a/src/test/ui/use/use-after-move-based-on-type.stderr +++ b/src/test/ui/use/use-after-move-based-on-type.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `x` | LL | let _y = x; | -- value moved here -LL | println!("{}", x); //~ ERROR use of moved value +LL | println!("{}", x); | ^ value used here after move | = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait diff --git a/src/test/ui/use/use-after-move-self-based-on-type.nll.stderr b/src/test/ui/use/use-after-move-self-based-on-type.nll.stderr index 4119741d805c..9bf1175430c8 100644 --- a/src/test/ui/use/use-after-move-self-based-on-type.nll.stderr +++ b/src/test/ui/use/use-after-move-self-based-on-type.nll.stderr @@ -5,7 +5,7 @@ LL | pub fn foo(self) -> isize { | ---- move occurs because `self` has type `S`, which does not implement the `Copy` trait LL | self.bar(); | ---- value moved here -LL | return self.x; //~ ERROR use of moved value: `self.x` +LL | return self.x; | ^^^^^^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/use/use-after-move-self-based-on-type.stderr b/src/test/ui/use/use-after-move-self-based-on-type.stderr index a3acc1aad0f0..d1d26069fdf0 100644 --- a/src/test/ui/use/use-after-move-self-based-on-type.stderr +++ b/src/test/ui/use/use-after-move-self-based-on-type.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `self.x` | LL | self.bar(); | ---- value moved here -LL | return self.x; //~ ERROR use of moved value: `self.x` +LL | return self.x; | ^^^^^^ value used here after move | = note: move occurs because `self` has type `S`, which does not implement the `Copy` trait diff --git a/src/test/ui/use/use-after-move-self.nll.stderr b/src/test/ui/use/use-after-move-self.nll.stderr index e2ce3690cb90..3be0a65550b7 100644 --- a/src/test/ui/use/use-after-move-self.nll.stderr +++ b/src/test/ui/use/use-after-move-self.nll.stderr @@ -5,7 +5,7 @@ LL | pub fn foo(self) -> isize { | ---- move occurs because `self` has type `S`, which does not implement the `Copy` trait LL | self.bar(); | ---- value moved here -LL | return *self.x; //~ ERROR use of moved value: `*self.x` +LL | return *self.x; | ^^^^^^^ value used here after move error: aborting due to previous error diff --git a/src/test/ui/use/use-after-move-self.stderr b/src/test/ui/use/use-after-move-self.stderr index 3cb77acaf3dd..2c4bd202681d 100644 --- a/src/test/ui/use/use-after-move-self.stderr +++ b/src/test/ui/use/use-after-move-self.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `*self.x` | LL | self.bar(); | ---- value moved here -LL | return *self.x; //~ ERROR use of moved value: `*self.x` +LL | return *self.x; | ^^^^^^^ value used here after move | = note: move occurs because `self` has type `S`, which does not implement the `Copy` trait diff --git a/src/test/ui/use/use-from-trait-xc.stderr b/src/test/ui/use/use-from-trait-xc.stderr index 8ff75b503d5a..97dc603f9eb2 100644 --- a/src/test/ui/use/use-from-trait-xc.stderr +++ b/src/test/ui/use/use-from-trait-xc.stderr @@ -19,13 +19,13 @@ LL | use use_from_trait_xc::Trait::CONST; error[E0432]: unresolved import `use_from_trait_xc::Foo` --> $DIR/use-from-trait-xc.rs:14:24 | -LL | use use_from_trait_xc::Foo::new; //~ ERROR struct `Foo` is private +LL | use use_from_trait_xc::Foo::new; | ^^^ not a module `Foo` error[E0432]: unresolved import `use_from_trait_xc::Foo` --> $DIR/use-from-trait-xc.rs:17:24 | -LL | use use_from_trait_xc::Foo::C; //~ ERROR struct `Foo` is private +LL | use use_from_trait_xc::Foo::C; | ^^^ not a module `Foo` error[E0432]: unresolved import `use_from_trait_xc::Bar` @@ -43,13 +43,13 @@ LL | use use_from_trait_xc::Baz::new as baznew; error[E0603]: struct `Foo` is private --> $DIR/use-from-trait-xc.rs:14:24 | -LL | use use_from_trait_xc::Foo::new; //~ ERROR struct `Foo` is private +LL | use use_from_trait_xc::Foo::new; | ^^^ error[E0603]: struct `Foo` is private --> $DIR/use-from-trait-xc.rs:17:24 | -LL | use use_from_trait_xc::Foo::C; //~ ERROR struct `Foo` is private +LL | use use_from_trait_xc::Foo::C; | ^^^ error: aborting due to 9 previous errors diff --git a/src/test/ui/use/use-mod/use-mod-3.stderr b/src/test/ui/use/use-mod/use-mod-3.stderr index c644ec752f90..0c800ec35e40 100644 --- a/src/test/ui/use/use-mod/use-mod-3.stderr +++ b/src/test/ui/use/use-mod/use-mod-3.stderr @@ -1,13 +1,13 @@ error[E0603]: module `bar` is private --> $DIR/use-mod-3.rs:1:10 | -LL | use foo::bar::{ //~ ERROR module `bar` is private +LL | use foo::bar::{ | ^^^ error[E0603]: module `bar` is private --> $DIR/use-mod-3.rs:4:10 | -LL | use foo::bar::{ //~ ERROR module `bar` is private +LL | use foo::bar::{ | ^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/use/use-mod/use-mod-4.stderr b/src/test/ui/use/use-mod/use-mod-4.stderr index fc0f8952c479..99f5c352184d 100644 --- a/src/test/ui/use/use-mod/use-mod-4.stderr +++ b/src/test/ui/use/use-mod/use-mod-4.stderr @@ -1,7 +1,7 @@ error[E0429]: `self` imports are only allowed within a { } list --> $DIR/use-mod-4.rs:1:5 | -LL | use foo::self; //~ ERROR unresolved import `foo` +LL | use foo::self; | ^^^^^^^^^ error[E0429]: `self` imports are only allowed within a { } list @@ -13,7 +13,7 @@ LL | use std::mem::self; error[E0432]: unresolved import `foo` --> $DIR/use-mod-4.rs:1:5 | -LL | use foo::self; //~ ERROR unresolved import `foo` +LL | use foo::self; | ^^^ maybe a missing `extern crate foo;`? error: aborting due to 3 previous errors diff --git a/src/test/ui/use/use-nested-groups-error.stderr b/src/test/ui/use/use-nested-groups-error.stderr index 9d6fd9df6cbe..7234c8ec621c 100644 --- a/src/test/ui/use/use-nested-groups-error.stderr +++ b/src/test/ui/use/use-nested-groups-error.stderr @@ -2,7 +2,10 @@ error[E0432]: unresolved import `a::b1::C1` --> $DIR/use-nested-groups-error.rs:9:14 | LL | use a::{b1::{C1, C2}, B2}; - | ^^ no `C1` in `a::b1`. Did you mean to use `C2`? + | ^^ + | | + | no `C1` in `a::b1` + | help: a similar name exists in the module: `C2` error: aborting due to previous error diff --git a/src/test/ui/use/use-paths-as-items.stderr b/src/test/ui/use/use-paths-as-items.stderr index 00f468cdf316..334e145098be 100644 --- a/src/test/ui/use/use-paths-as-items.stderr +++ b/src/test/ui/use/use-paths-as-items.stderr @@ -3,7 +3,7 @@ error[E0252]: the name `mem` is defined multiple times | LL | use std::{mem, ptr}; | --- previous import of the module `mem` here -LL | use std::mem; //~ ERROR the name `mem` is defined multiple times +LL | use std::mem; | ----^^^^^^^^- | | | | | `mem` reimported here diff --git a/src/test/ui/use/use-self-type.stderr b/src/test/ui/use/use-self-type.stderr index 50b4cdf357d8..38c09c2be76f 100644 --- a/src/test/ui/use/use-self-type.stderr +++ b/src/test/ui/use/use-self-type.stderr @@ -1,13 +1,13 @@ error[E0433]: failed to resolve: use of undeclared type or module `Self` --> $DIR/use-self-type.rs:7:16 | -LL | pub(in Self::f) struct Z; //~ ERROR use of undeclared type or module `Self` +LL | pub(in Self::f) struct Z; | ^^^^ use of undeclared type or module `Self` error[E0432]: unresolved import `Self` --> $DIR/use-self-type.rs:6:13 | -LL | use Self::f; //~ ERROR unresolved import +LL | use Self::f; | ^^^^ use of undeclared type or module `Self` error: aborting due to 2 previous errors diff --git a/src/test/ui/use/use-super-global-path.stderr b/src/test/ui/use/use-super-global-path.stderr index ee7deb264df5..a513d37738df 100644 --- a/src/test/ui/use/use-super-global-path.stderr +++ b/src/test/ui/use/use-super-global-path.stderr @@ -1,19 +1,19 @@ error[E0433]: failed to resolve: global paths cannot start with `super` --> $DIR/use-super-global-path.rs:7:11 | -LL | use ::super::{S, Z}; //~ ERROR global paths cannot start with `super` +LL | use ::super::{S, Z}; | ^^^^^ global paths cannot start with `super` error[E0433]: failed to resolve: global paths cannot start with `super` --> $DIR/use-super-global-path.rs:10:15 | -LL | use ::super::main; //~ ERROR global paths cannot start with `super` +LL | use ::super::main; | ^^^^^ global paths cannot start with `super` error[E0425]: cannot find function `main` in this scope --> $DIR/use-super-global-path.rs:11:9 | -LL | main(); //~ ERROR cannot find function `main` in this scope +LL | main(); | ^^^^ not found in this scope help: possible candidate is found in another module, you can import it into scope | diff --git a/src/test/ui/used.stderr b/src/test/ui/used.stderr index c998e27c531e..ea77f129d8ef 100644 --- a/src/test/ui/used.stderr +++ b/src/test/ui/used.stderr @@ -1,25 +1,25 @@ error: attribute must be applied to a `static` variable --> $DIR/used.rs:4:1 | -LL | #[used] //~ ERROR attribute must be applied to a `static` variable +LL | #[used] | ^^^^^^^ error: attribute must be applied to a `static` variable --> $DIR/used.rs:7:1 | -LL | #[used] //~ ERROR attribute must be applied to a `static` variable +LL | #[used] | ^^^^^^^ error: attribute must be applied to a `static` variable --> $DIR/used.rs:10:1 | -LL | #[used] //~ ERROR attribute must be applied to a `static` variable +LL | #[used] | ^^^^^^^ error: attribute must be applied to a `static` variable --> $DIR/used.rs:13:1 | -LL | #[used] //~ ERROR attribute must be applied to a `static` variable +LL | #[used] | ^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/useless-pub.stderr b/src/test/ui/useless-pub.stderr index 5bca980f21e1..14c4983ae29b 100644 --- a/src/test/ui/useless-pub.stderr +++ b/src/test/ui/useless-pub.stderr @@ -1,19 +1,19 @@ error[E0449]: unnecessary visibility qualifier --> $DIR/useless-pub.rs:8:5 | -LL | pub fn foo(&self) {} //~ ERROR: unnecessary visibility qualifier +LL | pub fn foo(&self) {} | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/useless-pub.rs:12:10 | -LL | V1 { pub f: i32 }, //~ ERROR unnecessary visibility qualifier +LL | V1 { pub f: i32 }, | ^^^ `pub` not permitted here because it's implied error[E0449]: unnecessary visibility qualifier --> $DIR/useless-pub.rs:13:8 | -LL | V2(pub i32), //~ ERROR unnecessary visibility qualifier +LL | V2(pub i32), | ^^^ `pub` not permitted here because it's implied error: aborting due to 3 previous errors diff --git a/src/test/ui/useless_comment.rs b/src/test/ui/useless_comment.rs index 531eec007fc4..7d2e5ab6f2b7 100644 --- a/src/test/ui/useless_comment.rs +++ b/src/test/ui/useless_comment.rs @@ -1,18 +1,43 @@ +#![feature(stmt_expr_attributes)] + #![deny(unused_doc_comments)] +macro_rules! mac { + () => {} +} + +/// foo //~ ERROR unused doc comment +mac!(); + fn foo() { - /// a //~ ERROR doc comment not used by rustdoc + /// a //~ ERROR unused doc comment let x = 12; - /// b //~ doc comment not used by rustdoc + /// multi-line //~ unused doc comment + /// doc comment + /// that is unused match x { - /// c //~ ERROR doc comment not used by rustdoc + /// c //~ ERROR unused doc comment 1 => {}, _ => {} } - /// foo //~ ERROR doc comment not used by rustdoc + /// foo //~ ERROR unused doc comment unsafe {} + + #[doc = "foo"] //~ ERROR unused doc comment + #[doc = "bar"] //~ ERROR unused doc comment + 3; + + /// bar //~ ERROR unused doc comment + mac!(); + + let x = /** comment */ 47; //~ ERROR unused doc comment + + /// dox //~ ERROR unused doc comment + { + + } } fn main() { diff --git a/src/test/ui/useless_comment.stderr b/src/test/ui/useless_comment.stderr index cc818f6ce7c3..10d8ee60f99f 100644 --- a/src/test/ui/useless_comment.stderr +++ b/src/test/ui/useless_comment.stderr @@ -1,32 +1,98 @@ -error: doc comment not used by rustdoc - --> $DIR/useless_comment.rs:4:5 +error: unused doc comment + --> $DIR/useless_comment.rs:9:1 | -LL | /// a //~ ERROR doc comment not used by rustdoc - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | /// foo + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | mac!(); + | ------- rustdoc does not generate documentation for macro expansions | note: lint level defined here - --> $DIR/useless_comment.rs:1:9 + --> $DIR/useless_comment.rs:3:9 | LL | #![deny(unused_doc_comments)] | ^^^^^^^^^^^^^^^^^^^ + = help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion -error: doc comment not used by rustdoc - --> $DIR/useless_comment.rs:7:5 +error: unused doc comment + --> $DIR/useless_comment.rs:13:5 | -LL | /// b //~ doc comment not used by rustdoc - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | /// a + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | let x = 12; + | ----------- rustdoc does not generate documentation for statements -error: doc comment not used by rustdoc - --> $DIR/useless_comment.rs:9:9 +error: unused doc comment + --> $DIR/useless_comment.rs:16:5 | -LL | /// c //~ ERROR doc comment not used by rustdoc - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / /// multi-line +LL | | /// doc comment +LL | | /// that is unused + | |______________________^ +LL | / match x { +LL | | /// c +LL | | 1 => {}, +LL | | _ => {} +LL | | } + | |_____- rustdoc does not generate documentation for expressions -error: doc comment not used by rustdoc - --> $DIR/useless_comment.rs:14:5 +error: unused doc comment + --> $DIR/useless_comment.rs:20:9 | -LL | /// foo //~ ERROR doc comment not used by rustdoc - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | /// c + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | 1 => {}, + | ------- rustdoc does not generate documentation for match arms -error: aborting due to 4 previous errors +error: unused doc comment + --> $DIR/useless_comment.rs:25:5 + | +LL | /// foo + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | unsafe {} + | --------- rustdoc does not generate documentation for expressions + +error: unused doc comment + --> $DIR/useless_comment.rs:28:5 + | +LL | #[doc = "foo"] + | ^^^^^^^^^^^^^^ +LL | #[doc = "bar"] +LL | 3; + | - rustdoc does not generate documentation for expressions + +error: unused doc comment + --> $DIR/useless_comment.rs:29:5 + | +LL | #[doc = "bar"] + | ^^^^^^^^^^^^^^ +LL | 3; + | - rustdoc does not generate documentation for expressions + +error: unused doc comment + --> $DIR/useless_comment.rs:32:5 + | +LL | /// bar + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | mac!(); + | ------- rustdoc does not generate documentation for macro expansions + | + = help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion + +error: unused doc comment + --> $DIR/useless_comment.rs:35:13 + | +LL | let x = /** comment */ 47; + | ^^^^^^^^^^^^^^ -- rustdoc does not generate documentation for expressions + +error: unused doc comment + --> $DIR/useless_comment.rs:37:5 + | +LL | /// dox + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | / { +LL | | +LL | | } + | |_____- rustdoc does not generate documentation for expressions + +error: aborting due to 10 previous errors diff --git a/src/test/ui/user-defined-macro-rules.stderr b/src/test/ui/user-defined-macro-rules.stderr index a2d7b171a73a..057515228e0d 100644 --- a/src/test/ui/user-defined-macro-rules.stderr +++ b/src/test/ui/user-defined-macro-rules.stderr @@ -1,7 +1,7 @@ error: user-defined macros may not be named `macro_rules` --> $DIR/user-defined-macro-rules.rs:3:1 | -LL | macro_rules! macro_rules { () => {} } //~ ERROR user-defined macros may not be named `macro_rules` +LL | macro_rules! macro_rules { () => {} } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/utf8_idents.stderr b/src/test/ui/utf8_idents.stderr index 52fb607af5b2..330ba3e0a8cc 100644 --- a/src/test/ui/utf8_idents.stderr +++ b/src/test/ui/utf8_idents.stderr @@ -1,7 +1,7 @@ error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/utf8_idents.rs:2:5 | -LL | 'Ξ², //~ ERROR non-ascii idents are not fully supported +LL | 'Ξ², | ^^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -9,7 +9,7 @@ LL | 'Ξ², //~ ERROR non-ascii idents are not fully supported error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/utf8_idents.rs:3:5 | -LL | Ξ³ //~ ERROR non-ascii idents are not fully supported +LL | Ξ³ | ^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -17,7 +17,7 @@ LL | Ξ³ //~ ERROR non-ascii idents are not fully supported error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/utf8_idents.rs:8:5 | -LL | Ξ΄: usize //~ ERROR non-ascii idents are not fully supported +LL | Ξ΄: usize | ^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -25,7 +25,7 @@ LL | Ξ΄: usize //~ ERROR non-ascii idents are not fully supported error[E0658]: non-ascii idents are not fully supported. (see issue #55467) --> $DIR/utf8_idents.rs:12:9 | -LL | let Ξ± = 0.00001f64; //~ ERROR non-ascii idents are not fully supported +LL | let Ξ± = 0.00001f64; | ^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable @@ -33,7 +33,7 @@ LL | let Ξ± = 0.00001f64; //~ ERROR non-ascii idents are not fully supported warning: type parameter `Ξ³` should have an upper camel case name --> $DIR/utf8_idents.rs:3:5 | -LL | Ξ³ //~ ERROR non-ascii idents are not fully supported +LL | Ξ³ | ^ help: convert the identifier to upper camel case: `Ξ“` | = note: #[warn(non_camel_case_types)] on by default diff --git a/src/test/ui/variadic/variadic-ffi.stderr b/src/test/ui/variadic/variadic-ffi.stderr deleted file mode 100644 index 617b1f46ea3f..000000000000 --- a/src/test/ui/variadic/variadic-ffi.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0045]: variadic function must have C or cdecl calling convention - --> $DIR/variadic-ffi.rs:5:5 - | -LL | fn printf(_: *const u8, ...); //~ ERROR: variadic function must have C or cdecl calling - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variadics require C or cdecl calling convention - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0045`. diff --git a/src/test/ui/variance/variance-associated-types.stderr b/src/test/ui/variance/variance-associated-types.stderr index 75ebc8668981..c0231aead4a4 100644 --- a/src/test/ui/variance/variance-associated-types.stderr +++ b/src/test/ui/variance/variance-associated-types.stderr @@ -1,7 +1,7 @@ error[E0208]: [-, +] --> $DIR/variance-associated-types.rs:13:1 | -LL | / struct Foo<'a, T : Trait<'a>> { //~ ERROR [-, +] +LL | / struct Foo<'a, T : Trait<'a>> { LL | | field: (T, &'a ()) LL | | } | |_^ @@ -9,7 +9,7 @@ LL | | } error[E0208]: [o, o] --> $DIR/variance-associated-types.rs:18:1 | -LL | / struct Bar<'a, T : Trait<'a>> { //~ ERROR [o, o] +LL | / struct Bar<'a, T : Trait<'a>> { LL | | field: >::Type LL | | } | |_^ diff --git a/src/test/ui/variance/variance-btree-invariant-types.stderr b/src/test/ui/variance/variance-btree-invariant-types.stderr index 0d8b4dddc68c..49222fc7fa62 100644 --- a/src/test/ui/variance/variance-btree-invariant-types.stderr +++ b/src/test/ui/variance/variance-btree-invariant-types.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-btree-invariant-types.rs:4:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::IterMut<'_, &'new (), _>` @@ -16,7 +16,7 @@ LL | fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, & error[E0308]: mismatched types --> $DIR/variance-btree-invariant-types.rs:7:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::IterMut<'_, _, &'new ()>` @@ -31,7 +31,7 @@ LL | fn iter_cov_val<'a, 'new>(v: IterMut<'a, (), &'static ()>) -> IterMut<'a, ( error[E0308]: mismatched types --> $DIR/variance-btree-invariant-types.rs:10:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::IterMut<'_, &'static (), _>` @@ -46,7 +46,7 @@ LL | fn iter_contra_key<'a, 'new>(v: IterMut<'a, &'new (), ()>) -> IterMut<'a, & error[E0308]: mismatched types --> $DIR/variance-btree-invariant-types.rs:13:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::IterMut<'_, _, &'static ()>` @@ -61,7 +61,7 @@ LL | fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, ( error[E0308]: mismatched types --> $DIR/variance-btree-invariant-types.rs:18:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::OccupiedEntry<'_, &'new (), _>` @@ -76,7 +76,7 @@ LL | fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>) error[E0308]: mismatched types --> $DIR/variance-btree-invariant-types.rs:22:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::OccupiedEntry<'_, _, &'new ()>` @@ -91,7 +91,7 @@ LL | fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>) error[E0308]: mismatched types --> $DIR/variance-btree-invariant-types.rs:26:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::OccupiedEntry<'_, &'static (), _>` @@ -106,7 +106,7 @@ LL | fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>) error[E0308]: mismatched types --> $DIR/variance-btree-invariant-types.rs:30:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::OccupiedEntry<'_, _, &'static ()>` @@ -121,7 +121,7 @@ LL | fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>) error[E0308]: mismatched types --> $DIR/variance-btree-invariant-types.rs:35:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::VacantEntry<'_, &'new (), _>` @@ -136,7 +136,7 @@ LL | fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>) error[E0308]: mismatched types --> $DIR/variance-btree-invariant-types.rs:39:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::VacantEntry<'_, _, &'new ()>` @@ -151,7 +151,7 @@ LL | fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>) error[E0308]: mismatched types --> $DIR/variance-btree-invariant-types.rs:43:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::VacantEntry<'_, &'static (), _>` @@ -166,7 +166,7 @@ LL | fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>) error[E0308]: mismatched types --> $DIR/variance-btree-invariant-types.rs:47:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `std::collections::btree_map::VacantEntry<'_, _, &'static ()>` diff --git a/src/test/ui/variance/variance-cell-is-invariant.stderr b/src/test/ui/variance/variance-cell-is-invariant.stderr index ba76c2efec48..6fcd6460fe30 100644 --- a/src/test/ui/variance/variance-cell-is-invariant.stderr +++ b/src/test/ui/variance/variance-cell-is-invariant.stderr @@ -7,7 +7,7 @@ LL | s: &'short isize, LL | l: &'long isize, | ------------ LL | _where:Option<&'short &'long ()>) { -LL | let _: Foo<'long> = c; //~ ERROR E0623 +LL | let _: Foo<'long> = c; | ^ ...but data from `c` flows into `l` here error: aborting due to previous error diff --git a/src/test/ui/variance/variance-contravariant-arg-object.stderr b/src/test/ui/variance/variance-contravariant-arg-object.stderr index 79681c776736..beac05e04a8e 100644 --- a/src/test/ui/variance/variance-contravariant-arg-object.stderr +++ b/src/test/ui/variance/variance-contravariant-arg-object.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-contravariant-arg-object.rs:14:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `dyn Get<&'min i32>` @@ -20,7 +20,7 @@ LL | fn get_min_from_max<'min, 'max>(v: Box>) error[E0308]: mismatched types --> $DIR/variance-contravariant-arg-object.rs:22:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `dyn Get<&'max i32>` diff --git a/src/test/ui/variance/variance-contravariant-arg-trait-match.stderr b/src/test/ui/variance/variance-contravariant-arg-trait-match.stderr index 4c97a5892f14..ffe690dd2207 100644 --- a/src/test/ui/variance/variance-contravariant-arg-trait-match.stderr +++ b/src/test/ui/variance/variance-contravariant-arg-trait-match.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-contravariant-arg-trait-match.rs:13:5 | -LL | impls_get::() //~ ERROR mismatched types +LL | impls_get::() | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get<&'min i32>` @@ -20,7 +20,7 @@ LL | fn get_min_from_max<'min, 'max, G>() error[E0308]: mismatched types --> $DIR/variance-contravariant-arg-trait-match.rs:21:5 | -LL | impls_get::() //~ ERROR mismatched types +LL | impls_get::() | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get<&'max i32>` diff --git a/src/test/ui/variance/variance-contravariant-self-trait-match.stderr b/src/test/ui/variance/variance-contravariant-self-trait-match.stderr index 30a7b02de76f..6f445d79bf5d 100644 --- a/src/test/ui/variance/variance-contravariant-self-trait-match.stderr +++ b/src/test/ui/variance/variance-contravariant-self-trait-match.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-contravariant-self-trait-match.rs:13:5 | -LL | impls_get::<&'min G>(); //~ ERROR mismatched types +LL | impls_get::<&'min G>(); | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get` @@ -20,7 +20,7 @@ LL | fn get_min_from_max<'min, 'max, G>() error[E0308]: mismatched types --> $DIR/variance-contravariant-self-trait-match.rs:22:5 | -LL | impls_get::<&'max G>(); //~ ERROR mismatched types +LL | impls_get::<&'max G>(); | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get` diff --git a/src/test/ui/variance/variance-covariant-arg-object.stderr b/src/test/ui/variance/variance-covariant-arg-object.stderr index afdcccd21192..cdcc7a6fd55a 100644 --- a/src/test/ui/variance/variance-covariant-arg-object.stderr +++ b/src/test/ui/variance/variance-covariant-arg-object.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-covariant-arg-object.rs:15:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `dyn Get<&'min i32>` @@ -20,7 +20,7 @@ LL | fn get_min_from_max<'min, 'max>(v: Box>) error[E0308]: mismatched types --> $DIR/variance-covariant-arg-object.rs:22:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `dyn Get<&'max i32>` diff --git a/src/test/ui/variance/variance-covariant-arg-trait-match.stderr b/src/test/ui/variance/variance-covariant-arg-trait-match.stderr index 3c1f43943a00..c0209edc9155 100644 --- a/src/test/ui/variance/variance-covariant-arg-trait-match.stderr +++ b/src/test/ui/variance/variance-covariant-arg-trait-match.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-covariant-arg-trait-match.rs:14:5 | -LL | impls_get::() //~ ERROR mismatched types +LL | impls_get::() | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get<&'min i32>` @@ -20,7 +20,7 @@ LL | fn get_min_from_max<'min, 'max, G>() error[E0308]: mismatched types --> $DIR/variance-covariant-arg-trait-match.rs:20:5 | -LL | impls_get::() //~ ERROR mismatched types +LL | impls_get::() | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get<&'max i32>` diff --git a/src/test/ui/variance/variance-covariant-self-trait-match.stderr b/src/test/ui/variance/variance-covariant-self-trait-match.stderr index c3a15662f729..fe5fe105c6b3 100644 --- a/src/test/ui/variance/variance-covariant-self-trait-match.stderr +++ b/src/test/ui/variance/variance-covariant-self-trait-match.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-covariant-self-trait-match.rs:14:5 | -LL | impls_get::<&'min G>(); //~ ERROR mismatched types +LL | impls_get::<&'min G>(); | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get` @@ -20,7 +20,7 @@ LL | fn get_min_from_max<'min, 'max, G>() error[E0308]: mismatched types --> $DIR/variance-covariant-self-trait-match.rs:20:5 | -LL | impls_get::<&'max G>(); //~ ERROR mismatched types +LL | impls_get::<&'max G>(); | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get` diff --git a/src/test/ui/variance/variance-invariant-arg-object.stderr b/src/test/ui/variance/variance-invariant-arg-object.stderr index b0dddd6ed497..e2ee35de1a27 100644 --- a/src/test/ui/variance/variance-invariant-arg-object.stderr +++ b/src/test/ui/variance/variance-invariant-arg-object.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-invariant-arg-object.rs:11:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `dyn Get<&'min i32>` @@ -20,7 +20,7 @@ LL | fn get_min_from_max<'min, 'max>(v: Box>) error[E0308]: mismatched types --> $DIR/variance-invariant-arg-object.rs:18:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `dyn Get<&'max i32>` diff --git a/src/test/ui/variance/variance-invariant-arg-trait-match.stderr b/src/test/ui/variance/variance-invariant-arg-trait-match.stderr index 32aac2e3a2b8..c8a1111e6237 100644 --- a/src/test/ui/variance/variance-invariant-arg-trait-match.stderr +++ b/src/test/ui/variance/variance-invariant-arg-trait-match.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-invariant-arg-trait-match.rs:10:5 | -LL | impls_get::() //~ ERROR mismatched types +LL | impls_get::() | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get<&'min i32>` @@ -20,7 +20,7 @@ LL | fn get_min_from_max<'min, 'max, G>() error[E0308]: mismatched types --> $DIR/variance-invariant-arg-trait-match.rs:16:5 | -LL | impls_get::() //~ ERROR mismatched types +LL | impls_get::() | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get<&'max i32>` diff --git a/src/test/ui/variance/variance-invariant-self-trait-match.stderr b/src/test/ui/variance/variance-invariant-self-trait-match.stderr index ba96fbdaa14d..cb03d95f7710 100644 --- a/src/test/ui/variance/variance-invariant-self-trait-match.stderr +++ b/src/test/ui/variance/variance-invariant-self-trait-match.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-invariant-self-trait-match.rs:10:5 | -LL | impls_get::<&'min G>(); //~ ERROR mismatched types +LL | impls_get::<&'min G>(); | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get` @@ -20,7 +20,7 @@ LL | fn get_min_from_max<'min, 'max, G>() error[E0308]: mismatched types --> $DIR/variance-invariant-self-trait-match.rs:16:5 | -LL | impls_get::<&'max G>(); //~ ERROR mismatched types +LL | impls_get::<&'max G>(); | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected type `Get` diff --git a/src/test/ui/variance/variance-issue-20533.nll.stderr b/src/test/ui/variance/variance-issue-20533.nll.stderr index 469adaf6f0ee..008e2a002bbb 100644 --- a/src/test/ui/variance/variance-issue-20533.nll.stderr +++ b/src/test/ui/variance/variance-issue-20533.nll.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `a` because it is borrowed | LL | let x = foo(&a); | -- borrow of `a` occurs here -LL | drop(a); //~ ERROR cannot move out of `a` +LL | drop(a); | ^ move out of `a` occurs here LL | drop(x); | - borrow later used here @@ -13,7 +13,7 @@ error[E0505]: cannot move out of `a` because it is borrowed | LL | let x = bar(&a); | -- borrow of `a` occurs here -LL | drop(a); //~ ERROR cannot move out of `a` +LL | drop(a); | ^ move out of `a` occurs here LL | drop(x); | - borrow later used here @@ -23,7 +23,7 @@ error[E0505]: cannot move out of `a` because it is borrowed | LL | let x = baz(&a); | -- borrow of `a` occurs here -LL | drop(a); //~ ERROR cannot move out of `a` +LL | drop(a); | ^ move out of `a` occurs here LL | drop(x); | - borrow later used here diff --git a/src/test/ui/variance/variance-issue-20533.stderr b/src/test/ui/variance/variance-issue-20533.stderr index 27aca3401f92..bcf99bcb9629 100644 --- a/src/test/ui/variance/variance-issue-20533.stderr +++ b/src/test/ui/variance/variance-issue-20533.stderr @@ -3,7 +3,7 @@ error[E0505]: cannot move out of `a` because it is borrowed | LL | let x = foo(&a); | - borrow of `a` occurs here -LL | drop(a); //~ ERROR cannot move out of `a` +LL | drop(a); | ^ move out of `a` occurs here error[E0505]: cannot move out of `a` because it is borrowed @@ -11,7 +11,7 @@ error[E0505]: cannot move out of `a` because it is borrowed | LL | let x = bar(&a); | - borrow of `a` occurs here -LL | drop(a); //~ ERROR cannot move out of `a` +LL | drop(a); | ^ move out of `a` occurs here error[E0505]: cannot move out of `a` because it is borrowed @@ -19,7 +19,7 @@ error[E0505]: cannot move out of `a` because it is borrowed | LL | let x = baz(&a); | - borrow of `a` occurs here -LL | drop(a); //~ ERROR cannot move out of `a` +LL | drop(a); | ^ move out of `a` occurs here error: aborting due to 3 previous errors diff --git a/src/test/ui/variance/variance-object-types.stderr b/src/test/ui/variance/variance-object-types.stderr index 3ba86c2620e0..385d8dc5c773 100644 --- a/src/test/ui/variance/variance-object-types.stderr +++ b/src/test/ui/variance/variance-object-types.stderr @@ -1,7 +1,7 @@ error[E0208]: [o] --> $DIR/variance-object-types.rs:11:1 | -LL | / struct Foo<'a> { //~ ERROR [o] +LL | / struct Foo<'a> { LL | | x: Box &'a i32 + 'static> LL | | } | |_^ diff --git a/src/test/ui/variance/variance-regions-direct.stderr b/src/test/ui/variance/variance-regions-direct.stderr index 82dc8df37268..bbc34799449a 100644 --- a/src/test/ui/variance/variance-regions-direct.stderr +++ b/src/test/ui/variance/variance-regions-direct.stderr @@ -1,7 +1,7 @@ error[E0208]: [-, -, -] --> $DIR/variance-regions-direct.rs:9:1 | -LL | / struct Test2<'a, 'b, 'c> { //~ ERROR [-, -, -] +LL | / struct Test2<'a, 'b, 'c> { LL | | x: &'a isize, LL | | y: &'b [isize], LL | | c: &'c str @@ -11,7 +11,7 @@ LL | | } error[E0208]: [+, +, +] --> $DIR/variance-regions-direct.rs:18:1 | -LL | / struct Test3<'a, 'b, 'c> { //~ ERROR [+, +, +] +LL | / struct Test3<'a, 'b, 'c> { LL | | x: extern "Rust" fn(&'a isize), LL | | y: extern "Rust" fn(&'b [isize]), LL | | c: extern "Rust" fn(&'c str), @@ -21,7 +21,7 @@ LL | | } error[E0208]: [-, o] --> $DIR/variance-regions-direct.rs:27:1 | -LL | / struct Test4<'a, 'b:'a> { //~ ERROR [-, o] +LL | / struct Test4<'a, 'b:'a> { LL | | x: &'a mut &'b isize, LL | | } | |_^ @@ -29,7 +29,7 @@ LL | | } error[E0208]: [+, o] --> $DIR/variance-regions-direct.rs:35:1 | -LL | / struct Test5<'a, 'b:'a> { //~ ERROR [+, o] +LL | / struct Test5<'a, 'b:'a> { LL | | x: extern "Rust" fn(&'a mut &'b isize), LL | | } | |_^ @@ -37,7 +37,7 @@ LL | | } error[E0208]: [-, o] --> $DIR/variance-regions-direct.rs:45:1 | -LL | / struct Test6<'a, 'b:'a> { //~ ERROR [-, o] +LL | / struct Test6<'a, 'b:'a> { LL | | x: &'a mut extern "Rust" fn(&'b isize), LL | | } | |_^ @@ -45,7 +45,7 @@ LL | | } error[E0208]: [*] --> $DIR/variance-regions-direct.rs:52:1 | -LL | / struct Test7<'a> { //~ ERROR [*] +LL | / struct Test7<'a> { LL | | x: isize LL | | } | |_^ @@ -53,7 +53,7 @@ LL | | } error[E0208]: [+, -, o] --> $DIR/variance-regions-direct.rs:59:1 | -LL | / enum Test8<'a, 'b, 'c:'b> { //~ ERROR [+, -, o] +LL | / enum Test8<'a, 'b, 'c:'b> { LL | | Test8A(extern "Rust" fn(&'a isize)), LL | | Test8B(&'b [isize]), LL | | Test8C(&'b mut &'c str), diff --git a/src/test/ui/variance/variance-regions-indirect.stderr b/src/test/ui/variance/variance-regions-indirect.stderr index 401fa2f3baa3..ccd4335f5004 100644 --- a/src/test/ui/variance/variance-regions-indirect.stderr +++ b/src/test/ui/variance/variance-regions-indirect.stderr @@ -1,7 +1,7 @@ error[E0208]: [+, -, o, *] --> $DIR/variance-regions-indirect.rs:8:1 | -LL | / enum Base<'a, 'b, 'c:'b, 'd> { //~ ERROR [+, -, o, *] +LL | / enum Base<'a, 'b, 'c:'b, 'd> { LL | | Test8A(extern "Rust" fn(&'a isize)), LL | | Test8B(&'b [isize]), LL | | Test8C(&'b mut &'c str), @@ -11,7 +11,7 @@ LL | | } error[E0208]: [*, o, -, +] --> $DIR/variance-regions-indirect.rs:15:1 | -LL | / struct Derived1<'w, 'x:'y, 'y, 'z> { //~ ERROR [*, o, -, +] +LL | / struct Derived1<'w, 'x:'y, 'y, 'z> { LL | | f: Base<'z, 'y, 'x, 'w> LL | | } | |_^ @@ -19,7 +19,7 @@ LL | | } error[E0208]: [o, o, *] --> $DIR/variance-regions-indirect.rs:20:1 | -LL | / struct Derived2<'a, 'b:'a, 'c> { //~ ERROR [o, o, *] +LL | / struct Derived2<'a, 'b:'a, 'c> { LL | | f: Base<'a, 'a, 'b, 'c> LL | | } | |_^ @@ -27,7 +27,7 @@ LL | | } error[E0208]: [o, -, *] --> $DIR/variance-regions-indirect.rs:25:1 | -LL | / struct Derived3<'a:'b, 'b, 'c> { //~ ERROR [o, -, *] +LL | / struct Derived3<'a:'b, 'b, 'c> { LL | | f: Base<'a, 'b, 'a, 'c> LL | | } | |_^ @@ -35,7 +35,7 @@ LL | | } error[E0208]: [+, -, o] --> $DIR/variance-regions-indirect.rs:30:1 | -LL | / struct Derived4<'a, 'b, 'c:'b> { //~ ERROR [+, -, o] +LL | / struct Derived4<'a, 'b, 'c:'b> { LL | | f: Base<'a, 'b, 'c, 'a> LL | | } | |_^ diff --git a/src/test/ui/variance/variance-regions-unused-direct.stderr b/src/test/ui/variance/variance-regions-unused-direct.stderr index 207cc9147f1c..ab5dce03fa0a 100644 --- a/src/test/ui/variance/variance-regions-unused-direct.stderr +++ b/src/test/ui/variance/variance-regions-unused-direct.stderr @@ -1,7 +1,7 @@ error[E0392]: parameter `'a` is never used --> $DIR/variance-regions-unused-direct.rs:5:18 | -LL | struct Bivariant<'a>; //~ ERROR parameter `'a` is never used +LL | struct Bivariant<'a>; | ^^ unused type parameter | = help: consider removing `'a` or using a marker such as `std::marker::PhantomData` @@ -9,7 +9,7 @@ LL | struct Bivariant<'a>; //~ ERROR parameter `'a` is never used error[E0392]: parameter `'d` is never used --> $DIR/variance-regions-unused-direct.rs:7:19 | -LL | struct Struct<'a, 'd> { //~ ERROR parameter `'d` is never used +LL | struct Struct<'a, 'd> { | ^^ unused type parameter | = help: consider removing `'d` or using a marker such as `std::marker::PhantomData` diff --git a/src/test/ui/variance/variance-regions-unused-indirect.stderr b/src/test/ui/variance/variance-regions-unused-indirect.stderr index 08d1189ea2c9..69631b4a504d 100644 --- a/src/test/ui/variance/variance-regions-unused-indirect.stderr +++ b/src/test/ui/variance/variance-regions-unused-indirect.stderr @@ -1,7 +1,7 @@ error[E0392]: parameter `'a` is never used --> $DIR/variance-regions-unused-indirect.rs:3:10 | -LL | enum Foo<'a> { //~ ERROR parameter `'a` is never used +LL | enum Foo<'a> { | ^^ unused type parameter | = help: consider removing `'a` or using a marker such as `std::marker::PhantomData` @@ -9,7 +9,7 @@ LL | enum Foo<'a> { //~ ERROR parameter `'a` is never used error[E0392]: parameter `'a` is never used --> $DIR/variance-regions-unused-indirect.rs:7:10 | -LL | enum Bar<'a> { //~ ERROR parameter `'a` is never used +LL | enum Bar<'a> { | ^^ unused type parameter | = help: consider removing `'a` or using a marker such as `std::marker::PhantomData` diff --git a/src/test/ui/variance/variance-trait-bounds.stderr b/src/test/ui/variance/variance-trait-bounds.stderr index 1fabadabbcbb..f136bd121d0d 100644 --- a/src/test/ui/variance/variance-trait-bounds.stderr +++ b/src/test/ui/variance/variance-trait-bounds.stderr @@ -1,7 +1,7 @@ error[E0208]: [+, +] --> $DIR/variance-trait-bounds.rs:16:1 | -LL | / struct TestStruct> { //~ ERROR [+, +] +LL | / struct TestStruct> { LL | | t: T, u: U LL | | } | |_^ @@ -9,7 +9,7 @@ LL | | } error[E0208]: [*, +] --> $DIR/variance-trait-bounds.rs:21:1 | -LL | / enum TestEnum> { //~ ERROR [*, +] +LL | / enum TestEnum> { LL | | Foo(T) LL | | } | |_^ @@ -17,7 +17,7 @@ LL | | } error[E0208]: [*, +] --> $DIR/variance-trait-bounds.rs:26:1 | -LL | / struct TestContraStruct> { //~ ERROR [*, +] +LL | / struct TestContraStruct> { LL | | t: T LL | | } | |_^ @@ -25,7 +25,7 @@ LL | | } error[E0208]: [*, +] --> $DIR/variance-trait-bounds.rs:31:1 | -LL | / struct TestBox+Setter> { //~ ERROR [*, +] +LL | / struct TestBox+Setter> { LL | | t: T LL | | } | |_^ diff --git a/src/test/ui/variance/variance-trait-matching.stderr b/src/test/ui/variance/variance-trait-matching.stderr index 2d11515a19c0..514153103bea 100644 --- a/src/test/ui/variance/variance-trait-matching.stderr +++ b/src/test/ui/variance/variance-trait-matching.stderr @@ -4,7 +4,7 @@ error[E0621]: explicit lifetime required in the type of `get` LL | fn get<'a, G>(get: &G) -> i32 | -- help: add explicit lifetime `'a` to the type of `get`: `&'a G` ... -LL | pick(get, &22) //~ ERROR explicit lifetime required in the type of `get` [E0621] +LL | pick(get, &22) | ^^^^ lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/variance/variance-trait-object-bound.stderr b/src/test/ui/variance/variance-trait-object-bound.stderr index c824f5a6db73..4fa4a2e8ab45 100644 --- a/src/test/ui/variance/variance-trait-object-bound.stderr +++ b/src/test/ui/variance/variance-trait-object-bound.stderr @@ -1,7 +1,7 @@ error[E0208]: [-] --> $DIR/variance-trait-object-bound.rs:14:1 | -LL | / struct TOption<'a> { //~ ERROR [-] +LL | / struct TOption<'a> { LL | | v: Option>, LL | | } | |_^ diff --git a/src/test/ui/variance/variance-types-bounds.stderr b/src/test/ui/variance/variance-types-bounds.stderr index 31271952f776..991bfd33a2e2 100644 --- a/src/test/ui/variance/variance-types-bounds.stderr +++ b/src/test/ui/variance/variance-types-bounds.stderr @@ -1,7 +1,7 @@ error[E0208]: [+, +] --> $DIR/variance-types-bounds.rs:7:1 | -LL | / struct TestImm { //~ ERROR [+, +] +LL | / struct TestImm { LL | | x: A, LL | | y: B, LL | | } @@ -10,7 +10,7 @@ LL | | } error[E0208]: [+, o] --> $DIR/variance-types-bounds.rs:13:1 | -LL | / struct TestMut { //~ ERROR [+, o] +LL | / struct TestMut { LL | | x: A, LL | | y: &'static mut B, LL | | } @@ -19,7 +19,7 @@ LL | | } error[E0208]: [+, o] --> $DIR/variance-types-bounds.rs:19:1 | -LL | / struct TestIndirect { //~ ERROR [+, o] +LL | / struct TestIndirect { LL | | m: TestMut LL | | } | |_^ @@ -27,7 +27,7 @@ LL | | } error[E0208]: [o, o] --> $DIR/variance-types-bounds.rs:24:1 | -LL | / struct TestIndirect2 { //~ ERROR [o, o] +LL | / struct TestIndirect2 { LL | | n: TestMut, LL | | m: TestMut LL | | } @@ -36,7 +36,7 @@ LL | | } error[E0208]: [o, o] --> $DIR/variance-types-bounds.rs:38:1 | -LL | / struct TestObject { //~ ERROR [o, o] +LL | / struct TestObject { LL | | n: Box+Send>, LL | | m: Box+Send>, LL | | } diff --git a/src/test/ui/variance/variance-types.stderr b/src/test/ui/variance/variance-types.stderr index 4362f6942026..f68a2666729d 100644 --- a/src/test/ui/variance/variance-types.stderr +++ b/src/test/ui/variance/variance-types.stderr @@ -1,7 +1,7 @@ error[E0208]: [-, o, o] --> $DIR/variance-types.rs:10:1 | -LL | / struct InvariantMut<'a,A:'a,B:'a> { //~ ERROR [-, o, o] +LL | / struct InvariantMut<'a,A:'a,B:'a> { LL | | t: &'a mut (A,B) LL | | } | |_^ @@ -9,7 +9,7 @@ LL | | } error[E0208]: [o] --> $DIR/variance-types.rs:15:1 | -LL | / struct InvariantCell { //~ ERROR [o] +LL | / struct InvariantCell { LL | | t: Cell LL | | } | |_^ @@ -17,7 +17,7 @@ LL | | } error[E0208]: [o] --> $DIR/variance-types.rs:20:1 | -LL | / struct InvariantIndirect { //~ ERROR [o] +LL | / struct InvariantIndirect { LL | | t: InvariantCell LL | | } | |_^ @@ -25,7 +25,7 @@ LL | | } error[E0208]: [+] --> $DIR/variance-types.rs:25:1 | -LL | / struct Covariant { //~ ERROR [+] +LL | / struct Covariant { LL | | t: A, u: fn() -> A LL | | } | |_^ @@ -33,7 +33,7 @@ LL | | } error[E0208]: [-] --> $DIR/variance-types.rs:30:1 | -LL | / struct Contravariant { //~ ERROR [-] +LL | / struct Contravariant { LL | | t: fn(A) LL | | } | |_^ @@ -41,7 +41,7 @@ LL | | } error[E0208]: [+, -, o] --> $DIR/variance-types.rs:35:1 | -LL | / enum Enum { //~ ERROR [+, -, o] +LL | / enum Enum { LL | | Foo(Covariant), LL | | Bar(Contravariant), LL | | Zed(Covariant,Contravariant) diff --git a/src/test/ui/variance/variance-unused-region-param.stderr b/src/test/ui/variance/variance-unused-region-param.stderr index 9cd133bbc937..6c103f168f47 100644 --- a/src/test/ui/variance/variance-unused-region-param.stderr +++ b/src/test/ui/variance/variance-unused-region-param.stderr @@ -1,7 +1,7 @@ error[E0392]: parameter `'a` is never used --> $DIR/variance-unused-region-param.rs:3:19 | -LL | struct SomeStruct<'a> { x: u32 } //~ ERROR parameter `'a` is never used +LL | struct SomeStruct<'a> { x: u32 } | ^^ unused type parameter | = help: consider removing `'a` or using a marker such as `std::marker::PhantomData` @@ -9,7 +9,7 @@ LL | struct SomeStruct<'a> { x: u32 } //~ ERROR parameter `'a` is never used error[E0392]: parameter `'a` is never used --> $DIR/variance-unused-region-param.rs:4:15 | -LL | enum SomeEnum<'a> { Nothing } //~ ERROR parameter `'a` is never used +LL | enum SomeEnum<'a> { Nothing } | ^^ unused type parameter | = help: consider removing `'a` or using a marker such as `std::marker::PhantomData` diff --git a/src/test/ui/variance/variance-use-contravariant-struct-1.stderr b/src/test/ui/variance/variance-use-contravariant-struct-1.stderr index 89a49a00b34e..7c433378df5c 100644 --- a/src/test/ui/variance/variance-use-contravariant-struct-1.stderr +++ b/src/test/ui/variance/variance-use-contravariant-struct-1.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-use-contravariant-struct-1.rs:12:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `SomeStruct<&'min ()>` diff --git a/src/test/ui/variance/variance-use-covariant-struct-1.stderr b/src/test/ui/variance/variance-use-covariant-struct-1.stderr index a6f298c9bfbe..6ae7d12c4633 100644 --- a/src/test/ui/variance/variance-use-covariant-struct-1.stderr +++ b/src/test/ui/variance/variance-use-covariant-struct-1.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-use-covariant-struct-1.rs:10:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `SomeStruct<&'max ()>` diff --git a/src/test/ui/variance/variance-use-invariant-struct-1.stderr b/src/test/ui/variance/variance-use-invariant-struct-1.stderr index 2bd39d5a831f..793954e3a1f0 100644 --- a/src/test/ui/variance/variance-use-invariant-struct-1.stderr +++ b/src/test/ui/variance/variance-use-invariant-struct-1.stderr @@ -1,7 +1,7 @@ error[E0308]: mismatched types --> $DIR/variance-use-invariant-struct-1.rs:12:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `SomeStruct<&'min ()>` @@ -20,7 +20,7 @@ LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>) error[E0308]: mismatched types --> $DIR/variance-use-invariant-struct-1.rs:19:5 | -LL | v //~ ERROR mismatched types +LL | v | ^ lifetime mismatch | = note: expected type `SomeStruct<&'max ()>` diff --git a/src/test/ui/variants/variant-size-differences.stderr b/src/test/ui/variants/variant-size-differences.stderr index 5cd168df5382..c82c253f610d 100644 --- a/src/test/ui/variants/variant-size-differences.stderr +++ b/src/test/ui/variants/variant-size-differences.stderr @@ -1,7 +1,7 @@ error: enum variant is more than three times larger (1024 bytes) than the next largest --> $DIR/variant-size-differences.rs:5:5 | -LL | VBig([u8; 1024]), //~ ERROR variant is more than three times larger +LL | VBig([u8; 1024]), | ^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui/vec/vec-macro-with-comma-only.stderr b/src/test/ui/vec/vec-macro-with-comma-only.stderr index 92e704c3fb4b..abbee347c00b 100644 --- a/src/test/ui/vec/vec-macro-with-comma-only.stderr +++ b/src/test/ui/vec/vec-macro-with-comma-only.stderr @@ -1,7 +1,7 @@ error: no rules expected the token `,` --> $DIR/vec-macro-with-comma-only.rs:2:10 | -LL | vec![,]; //~ ERROR no rules expected the token `,` +LL | vec![,]; | ^ no rules expected this token in macro call error: aborting due to previous error diff --git a/src/test/ui/vec/vec-mut-iter-borrow.nll.stderr b/src/test/ui/vec/vec-mut-iter-borrow.nll.stderr index c77be26f0193..679fd8997733 100644 --- a/src/test/ui/vec/vec-mut-iter-borrow.nll.stderr +++ b/src/test/ui/vec/vec-mut-iter-borrow.nll.stderr @@ -6,7 +6,7 @@ LL | for x in &mut xs { | | | first mutable borrow occurs here | first borrow later used here -LL | xs.push(1) //~ ERROR cannot borrow `xs` +LL | xs.push(1) | ^^ second mutable borrow occurs here error: aborting due to previous error diff --git a/src/test/ui/vec/vec-mut-iter-borrow.stderr b/src/test/ui/vec/vec-mut-iter-borrow.stderr index 9b4b56737915..ec16d2bebd6b 100644 --- a/src/test/ui/vec/vec-mut-iter-borrow.stderr +++ b/src/test/ui/vec/vec-mut-iter-borrow.stderr @@ -6,7 +6,7 @@ LL | for x in &mut xs { | || | |first borrow ends here | first mutable borrow occurs here -LL | xs.push(1) //~ ERROR cannot borrow `xs` +LL | xs.push(1) | ^^ second mutable borrow occurs here error: aborting due to previous error diff --git a/src/test/ui/vector-cast-weirdness.stderr b/src/test/ui/vector-cast-weirdness.stderr index 330b87801ebb..37055bb75f55 100644 --- a/src/test/ui/vector-cast-weirdness.stderr +++ b/src/test/ui/vector-cast-weirdness.stderr @@ -1,7 +1,7 @@ error[E0606]: casting `&mut [u8; 2]` as `*mut u8` is invalid --> $DIR/vector-cast-weirdness.rs:21:23 | -LL | let p1: *mut u8 = &mut x1.y as *mut _; //~ ERROR casting +LL | let p1: *mut u8 = &mut x1.y as *mut _; | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/vtable-res-trait-param.stderr b/src/test/ui/vtable-res-trait-param.stderr index 6dac9fe335f6..58a88979b2fa 100644 --- a/src/test/ui/vtable-res-trait-param.stderr +++ b/src/test/ui/vtable-res-trait-param.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `{integer}: TraitA` is not satisfied --> $DIR/vtable-res-trait-param.rs:17:7 | -LL | b.gimme_an_a(y) //~ ERROR `{integer}: TraitA` is not satisfied +LL | b.gimme_an_a(y) | ^^^^^^^^^^ the trait `TraitA` is not implemented for `{integer}` error: aborting due to previous error diff --git a/src/test/ui/walk-struct-literal-with.nll.stderr b/src/test/ui/walk-struct-literal-with.nll.stderr index 2263747607b9..eeb594a21f38 100644 --- a/src/test/ui/walk-struct-literal-with.nll.stderr +++ b/src/test/ui/walk-struct-literal-with.nll.stderr @@ -5,7 +5,7 @@ LL | let start = Mine{test:"Foo".to_string(), other_val:0}; | ----- move occurs because `start` has type `Mine`, which does not implement the `Copy` trait LL | let end = Mine{other_val:1, ..start.make_string_bar()}; | ----- value moved here -LL | println!("{}", start.test); //~ ERROR use of moved value: `start.test` +LL | println!("{}", start.test); | ^^^^^^^^^^ value borrowed here after move error: aborting due to previous error diff --git a/src/test/ui/walk-struct-literal-with.stderr b/src/test/ui/walk-struct-literal-with.stderr index 9362301b4081..d5351eb0ce5a 100644 --- a/src/test/ui/walk-struct-literal-with.stderr +++ b/src/test/ui/walk-struct-literal-with.stderr @@ -3,7 +3,7 @@ error[E0382]: use of moved value: `start.test` | LL | let end = Mine{other_val:1, ..start.make_string_bar()}; | ----- value moved here -LL | println!("{}", start.test); //~ ERROR use of moved value: `start.test` +LL | println!("{}", start.test); | ^^^^^^^^^^ value used here after move | = note: move occurs because `start` has type `Mine`, which does not implement the `Copy` trait diff --git a/src/test/ui/warn-path-statement.stderr b/src/test/ui/warn-path-statement.stderr index 55d33058c17f..30afb99e5f02 100644 --- a/src/test/ui/warn-path-statement.stderr +++ b/src/test/ui/warn-path-statement.stderr @@ -1,7 +1,7 @@ error: path statement with no effect --> $DIR/warn-path-statement.rs:5:5 | -LL | x; //~ ERROR path statement with no effect +LL | x; | ^^ | = note: requested on the command line with `-D path-statements` diff --git a/src/test/ui/wasm-custom-section-relocations.stderr b/src/test/ui/wasm-custom-section-relocations.stderr index 272dd8d524d6..eb8ab2644a33 100644 --- a/src/test/ui/wasm-custom-section-relocations.stderr +++ b/src/test/ui/wasm-custom-section-relocations.stderr @@ -1,13 +1,13 @@ error: statics with a custom `#[link_section]` must be a simple list of bytes on the wasm target with no extra levels of indirection such as references --> $DIR/wasm-custom-section-relocations.rs:4:1 | -LL | pub static A: &[u8] = &[1]; //~ ERROR: no extra levels of indirection +LL | pub static A: &[u8] = &[1]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: statics with a custom `#[link_section]` must be a simple list of bytes on the wasm target with no extra levels of indirection such as references --> $DIR/wasm-custom-section-relocations.rs:13:1 | -LL | pub static D: &usize = &C; //~ ERROR: no extra levels of indirection +LL | pub static D: &usize = &C; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/wasm-import-module.stderr b/src/test/ui/wasm-import-module.stderr index a3955bb676e9..20eec4c9f59b 100644 --- a/src/test/ui/wasm-import-module.stderr +++ b/src/test/ui/wasm-import-module.stderr @@ -1,19 +1,19 @@ error: must be of the form #[link(wasm_import_module = "...")] --> $DIR/wasm-import-module.rs:1:22 | -LL | #[link(name = "...", wasm_import_module)] //~ ERROR: must be of the form +LL | #[link(name = "...", wasm_import_module)] | ^^^^^^^^^^^^^^^^^^ error: must be of the form #[link(wasm_import_module = "...")] --> $DIR/wasm-import-module.rs:4:22 | -LL | #[link(name = "...", wasm_import_module(x))] //~ ERROR: must be of the form +LL | #[link(name = "...", wasm_import_module(x))] | ^^^^^^^^^^^^^^^^^^^^^ error: must be of the form #[link(wasm_import_module = "...")] --> $DIR/wasm-import-module.rs:7:22 | -LL | #[link(name = "...", wasm_import_module())] //~ ERROR: must be of the form +LL | #[link(name = "...", wasm_import_module())] | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/wf/wf-array-elem-sized.stderr b/src/test/ui/wf/wf-array-elem-sized.stderr index 69df9ea7857d..b222d07580ea 100644 --- a/src/test/ui/wf/wf-array-elem-sized.stderr +++ b/src/test/ui/wf/wf-array-elem-sized.stderr @@ -1,7 +1,7 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation time --> $DIR/wf-array-elem-sized.rs:7:5 | -LL | foo: [[u8]], //~ ERROR E0277 +LL | foo: [[u8]], | ^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `[u8]` diff --git a/src/test/ui/wf/wf-enum-bound.stderr b/src/test/ui/wf/wf-enum-bound.stderr index 487592dcaca6..de28a882f13c 100644 --- a/src/test/ui/wf/wf-enum-bound.stderr +++ b/src/test/ui/wf/wf-enum-bound.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied --> $DIR/wf-enum-bound.rs:9:1 | -LL | / enum SomeEnum //~ ERROR E0277 +LL | / enum SomeEnum LL | | where T: ExtraCopy LL | | { LL | | SomeVariant(T,U) diff --git a/src/test/ui/wf/wf-enum-fields-struct-variant.stderr b/src/test/ui/wf/wf-enum-fields-struct-variant.stderr index f4b8ec0c6687..6c1267cf7e1b 100644 --- a/src/test/ui/wf/wf-enum-fields-struct-variant.stderr +++ b/src/test/ui/wf/wf-enum-fields-struct-variant.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `A: std::marker::Copy` is not satisfied --> $DIR/wf-enum-fields-struct-variant.rs:13:9 | -LL | f: IsCopy //~ ERROR E0277 +LL | f: IsCopy | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A` | = help: consider adding a `where A: std::marker::Copy` bound diff --git a/src/test/ui/wf/wf-enum-fields.stderr b/src/test/ui/wf/wf-enum-fields.stderr index 600dd3dc03de..9c4eec6c5fbf 100644 --- a/src/test/ui/wf/wf-enum-fields.stderr +++ b/src/test/ui/wf/wf-enum-fields.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `A: std::marker::Copy` is not satisfied --> $DIR/wf-enum-fields.rs:12:17 | -LL | SomeVariant(IsCopy) //~ ERROR E0277 +LL | SomeVariant(IsCopy) | ^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A` | = help: consider adding a `where A: std::marker::Copy` bound diff --git a/src/test/ui/wf/wf-fn-where-clause.stderr b/src/test/ui/wf/wf-fn-where-clause.stderr index 594ce7d2f49c..f1648aa12acd 100644 --- a/src/test/ui/wf/wf-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-fn-where-clause.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied --> $DIR/wf-fn-where-clause.rs:8:1 | -LL | / fn foo() where T: ExtraCopy //~ ERROR E0277 +LL | / fn foo() where T: ExtraCopy LL | | { LL | | } | |_^ the trait `std::marker::Copy` is not implemented for `U` diff --git a/src/test/ui/wf/wf-impl-associated-type-region.stderr b/src/test/ui/wf/wf-impl-associated-type-region.stderr index de7e8fa9a28a..9cc36025305f 100644 --- a/src/test/ui/wf/wf-impl-associated-type-region.stderr +++ b/src/test/ui/wf/wf-impl-associated-type-region.stderr @@ -3,13 +3,13 @@ error[E0309]: the parameter type `T` may not live long enough | LL | impl<'a, T> Foo<'a> for T { | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | type Bar = &'a T; //~ ERROR E0309 +LL | type Bar = &'a T; | ^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'a T` does not outlive the data it points at --> $DIR/wf-impl-associated-type-region.rs:10:5 | -LL | type Bar = &'a T; //~ ERROR E0309 +LL | type Bar = &'a T; | ^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-in-fn-arg.stderr b/src/test/ui/wf/wf-in-fn-arg.stderr index 987984060e69..8635dad85166 100644 --- a/src/test/ui/wf/wf-in-fn-arg.stderr +++ b/src/test/ui/wf/wf-in-fn-arg.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/wf-in-fn-arg.rs:10:1 | -LL | / fn bar(_: &MustBeCopy) //~ ERROR E0277 +LL | / fn bar(_: &MustBeCopy) LL | | { LL | | } | |_^ the trait `std::marker::Copy` is not implemented for `T` diff --git a/src/test/ui/wf/wf-in-fn-ret.stderr b/src/test/ui/wf/wf-in-fn-ret.stderr index 81aae855b843..3879f7b0a4bf 100644 --- a/src/test/ui/wf/wf-in-fn-ret.stderr +++ b/src/test/ui/wf/wf-in-fn-ret.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/wf-in-fn-ret.rs:10:1 | -LL | / fn bar() -> MustBeCopy //~ ERROR E0277 +LL | / fn bar() -> MustBeCopy LL | | { LL | | } | |_^ the trait `std::marker::Copy` is not implemented for `T` diff --git a/src/test/ui/wf/wf-in-fn-type-arg.stderr b/src/test/ui/wf/wf-in-fn-type-arg.stderr index e60529dba1ed..40cb4a7050cc 100644 --- a/src/test/ui/wf/wf-in-fn-type-arg.stderr +++ b/src/test/ui/wf/wf-in-fn-type-arg.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/wf-in-fn-type-arg.rs:9:5 | -LL | x: fn(MustBeCopy) //~ ERROR E0277 +LL | x: fn(MustBeCopy) | ^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound diff --git a/src/test/ui/wf/wf-in-fn-type-ret.stderr b/src/test/ui/wf/wf-in-fn-type-ret.stderr index 9f18a00926d7..059f164e25c2 100644 --- a/src/test/ui/wf/wf-in-fn-type-ret.stderr +++ b/src/test/ui/wf/wf-in-fn-type-ret.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/wf-in-fn-type-ret.rs:9:5 | -LL | x: fn() -> MustBeCopy //~ ERROR E0277 +LL | x: fn() -> MustBeCopy | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound diff --git a/src/test/ui/wf/wf-in-fn-type-static.stderr b/src/test/ui/wf/wf-in-fn-type-static.stderr index 1fabfb04adde..8952c78aacd7 100644 --- a/src/test/ui/wf/wf-in-fn-type-static.stderr +++ b/src/test/ui/wf/wf-in-fn-type-static.stderr @@ -4,13 +4,13 @@ error[E0310]: the parameter type `T` may not live long enough LL | struct Foo { | - help: consider adding an explicit lifetime bound `T: 'static`... LL | // needs T: 'static -LL | x: fn() -> &'static T //~ ERROR E0310 +LL | x: fn() -> &'static T | ^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'static T` does not outlive the data it points at --> $DIR/wf-in-fn-type-static.rs:13:5 | -LL | x: fn() -> &'static T //~ ERROR E0310 +LL | x: fn() -> &'static T | ^^^^^^^^^^^^^^^^^^^^^ error[E0310]: the parameter type `T` may not live long enough @@ -19,13 +19,13 @@ error[E0310]: the parameter type `T` may not live long enough LL | struct Bar { | - help: consider adding an explicit lifetime bound `T: 'static`... LL | // needs T: Copy -LL | x: fn(&'static T) //~ ERROR E0310 +LL | x: fn(&'static T) | ^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'static T` does not outlive the data it points at --> $DIR/wf-in-fn-type-static.rs:18:5 | -LL | x: fn(&'static T) //~ ERROR E0310 +LL | x: fn(&'static T) | ^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/wf/wf-in-fn-where-clause.stderr b/src/test/ui/wf/wf-in-fn-where-clause.stderr index 8d6700e35714..1e732a3341c0 100644 --- a/src/test/ui/wf/wf-in-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-in-fn-where-clause.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied --> $DIR/wf-in-fn-where-clause.rs:9:1 | -LL | / fn bar() //~ ERROR E0277 +LL | / fn bar() LL | | where T: MustBeCopy LL | | { LL | | } diff --git a/src/test/ui/wf/wf-in-obj-type-static.stderr b/src/test/ui/wf/wf-in-obj-type-static.stderr index 9e0628e3ec61..cc06b9243f70 100644 --- a/src/test/ui/wf/wf-in-obj-type-static.stderr +++ b/src/test/ui/wf/wf-in-obj-type-static.stderr @@ -4,13 +4,13 @@ error[E0310]: the parameter type `T` may not live long enough LL | struct Foo { | - help: consider adding an explicit lifetime bound `T: 'static`... LL | // needs T: 'static -LL | x: Object<&'static T> //~ ERROR E0310 +LL | x: Object<&'static T> | ^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'static T` does not outlive the data it points at --> $DIR/wf-in-obj-type-static.rs:14:5 | -LL | x: Object<&'static T> //~ ERROR E0310 +LL | x: Object<&'static T> | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/wf/wf-in-obj-type-trait.stderr b/src/test/ui/wf/wf-in-obj-type-trait.stderr index a4a14817d3f7..94b3de78898a 100644 --- a/src/test/ui/wf/wf-in-obj-type-trait.stderr +++ b/src/test/ui/wf/wf-in-obj-type-trait.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/wf-in-obj-type-trait.rs:11:5 | -LL | x: Object> //~ ERROR E0277 +LL | x: Object> | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` | = help: consider adding a `where T: std::marker::Copy` bound diff --git a/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr b/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr index ba9d3d7877dd..b79093f7d023 100644 --- a/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr +++ b/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied --> $DIR/wf-inherent-impl-method-where-clause.rs:12:5 | -LL | / fn foo(self) where T: ExtraCopy //~ ERROR E0277 +LL | / fn foo(self) where T: ExtraCopy LL | | {} | |______^ the trait `std::marker::Copy` is not implemented for `U` | diff --git a/src/test/ui/wf/wf-inherent-impl-where-clause.stderr b/src/test/ui/wf/wf-inherent-impl-where-clause.stderr index 2ed9cc56f94a..f10ff841acbf 100644 --- a/src/test/ui/wf/wf-inherent-impl-where-clause.stderr +++ b/src/test/ui/wf/wf-inherent-impl-where-clause.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied --> $DIR/wf-inherent-impl-where-clause.rs:11:1 | -LL | / impl Foo where T: ExtraCopy //~ ERROR E0277 +LL | / impl Foo where T: ExtraCopy LL | | { LL | | } | |_^ the trait `std::marker::Copy` is not implemented for `U` diff --git a/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr b/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr index 21ac2031d040..fc58984345a9 100644 --- a/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr +++ b/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr @@ -1,7 +1,7 @@ error[E0515]: cannot return value referencing temporary value --> $DIR/wf-misc-methods-issue-28609.rs:22:5 | -LL | s.transmute_inherent(&mut 42) //~ ERROR does not live long enough +LL | s.transmute_inherent(&mut 42) | ^^^^^^^^^^^^^^^^^^^^^^^^^^--^ | | | | | temporary value created here @@ -10,7 +10,7 @@ LL | s.transmute_inherent(&mut 42) //~ ERROR does not live long enough error[E0515]: cannot return value referencing local variable `four` --> $DIR/wf-misc-methods-issue-28609.rs:36:5 | -LL | s.bomb = Some(&four); //~ ERROR does not live long enough +LL | s.bomb = Some(&four); | ----- `four` is borrowed here LL | &s | ^^ returns a value referencing data owned by the current function @@ -18,7 +18,7 @@ LL | &s error[E0515]: cannot return value referencing local variable `four` --> $DIR/wf-misc-methods-issue-28609.rs:43:5 | -LL | s.bomb = Some(&four); //~ ERROR does not live long enough +LL | s.bomb = Some(&four); | ----- `four` is borrowed here LL | &*s | ^^^ returns a value referencing data owned by the current function @@ -26,7 +26,7 @@ LL | &*s error[E0515]: cannot return value referencing temporary value --> $DIR/wf-misc-methods-issue-28609.rs:53:5 | -LL | s << &mut 3 //~ ERROR does not live long enough +LL | s << &mut 3 | ^^^^^^^^^^- | | | | | temporary value created here @@ -35,7 +35,7 @@ LL | s << &mut 3 //~ ERROR does not live long enough error[E0515]: cannot return value referencing temporary value --> $DIR/wf-misc-methods-issue-28609.rs:58:5 | -LL | s.shl(&mut 3) //~ ERROR does not live long enough +LL | s.shl(&mut 3) | ^^^^^^^^^^^-^ | | | | | temporary value created here @@ -44,7 +44,7 @@ LL | s.shl(&mut 3) //~ ERROR does not live long enough error[E0515]: cannot return value referencing temporary value --> $DIR/wf-misc-methods-issue-28609.rs:63:5 | -LL | S2::shl(s, &mut 3) //~ ERROR does not live long enough +LL | S2::shl(s, &mut 3) | ^^^^^^^^^^^^^^^^-^ | | | | | temporary value created here diff --git a/src/test/ui/wf/wf-misc-methods-issue-28609.stderr b/src/test/ui/wf/wf-misc-methods-issue-28609.stderr index 46dc4dc8870d..d470aecd2660 100644 --- a/src/test/ui/wf/wf-misc-methods-issue-28609.stderr +++ b/src/test/ui/wf/wf-misc-methods-issue-28609.stderr @@ -1,7 +1,7 @@ error[E0597]: borrowed value does not live long enough --> $DIR/wf-misc-methods-issue-28609.rs:22:31 | -LL | s.transmute_inherent(&mut 42) //~ ERROR does not live long enough +LL | s.transmute_inherent(&mut 42) | ^^ temporary value does not live long enough LL | } | - temporary value only lives until here @@ -11,14 +11,14 @@ note: borrowed value must be valid for the anonymous lifetime #1 defined on the | LL | / fn return_dangling_pointer_inherent(s: S2) -> &u32 { LL | | let s = s; -LL | | s.transmute_inherent(&mut 42) //~ ERROR does not live long enough +LL | | s.transmute_inherent(&mut 42) LL | | } | |_^ error[E0597]: `four` does not live long enough --> $DIR/wf-misc-methods-issue-28609.rs:35:20 | -LL | s.bomb = Some(&four); //~ ERROR does not live long enough +LL | s.bomb = Some(&four); | ^^^^ borrowed value does not live long enough LL | &s LL | } @@ -30,7 +30,7 @@ note: borrowed value must be valid for the anonymous lifetime #1 defined on the LL | / fn return_dangling_pointer_coerce(s: S2) -> &u32 { LL | | let four = 4; LL | | let mut s = s; -LL | | s.bomb = Some(&four); //~ ERROR does not live long enough +LL | | s.bomb = Some(&four); LL | | &s LL | | } | |_^ @@ -38,7 +38,7 @@ LL | | } error[E0597]: `four` does not live long enough --> $DIR/wf-misc-methods-issue-28609.rs:42:20 | -LL | s.bomb = Some(&four); //~ ERROR does not live long enough +LL | s.bomb = Some(&four); | ^^^^ borrowed value does not live long enough LL | &*s LL | } @@ -50,7 +50,7 @@ note: borrowed value must be valid for the anonymous lifetime #1 defined on the LL | / fn return_dangling_pointer_unary_op(s: S2) -> &u32 { LL | | let four = 4; LL | | let mut s = s; -LL | | s.bomb = Some(&four); //~ ERROR does not live long enough +LL | | s.bomb = Some(&four); LL | | &*s LL | | } | |_^ @@ -58,7 +58,7 @@ LL | | } error[E0597]: borrowed value does not live long enough --> $DIR/wf-misc-methods-issue-28609.rs:53:15 | -LL | s << &mut 3 //~ ERROR does not live long enough +LL | s << &mut 3 | ^ temporary value does not live long enough LL | } | - temporary value only lives until here @@ -68,14 +68,14 @@ note: borrowed value must be valid for the anonymous lifetime #1 defined on the | LL | / fn return_dangling_pointer_binary_op(s: S2) -> &u32 { LL | | let s = s; -LL | | s << &mut 3 //~ ERROR does not live long enough +LL | | s << &mut 3 LL | | } | |_^ error[E0597]: borrowed value does not live long enough --> $DIR/wf-misc-methods-issue-28609.rs:58:16 | -LL | s.shl(&mut 3) //~ ERROR does not live long enough +LL | s.shl(&mut 3) | ^ temporary value does not live long enough LL | } | - temporary value only lives until here @@ -85,14 +85,14 @@ note: borrowed value must be valid for the anonymous lifetime #1 defined on the | LL | / fn return_dangling_pointer_method(s: S2) -> &u32 { LL | | let s = s; -LL | | s.shl(&mut 3) //~ ERROR does not live long enough +LL | | s.shl(&mut 3) LL | | } | |_^ error[E0597]: borrowed value does not live long enough --> $DIR/wf-misc-methods-issue-28609.rs:63:21 | -LL | S2::shl(s, &mut 3) //~ ERROR does not live long enough +LL | S2::shl(s, &mut 3) | ^ temporary value does not live long enough LL | } | - temporary value only lives until here @@ -102,7 +102,7 @@ note: borrowed value must be valid for the anonymous lifetime #1 defined on the | LL | / fn return_dangling_pointer_ufcs(s: S2) -> &u32 { LL | | let s = s; -LL | | S2::shl(s, &mut 3) //~ ERROR does not live long enough +LL | | S2::shl(s, &mut 3) LL | | } | |_^ diff --git a/src/test/ui/wf/wf-object-safe.stderr b/src/test/ui/wf/wf-object-safe.stderr index 2a514d9d2c2b..87e8105d4aff 100644 --- a/src/test/ui/wf/wf-object-safe.stderr +++ b/src/test/ui/wf/wf-object-safe.stderr @@ -1,7 +1,7 @@ error[E0038]: the trait `A` cannot be made into an object --> $DIR/wf-object-safe.rs:9:13 | -LL | let _x: &A; //~ ERROR E0038 +LL | let _x: &A; | ^^ the trait `A` cannot be made into an object | = note: method `foo` references the `Self` type in its arguments or return type diff --git a/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr index 04f8c70bbf42..8649506c870d 100644 --- a/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr +++ b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr @@ -3,13 +3,13 @@ error[E0309]: the parameter type `T` may not live long enough | LL | impl<'a, T> Trait<'a, T> for usize { | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | type Out = &'a fn(T); //~ ERROR `T` may not live long enough +LL | type Out = &'a fn(T); | ^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'a fn(T)` does not outlive the data it points at --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:9:5 | -LL | type Out = &'a fn(T); //~ ERROR `T` may not live long enough +LL | type Out = &'a fn(T); | ^^^^^^^^^^^^^^^^^^^^^ error[E0309]: the parameter type `T` may not live long enough @@ -17,13 +17,13 @@ error[E0309]: the parameter type `T` may not live long enough | LL | impl<'a, T> Trait<'a, T> for u32 { | - help: consider adding an explicit lifetime bound `T: 'a`... -LL | type Out = &'a Baz; //~ ERROR `T` may not live long enough +LL | type Out = &'a Baz; | ^^^^^^^^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'a (dyn Baz + 'a)` does not outlive the data it points at --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:19:5 | -LL | type Out = &'a Baz; //~ ERROR `T` may not live long enough +LL | type Out = &'a Baz; | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.rs b/src/test/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.rs new file mode 100644 index 000000000000..d0167c8c268c --- /dev/null +++ b/src/test/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.rs @@ -0,0 +1,31 @@ +// rust-lang/rust#58158: We have special-case code to deal with case +// when a type is both packed and needs drop glue, (we move the fields +// out of their potentially unaligned locations before dropping them, +// which requires they be Sized; see PR #44884). +// +// So, we need to check if a given type needs drop-glue. That requires +// that we actually know that the concrete type, and we guard against +// the type having unknown parts (i.e. type variables) by ICE'ing in +// that scenario. +// +// But in a case where we have a projection (`Type as Trait::Assoc`) +// where `Type` does not actually implement `Trait`, we of course +// cannot have a concrete type, because there is no impl to look up +// the concrete type for the associated type `Assoc`. +// +// So, this test is just making sure that in such a case that we do +// not immediately ICE, and instead allow the underlying type error to +// surface. + +pub struct Matrix(S); +pub struct DefaultAllocator; + +pub trait Allocator { type Buffer; } + +// impl Allocator for DefaultAllocator { type Buffer = (); } + +#[repr(packed)] +struct Foo(Matrix<::Buffer>); +//~^ ERROR the trait bound `DefaultAllocator: Allocator` is not satisfied + +fn main() { } diff --git a/src/test/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr b/src/test/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr new file mode 100644 index 000000000000..e460cdcd3f3e --- /dev/null +++ b/src/test/ui/wf/wf-packed-on-proj-of-type-as-unimpl-trait.stderr @@ -0,0 +1,9 @@ +error[E0277]: the trait bound `DefaultAllocator: Allocator` is not satisfied + --> $DIR/wf-packed-on-proj-of-type-as-unimpl-trait.rs:28:12 + | +LL | struct Foo(Matrix<::Buffer>); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Allocator` is not implemented for `DefaultAllocator` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/wf/wf-static-method.stderr b/src/test/ui/wf/wf-static-method.stderr index 78ea903e699c..32832ceb79ca 100644 --- a/src/test/ui/wf/wf-static-method.stderr +++ b/src/test/ui/wf/wf-static-method.stderr @@ -1,7 +1,7 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content... --> $DIR/wf-static-method.rs:17:9 | -LL | u //~ ERROR E0312 +LL | u | ^ | note: ...the reference is valid for the lifetime 'a as defined on the impl at 14:6... @@ -18,7 +18,7 @@ LL | impl<'a, 'b> Foo<'a, 'b, Evil<'a, 'b>> for () { error[E0478]: lifetime bound not satisfied --> $DIR/wf-static-method.rs:26:18 | -LL | let me = Self::make_me(); //~ ERROR lifetime bound not satisfied +LL | let me = Self::make_me(); | ^^^^^^^^^^^^^ | note: lifetime parameter instantiated with the lifetime 'b as defined on the impl at 23:10 @@ -35,7 +35,7 @@ LL | impl<'a, 'b> Foo<'a, 'b, ()> for IndirectEvil<'a, 'b> { error[E0312]: lifetime of reference outlives lifetime of borrowed content... --> $DIR/wf-static-method.rs:33:9 | -LL | u //~ ERROR E0312 +LL | u | ^ | note: ...the reference is valid for the lifetime 'a as defined on the impl at 31:6... @@ -52,7 +52,7 @@ LL | impl<'a, 'b> Evil<'a, 'b> { error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements --> $DIR/wf-static-method.rs:41:5 | -LL | <()>::static_evil(b) //~ ERROR cannot infer an appropriate lifetime +LL | <()>::static_evil(b) | ^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime 'b as defined on the function body at 40:13... @@ -63,7 +63,7 @@ LL | fn evil<'a, 'b>(b: &'b u32) -> &'a u32 { note: ...so that reference does not outlive borrowed content --> $DIR/wf-static-method.rs:41:23 | -LL | <()>::static_evil(b) //~ ERROR cannot infer an appropriate lifetime +LL | <()>::static_evil(b) | ^ note: but, the lifetime must be valid for the lifetime 'a as defined on the function body at 40:9... --> $DIR/wf-static-method.rs:40:9 @@ -73,7 +73,7 @@ LL | fn evil<'a, 'b>(b: &'b u32) -> &'a u32 { note: ...so that reference does not outlive borrowed content --> $DIR/wf-static-method.rs:41:5 | -LL | <()>::static_evil(b) //~ ERROR cannot infer an appropriate lifetime +LL | <()>::static_evil(b) | ^^^^^^^^^^^^^^^^^^^^ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements diff --git a/src/test/ui/wf/wf-struct-bound.stderr b/src/test/ui/wf/wf-struct-bound.stderr index 37defb87ee52..1fdcced90cc5 100644 --- a/src/test/ui/wf/wf-struct-bound.stderr +++ b/src/test/ui/wf/wf-struct-bound.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied --> $DIR/wf-struct-bound.rs:9:1 | -LL | / struct SomeStruct //~ ERROR E0277 +LL | / struct SomeStruct LL | | where T: ExtraCopy LL | | { LL | | data: (T,U) diff --git a/src/test/ui/wf/wf-struct-field.stderr b/src/test/ui/wf/wf-struct-field.stderr index e31552b40895..e609f93ff700 100644 --- a/src/test/ui/wf/wf-struct-field.stderr +++ b/src/test/ui/wf/wf-struct-field.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `A: std::marker::Copy` is not satisfied --> $DIR/wf-struct-field.rs:12:5 | -LL | data: IsCopy //~ ERROR E0277 +LL | data: IsCopy | ^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A` | = help: consider adding a `where A: std::marker::Copy` bound diff --git a/src/test/ui/wf/wf-trait-associated-type-bound.stderr b/src/test/ui/wf/wf-trait-associated-type-bound.stderr index f8ba74a2fdc3..658d41218e48 100644 --- a/src/test/ui/wf/wf-trait-associated-type-bound.stderr +++ b/src/test/ui/wf/wf-trait-associated-type-bound.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/wf-trait-associated-type-bound.rs:9:1 | -LL | / trait SomeTrait { //~ ERROR E0277 +LL | / trait SomeTrait { LL | | type Type1: ExtraCopy; LL | | } | |_^ the trait `std::marker::Copy` is not implemented for `T` diff --git a/src/test/ui/wf/wf-trait-bound.stderr b/src/test/ui/wf/wf-trait-bound.stderr index 585571a6a3cb..5cc9451bf5ca 100644 --- a/src/test/ui/wf/wf-trait-bound.stderr +++ b/src/test/ui/wf/wf-trait-bound.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied --> $DIR/wf-trait-bound.rs:9:1 | -LL | / trait SomeTrait //~ ERROR E0277 +LL | / trait SomeTrait LL | | where T: ExtraCopy LL | | { LL | | } diff --git a/src/test/ui/wf/wf-trait-default-fn-arg.stderr b/src/test/ui/wf/wf-trait-default-fn-arg.stderr index eeafc06db347..e71338922365 100644 --- a/src/test/ui/wf/wf-trait-default-fn-arg.stderr +++ b/src/test/ui/wf/wf-trait-default-fn-arg.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied --> $DIR/wf-trait-default-fn-arg.rs:11:5 | LL | / fn bar(&self, x: &Bar) { -LL | | //~^ ERROR E0277 +LL | | LL | | // LL | | // Here, Eq ought to be implemented. LL | | } diff --git a/src/test/ui/wf/wf-trait-default-fn-ret.stderr b/src/test/ui/wf/wf-trait-default-fn-ret.stderr index 7fabd6b47136..5a310a826dd9 100644 --- a/src/test/ui/wf/wf-trait-default-fn-ret.stderr +++ b/src/test/ui/wf/wf-trait-default-fn-ret.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied --> $DIR/wf-trait-default-fn-ret.rs:11:5 | LL | / fn bar(&self) -> Bar { -LL | | //~^ ERROR E0277 +LL | | LL | | // LL | | // Here, Eq ought to be implemented. LL | | loop { } diff --git a/src/test/ui/wf/wf-trait-default-fn-where-clause.stderr b/src/test/ui/wf/wf-trait-default-fn-where-clause.stderr index 669dd08b21f9..d5a00be6d346 100644 --- a/src/test/ui/wf/wf-trait-default-fn-where-clause.stderr +++ b/src/test/ui/wf/wf-trait-default-fn-where-clause.stderr @@ -2,7 +2,7 @@ error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied --> $DIR/wf-trait-default-fn-where-clause.rs:11:5 | LL | / fn bar(&self) where A: Bar { -LL | | //~^ ERROR E0277 +LL | | LL | | // LL | | // Here, Eq ought to be implemented. LL | | } diff --git a/src/test/ui/wf/wf-trait-superbound.stderr b/src/test/ui/wf/wf-trait-superbound.stderr index 0bcda407d9cd..a3c4ab58f65f 100644 --- a/src/test/ui/wf/wf-trait-superbound.stderr +++ b/src/test/ui/wf/wf-trait-superbound.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/wf-trait-superbound.rs:9:1 | -LL | / trait SomeTrait: ExtraCopy { //~ ERROR E0277 +LL | / trait SomeTrait: ExtraCopy { LL | | } | |_^ the trait `std::marker::Copy` is not implemented for `T` | diff --git a/src/test/ui/where-clauses/where-for-self-2.stderr b/src/test/ui/where-clauses/where-for-self-2.stderr index bbcb61a856d8..dbe68b82c24c 100644 --- a/src/test/ui/where-clauses/where-for-self-2.stderr +++ b/src/test/ui/where-clauses/where-for-self-2.stderr @@ -1,7 +1,7 @@ error[E0277]: the trait bound `for<'a> &'a _: Bar` is not satisfied --> $DIR/where-for-self-2.rs:21:5 | -LL | foo(&X); //~ ERROR trait bound +LL | foo(&X); | ^^^ the trait `for<'a> Bar` is not implemented for `&'a _` | = help: the following implementations were found: diff --git a/src/test/ui/while-let.stderr b/src/test/ui/while-let.stderr index 6d61143d33c8..156d0e6c33d8 100644 --- a/src/test/ui/while-let.stderr +++ b/src/test/ui/while-let.stderr @@ -4,7 +4,7 @@ warning: irrefutable while-let pattern LL | while let $p = $e $b | ^^^^^ ... -LL | / foo!(a, 1, { //~ WARN irrefutable while-let +LL | / foo!(a, 1, { LL | | println!("irrefutable pattern"); LL | | }); | |_______- in this macro invocation @@ -17,7 +17,7 @@ warning: irrefutable while-let pattern LL | while let $p = $e $b | ^^^^^ ... -LL | / bar!(a, 1, { //~ WARN irrefutable while-let +LL | / bar!(a, 1, { LL | | println!("irrefutable pattern"); LL | | }); | |_______- in this macro invocation @@ -25,7 +25,7 @@ LL | | }); warning: irrefutable while-let pattern --> $DIR/while-let.rs:24:5 | -LL | / while let a = 1 { //~ WARN irrefutable while-let +LL | / while let a = 1 { LL | | println!("irrefutable pattern"); LL | | break; LL | | } diff --git a/src/test/ui/writing-to-immutable-vec.nll.stderr b/src/test/ui/writing-to-immutable-vec.nll.stderr index 6ec56f90ca47..a65765c86c8b 100644 --- a/src/test/ui/writing-to-immutable-vec.nll.stderr +++ b/src/test/ui/writing-to-immutable-vec.nll.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable | LL | let v: Vec = vec![1, 2, 3]; | - help: consider changing this to be mutable: `mut v` -LL | v[1] = 4; //~ ERROR cannot borrow immutable local variable `v` as mutable +LL | v[1] = 4; | ^ cannot borrow as mutable error: aborting due to previous error diff --git a/src/test/ui/writing-to-immutable-vec.stderr b/src/test/ui/writing-to-immutable-vec.stderr index 3a99186b46f6..9bc82dfd3589 100644 --- a/src/test/ui/writing-to-immutable-vec.stderr +++ b/src/test/ui/writing-to-immutable-vec.stderr @@ -3,7 +3,7 @@ error[E0596]: cannot borrow immutable local variable `v` as mutable | LL | let v: Vec = vec![1, 2, 3]; | - help: make this binding mutable: `mut v` -LL | v[1] = 4; //~ ERROR cannot borrow immutable local variable `v` as mutable +LL | v[1] = 4; | ^ cannot borrow mutably error: aborting due to previous error diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index 8d87c404d0b2..d44a51a9635e 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -358,6 +358,7 @@ impl Builder { self.package("rust-src", &mut manifest.pkg, &["*"]); self.package("rls-preview", &mut manifest.pkg, HOSTS); self.package("clippy-preview", &mut manifest.pkg, HOSTS); + self.package("miri", &mut manifest.pkg, HOSTS); self.package("rustfmt-preview", &mut manifest.pkg, HOSTS); self.package("rust-analysis", &mut manifest.pkg, TARGETS); self.package("llvm-tools-preview", &mut manifest.pkg, TARGETS); @@ -375,7 +376,7 @@ impl Builder { &["rustc", "cargo", "rust-std", "rust-mingw", "rust-docs", "rustfmt-preview", "clippy-preview", "rls-preview", "rust-src", "llvm-tools-preview", - "lldb-preview", "rust-analysis"]); + "lldb-preview", "rust-analysis", "miri"]); manifest.renames.insert("rls".to_owned(), Rename { to: "rls-preview".to_owned() }); manifest.renames.insert("rustfmt".to_owned(), Rename { to: "rustfmt-preview".to_owned() }); @@ -422,6 +423,7 @@ impl Builder { // weren't built extensions.extend(vec![ Component { pkg: "clippy-preview".to_string(), target: host.to_string() }, + Component { pkg: "miri".to_string(), target: host.to_string() }, Component { pkg: "rls-preview".to_string(), target: host.to_string() }, Component { pkg: "rustfmt-preview".to_string(), target: host.to_string() }, Component { pkg: "llvm-tools-preview".to_string(), target: host.to_string() }, diff --git a/src/tools/cargo b/src/tools/cargo index 5c6aa46e6f28..95b45eca19ac 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit 5c6aa46e6f28661270979696e7b4c2f0dff8628f +Subproject commit 95b45eca19ac785263fed98ecefe540bb47337ac diff --git a/src/tools/clippy b/src/tools/clippy index 1fac38088609..016d92d6ed5a 160000 --- a/src/tools/clippy +++ b/src/tools/clippy @@ -1 +1 @@ -Subproject commit 1fac38088609747627b07807945224cf1ea642ca +Subproject commit 016d92d6ed5ae8a3785b65aa300768abbc26f818 diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index fea000738dfc..80b8a8b728bb 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -24,6 +24,7 @@ pub enum Mode { Incremental, RunMake, Ui, + JsDocTest, MirOpt, Assembly, } @@ -60,6 +61,7 @@ impl FromStr for Mode { "incremental" => Ok(Incremental), "run-make" => Ok(RunMake), "ui" => Ok(Ui), + "js-doc-test" => Ok(JsDocTest), "mir-opt" => Ok(MirOpt), "assembly" => Ok(Assembly), _ => Err(()), @@ -84,6 +86,7 @@ impl fmt::Display for Mode { Incremental => "incremental", RunMake => "run-make", Ui => "ui", + JsDocTest => "js-doc-test", MirOpt => "mir-opt", Assembly => "assembly", }; diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 85b700393a52..5cd927dc1e5f 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -4,7 +4,7 @@ use crate::common::{output_base_dir, output_base_name, output_testname_unique}; use crate::common::{Codegen, CodegenUnits, DebugInfoBoth, DebugInfoGdb, DebugInfoLldb, Rustdoc}; use crate::common::{CompileFail, Pretty, RunFail, RunPass, RunPassValgrind}; use crate::common::{Config, TestPaths}; -use crate::common::{Incremental, MirOpt, RunMake, Ui, Assembly}; +use crate::common::{Incremental, MirOpt, RunMake, Ui, JsDocTest, Assembly}; use diff; use crate::errors::{self, Error, ErrorKind}; use filetime::FileTime; @@ -276,6 +276,7 @@ impl<'test> TestCx<'test> { RunPass | Ui => self.run_ui_test(), MirOpt => self.run_mir_opt_test(), Assembly => self.run_assembly_test(), + JsDocTest => self.run_js_doc_test(), } } @@ -292,6 +293,7 @@ impl<'test> TestCx<'test> { match self.config.mode { CompileFail => self.props.compile_pass, RunPass => true, + JsDocTest => true, Ui => self.props.compile_pass, Incremental => { let revision = self.revision @@ -1714,7 +1716,8 @@ impl<'test> TestCx<'test> { } fn make_compile_args(&self, input_file: &Path, output_file: TargetLocation) -> Command { - let is_rustdoc = self.config.src_base.ends_with("rustdoc-ui"); + let is_rustdoc = self.config.src_base.ends_with("rustdoc-ui") || + self.config.src_base.ends_with("rustdoc-js"); let mut rustc = if !is_rustdoc { Command::new(&self.config.rustc_path) } else { @@ -1804,7 +1807,7 @@ impl<'test> TestCx<'test> { rustc.arg(dir_opt); } RunFail | RunPassValgrind | Pretty | DebugInfoBoth | DebugInfoGdb | DebugInfoLldb - | Codegen | Rustdoc | RunMake | CodegenUnits | Assembly => { + | Codegen | Rustdoc | RunMake | CodegenUnits | JsDocTest | Assembly => { // do not use JSON output } } @@ -2754,6 +2757,27 @@ impl<'test> TestCx<'test> { fs::remove_dir(path) } + fn run_js_doc_test(&self) { + if let Some(nodejs) = &self.config.nodejs { + let out_dir = self.output_base_dir(); + + self.document(&out_dir); + + let root = self.config.find_rust_src_root().unwrap(); + let res = self.cmd2procres( + Command::new(&nodejs) + .arg(root.join("src/tools/rustdoc-js/tester.js")) + .arg(out_dir.parent().expect("no parent")) + .arg(&self.testpaths.file.file_stem().expect("couldn't get file stem")), + ); + if !res.status.success() { + self.fatal_proc_rec("rustdoc-js test failed!", &res); + } + } else { + self.fatal("no nodeJS"); + } + } + fn run_ui_test(&self) { // if the user specified a format in the ui test // print the output to the stderr file, otherwise extract @@ -3127,6 +3151,12 @@ impl<'test> TestCx<'test> { .replace("\\", "/") // normalize for paths on windows .replace("\r\n", "\n") // normalize for linebreaks on windows .replace("\t", "\\t"); // makes tabs visible + + // Remove test annotations like `//~ ERROR text` from the output, + // since they duplicate actual errors and make the output hard to read. + normalized = Regex::new("\\s*//~.*").unwrap() + .replace_all(&normalized, "").into_owned(); + for rule in custom_rules { let re = Regex::new(&rule.0).expect("bad regex in custom normalization rule"); normalized = re.replace_all(&normalized, &rule.1[..]).into_owned(); diff --git a/src/tools/linkchecker/main.rs b/src/tools/linkchecker/main.rs index af704ce260dc..9a6c97dbca01 100644 --- a/src/tools/linkchecker/main.rs +++ b/src/tools/linkchecker/main.rs @@ -134,7 +134,9 @@ fn check(cache: &mut Cache, file.ends_with("log/index.html") || file.ends_with("ty/struct.Slice.html") || file.ends_with("ty/enum.Attributes.html") || - file.ends_with("ty/struct.SymbolName.html") { + file.ends_with("ty/struct.SymbolName.html") || + file.ends_with("io/struct.IoVec.html") || + file.ends_with("io/struct.IoVecMut.html") { return None; } // FIXME(#32553) diff --git a/src/tools/miri b/src/tools/miri index 724be298a1e1..e3527fdba717 160000 --- a/src/tools/miri +++ b/src/tools/miri @@ -1 +1 @@ -Subproject commit 724be298a1e12593dbc3786cafc307627e46e802 +Subproject commit e3527fdba7178120a6398e76aa4b3908b10ef85e diff --git a/src/tools/remote-test-client/src/main.rs b/src/tools/remote-test-client/src/main.rs index cb9dac27ce49..f42de4417678 100644 --- a/src/tools/remote-test-client/src/main.rs +++ b/src/tools/remote-test-client/src/main.rs @@ -1,3 +1,5 @@ +#![deny(rust_2018_idioms)] + /// This is a small client program intended to pair with `remote-test-server` in /// this repository. This client connects to the server over TCP and is used to /// push artifacts and run tests on the server instead of locally. @@ -15,7 +17,7 @@ use std::process::{Command, Stdio}; use std::thread; use std::time::Duration; -const REMOTE_ADDR_ENV: &'static str = "TEST_DEVICE_ADDR"; +const REMOTE_ADDR_ENV: &str = "TEST_DEVICE_ADDR"; macro_rules! t { ($e:expr) => (match $e { diff --git a/src/tools/remote-test-server/src/main.rs b/src/tools/remote-test-server/src/main.rs index 750eea3a28ae..e1270489d315 100644 --- a/src/tools/remote-test-server/src/main.rs +++ b/src/tools/remote-test-server/src/main.rs @@ -1,3 +1,5 @@ +#![deny(rust_2018_idioms)] + /// This is a small server which is intended to run inside of an emulator or /// on a remote test device. This server pairs with the `remote-test-client` /// program in this repository. The `remote-test-client` connects to this @@ -120,7 +122,7 @@ struct RemoveOnDrop<'a> { inner: &'a Path, } -impl<'a> Drop for RemoveOnDrop<'a> { +impl Drop for RemoveOnDrop<'_> { fn drop(&mut self) { t!(fs::remove_dir_all(self.inner)); } diff --git a/src/tools/rls b/src/tools/rls index 0d6f53e1a4ad..6840dd69af3a 160000 --- a/src/tools/rls +++ b/src/tools/rls @@ -1 +1 @@ -Subproject commit 0d6f53e1a4adbaf7d83cdc0cb54720203fcb522e +Subproject commit 6840dd69af3ada1f8a432075f1f0be679ea8a468 diff --git a/src/tools/rustbook/src/main.rs b/src/tools/rustbook/src/main.rs index 5a6246347cc0..cfc1bc6d414e 100644 --- a/src/tools/rustbook/src/main.rs +++ b/src/tools/rustbook/src/main.rs @@ -1,4 +1,5 @@ -// +#![deny(rust_2018_idioms)] + use clap::{crate_version}; use std::env; @@ -68,7 +69,7 @@ fn main() { } // Build command implementation -pub fn build_1(args: &ArgMatches) -> Result1<()> { +pub fn build_1(args: &ArgMatches<'_>) -> Result1<()> { let book_dir = get_book_dir(args); let mut book = MDBook1::load(&book_dir)?; @@ -85,7 +86,7 @@ pub fn build_1(args: &ArgMatches) -> Result1<()> { } // Build command implementation -pub fn build_2(args: &ArgMatches) -> Result2<()> { +pub fn build_2(args: &ArgMatches<'_>) -> Result2<()> { let book_dir = get_book_dir(args); let mut book = MDBook2::load(&book_dir)?; @@ -101,7 +102,7 @@ pub fn build_2(args: &ArgMatches) -> Result2<()> { Ok(()) } -fn get_book_dir(args: &ArgMatches) -> PathBuf { +fn get_book_dir(args: &ArgMatches<'_>) -> PathBuf { if let Some(dir) = args.value_of("dir") { // Check if path is relative from current dir, or absolute... let p = Path::new(dir); diff --git a/src/tools/rustdoc-js-std/tester.js b/src/tools/rustdoc-js-std/tester.js new file mode 100644 index 000000000000..d5f0ab9f4292 --- /dev/null +++ b/src/tools/rustdoc-js-std/tester.js @@ -0,0 +1,344 @@ +const fs = require('fs'); + +const TEST_FOLDER = 'src/test/rustdoc-js-std/'; + +function getNextStep(content, pos, stop) { + while (pos < content.length && content[pos] !== stop && + (content[pos] === ' ' || content[pos] === '\t' || content[pos] === '\n')) { + pos += 1; + } + if (pos >= content.length) { + return null; + } + if (content[pos] !== stop) { + return pos * -1; + } + return pos; +} + +// Stupid function extractor based on indent. Doesn't support block +// comments. If someone puts a ' or an " in a block comment this +// will blow up. Template strings are not tested and might also be +// broken. +function extractFunction(content, functionName) { + var indent = 0; + var splitter = "function " + functionName + "("; + + while (true) { + var start = content.indexOf(splitter); + if (start === -1) { + break; + } + var pos = start; + while (pos < content.length && content[pos] !== ')') { + pos += 1; + } + if (pos >= content.length) { + break; + } + pos = getNextStep(content, pos + 1, '{'); + if (pos === null) { + break; + } else if (pos < 0) { + content = content.slice(-pos); + continue; + } + while (pos < content.length) { + // Eat single-line comments + if (content[pos] === '/' && pos > 0 && content[pos-1] === '/') { + do { + pos += 1; + } while (pos < content.length && content[pos] !== '\n'); + + // Eat quoted strings + } else if (content[pos] === '"' || content[pos] === "'" || content[pos] === "`") { + var stop = content[pos]; + var is_escaped = false; + do { + if (content[pos] === '\\') { + pos += 2; + } else { + pos += 1; + } + } while (pos < content.length && + (content[pos] !== stop || content[pos - 1] === '\\')); + + // Otherwise, check for indent + } else if (content[pos] === '{') { + indent += 1; + } else if (content[pos] === '}') { + indent -= 1; + if (indent === 0) { + return content.slice(start, pos + 1); + } + } + pos += 1; + } + content = content.slice(start + 1); + } + return null; +} + +// Stupid function extractor for array. +function extractArrayVariable(content, arrayName) { + var splitter = "var " + arrayName; + while (true) { + var start = content.indexOf(splitter); + if (start === -1) { + break; + } + var pos = getNextStep(content, start, '='); + if (pos === null) { + break; + } else if (pos < 0) { + content = content.slice(-pos); + continue; + } + pos = getNextStep(content, pos, '['); + if (pos === null) { + break; + } else if (pos < 0) { + content = content.slice(-pos); + continue; + } + while (pos < content.length) { + if (content[pos] === '"' || content[pos] === "'") { + var stop = content[pos]; + do { + if (content[pos] === '\\') { + pos += 2; + } else { + pos += 1; + } + } while (pos < content.length && + (content[pos] !== stop || content[pos - 1] === '\\')); + } else if (content[pos] === ']' && + pos + 1 < content.length && + content[pos + 1] === ';') { + return content.slice(start, pos + 2); + } + pos += 1; + } + content = content.slice(start + 1); + } + return null; +} + +// Stupid function extractor for variable. +function extractVariable(content, varName) { + var splitter = "var " + varName; + while (true) { + var start = content.indexOf(splitter); + if (start === -1) { + break; + } + var pos = getNextStep(content, start, '='); + if (pos === null) { + break; + } else if (pos < 0) { + content = content.slice(-pos); + continue; + } + while (pos < content.length) { + if (content[pos] === '"' || content[pos] === "'") { + var stop = content[pos]; + do { + if (content[pos] === '\\') { + pos += 2; + } else { + pos += 1; + } + } while (pos < content.length && + (content[pos] !== stop || content[pos - 1] === '\\')); + } else if (content[pos] === ';') { + return content.slice(start, pos + 1); + } + pos += 1; + } + content = content.slice(start + 1); + } + return null; +} + +function loadContent(content) { + var Module = module.constructor; + var m = new Module(); + m._compile(content, "tmp.js"); + m.exports.ignore_order = content.indexOf("\n// ignore-order\n") !== -1 || + content.startsWith("// ignore-order\n"); + m.exports.exact_check = content.indexOf("\n// exact-check\n") !== -1 || + content.startsWith("// exact-check\n"); + m.exports.should_fail = content.indexOf("\n// should-fail\n") !== -1 || + content.startsWith("// should-fail\n"); + return m.exports; +} + +function readFile(filePath) { + return fs.readFileSync(filePath, 'utf8'); +} + +function loadThings(thingsToLoad, kindOfLoad, funcToCall, fileContent) { + var content = ''; + for (var i = 0; i < thingsToLoad.length; ++i) { + var tmp = funcToCall(fileContent, thingsToLoad[i]); + if (tmp === null) { + console.error('unable to find ' + kindOfLoad + ' "' + thingsToLoad[i] + '"'); + process.exit(1); + } + content += tmp; + content += 'exports.' + thingsToLoad[i] + ' = ' + thingsToLoad[i] + ';'; + } + return content; +} + +function lookForEntry(entry, data) { + for (var i = 0; i < data.length; ++i) { + var allGood = true; + for (var key in entry) { + if (!entry.hasOwnProperty(key)) { + continue; + } + var value = data[i][key]; + // To make our life easier, if there is a "parent" type, we add it to the path. + if (key === 'path' && data[i]['parent'] !== undefined) { + if (value.length > 0) { + value += '::' + data[i]['parent']['name']; + } else { + value = data[i]['parent']['name']; + } + } + if (value !== entry[key]) { + allGood = false; + break; + } + } + if (allGood === true) { + return i; + } + } + return null; +} + +function findFile(dir, name, extension) { + var entries = fs.readdirSync(dir); + for (var i = 0; i < entries.length; ++i) { + var entry = entries[i]; + var file_type = fs.statSync(dir + entry); + if (file_type.isDirectory()) { + continue; + } + if (entry.startsWith(name) && entry.endsWith(extension)) { + return entry; + } + } + return null; +} + +function readFileMatching(dir, name, extension) { + if (dir.endsWith("/") === false) { + dir += "/"; + } + var f = findFile(dir, name, extension); + if (f === null) { + return ""; + } + return readFile(dir + f); +} + +function main(argv) { + if (argv.length !== 3) { + console.error("Expected toolchain to check as argument (for example \ + 'x86_64-apple-darwin')"); + return 1; + } + var toolchain = argv[2]; + + var mainJs = readFileMatching("build/" + toolchain + "/doc/", "main", ".js"); + var ALIASES = readFileMatching("build/" + toolchain + "/doc/", "aliases", ".js"); + var searchIndex = readFileMatching("build/" + toolchain + "/doc/", + "search-index", ".js").split("\n"); + if (searchIndex[searchIndex.length - 1].length === 0) { + searchIndex.pop(); + } + searchIndex.pop(); + searchIndex = loadContent(searchIndex.join("\n") + '\nexports.searchIndex = searchIndex;'); + finalJS = ""; + + var arraysToLoad = ["itemTypes"]; + var variablesToLoad = ["MAX_LEV_DISTANCE", "MAX_RESULTS", + "GENERICS_DATA", "NAME", "INPUTS_DATA", "OUTPUT_DATA", + "TY_PRIMITIVE", "TY_KEYWORD", + "levenshtein_row2"]; + // execQuery first parameter is built in getQuery (which takes in the search input). + // execQuery last parameter is built in buildIndex. + // buildIndex requires the hashmap from search-index. + var functionsToLoad = ["buildHrefAndPath", "pathSplitter", "levenshtein", "validateResult", + "getQuery", "buildIndex", "execQuery", "execSearch"]; + + finalJS += 'window = { "currentCrate": "std" };\n'; + finalJS += 'var rootPath = "../";\n'; + finalJS += ALIASES; + finalJS += loadThings(arraysToLoad, 'array', extractArrayVariable, mainJs); + finalJS += loadThings(variablesToLoad, 'variable', extractVariable, mainJs); + finalJS += loadThings(functionsToLoad, 'function', extractFunction, mainJs); + + var loaded = loadContent(finalJS); + var index = loaded.buildIndex(searchIndex.searchIndex); + + var errors = 0; + + fs.readdirSync(TEST_FOLDER).forEach(function(file) { + var loadedFile = loadContent(readFile(TEST_FOLDER + file) + + 'exports.QUERY = QUERY;exports.EXPECTED = EXPECTED;'); + const expected = loadedFile.EXPECTED; + const query = loadedFile.QUERY; + const filter_crate = loadedFile.FILTER_CRATE; + const ignore_order = loadedFile.ignore_order; + const exact_check = loadedFile.exact_check; + const should_fail = loadedFile.should_fail; + var results = loaded.execSearch(loaded.getQuery(query), index); + process.stdout.write('Checking "' + file + '" ... '); + var error_text = []; + for (var key in expected) { + if (!expected.hasOwnProperty(key)) { + continue; + } + if (!results.hasOwnProperty(key)) { + error_text.push('==> Unknown key "' + key + '"'); + break; + } + var entry = expected[key]; + var prev_pos = -1; + for (var i = 0; i < entry.length; ++i) { + var entry_pos = lookForEntry(entry[i], results[key]); + if (entry_pos === null) { + error_text.push("==> Result not found in '" + key + "': '" + + JSON.stringify(entry[i]) + "'"); + } else if (exact_check === true && prev_pos + 1 !== entry_pos) { + error_text.push("==> Exact check failed at position " + (prev_pos + 1) + ": " + + "expected '" + JSON.stringify(entry[i]) + "' but found '" + + JSON.stringify(results[key][i]) + "'"); + } else if (ignore_order === false && entry_pos < prev_pos) { + error_text.push("==> '" + JSON.stringify(entry[i]) + "' was supposed to be " + + " before '" + JSON.stringify(results[key][entry_pos]) + "'"); + } else { + prev_pos = entry_pos; + } + } + } + if (error_text.length === 0 && should_fail === true) { + errors += 1; + console.error("FAILED"); + console.error("==> Test was supposed to fail but all items were found..."); + } else if (error_text.length !== 0 && should_fail === false) { + errors += 1; + console.error("FAILED"); + console.error(error_text.join("\n")); + } else { + console.log("OK"); + } + }); + return errors; +} + +process.exit(main(process.argv)); diff --git a/src/tools/rustdoc-js/tester.js b/src/tools/rustdoc-js/tester.js index c41da93a9831..833ce5d13704 100644 --- a/src/tools/rustdoc-js/tester.js +++ b/src/tools/rustdoc-js/tester.js @@ -1,4 +1,5 @@ const fs = require('fs'); +const { spawnSync } = require('child_process'); const TEST_FOLDER = 'src/test/rustdoc-js/'; @@ -219,16 +220,10 @@ function lookForEntry(entry, data) { return null; } -function main(argv) { - if (argv.length !== 3) { - console.error("Expected toolchain to check as argument (for example 'x86_64-apple-darwin'"); - return 1; - } - var toolchain = argv[2]; - - var mainJs = readFile("build/" + toolchain + "/doc/main.js"); - var ALIASES = readFile("build/" + toolchain + "/doc/aliases.js"); - var searchIndex = readFile("build/" + toolchain + "/doc/search-index.js").split("\n"); +function load_files(out_folder, crate) { + var mainJs = readFile(out_folder + "/main.js"); + var ALIASES = readFile(out_folder + "/aliases.js"); + var searchIndex = readFile(out_folder + "/search-index.js").split("\n"); if (searchIndex[searchIndex.length - 1].length === 0) { searchIndex.pop(); } @@ -247,7 +242,7 @@ function main(argv) { var functionsToLoad = ["buildHrefAndPath", "pathSplitter", "levenshtein", "validateResult", "getQuery", "buildIndex", "execQuery", "execSearch"]; - finalJS += 'window = { "currentCrate": "std" };\n'; + finalJS += 'window = { "currentCrate": "' + crate + '" };\n'; finalJS += 'var rootPath = "../";\n'; finalJS += ALIASES; finalJS += loadThings(arraysToLoad, 'array', extractArrayVariable, mainJs); @@ -255,12 +250,36 @@ function main(argv) { finalJS += loadThings(functionsToLoad, 'function', extractFunction, mainJs); var loaded = loadContent(finalJS); - var index = loaded.buildIndex(searchIndex.searchIndex); + return [loaded, loaded.buildIndex(searchIndex.searchIndex)]; +} + +function main(argv) { + if (argv.length < 4) { + console.error("USAGE: node tester.js OUT_FOLDER [TESTS]"); + return 1; + } + if (argv[2].substr(-1) !== "/") { + argv[2] += "/"; + } + const out_folder = argv[2]; var errors = 0; - fs.readdirSync(TEST_FOLDER).forEach(function(file) { - var loadedFile = loadContent(readFile(TEST_FOLDER + file) + + for (var j = 3; j < argv.length; ++j) { + const test_name = argv[j]; + + process.stdout.write('Checking "' + test_name + '" ... '); + if (!fs.existsSync(TEST_FOLDER + test_name + ".js")) { + errors += 1; + console.error("FAILED"); + console.error("==> Missing '" + test_name + ".js' file..."); + continue; + } + + const test_out_folder = out_folder + test_name; + + var [loaded, index] = load_files(test_out_folder, test_name); + var loadedFile = loadContent(readFile(TEST_FOLDER + test_name + ".js") + 'exports.QUERY = QUERY;exports.EXPECTED = EXPECTED;'); const expected = loadedFile.EXPECTED; const query = loadedFile.QUERY; @@ -269,7 +288,6 @@ function main(argv) { const exact_check = loadedFile.exact_check; const should_fail = loadedFile.should_fail; var results = loaded.execSearch(loaded.getQuery(query), index); - process.stdout.write('Checking "' + file + '" ... '); var error_text = []; for (var key in expected) { if (!expected.hasOwnProperty(key)) { @@ -309,7 +327,7 @@ function main(argv) { } else { console.log("OK"); } - }); + } return errors; } diff --git a/src/tools/rustdoc/main.rs b/src/tools/rustdoc/main.rs index 8bdc365c4ca6..8171708e99d0 100644 --- a/src/tools/rustdoc/main.rs +++ b/src/tools/rustdoc/main.rs @@ -1,15 +1,3 @@ #![deny(rust_2018_idioms)] -#![feature(link_args)] - -#[allow(unused_attributes)] -// Set the stack size at link time on Windows. See rustc_driver::in_rustc_thread -// for the rationale. -#[cfg_attr(all(windows, target_env = "msvc"), link_args = "/STACK:16777216")] -// We only build for msvc and gnu now, but we use a exhaustive condition here -// so we can expect either the stack size to be set or the build fails. -#[cfg_attr(all(windows, not(target_env = "msvc")), link_args = "-Wl,--stack,16777216")] -// See src/rustc/rustc.rs for the corresponding rustc settings. -extern {} - fn main() { rustdoc::main() } diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index 94dd5478e529..d7683aae841c 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -49,13 +49,13 @@ const EXCEPTIONS: &[&str] = &[ ]; /// Which crates to check against the whitelist? -const WHITELIST_CRATES: &[CrateVersion] = &[ +const WHITELIST_CRATES: &[CrateVersion<'_>] = &[ CrateVersion("rustc", "0.0.0"), CrateVersion("rustc_codegen_llvm", "0.0.0"), ]; /// Whitelist of crates rustc is allowed to depend on. Avoid adding to the list if possible. -const WHITELIST: &[Crate] = &[ +const WHITELIST: &[Crate<'_>] = &[ Crate("adler32"), Crate("aho-corasick"), Crate("arrayvec"), @@ -137,6 +137,7 @@ const WHITELIST: &[Crate] = &[ Crate("smallvec"), Crate("stable_deref_trait"), Crate("syn"), + Crate("synstructure"), Crate("tempfile"), Crate("termcolor"), Crate("terminon"), @@ -183,7 +184,7 @@ struct Crate<'a>(&'a str); // (name) #[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Debug, Hash)] struct CrateVersion<'a>(&'a str, &'a str); // (name, version) -impl<'a> Crate<'a> { +impl Crate<'_> { pub fn id_str(&self) -> String { format!("{} ", self.0) } @@ -330,10 +331,10 @@ fn get_deps(path: &Path, cargo: &Path) -> Resolve { /// Checks the dependencies of the given crate from the given cargo metadata to see if they are on /// the whitelist. Returns a list of illegal dependencies. -fn check_crate_whitelist<'a, 'b>( - whitelist: &'a HashSet, +fn check_crate_whitelist<'a>( + whitelist: &'a HashSet>, resolve: &'a Resolve, - visited: &'b mut BTreeSet>, + visited: &mut BTreeSet>, krate: CrateVersion<'a>, must_be_on_whitelist: bool, ) -> BTreeSet> { @@ -378,7 +379,7 @@ fn check_crate_duplicate(resolve: &Resolve, bad: &mut bool) { // to accidentally sneak into our dependency graph, in order to ensure we keep our CI times // under control. - // "cargo", // FIXME(#53005) + "cargo", "rustc-ap-syntax", ]; let mut name_to_id: HashMap<_, Vec<_>> = HashMap::new(); diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs index 7126c0c2f6ec..1eab217027c8 100644 --- a/src/tools/tidy/src/features.rs +++ b/src/tools/tidy/src/features.rs @@ -22,7 +22,7 @@ pub enum Status { } impl fmt::Display for Status { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let as_str = match *self { Status::Stable => "stable", Status::Unstable => "unstable", diff --git a/src/tools/tidy/src/lib.rs b/src/tools/tidy/src/lib.rs index 022c53f909c7..c4a1246ffdf5 100644 --- a/src/tools/tidy/src/lib.rs +++ b/src/tools/tidy/src/lib.rs @@ -3,7 +3,8 @@ //! This library contains the tidy lints and exposes it //! to be used by tools. -extern crate serde; +#![deny(rust_2018_idioms)] + extern crate serde_json; #[macro_use] extern crate serde_derive; diff --git a/src/tools/tidy/src/unstable_book.rs b/src/tools/tidy/src/unstable_book.rs index 63196eda7cc5..cd60f36b1d27 100644 --- a/src/tools/tidy/src/unstable_book.rs +++ b/src/tools/tidy/src/unstable_book.rs @@ -82,25 +82,27 @@ pub fn check(path: &path::Path, bad: &mut bool) { !lang_features.contains_key(name) }).collect(); + // Library features let unstable_lib_feature_names = collect_unstable_feature_names(&lib_features); let unstable_book_lib_features_section_file_names = collect_unstable_book_lib_features_section_file_names(path); - // Check for Unstable Book sections that don't have a corresponding unstable feature - for feature_name in &unstable_book_lib_features_section_file_names - - &unstable_lib_feature_names { - tidy_error!(bad, - "The Unstable Book has a 'library feature' section '{}' which doesn't \ - correspond to an unstable library feature", - feature_name) - } - // Language features - let unstable_lang_feature_names = collect_unstable_feature_names(&lang_features); let unstable_book_lang_features_section_file_names = collect_unstable_book_lang_features_section_file_names(path); + // Check for Unstable Book sections that don't have a corresponding unstable feature + for feature_name in &unstable_book_lib_features_section_file_names - + &unstable_lib_feature_names { + if !unstable_lang_feature_names.contains(&feature_name) { + tidy_error!(bad, + "The Unstable Book has a 'library feature' section '{}' which doesn't \ + correspond to an unstable library feature", + feature_name); + } + } + // Check for Unstable Book sections that don't have a corresponding unstable feature. for feature_name in &unstable_book_lang_features_section_file_names - &unstable_lang_feature_names {