diff --git a/Cargo.lock b/Cargo.lock index e2938b5f8c2..93814bedc9c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -76,25 +76,6 @@ name = "bitflags" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "block-padding" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "bstr" version = "0.2.7" @@ -103,11 +84,6 @@ dependencies = [ "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "byteorder" version = "1.3.2" @@ -206,15 +182,9 @@ dependencies = [ "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "ci_info" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "clap" version = "2.33.0" @@ -261,6 +231,21 @@ dependencies = [ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "console" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "clicolors-control 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "crossbeam" version = "0.7.2" @@ -345,14 +330,6 @@ name = "difference" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "drop_bomb" version = "0.1.4" @@ -409,11 +386,6 @@ dependencies = [ "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "filetime" version = "0.2.5" @@ -512,14 +484,6 @@ dependencies = [ "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "generic-array" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "getrandom" version = "0.1.10" @@ -602,18 +566,12 @@ dependencies = [ [[package]] name = "insta" -version = "0.10.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "ci_info 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "console 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)", + "console 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pest 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "pest_derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ron 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "serde_yaml 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -743,11 +701,6 @@ dependencies = [ "url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "maplit" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "matches" version = "0.1.8" @@ -879,11 +832,6 @@ dependencies = [ "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "ordermap" version = "0.3.5" @@ -938,45 +886,6 @@ name = "percent-encoding" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "pest" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ucd-trie 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "pest_derive" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "pest 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "pest_generator 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "pest_generator" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "pest 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "pest_meta 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "pest_meta" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "pest 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "petgraph" version = "0.4.13" @@ -1134,7 +1043,7 @@ dependencies = [ "chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git)", "chalk-solve 0.1.0 (git+https://github.com/rust-lang/chalk.git)", "ena 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "insta 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "insta 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "lalrpop-intern 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "once_cell 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1156,7 +1065,7 @@ version = "0.1.0" dependencies = [ "format-buf 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "fst 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "insta 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "insta 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "join_to_string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1529,16 +1438,6 @@ dependencies = [ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "ron" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.99 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "ron" version = "0.5.1" @@ -1688,17 +1587,6 @@ dependencies = [ "yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "sha-1" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "slab" version = "0.4.2" @@ -1842,16 +1730,6 @@ dependencies = [ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "typenum" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "ucd-trie" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "unicase" version = "2.4.0" @@ -2006,10 +1884,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum bit-set 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e84c238982c4b1e1ee668d136c510c67a13465279c0cb367ea6baf6310620a80" "checksum bit-vec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f59bbe95d4e52a6398ec21238d31577f2b28a9d86807f06ca59d191d8440d0bb" "checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" -"checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -"checksum block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4dc3af3ee2e12f3e5d224e5e1e3d73668abbeb69e566d361f7d5563a4fdf09" "checksum bstr 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94cdf78eb7e94c566c1f5dbe2abf8fc70a548fc902942a48c4b3a98b48ca9ade" -"checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" "checksum c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d64d04786e0f528460fc884753cf8dddcc466be308f6026f8e355c41a0e4101" "checksum cargo_metadata 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "700b3731fd7d357223d0000f4dbf1808401b694609035c3c411fbc0cd375c426" @@ -2021,11 +1896,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum chalk-rust-ir 0.1.0 (git+https://github.com/rust-lang/chalk.git)" = "" "checksum chalk-solve 0.1.0 (git+https://github.com/rust-lang/chalk.git)" = "" "checksum chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "77d81f58b7301084de3b958691458a53c3f7e0b1d702f77e550b6a88e3a88abe" -"checksum ci_info 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e5e881307a989a3a5e20d52a32cc05950e3c2178cccfcc9428271a6cde09f902" "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" "checksum clicolors-control 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "73abfd4c73d003a674ce5d2933fca6ce6c42480ea84a5ffe0a2dc39ed56300f9" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum console 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8ca57c2c14b8a2bf3105bc9d15574aad80babf6a9c44b1058034cdf8bd169628" +"checksum console 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b147390a412132d75d10dd3b7b175a69cf5fd95032f7503c7091b8831ba10242" "checksum crossbeam 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2d818a4990769aac0c7ff1360e233ef3a41adcb009ebb2036bf6915eb0f6b23c" "checksum crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c8ec7fcd21571dc78f96cc96243cab8d8f035247c3efd16c687be154c3fa9efa" "checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13" @@ -2035,7 +1910,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6" "checksum derive-new 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)" = "71f31892cd5c62e414316f2963c5689242c43d8e7bbcaaeca97e5e28c95d91d9" "checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" -"checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" "checksum drop_bomb 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "69b26e475fd29098530e709294e94e661974c851aed42512793f120fed4e199f" "checksum dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e" "checksum either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5527cfe0d098f36e3f8839852688e63c8fff1c90b2b405aef730615f9a7bcf7b" @@ -2044,7 +1918,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "90b2c9496c001e8cb61827acdefad780795c42264c137744cae6f7d9e3450abd" "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" -"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" "checksum filetime 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2f8c63033fcba1f51ef744505b3cad42510432b904c062afa67ad7ece008429d" "checksum fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" "checksum flexi_logger 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2be2727ae1f60711d1991788605245e70cc500bd1d92edb909af160634e1a869" @@ -2057,7 +1930,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" -"checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" "checksum getrandom 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "6171a6cc63fbabbe27c2b5ee268e8b7fe5dc1eb0dd2dfad537c1dfed6f69117e" "checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" "checksum globset 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "925aa2cac82d8834e2b2a4415b6f6879757fb5c0928fc445ae76461a12eed8f2" @@ -2067,7 +1939,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum indicatif 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2c60da1c9abea75996b70a931bba6c750730399005b61ccd853cee50ef3d0d0c" "checksum inotify 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40b54539f3910d6f84fbf9a643efd6e3aa6e4f001426c0329576128255994718" "checksum inotify-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e74a1aa87c59aeff6ef2cc2fa62d41bc43f54952f55652656b18a02fd5e356c0" -"checksum insta 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fcb8917b02e8fee27da19291be792fa53acec68ea0b7a45a914dcb80a67d42ab" +"checksum insta 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23f83ab4ee86f38b292f0420c27fd412690a4baa9ea0ad4e3fa624bf34379b76" "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" "checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358" "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" @@ -2085,7 +1957,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum lock_api 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f8912e782533a93a167888781b836336a6ca5da6175c05944c86cf28c31104dc" "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" "checksum lsp-types 0.60.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fe3edefcd66dde1f7f1df706f46520a3c93adc5ca4bc5747da6621195e894efd" -"checksum maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08cbb6b4fef96b6d77bfc40ec491b1690c779e77b05cd9f07f787ed376fd4c43" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" "checksum memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce6075db033bbbb7ee5a0bbd3a3186bbae616f57fb001c485c7ff77955f8177f" @@ -2100,17 +1971,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273" "checksum number_prefix 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dbf9993e59c894e3c08aa1c2712914e9e6bf1fcbfc6bef283e2183df345a4fee" "checksum once_cell 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1824583b0e4dc0c1716eea4fb51a9ca2634943f0b07fd929e79af6aeb5a513cc" -"checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" "checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" "checksum parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" "checksum parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" "checksum paste 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "423a519e1c6e828f1e73b720f9d9ed2fa643dce8a7737fb43235ce0b41eeaa49" "checksum paste-impl 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4214c9e912ef61bf42b81ba9a47e8aad1b2ffaf739ab162bf96d1e011f54e6c5" "checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" -"checksum pest 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "933085deae3f32071f135d799d75667b63c8dc1f4537159756e3d4ceab41868c" -"checksum pest_derive 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0" -"checksum pest_generator 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "63120576c4efd69615b5537d3d052257328a4ca82876771d6944424ccfd9f646" -"checksum pest_meta 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f249ea6de7c7b7aba92b4ff4376a994c6dbd98fd2166c89d5c4947397ecb574d" "checksum petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f" "checksum ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e3cbf9f658cdb5000fcf6f362b8ea2ba154b9f146a61c7a20d647034c6b6561b" "checksum proc-macro-hack 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e688f31d92ffd7c1ddc57a1b4e6d773c0f2a14ee437a4b0a4f5a69c80eb221c8" @@ -2145,7 +2011,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b143cceb2ca5e56d5671988ef8b15615733e7ee16cd348e064333b251b89343f" "checksum relative-path 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0e7790c7f1cc73d831d28dc5a7deb316a006e7848e6a7f467cdb10a0a9e0fb1c" "checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" -"checksum ron 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "17f52a24414403f81528b67488cf8edc4eda977d3af1646bb6b106a600ead78f" "checksum ron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2ece421e0c4129b90e4a35b6f625e472e96c552136f5093a2f4fa2bbb75a62d5" "checksum rowan 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dc2b79612dedc9004083a61448eb669d336d56690aab29fbd7249e8c8ab41d8c" "checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" @@ -2163,7 +2028,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704" "checksum serde_repr 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "cd02c7587ec314570041b2754829f84d873ced14a96d1fd1823531e11db40573" "checksum serde_yaml 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)" = "38b08a9a90e5260fe01c6480ec7c811606df6d3a660415808c3c3fa8ed95b582" -"checksum sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "23962131a91661d643c98940b20fcaffe62d776a823247be80a48fcb8b6fce68" "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" "checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7" "checksum smol_str 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "590700be3630457c56f8c73c0ea39881476ad7076cd84057d44f4f38f79914fb" @@ -2179,8 +2043,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e2f0c90a5f3459330ac8bc0d2f879c693bb7a2f59689c1083fc4ef83834da865" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" -"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" -"checksum ucd-trie 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8f00ed7be0c1ff1e24f46c3d2af4859f7e863672ba3a6e92e7cff702bf9f06c2" "checksum unicase 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a84e5511b2a947f3ae965dcb29b13b7b1691b6e7332cf5dbc1744138d5acb7f6" "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" "checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426" diff --git a/crates/ra_hir/Cargo.toml b/crates/ra_hir/Cargo.toml index 1a2f1b47c91..646c96692da 100644 --- a/crates/ra_hir/Cargo.toml +++ b/crates/ra_hir/Cargo.toml @@ -27,4 +27,4 @@ chalk-ir = { git = "https://github.com/rust-lang/chalk.git" } lalrpop-intern = "0.15.1" [dev-dependencies] -insta = "0.10.0" +insta = "0.11.0" diff --git a/crates/ra_hir/src/mock.rs b/crates/ra_hir/src/mock.rs index ba33273b86e..77a44a275b5 100644 --- a/crates/ra_hir/src/mock.rs +++ b/crates/ra_hir/src/mock.rs @@ -75,7 +75,7 @@ impl MockDatabase { } pub fn diagnostics(&self) -> String { - let mut buf = String::from("\n"); + let mut buf = String::new(); let mut files: Vec = self.files.values().copied().collect(); files.sort(); for file in files { diff --git a/crates/ra_hir/src/nameres/tests.rs b/crates/ra_hir/src/nameres/tests.rs index 8b0887fb59f..c1dbad283a4 100644 --- a/crates/ra_hir/src/nameres/tests.rs +++ b/crates/ra_hir/src/nameres/tests.rs @@ -6,7 +6,7 @@ mod mods; use std::sync::Arc; -use insta::assert_snapshot_matches; +use insta::assert_snapshot; use ra_db::SourceDatabase; use test_utils::covers; @@ -97,7 +97,7 @@ fn crate_def_map_smoke_test() { enum E { V } ", ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮E: t ⋮S: t v @@ -130,7 +130,7 @@ fn bogus_paths() { ", ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮S: t v ⋮foo: t @@ -153,7 +153,7 @@ fn use_as() { pub struct Baz; ", ); - assert_snapshot_matches!(map, + assert_snapshot!(map, @r###" ⋮crate ⋮Foo: t v @@ -182,7 +182,7 @@ fn use_trees() { pub enum Quux {}; ", ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮Baz: t v ⋮Quux: t @@ -215,7 +215,7 @@ fn re_exports() { pub struct Baz; ", ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮Baz: t v ⋮foo: t @@ -250,7 +250,7 @@ fn std_prelude() { "test_crate": ("/lib.rs", []), }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮Bar: t v ⋮Baz: t v @@ -267,7 +267,7 @@ fn can_import_enum_variant() { use self::E::V; ", ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮E: t ⋮V: t v @@ -299,7 +299,7 @@ fn edition_2015_imports() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮bar: t ⋮foo: t @@ -326,7 +326,7 @@ fn item_map_using_self() { pub struct Baz; ", ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮Baz: t v ⋮foo: t @@ -355,7 +355,7 @@ fn item_map_across_crates() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮Baz: t v "###); @@ -383,7 +383,7 @@ fn extern_crate_rename() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮alloc_crate: t ⋮sync: t @@ -415,7 +415,7 @@ fn extern_crate_rename_2015_edition() { }, ); - assert_snapshot_matches!(map, + assert_snapshot!(map, @r###" ⋮crate ⋮alloc_crate: t @@ -449,7 +449,7 @@ fn import_across_source_roots() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮C: t v "###); @@ -476,7 +476,7 @@ fn reexport_across_crates() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮Baz: t v "###); @@ -499,7 +499,7 @@ fn values_dont_shadow_extern_crates() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮Bar: t v ⋮foo: v diff --git a/crates/ra_hir/src/nameres/tests/globs.rs b/crates/ra_hir/src/nameres/tests/globs.rs index e1519ca6bbf..7ac22b47b80 100644 --- a/crates/ra_hir/src/nameres/tests/globs.rs +++ b/crates/ra_hir/src/nameres/tests/globs.rs @@ -17,7 +17,7 @@ fn glob_1() { pub struct Baz; ", ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮Baz: t v ⋮Foo: t v @@ -53,7 +53,7 @@ fn glob_2() { pub use super::*; ", ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮Baz: t v ⋮Foo: t v @@ -89,7 +89,7 @@ fn glob_across_crates() { "test_crate": ("/lib.rs", []), }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮Baz: t v "### @@ -108,7 +108,7 @@ fn glob_enum() { use self::Foo::*; ", ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮Bar: t v ⋮Baz: t v diff --git a/crates/ra_hir/src/nameres/tests/macros.rs b/crates/ra_hir/src/nameres/tests/macros.rs index 4e04740eb99..631df2ceff1 100644 --- a/crates/ra_hir/src/nameres/tests/macros.rs +++ b/crates/ra_hir/src/nameres/tests/macros.rs @@ -17,7 +17,7 @@ fn macro_rules_are_globally_visible() { structs!(Bar, Baz); ", ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮Foo: t v ⋮nested: t @@ -45,7 +45,7 @@ fn macro_rules_can_define_modules() { struct X; ", ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮m: m ⋮n1: t @@ -82,7 +82,7 @@ fn macro_rules_from_other_crates_are_visible() { "foo": ("/lib.rs", []), }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮Bar: t v ⋮Foo: t v @@ -129,7 +129,7 @@ fn unexpanded_macro_should_expand_by_fixedpoint_loop() { "foo": ("/lib.rs", []), }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮Foo: t v ⋮bar: m diff --git a/crates/ra_hir/src/nameres/tests/mods.rs b/crates/ra_hir/src/nameres/tests/mods.rs index 6dd18df1a9a..4f8398460d1 100644 --- a/crates/ra_hir/src/nameres/tests/mods.rs +++ b/crates/ra_hir/src/nameres/tests/mods.rs @@ -19,7 +19,7 @@ fn name_res_works_for_broken_modules() { pub struct Baz; ", ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮Baz: _ "###); @@ -41,7 +41,7 @@ fn module_resolution_works_for_non_standard_filenames() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮Bar: t v ⋮foo: t @@ -67,7 +67,7 @@ fn module_resolution_works_for_raw_modules() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮Bar: t v ⋮async: t @@ -94,7 +94,7 @@ fn module_resolution_decl_path() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮Bar: t v ⋮foo: t @@ -110,7 +110,7 @@ fn module_resolution_module_with_path_in_mod_rs() { r###" //- /main.rs mod foo; - + //- /foo/mod.rs #[path = "baz.rs"] pub mod bar; @@ -125,7 +125,7 @@ fn module_resolution_module_with_path_in_mod_rs() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮foo: t ⋮ @@ -144,7 +144,7 @@ fn module_resolution_module_with_path_non_crate_root() { r###" //- /main.rs mod foo; - + //- /foo.rs #[path = "baz.rs"] pub mod bar; @@ -159,7 +159,7 @@ fn module_resolution_module_with_path_non_crate_root() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮foo: t ⋮ @@ -189,7 +189,7 @@ fn module_resolution_module_decl_path_super() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮Baz: t v ⋮foo: t @@ -215,7 +215,7 @@ fn module_resolution_explicit_path_mod_rs() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮foo: t ⋮ @@ -243,7 +243,7 @@ fn module_resolution_relative_path() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮foo: t ⋮ @@ -274,7 +274,7 @@ fn module_resolution_relative_path_2() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮foo: t ⋮ @@ -302,7 +302,7 @@ fn module_resolution_explicit_path_mod_rs_2() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮foo: t ⋮ @@ -327,7 +327,7 @@ fn module_resolution_explicit_path_mod_rs_with_win_separator() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮foo: t ⋮ @@ -354,7 +354,7 @@ fn module_resolution_decl_inside_inline_module_with_path_attribute() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮foo: t ⋮ @@ -383,7 +383,7 @@ fn module_resolution_decl_inside_inline_module() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮foo: t ⋮ @@ -413,7 +413,7 @@ fn module_resolution_decl_inside_inline_module_2_with_path_attribute() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮foo: t ⋮ @@ -444,7 +444,7 @@ fn module_resolution_decl_inside_inline_module_3() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮foo: t ⋮ @@ -475,7 +475,7 @@ fn module_resolution_decl_inside_inline_module_empty_path() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮foo: t ⋮ @@ -503,7 +503,7 @@ fn module_resolution_decl_empty_path() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮foo: t ⋮ @@ -530,7 +530,7 @@ fn module_resolution_decl_inside_inline_module_relative_path() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮foo: t ⋮ @@ -561,7 +561,7 @@ fn module_resolution_decl_inside_inline_module_in_crate_root() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮Baz: t v ⋮foo: t @@ -596,7 +596,7 @@ fn module_resolution_decl_inside_inline_module_in_mod_rs() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮foo: t ⋮ @@ -634,7 +634,7 @@ fn module_resolution_decl_inside_inline_module_in_non_crate_root() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮foo: t ⋮ @@ -672,7 +672,7 @@ fn module_resolution_decl_inside_inline_module_in_non_crate_root_2() { }, ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮foo: t ⋮ @@ -701,8 +701,8 @@ fn unresolved_module_diagnostics() { ) .diagnostics(); - assert_snapshot_matches!(diagnostics, @r###" -"mod bar;": unresolved module -"### + assert_snapshot!(diagnostics, @r###" + "mod bar;": unresolved module + "### ); } diff --git a/crates/ra_hir/src/nameres/tests/primitives.rs b/crates/ra_hir/src/nameres/tests/primitives.rs index 734744835a3..0e27086585c 100644 --- a/crates/ra_hir/src/nameres/tests/primitives.rs +++ b/crates/ra_hir/src/nameres/tests/primitives.rs @@ -12,7 +12,7 @@ fn primitive_reexport() { pub use i32 as int; ", ); - assert_snapshot_matches!(map, @r###" + assert_snapshot!(map, @r###" ⋮crate ⋮foo: t ⋮int: t diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index e3eb0c3fafc..b034fd59e9d 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs @@ -1,7 +1,7 @@ use std::fmt::Write; use std::sync::Arc; -use insta::assert_snapshot_matches; +use insta::assert_snapshot; use ra_db::{salsa::Database, FilePosition, SourceDatabase}; use ra_syntax::{ @@ -166,7 +166,7 @@ fn test() { #[test] fn infer_basics() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" fn test(a: u32, b: isize, c: !, d: &str) { a; @@ -179,25 +179,27 @@ fn test(a: u32, b: isize, c: !, d: &str) { 1.0f32; }"#), @r###" -[9; 10) 'a': u32 -[17; 18) 'b': isize -[27; 28) 'c': ! -[33; 34) 'd': &str -[42; 121) '{ ...f32; }': () -[48; 49) 'a': u32 -[55; 56) 'b': isize -[62; 63) 'c': ! -[69; 70) 'd': &str -[76; 82) '1usize': usize -[88; 94) '1isize': isize -[100; 106) '"test"': &str -[112; 118) '1.0f32': f32"### + + [9; 10) 'a': u32 + [17; 18) 'b': isize + [27; 28) 'c': ! + [33; 34) 'd': &str + [42; 121) '{ ...f32; }': () + [48; 49) 'a': u32 + [55; 56) 'b': isize + [62; 63) 'c': ! + [69; 70) 'd': &str + [76; 82) '1usize': usize + [88; 94) '1isize': isize + [100; 106) '"test"': &str + [112; 118) '1.0f32': f32 + "### ); } #[test] fn infer_let() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" fn test() { let a = 1isize; @@ -206,19 +208,21 @@ fn test() { } "#), @r###" -[11; 71) '{ ...= b; }': () -[21; 22) 'a': isize -[25; 31) '1isize': isize -[41; 42) 'b': usize -[52; 53) '1': usize -[63; 64) 'c': usize -[67; 68) 'b': usize"### + + [11; 71) '{ ...= b; }': () + [21; 22) 'a': isize + [25; 31) '1isize': isize + [41; 42) 'b': usize + [52; 53) '1': usize + [63; 64) 'c': usize + [67; 68) 'b': usize + "### ); } #[test] fn infer_paths() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" fn a() -> u32 { 1 } @@ -232,21 +236,23 @@ fn test() { } "#), @r###" -[15; 20) '{ 1 }': u32 -[17; 18) '1': u32 -[48; 53) '{ 1 }': u32 -[50; 51) '1': u32 -[67; 91) '{ ...c(); }': () -[73; 74) 'a': fn a() -> u32 -[73; 76) 'a()': u32 -[82; 86) 'b::c': fn c() -> u32 -[82; 88) 'b::c()': u32"### + + [15; 20) '{ 1 }': u32 + [17; 18) '1': u32 + [48; 53) '{ 1 }': u32 + [50; 51) '1': u32 + [67; 91) '{ ...c(); }': () + [73; 74) 'a': fn a() -> u32 + [73; 76) 'a()': u32 + [82; 86) 'b::c': fn c() -> u32 + [82; 88) 'b::c()': u32 + "### ); } #[test] fn infer_struct() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct A { b: B, @@ -264,28 +270,30 @@ fn test() { } "#), @r###" -[72; 154) '{ ...a.c; }': () -[82; 83) 'c': C -[86; 87) 'C': C(usize) -> C -[86; 90) 'C(1)': C -[88; 89) '1': usize -[96; 97) 'B': B -[107; 108) 'a': A -[114; 133) 'A { b:...C(1) }': A -[121; 122) 'B': B -[127; 128) 'C': C(usize) -> C -[127; 131) 'C(1)': C -[129; 130) '1': usize -[139; 140) 'a': A -[139; 142) 'a.b': B -[148; 149) 'a': A -[148; 151) 'a.c': C"### + + [72; 154) '{ ...a.c; }': () + [82; 83) 'c': C + [86; 87) 'C': C(usize) -> C + [86; 90) 'C(1)': C + [88; 89) '1': usize + [96; 97) 'B': B + [107; 108) 'a': A + [114; 133) 'A { b:...C(1) }': A + [121; 122) 'B': B + [127; 128) 'C': C(usize) -> C + [127; 131) 'C(1)': C + [129; 130) '1': usize + [139; 140) 'a': A + [139; 142) 'a.b': B + [148; 149) 'a': A + [148; 151) 'a.c': C + "### ); } #[test] fn infer_enum() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" enum E { V1 { field: u32 }, @@ -296,16 +304,18 @@ fn test() { E::V2; }"#), @r###" -[48; 82) '{ E:...:V2; }': () -[52; 70) 'E::V1 ...d: 1 }': E -[67; 68) '1': u32 -[74; 79) 'E::V2': E"### + + [48; 82) '{ E:...:V2; }': () + [52; 70) 'E::V1 ...d: 1 }': E + [67; 68) '1': u32 + [74; 79) 'E::V2': E + "### ); } #[test] fn infer_refs() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" fn test(a: &u32, b: &mut u32, c: *const u32, d: *mut u32) { a; @@ -322,35 +332,37 @@ fn test(a: &u32, b: &mut u32, c: *const u32, d: *mut u32) { } "#), @r###" -[9; 10) 'a': &u32 -[18; 19) 'b': &mut u32 -[31; 32) 'c': *const u32 -[46; 47) 'd': *mut u32 -[59; 150) '{ ... *d; }': () -[65; 66) 'a': &u32 -[72; 74) '*a': u32 -[73; 74) 'a': &u32 -[80; 82) '&a': &&u32 -[81; 82) 'a': &u32 -[88; 94) '&mut a': &mut &u32 -[93; 94) 'a': &u32 -[100; 101) 'b': &mut u32 -[107; 109) '*b': u32 -[108; 109) 'b': &mut u32 -[115; 117) '&b': &&mut u32 -[116; 117) 'b': &mut u32 -[123; 124) 'c': *const u32 -[130; 132) '*c': u32 -[131; 132) 'c': *const u32 -[138; 139) 'd': *mut u32 -[145; 147) '*d': u32 -[146; 147) 'd': *mut u32"### + + [9; 10) 'a': &u32 + [18; 19) 'b': &mut u32 + [31; 32) 'c': *const u32 + [46; 47) 'd': *mut u32 + [59; 150) '{ ... *d; }': () + [65; 66) 'a': &u32 + [72; 74) '*a': u32 + [73; 74) 'a': &u32 + [80; 82) '&a': &&u32 + [81; 82) 'a': &u32 + [88; 94) '&mut a': &mut &u32 + [93; 94) 'a': &u32 + [100; 101) 'b': &mut u32 + [107; 109) '*b': u32 + [108; 109) 'b': &mut u32 + [115; 117) '&b': &&mut u32 + [116; 117) 'b': &mut u32 + [123; 124) 'c': *const u32 + [130; 132) '*c': u32 + [131; 132) 'c': *const u32 + [138; 139) 'd': *mut u32 + [145; 147) '*d': u32 + [146; 147) 'd': *mut u32 + "### ); } #[test] fn infer_literals() { - assert_snapshot_matches!( + assert_snapshot!( infer(r##" fn test() { 5i32; @@ -373,26 +385,28 @@ fn test() { } "##), @r###" -[11; 221) '{ ...o"#; }': () -[17; 21) '5i32': i32 -[27; 31) '5f32': f32 -[37; 41) '5f64': f64 -[47; 54) '"hello"': &str -[60; 68) 'b"bytes"': &[u8] -[74; 77) ''c'': char -[83; 87) 'b'b'': u8 -[93; 97) '3.14': f64 -[103; 107) '5000': i32 -[113; 118) 'false': bool -[124; 128) 'true': bool -[134; 202) 'r#" ... "#': &str -[208; 218) 'br#"yolo"#': &[u8]"### + + [11; 221) '{ ...o"#; }': () + [17; 21) '5i32': i32 + [27; 31) '5f32': f32 + [37; 41) '5f64': f64 + [47; 54) '"hello"': &str + [60; 68) 'b"bytes"': &[u8] + [74; 77) ''c'': char + [83; 87) 'b'b'': u8 + [93; 97) '3.14': f64 + [103; 107) '5000': i32 + [113; 118) 'false': bool + [124; 128) 'true': bool + [134; 202) 'r#" ... "#': &str + [208; 218) 'br#"yolo"#': &[u8] + "### ); } #[test] fn infer_unary_op() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" enum SomeType {} @@ -415,53 +429,55 @@ fn test(x: SomeType) { } "#), @r###" -[27; 28) 'x': SomeType -[40; 272) '{ ...lo"; }': () -[50; 51) 'b': bool -[54; 59) 'false': bool -[69; 70) 'c': bool -[73; 75) '!b': bool -[74; 75) 'b': bool -[85; 86) 'a': i128 -[89; 92) '100': i128 -[102; 103) 'd': i128 -[112; 114) '-a': i128 -[113; 114) 'a': i128 -[124; 125) 'e': i32 -[128; 132) '-100': i32 -[129; 132) '100': i32 -[142; 143) 'f': bool -[146; 153) '!!!true': bool -[147; 153) '!!true': bool -[148; 153) '!true': bool -[149; 153) 'true': bool -[163; 164) 'g': i32 -[167; 170) '!42': i32 -[168; 170) '42': i32 -[180; 181) 'h': u32 -[184; 190) '!10u32': u32 -[185; 190) '10u32': u32 -[200; 201) 'j': i128 -[204; 206) '!a': i128 -[205; 206) 'a': i128 -[212; 217) '-3.14': f64 -[213; 217) '3.14': f64 -[223; 225) '!3': i32 -[224; 225) '3': i32 -[231; 233) '-x': {unknown} -[232; 233) 'x': SomeType -[239; 241) '!x': {unknown} -[240; 241) 'x': SomeType -[247; 255) '-"hello"': {unknown} -[248; 255) '"hello"': &str -[261; 269) '!"hello"': {unknown} -[262; 269) '"hello"': &str"### + + [27; 28) 'x': SomeType + [40; 272) '{ ...lo"; }': () + [50; 51) 'b': bool + [54; 59) 'false': bool + [69; 70) 'c': bool + [73; 75) '!b': bool + [74; 75) 'b': bool + [85; 86) 'a': i128 + [89; 92) '100': i128 + [102; 103) 'd': i128 + [112; 114) '-a': i128 + [113; 114) 'a': i128 + [124; 125) 'e': i32 + [128; 132) '-100': i32 + [129; 132) '100': i32 + [142; 143) 'f': bool + [146; 153) '!!!true': bool + [147; 153) '!!true': bool + [148; 153) '!true': bool + [149; 153) 'true': bool + [163; 164) 'g': i32 + [167; 170) '!42': i32 + [168; 170) '42': i32 + [180; 181) 'h': u32 + [184; 190) '!10u32': u32 + [185; 190) '10u32': u32 + [200; 201) 'j': i128 + [204; 206) '!a': i128 + [205; 206) 'a': i128 + [212; 217) '-3.14': f64 + [213; 217) '3.14': f64 + [223; 225) '!3': i32 + [224; 225) '3': i32 + [231; 233) '-x': {unknown} + [232; 233) 'x': SomeType + [239; 241) '!x': {unknown} + [240; 241) 'x': SomeType + [247; 255) '-"hello"': {unknown} + [248; 255) '"hello"': &str + [261; 269) '!"hello"': {unknown} + [262; 269) '"hello"': &str + "### ); } #[test] fn infer_backwards() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" fn takes_u32(x: u32) {} @@ -477,32 +493,34 @@ fn test() -> &mut &f64 { } "#), @r###" -[14; 15) 'x': u32 -[22; 24) '{}': () -[78; 231) '{ ...t &c }': &mut &f64 -[88; 89) 'a': u32 -[92; 108) 'unknow...nction': {unknown} -[92; 110) 'unknow...tion()': u32 -[116; 125) 'takes_u32': fn takes_u32(u32) -> () -[116; 128) 'takes_u32(a)': () -[126; 127) 'a': u32 -[138; 139) 'b': i32 -[142; 158) 'unknow...nction': {unknown} -[142; 160) 'unknow...tion()': i32 -[166; 184) 'S { i3...d: b }': S -[181; 182) 'b': i32 -[194; 195) 'c': f64 -[198; 214) 'unknow...nction': {unknown} -[198; 216) 'unknow...tion()': f64 -[222; 229) '&mut &c': &mut &f64 -[227; 229) '&c': &f64 -[228; 229) 'c': f64"### + + [14; 15) 'x': u32 + [22; 24) '{}': () + [78; 231) '{ ...t &c }': &mut &f64 + [88; 89) 'a': u32 + [92; 108) 'unknow...nction': {unknown} + [92; 110) 'unknow...tion()': u32 + [116; 125) 'takes_u32': fn takes_u32(u32) -> () + [116; 128) 'takes_u32(a)': () + [126; 127) 'a': u32 + [138; 139) 'b': i32 + [142; 158) 'unknow...nction': {unknown} + [142; 160) 'unknow...tion()': i32 + [166; 184) 'S { i3...d: b }': S + [181; 182) 'b': i32 + [194; 195) 'c': f64 + [198; 214) 'unknow...nction': {unknown} + [198; 216) 'unknow...tion()': f64 + [222; 229) '&mut &c': &mut &f64 + [227; 229) '&c': &f64 + [228; 229) 'c': f64 + "### ); } #[test] fn infer_self() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct S; @@ -522,22 +540,24 @@ impl S { } "#), @r###" -[34; 38) 'self': &S -[40; 61) '{ ... }': () -[50; 54) 'self': &S -[75; 79) 'self': &S -[88; 109) '{ ... }': () -[98; 102) 'self': &S -[133; 153) '{ ... }': S -[143; 147) 'S {}': S -[177; 200) '{ ... }': S -[187; 194) 'Self {}': S"### + + [34; 38) 'self': &S + [40; 61) '{ ... }': () + [50; 54) 'self': &S + [75; 79) 'self': &S + [88; 109) '{ ... }': () + [98; 102) 'self': &S + [133; 153) '{ ... }': S + [143; 147) 'S {}': S + [177; 200) '{ ... }': S + [187; 194) 'Self {}': S + "### ); } #[test] fn infer_binary_op() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" fn f(x: bool) -> i32 { 0i32 @@ -560,62 +580,64 @@ fn test() -> bool { } "#), @r###" -[6; 7) 'x': bool -[22; 34) '{ 0i32 }': i32 -[28; 32) '0i32': i32 -[54; 370) '{ ... < 3 }': bool -[64; 65) 'x': bool -[68; 69) 'a': bool -[68; 74) 'a && b': bool -[73; 74) 'b': bool -[84; 85) 'y': bool -[88; 92) 'true': bool -[88; 101) 'true || false': bool -[96; 101) 'false': bool -[111; 112) 'z': bool -[115; 116) 'x': bool -[115; 121) 'x == y': bool -[120; 121) 'y': bool -[131; 132) 't': bool -[135; 136) 'x': bool -[135; 141) 'x != y': bool -[140; 141) 'y': bool -[151; 162) 'minus_forty': isize -[172; 180) '-40isize': isize -[173; 180) '40isize': isize -[190; 191) 'h': bool -[194; 205) 'minus_forty': isize -[194; 216) 'minus_...ONST_2': bool -[209; 216) 'CONST_2': isize -[226; 227) 'c': i32 -[230; 231) 'f': fn f(bool) -> i32 -[230; 239) 'f(z || y)': i32 -[230; 243) 'f(z || y) + 5': i32 -[232; 233) 'z': bool -[232; 238) 'z || y': bool -[237; 238) 'y': bool -[242; 243) '5': i32 -[253; 254) 'd': {unknown} -[257; 258) 'b': {unknown} -[268; 269) 'g': () -[272; 283) 'minus_forty': isize -[272; 288) 'minus_...y ^= i': () -[287; 288) 'i': isize -[298; 301) 'ten': usize -[311; 313) '10': usize -[323; 336) 'ten_is_eleven': bool -[339; 342) 'ten': usize -[339; 354) 'ten == some_num': bool -[346; 354) 'some_num': usize -[361; 364) 'ten': usize -[361; 368) 'ten < 3': bool -[367; 368) '3': usize"### + + [6; 7) 'x': bool + [22; 34) '{ 0i32 }': i32 + [28; 32) '0i32': i32 + [54; 370) '{ ... < 3 }': bool + [64; 65) 'x': bool + [68; 69) 'a': bool + [68; 74) 'a && b': bool + [73; 74) 'b': bool + [84; 85) 'y': bool + [88; 92) 'true': bool + [88; 101) 'true || false': bool + [96; 101) 'false': bool + [111; 112) 'z': bool + [115; 116) 'x': bool + [115; 121) 'x == y': bool + [120; 121) 'y': bool + [131; 132) 't': bool + [135; 136) 'x': bool + [135; 141) 'x != y': bool + [140; 141) 'y': bool + [151; 162) 'minus_forty': isize + [172; 180) '-40isize': isize + [173; 180) '40isize': isize + [190; 191) 'h': bool + [194; 205) 'minus_forty': isize + [194; 216) 'minus_...ONST_2': bool + [209; 216) 'CONST_2': isize + [226; 227) 'c': i32 + [230; 231) 'f': fn f(bool) -> i32 + [230; 239) 'f(z || y)': i32 + [230; 243) 'f(z || y) + 5': i32 + [232; 233) 'z': bool + [232; 238) 'z || y': bool + [237; 238) 'y': bool + [242; 243) '5': i32 + [253; 254) 'd': {unknown} + [257; 258) 'b': {unknown} + [268; 269) 'g': () + [272; 283) 'minus_forty': isize + [272; 288) 'minus_...y ^= i': () + [287; 288) 'i': isize + [298; 301) 'ten': usize + [311; 313) '10': usize + [323; 336) 'ten_is_eleven': bool + [339; 342) 'ten': usize + [339; 354) 'ten == some_num': bool + [346; 354) 'some_num': usize + [361; 364) 'ten': usize + [361; 368) 'ten < 3': bool + [367; 368) '3': usize + "### ); } #[test] fn infer_field_autoderef() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct A { b: B, @@ -641,72 +663,76 @@ fn test2(a1: *const A, a2: *mut A) { } "#), @r###" -[44; 45) 'a': A -[50; 213) '{ ...5.b; }': () -[60; 62) 'a1': A -[65; 66) 'a': A -[72; 74) 'a1': A -[72; 76) 'a1.b': B -[86; 88) 'a2': &A -[91; 93) '&a': &A -[92; 93) 'a': A -[99; 101) 'a2': &A -[99; 103) 'a2.b': B -[113; 115) 'a3': &mut A -[118; 124) '&mut a': &mut A -[123; 124) 'a': A -[130; 132) 'a3': &mut A -[130; 134) 'a3.b': B -[144; 146) 'a4': &&&&&&&A -[149; 157) '&&&&&&&a': &&&&&&&A -[150; 157) '&&&&&&a': &&&&&&A -[151; 157) '&&&&&a': &&&&&A -[152; 157) '&&&&a': &&&&A -[153; 157) '&&&a': &&&A -[154; 157) '&&a': &&A -[155; 157) '&a': &A -[156; 157) 'a': A -[163; 165) 'a4': &&&&&&&A -[163; 167) 'a4.b': B -[177; 179) 'a5': &mut &&mut &&mut A -[182; 200) '&mut &...&mut a': &mut &&mut &&mut A -[187; 200) '&&mut &&mut a': &&mut &&mut A -[188; 200) '&mut &&mut a': &mut &&mut A -[193; 200) '&&mut a': &&mut A -[194; 200) '&mut a': &mut A -[199; 200) 'a': A -[206; 208) 'a5': &mut &&mut &&mut A -[206; 210) 'a5.b': B -[224; 226) 'a1': *const A -[238; 240) 'a2': *mut A -[250; 273) '{ ...2.b; }': () -[256; 258) 'a1': *const A -[256; 260) 'a1.b': B -[266; 268) 'a2': *mut A -[266; 270) 'a2.b': B"### + + [44; 45) 'a': A + [50; 213) '{ ...5.b; }': () + [60; 62) 'a1': A + [65; 66) 'a': A + [72; 74) 'a1': A + [72; 76) 'a1.b': B + [86; 88) 'a2': &A + [91; 93) '&a': &A + [92; 93) 'a': A + [99; 101) 'a2': &A + [99; 103) 'a2.b': B + [113; 115) 'a3': &mut A + [118; 124) '&mut a': &mut A + [123; 124) 'a': A + [130; 132) 'a3': &mut A + [130; 134) 'a3.b': B + [144; 146) 'a4': &&&&&&&A + [149; 157) '&&&&&&&a': &&&&&&&A + [150; 157) '&&&&&&a': &&&&&&A + [151; 157) '&&&&&a': &&&&&A + [152; 157) '&&&&a': &&&&A + [153; 157) '&&&a': &&&A + [154; 157) '&&a': &&A + [155; 157) '&a': &A + [156; 157) 'a': A + [163; 165) 'a4': &&&&&&&A + [163; 167) 'a4.b': B + [177; 179) 'a5': &mut &&mut &&mut A + [182; 200) '&mut &...&mut a': &mut &&mut &&mut A + [187; 200) '&&mut &&mut a': &&mut &&mut A + [188; 200) '&mut &&mut a': &mut &&mut A + [193; 200) '&&mut a': &&mut A + [194; 200) '&mut a': &mut A + [199; 200) 'a': A + [206; 208) 'a5': &mut &&mut &&mut A + [206; 210) 'a5.b': B + [224; 226) 'a1': *const A + [238; 240) 'a2': *mut A + [250; 273) '{ ...2.b; }': () + [256; 258) 'a1': *const A + [256; 260) 'a1.b': B + [266; 268) 'a2': *mut A + [266; 270) 'a2.b': B + "### ); } #[test] fn bug_484() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" fn test() { let x = if true {}; } "#), @r###" -[11; 37) '{ l... {}; }': () -[20; 21) 'x': () -[24; 34) 'if true {}': () -[27; 31) 'true': bool -[32; 34) '{}': ()"### + + [11; 37) '{ l... {}; }': () + [20; 21) 'x': () + [24; 34) 'if true {}': () + [27; 31) 'true': bool + [32; 34) '{}': () + "### ); } #[test] fn infer_in_elseif() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct Foo { field: i32 } fn main(foo: Foo) { @@ -718,24 +744,23 @@ fn main(foo: Foo) { } "#), @r###" - ⋮ - ⋮[35; 38) 'foo': Foo - ⋮[45; 109) '{ ... } }': () - ⋮[51; 107) 'if tru... }': () - ⋮[54; 58) 'true': bool - ⋮[59; 67) '{ }': () - ⋮[73; 107) 'if fal... }': () - ⋮[76; 81) 'false': bool - ⋮[82; 107) '{ ... }': i32 - ⋮[92; 95) 'foo': Foo - ⋮[92; 101) 'foo.field': i32 + [35; 38) 'foo': Foo + [45; 109) '{ ... } }': () + [51; 107) 'if tru... }': () + [54; 58) 'true': bool + [59; 67) '{ }': () + [73; 107) 'if fal... }': () + [76; 81) 'false': bool + [82; 107) '{ ... }': i32 + [92; 95) 'foo': Foo + [92; 101) 'foo.field': i32 "### ) } #[test] fn infer_inherent_method() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct A; @@ -756,30 +781,32 @@ fn test(a: A) { } "#), @r###" -[32; 36) 'self': A -[38; 39) 'x': u32 -[53; 55) '{}': () -[103; 107) 'self': &A -[109; 110) 'x': u64 -[124; 126) '{}': () -[144; 145) 'a': A -[150; 198) '{ ...(1); }': () -[156; 157) 'a': A -[156; 164) 'a.foo(1)': i32 -[162; 163) '1': u32 -[170; 181) '(&a).bar(1)': i64 -[171; 173) '&a': &A -[172; 173) 'a': A -[179; 180) '1': u64 -[187; 188) 'a': A -[187; 195) 'a.bar(1)': i64 -[193; 194) '1': u64"### + + [32; 36) 'self': A + [38; 39) 'x': u32 + [53; 55) '{}': () + [103; 107) 'self': &A + [109; 110) 'x': u64 + [124; 126) '{}': () + [144; 145) 'a': A + [150; 198) '{ ...(1); }': () + [156; 157) 'a': A + [156; 164) 'a.foo(1)': i32 + [162; 163) '1': u32 + [170; 181) '(&a).bar(1)': i64 + [171; 173) '&a': &A + [172; 173) 'a': A + [179; 180) '1': u64 + [187; 188) 'a': A + [187; 195) 'a.bar(1)': i64 + [193; 194) '1': u64 + "### ); } #[test] fn infer_inherent_method_str() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" #[lang = "str"] impl str { @@ -791,17 +818,19 @@ fn test() { } "#), @r###" -[40; 44) 'self': &str -[53; 55) '{}': () -[69; 89) '{ ...o(); }': () -[75; 80) '"foo"': &str -[75; 86) '"foo".foo()': i32"### + + [40; 44) 'self': &str + [53; 55) '{}': () + [69; 89) '{ ...o(); }': () + [75; 80) '"foo"': &str + [75; 86) '"foo".foo()': i32 + "### ); } #[test] fn infer_tuple() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" fn test(x: &str, y: isize) { let a: (u32, &str) = (1, "a"); @@ -813,39 +842,41 @@ fn test(x: &str, y: isize) { } "#), @r###" -[9; 10) 'x': &str -[18; 19) 'y': isize -[28; 170) '{ ...d"); }': () -[38; 39) 'a': (u32, &str) -[55; 63) '(1, "a")': (u32, &str) -[56; 57) '1': u32 -[59; 62) '"a"': &str -[73; 74) 'b': ((u32, &str), &str) -[77; 83) '(a, x)': ((u32, &str), &str) -[78; 79) 'a': (u32, &str) -[81; 82) 'x': &str -[93; 94) 'c': (isize, &str) -[97; 103) '(y, x)': (isize, &str) -[98; 99) 'y': isize -[101; 102) 'x': &str -[113; 114) 'd': ((isize, &str), &str) -[117; 123) '(c, x)': ((isize, &str), &str) -[118; 119) 'c': (isize, &str) -[121; 122) 'x': &str -[133; 134) 'e': (i32, &str) -[137; 145) '(1, "e")': (i32, &str) -[138; 139) '1': i32 -[141; 144) '"e"': &str -[155; 156) 'f': ((i32, &str), &str) -[159; 167) '(e, "d")': ((i32, &str), &str) -[160; 161) 'e': (i32, &str) -[163; 166) '"d"': &str"### + + [9; 10) 'x': &str + [18; 19) 'y': isize + [28; 170) '{ ...d"); }': () + [38; 39) 'a': (u32, &str) + [55; 63) '(1, "a")': (u32, &str) + [56; 57) '1': u32 + [59; 62) '"a"': &str + [73; 74) 'b': ((u32, &str), &str) + [77; 83) '(a, x)': ((u32, &str), &str) + [78; 79) 'a': (u32, &str) + [81; 82) 'x': &str + [93; 94) 'c': (isize, &str) + [97; 103) '(y, x)': (isize, &str) + [98; 99) 'y': isize + [101; 102) 'x': &str + [113; 114) 'd': ((isize, &str), &str) + [117; 123) '(c, x)': ((isize, &str), &str) + [118; 119) 'c': (isize, &str) + [121; 122) 'x': &str + [133; 134) 'e': (i32, &str) + [137; 145) '(1, "e")': (i32, &str) + [138; 139) '1': i32 + [141; 144) '"e"': &str + [155; 156) 'f': ((i32, &str), &str) + [159; 167) '(e, "d")': ((i32, &str), &str) + [160; 161) 'e': (i32, &str) + [163; 166) '"d"': &str + "### ); } #[test] fn infer_array() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" fn test(x: &str, y: isize) { let a = [x]; @@ -867,70 +898,72 @@ fn test(x: &str, y: isize) { } "#), @r###" -[9; 10) 'x': &str -[18; 19) 'y': isize -[28; 324) '{ ... 3]; }': () -[38; 39) 'a': [&str;_] -[42; 45) '[x]': [&str;_] -[43; 44) 'x': &str -[55; 56) 'b': [[&str;_];_] -[59; 65) '[a, a]': [[&str;_];_] -[60; 61) 'a': [&str;_] -[63; 64) 'a': [&str;_] -[75; 76) 'c': [[[&str;_];_];_] -[79; 85) '[b, b]': [[[&str;_];_];_] -[80; 81) 'b': [[&str;_];_] -[83; 84) 'b': [[&str;_];_] -[96; 97) 'd': [isize;_] -[100; 112) '[y, 1, 2, 3]': [isize;_] -[101; 102) 'y': isize -[104; 105) '1': isize -[107; 108) '2': isize -[110; 111) '3': isize -[122; 123) 'd': [isize;_] -[126; 138) '[1, y, 2, 3]': [isize;_] -[127; 128) '1': isize -[130; 131) 'y': isize -[133; 134) '2': isize -[136; 137) '3': isize -[148; 149) 'e': [isize;_] -[152; 155) '[y]': [isize;_] -[153; 154) 'y': isize -[165; 166) 'f': [[isize;_];_] -[169; 175) '[d, d]': [[isize;_];_] -[170; 171) 'd': [isize;_] -[173; 174) 'd': [isize;_] -[185; 186) 'g': [[isize;_];_] -[189; 195) '[e, e]': [[isize;_];_] -[190; 191) 'e': [isize;_] -[193; 194) 'e': [isize;_] -[206; 207) 'h': [i32;_] -[210; 216) '[1, 2]': [i32;_] -[211; 212) '1': i32 -[214; 215) '2': i32 -[226; 227) 'i': [&str;_] -[230; 240) '["a", "b"]': [&str;_] -[231; 234) '"a"': &str -[236; 239) '"b"': &str -[251; 252) 'b': [[&str;_];_] -[255; 265) '[a, ["b"]]': [[&str;_];_] -[256; 257) 'a': [&str;_] -[259; 264) '["b"]': [&str;_] -[260; 263) '"b"': &str -[275; 276) 'x': [u8;_] -[288; 290) '[]': [u8;_] -[300; 301) 'z': &[u8;_] -[311; 321) '&[1, 2, 3]': &[u8;_] -[312; 321) '[1, 2, 3]': [u8;_] -[313; 314) '1': u8 -[316; 317) '2': u8 -[319; 320) '3': u8"### + + [9; 10) 'x': &str + [18; 19) 'y': isize + [28; 324) '{ ... 3]; }': () + [38; 39) 'a': [&str;_] + [42; 45) '[x]': [&str;_] + [43; 44) 'x': &str + [55; 56) 'b': [[&str;_];_] + [59; 65) '[a, a]': [[&str;_];_] + [60; 61) 'a': [&str;_] + [63; 64) 'a': [&str;_] + [75; 76) 'c': [[[&str;_];_];_] + [79; 85) '[b, b]': [[[&str;_];_];_] + [80; 81) 'b': [[&str;_];_] + [83; 84) 'b': [[&str;_];_] + [96; 97) 'd': [isize;_] + [100; 112) '[y, 1, 2, 3]': [isize;_] + [101; 102) 'y': isize + [104; 105) '1': isize + [107; 108) '2': isize + [110; 111) '3': isize + [122; 123) 'd': [isize;_] + [126; 138) '[1, y, 2, 3]': [isize;_] + [127; 128) '1': isize + [130; 131) 'y': isize + [133; 134) '2': isize + [136; 137) '3': isize + [148; 149) 'e': [isize;_] + [152; 155) '[y]': [isize;_] + [153; 154) 'y': isize + [165; 166) 'f': [[isize;_];_] + [169; 175) '[d, d]': [[isize;_];_] + [170; 171) 'd': [isize;_] + [173; 174) 'd': [isize;_] + [185; 186) 'g': [[isize;_];_] + [189; 195) '[e, e]': [[isize;_];_] + [190; 191) 'e': [isize;_] + [193; 194) 'e': [isize;_] + [206; 207) 'h': [i32;_] + [210; 216) '[1, 2]': [i32;_] + [211; 212) '1': i32 + [214; 215) '2': i32 + [226; 227) 'i': [&str;_] + [230; 240) '["a", "b"]': [&str;_] + [231; 234) '"a"': &str + [236; 239) '"b"': &str + [251; 252) 'b': [[&str;_];_] + [255; 265) '[a, ["b"]]': [[&str;_];_] + [256; 257) 'a': [&str;_] + [259; 264) '["b"]': [&str;_] + [260; 263) '"b"': &str + [275; 276) 'x': [u8;_] + [288; 290) '[]': [u8;_] + [300; 301) 'z': &[u8;_] + [311; 321) '&[1, 2, 3]': &[u8;_] + [312; 321) '[1, 2, 3]': [u8;_] + [313; 314) '1': u8 + [316; 317) '2': u8 + [319; 320) '3': u8 + "### ); } #[test] fn infer_pattern() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" fn test(x: &i32) { let y = x; @@ -955,59 +988,61 @@ fn test(x: &i32) { } "#), @r###" -[9; 10) 'x': &i32 -[18; 369) '{ ...o_x; }': () -[28; 29) 'y': &i32 -[32; 33) 'x': &i32 -[43; 45) '&z': &i32 -[44; 45) 'z': i32 -[48; 49) 'x': &i32 -[59; 60) 'a': i32 -[63; 64) 'z': i32 -[74; 80) '(c, d)': (i32, &str) -[75; 76) 'c': i32 -[78; 79) 'd': &str -[83; 95) '(1, "hello")': (i32, &str) -[84; 85) '1': i32 -[87; 94) '"hello"': &str -[102; 152) 'for (e... }': () -[106; 112) '(e, f)': ({unknown}, {unknown}) -[107; 108) 'e': {unknown} -[110; 111) 'f': {unknown} -[116; 125) 'some_iter': {unknown} -[126; 152) '{ ... }': () -[140; 141) 'g': {unknown} -[144; 145) 'e': {unknown} -[158; 205) 'if let... }': () -[165; 170) '[val]': {unknown} -[173; 176) 'opt': {unknown} -[177; 205) '{ ... }': () -[191; 192) 'h': {unknown} -[195; 198) 'val': {unknown} -[215; 221) 'lambda': {unknown} -[224; 256) '|a: u6...b; c }': {unknown} -[225; 226) 'a': u64 -[233; 234) 'b': u64 -[236; 237) 'c': i32 -[244; 256) '{ a + b; c }': i32 -[246; 247) 'a': u64 -[246; 251) 'a + b': u64 -[250; 251) 'b': u64 -[253; 254) 'c': i32 -[267; 279) 'ref ref_to_x': &&i32 -[282; 283) 'x': &i32 -[293; 302) 'mut mut_x': &i32 -[305; 306) 'x': &i32 -[316; 336) 'ref mu...f_to_x': &mut &i32 -[339; 340) 'x': &i32 -[350; 351) 'k': &mut &i32 -[354; 366) 'mut_ref_to_x': &mut &i32"### + + [9; 10) 'x': &i32 + [18; 369) '{ ...o_x; }': () + [28; 29) 'y': &i32 + [32; 33) 'x': &i32 + [43; 45) '&z': &i32 + [44; 45) 'z': i32 + [48; 49) 'x': &i32 + [59; 60) 'a': i32 + [63; 64) 'z': i32 + [74; 80) '(c, d)': (i32, &str) + [75; 76) 'c': i32 + [78; 79) 'd': &str + [83; 95) '(1, "hello")': (i32, &str) + [84; 85) '1': i32 + [87; 94) '"hello"': &str + [102; 152) 'for (e... }': () + [106; 112) '(e, f)': ({unknown}, {unknown}) + [107; 108) 'e': {unknown} + [110; 111) 'f': {unknown} + [116; 125) 'some_iter': {unknown} + [126; 152) '{ ... }': () + [140; 141) 'g': {unknown} + [144; 145) 'e': {unknown} + [158; 205) 'if let... }': () + [165; 170) '[val]': {unknown} + [173; 176) 'opt': {unknown} + [177; 205) '{ ... }': () + [191; 192) 'h': {unknown} + [195; 198) 'val': {unknown} + [215; 221) 'lambda': {unknown} + [224; 256) '|a: u6...b; c }': {unknown} + [225; 226) 'a': u64 + [233; 234) 'b': u64 + [236; 237) 'c': i32 + [244; 256) '{ a + b; c }': i32 + [246; 247) 'a': u64 + [246; 251) 'a + b': u64 + [250; 251) 'b': u64 + [253; 254) 'c': i32 + [267; 279) 'ref ref_to_x': &&i32 + [282; 283) 'x': &i32 + [293; 302) 'mut mut_x': &i32 + [305; 306) 'x': &i32 + [316; 336) 'ref mu...f_to_x': &mut &i32 + [339; 340) 'x': &i32 + [350; 351) 'k': &mut &i32 + [354; 366) 'mut_ref_to_x': &mut &i32 + "### ); } #[test] fn infer_pattern_match_ergonomics() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct A(T); @@ -1017,26 +1052,28 @@ fn test() { } "#), @r###" -[28; 79) '{ ...(1); }': () -[38; 42) 'A(n)': A -[40; 41) 'n': &i32 -[45; 50) '&A(1)': &A -[46; 47) 'A': A(T) -> A -[46; 50) 'A(1)': A -[48; 49) '1': i32 -[60; 64) 'A(n)': A -[62; 63) 'n': &mut i32 -[67; 76) '&mut A(1)': &mut A -[72; 73) 'A': A(T) -> A -[72; 76) 'A(1)': A -[74; 75) '1': i32"### + + [28; 79) '{ ...(1); }': () + [38; 42) 'A(n)': A + [40; 41) 'n': &i32 + [45; 50) '&A(1)': &A + [46; 47) 'A': A(T) -> A + [46; 50) 'A(1)': A + [48; 49) '1': i32 + [60; 64) 'A(n)': A + [62; 63) 'n': &mut i32 + [67; 76) '&mut A(1)': &mut A + [72; 73) 'A': A(T) -> A + [72; 76) 'A(1)': A + [74; 75) '1': i32 + "### ); } #[test] fn infer_pattern_match_ergonomics_ref() { covers!(match_ergonomics_ref); - assert_snapshot_matches!( + assert_snapshot!( infer(r#" fn test() { let v = &(1, &2); @@ -1044,24 +1081,26 @@ fn test() { } "#), @r###" -[11; 57) '{ ...= v; }': () -[21; 22) 'v': &(i32, &i32) -[25; 33) '&(1, &2)': &(i32, &i32) -[26; 33) '(1, &2)': (i32, &i32) -[27; 28) '1': i32 -[30; 32) '&2': &i32 -[31; 32) '2': i32 -[43; 50) '(_, &w)': (i32, &i32) -[44; 45) '_': i32 -[47; 49) '&w': &i32 -[48; 49) 'w': i32 -[53; 54) 'v': &(i32, &i32)"### + + [11; 57) '{ ...= v; }': () + [21; 22) 'v': &(i32, &i32) + [25; 33) '&(1, &2)': &(i32, &i32) + [26; 33) '(1, &2)': (i32, &i32) + [27; 28) '1': i32 + [30; 32) '&2': &i32 + [31; 32) '2': i32 + [43; 50) '(_, &w)': (i32, &i32) + [44; 45) '_': i32 + [47; 49) '&w': &i32 + [48; 49) 'w': i32 + [53; 54) 'v': &(i32, &i32) + "### ); } #[test] fn infer_adt_pattern() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" enum E { A { x: usize }, @@ -1087,37 +1126,39 @@ fn test() { } "#), @r###" -[68; 289) '{ ... d; }': () -[78; 79) 'e': E -[82; 95) 'E::A { x: 3 }': E -[92; 93) '3': usize -[106; 113) 'S(y, z)': S -[108; 109) 'y': u32 -[111; 112) 'z': E -[116; 119) 'foo': S -[129; 148) 'E::A {..._var }': E -[139; 146) 'new_var': usize -[151; 152) 'e': E -[159; 245) 'match ... }': usize -[165; 166) 'e': E -[177; 187) 'E::A { x }': E -[184; 185) 'x': usize -[191; 192) 'x': usize -[202; 206) 'E::B': E -[210; 213) 'foo': bool -[217; 218) '1': usize -[228; 232) 'E::B': E -[236; 238) '10': usize -[256; 275) 'ref d ...{ .. }': &E -[264; 275) 'E::A { .. }': E -[278; 279) 'e': E -[285; 286) 'd': &E"### + + [68; 289) '{ ... d; }': () + [78; 79) 'e': E + [82; 95) 'E::A { x: 3 }': E + [92; 93) '3': usize + [106; 113) 'S(y, z)': S + [108; 109) 'y': u32 + [111; 112) 'z': E + [116; 119) 'foo': S + [129; 148) 'E::A {..._var }': E + [139; 146) 'new_var': usize + [151; 152) 'e': E + [159; 245) 'match ... }': usize + [165; 166) 'e': E + [177; 187) 'E::A { x }': E + [184; 185) 'x': usize + [191; 192) 'x': usize + [202; 206) 'E::B': E + [210; 213) 'foo': bool + [217; 218) '1': usize + [228; 232) 'E::B': E + [236; 238) '10': usize + [256; 275) 'ref d ...{ .. }': &E + [264; 275) 'E::A { .. }': E + [278; 279) 'e': E + [285; 286) 'd': &E + "### ); } #[test] fn infer_struct_generics() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct A { x: T, @@ -1132,27 +1173,29 @@ fn test(a1: A, i: i32) { } "#), @r###" -[36; 38) 'a1': A -[48; 49) 'i': i32 -[56; 147) '{ ...3.x; }': () -[62; 64) 'a1': A -[62; 66) 'a1.x': u32 -[76; 78) 'a2': A -[81; 91) 'A { x: i }': A -[88; 89) 'i': i32 -[97; 99) 'a2': A -[97; 101) 'a2.x': i32 -[111; 113) 'a3': A -[116; 134) 'A:: -[131; 132) '1': i128 -[140; 142) 'a3': A -[140; 144) 'a3.x': i128"### + + [36; 38) 'a1': A + [48; 49) 'i': i32 + [56; 147) '{ ...3.x; }': () + [62; 64) 'a1': A + [62; 66) 'a1.x': u32 + [76; 78) 'a2': A + [81; 91) 'A { x: i }': A + [88; 89) 'i': i32 + [97; 99) 'a2': A + [97; 101) 'a2.x': i32 + [111; 113) 'a3': A + [116; 134) 'A:: + [131; 132) '1': i128 + [140; 142) 'a3': A + [140; 144) 'a3.x': i128 + "### ); } #[test] fn infer_tuple_struct_generics() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct A(T); enum Option { Some(T), None } @@ -1168,30 +1211,29 @@ fn test() { } "#), @r###" - ⋮ - ⋮[76; 184) '{ ...one; }': () - ⋮[82; 83) 'A': A(T) -> A - ⋮[82; 87) 'A(42)': A - ⋮[84; 86) '42': i32 - ⋮[93; 94) 'A': A(T) -> A - ⋮[93; 102) 'A(42u128)': A - ⋮[95; 101) '42u128': u128 - ⋮[108; 112) 'Some': Some<&str>(T) -> Option - ⋮[108; 117) 'Some("x")': Option<&str> - ⋮[113; 116) '"x"': &str - ⋮[123; 135) 'Option::Some': Some<&str>(T) -> Option - ⋮[123; 140) 'Option...e("x")': Option<&str> - ⋮[136; 139) '"x"': &str - ⋮[146; 150) 'None': Option<{unknown}> - ⋮[160; 161) 'x': Option - ⋮[177; 181) 'None': Option + [76; 184) '{ ...one; }': () + [82; 83) 'A': A(T) -> A + [82; 87) 'A(42)': A + [84; 86) '42': i32 + [93; 94) 'A': A(T) -> A + [93; 102) 'A(42u128)': A + [95; 101) '42u128': u128 + [108; 112) 'Some': Some<&str>(T) -> Option + [108; 117) 'Some("x")': Option<&str> + [113; 116) '"x"': &str + [123; 135) 'Option::Some': Some<&str>(T) -> Option + [123; 140) 'Option...e("x")': Option<&str> + [136; 139) '"x"': &str + [146; 150) 'None': Option<{unknown}> + [160; 161) 'x': Option + [177; 181) 'None': Option "### ); } #[test] fn infer_generics_in_patterns() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct A { x: T, @@ -1212,29 +1254,31 @@ fn test(a1: A, o: Option) { } "#), @r###" -[79; 81) 'a1': A -[91; 92) 'o': Option -[107; 244) '{ ... }; }': () -[117; 128) 'A { x: x2 }': A -[124; 126) 'x2': u32 -[131; 133) 'a1': A -[143; 161) 'A:: -[157; 159) 'x3': i64 -[164; 174) 'A { x: 1 }': A -[171; 172) '1': i64 -[180; 241) 'match ... }': u64 -[186; 187) 'o': Option -[198; 213) 'Option::Some(t)': Option -[211; 212) 't': u64 -[217; 218) 't': u64 -[228; 229) '_': Option -[233; 234) '1': u64"### + + [79; 81) 'a1': A + [91; 92) 'o': Option + [107; 244) '{ ... }; }': () + [117; 128) 'A { x: x2 }': A + [124; 126) 'x2': u32 + [131; 133) 'a1': A + [143; 161) 'A:: + [157; 159) 'x3': i64 + [164; 174) 'A { x: 1 }': A + [171; 172) '1': i64 + [180; 241) 'match ... }': u64 + [186; 187) 'o': Option + [198; 213) 'Option::Some(t)': Option + [211; 212) 't': u64 + [217; 218) 't': u64 + [228; 229) '_': Option + [233; 234) '1': u64 + "### ); } #[test] fn infer_function_generics() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" fn id(t: T) -> T { t } @@ -1245,26 +1289,28 @@ fn test() { } "#), @r###" -[10; 11) 't': T -[21; 26) '{ t }': T -[23; 24) 't': T -[38; 98) '{ ...(1); }': () -[44; 46) 'id': fn id(T) -> T -[44; 52) 'id(1u32)': u32 -[47; 51) '1u32': u32 -[58; 68) 'id::': fn id(T) -> T -[58; 71) 'id::(1)': i128 -[69; 70) '1': i128 -[81; 82) 'x': u64 -[90; 92) 'id': fn id(T) -> T -[90; 95) 'id(1)': u64 -[93; 94) '1': u64"### + + [10; 11) 't': T + [21; 26) '{ t }': T + [23; 24) 't': T + [38; 98) '{ ...(1); }': () + [44; 46) 'id': fn id(T) -> T + [44; 52) 'id(1u32)': u32 + [47; 51) '1u32': u32 + [58; 68) 'id::': fn id(T) -> T + [58; 71) 'id::(1)': i128 + [69; 70) '1': i128 + [81; 82) 'x': u64 + [90; 92) 'id': fn id(T) -> T + [90; 95) 'id(1)': u64 + [93; 94) '1': u64 + "### ); } #[test] fn infer_impl_generics() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct A { x: T1, @@ -1291,44 +1337,46 @@ fn test() -> i128 { } "#), @r###" -[74; 78) 'self': A -[85; 107) '{ ... }': X -[95; 99) 'self': A -[95; 101) 'self.x': X -[117; 121) 'self': A -[128; 150) '{ ... }': Y -[138; 142) 'self': A -[138; 144) 'self.y': Y -[163; 167) 'self': A -[169; 170) 't': T -[188; 223) '{ ... }': (X, Y, T) -[198; 217) '(self.....y, t)': (X, Y, T) -[199; 203) 'self': A -[199; 205) 'self.x': X -[207; 211) 'self': A -[207; 213) 'self.y': Y -[215; 216) 't': T -[245; 342) '{ ...(1); }': () -[255; 256) 'a': A -[259; 281) 'A { x:...1i64 }': A -[266; 270) '1u64': u64 -[275; 279) '1i64': i64 -[287; 288) 'a': A -[287; 292) 'a.x()': u64 -[298; 299) 'a': A -[298; 303) 'a.y()': i64 -[309; 310) 'a': A -[309; 319) 'a.z(1i128)': (u64, i64, i128) -[313; 318) '1i128': i128 -[325; 326) 'a': A -[325; 339) 'a.z::(1)': (u64, i64, u128) -[337; 338) '1': u128"### + + [74; 78) 'self': A + [85; 107) '{ ... }': X + [95; 99) 'self': A + [95; 101) 'self.x': X + [117; 121) 'self': A + [128; 150) '{ ... }': Y + [138; 142) 'self': A + [138; 144) 'self.y': Y + [163; 167) 'self': A + [169; 170) 't': T + [188; 223) '{ ... }': (X, Y, T) + [198; 217) '(self.....y, t)': (X, Y, T) + [199; 203) 'self': A + [199; 205) 'self.x': X + [207; 211) 'self': A + [207; 213) 'self.y': Y + [215; 216) 't': T + [245; 342) '{ ...(1); }': () + [255; 256) 'a': A + [259; 281) 'A { x:...1i64 }': A + [266; 270) '1u64': u64 + [275; 279) '1i64': i64 + [287; 288) 'a': A + [287; 292) 'a.x()': u64 + [298; 299) 'a': A + [298; 303) 'a.y()': i64 + [309; 310) 'a': A + [309; 319) 'a.z(1i128)': (u64, i64, i128) + [313; 318) '1i128': i128 + [325; 326) 'a': A + [325; 339) 'a.z::(1)': (u64, i64, u128) + [337; 338) '1': u128 + "### ); } #[test] fn infer_impl_generics_with_autoderef() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" enum Option { Some(T), @@ -1343,21 +1391,23 @@ fn test(o: Option) { } "#), @r###" -[78; 82) 'self': &Option -[98; 100) '{}': () -[111; 112) 'o': Option -[127; 165) '{ ...f(); }': () -[133; 146) '(&o).as_ref()': Option<&u32> -[134; 136) '&o': &Option -[135; 136) 'o': Option -[152; 153) 'o': Option -[152; 162) 'o.as_ref()': Option<&u32>"### + + [78; 82) 'self': &Option + [98; 100) '{}': () + [111; 112) 'o': Option + [127; 165) '{ ...f(); }': () + [133; 146) '(&o).as_ref()': Option<&u32> + [134; 136) '&o': &Option + [135; 136) 'o': Option + [152; 153) 'o': Option + [152; 162) 'o.as_ref()': Option<&u32> + "### ); } #[test] fn infer_generic_chain() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct A { x: T, @@ -1379,41 +1429,43 @@ fn test() -> i128 { } "#), @r###" -[53; 57) 'self': A -[65; 87) '{ ... }': T2 -[75; 79) 'self': A -[75; 81) 'self.x': T2 -[99; 100) 't': T -[110; 115) '{ t }': T -[112; 113) 't': T -[135; 261) '{ ....x() }': i128 -[146; 147) 'x': i128 -[150; 151) '1': i128 -[162; 163) 'y': i128 -[166; 168) 'id': fn id(T) -> T -[166; 171) 'id(x)': i128 -[169; 170) 'x': i128 -[182; 183) 'a': A -[186; 200) 'A { x: id(y) }': A -[193; 195) 'id': fn id(T) -> T -[193; 198) 'id(y)': i128 -[196; 197) 'y': i128 -[211; 212) 'z': i128 -[215; 217) 'id': fn id(T) -> T -[215; 222) 'id(a.x)': i128 -[218; 219) 'a': A -[218; 221) 'a.x': i128 -[233; 234) 'b': A -[237; 247) 'A { x: z }': A -[244; 245) 'z': i128 -[254; 255) 'b': A -[254; 259) 'b.x()': i128"### + + [53; 57) 'self': A + [65; 87) '{ ... }': T2 + [75; 79) 'self': A + [75; 81) 'self.x': T2 + [99; 100) 't': T + [110; 115) '{ t }': T + [112; 113) 't': T + [135; 261) '{ ....x() }': i128 + [146; 147) 'x': i128 + [150; 151) '1': i128 + [162; 163) 'y': i128 + [166; 168) 'id': fn id(T) -> T + [166; 171) 'id(x)': i128 + [169; 170) 'x': i128 + [182; 183) 'a': A + [186; 200) 'A { x: id(y) }': A + [193; 195) 'id': fn id(T) -> T + [193; 198) 'id(y)': i128 + [196; 197) 'y': i128 + [211; 212) 'z': i128 + [215; 217) 'id': fn id(T) -> T + [215; 222) 'id(a.x)': i128 + [218; 219) 'a': A + [218; 221) 'a.x': i128 + [233; 234) 'b': A + [237; 247) 'A { x: z }': A + [244; 245) 'z': i128 + [254; 255) 'b': A + [254; 259) 'b.x()': i128 + "### ); } #[test] fn infer_associated_const() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct Struct; @@ -1444,24 +1496,23 @@ fn test() { } "#), @r###" - ⋮ - ⋮[52; 53) '1': u32 - ⋮[105; 106) '2': u32 - ⋮[213; 214) '5': u32 - ⋮[229; 307) '{ ...:ID; }': () - ⋮[239; 240) 'x': u32 - ⋮[243; 254) 'Struct::FOO': u32 - ⋮[264; 265) 'y': u32 - ⋮[268; 277) 'Enum::BAR': u32 - ⋮[287; 288) 'z': {unknown} - ⋮[291; 304) 'TraitTest::ID': {unknown} + [52; 53) '1': u32 + [105; 106) '2': u32 + [213; 214) '5': u32 + [229; 307) '{ ...:ID; }': () + [239; 240) 'x': u32 + [243; 254) 'Struct::FOO': u32 + [264; 265) 'y': u32 + [268; 277) 'Enum::BAR': u32 + [287; 288) 'z': {unknown} + [291; 304) 'TraitTest::ID': {unknown} "### ); } #[test] fn infer_associated_method_struct() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct A { x: u32 } @@ -1476,23 +1527,22 @@ fn test() { } "#), @r###" - ⋮ - ⋮[49; 75) '{ ... }': A - ⋮[59; 69) 'A { x: 0 }': A - ⋮[66; 67) '0': u32 - ⋮[88; 122) '{ ...a.x; }': () - ⋮[98; 99) 'a': A - ⋮[102; 108) 'A::new': fn new() -> A - ⋮[102; 110) 'A::new()': A - ⋮[116; 117) 'a': A - ⋮[116; 119) 'a.x': u32 + [49; 75) '{ ... }': A + [59; 69) 'A { x: 0 }': A + [66; 67) '0': u32 + [88; 122) '{ ...a.x; }': () + [98; 99) 'a': A + [102; 108) 'A::new': fn new() -> A + [102; 110) 'A::new()': A + [116; 117) 'a': A + [116; 119) 'a.x': u32 "### ); } #[test] fn infer_associated_method_enum() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" enum A { B, C } @@ -1512,27 +1562,26 @@ fn test() { } "#), @r###" - ⋮ - ⋮[47; 67) '{ ... }': A - ⋮[57; 61) 'A::B': A - ⋮[88; 108) '{ ... }': A - ⋮[98; 102) 'A::C': A - ⋮[121; 178) '{ ... c; }': () - ⋮[131; 132) 'a': A - ⋮[135; 139) 'A::b': fn b() -> A - ⋮[135; 141) 'A::b()': A - ⋮[147; 148) 'a': A - ⋮[158; 159) 'c': A - ⋮[162; 166) 'A::c': fn c() -> A - ⋮[162; 168) 'A::c()': A - ⋮[174; 175) 'c': A + [47; 67) '{ ... }': A + [57; 61) 'A::B': A + [88; 108) '{ ... }': A + [98; 102) 'A::C': A + [121; 178) '{ ... c; }': () + [131; 132) 'a': A + [135; 139) 'A::b': fn b() -> A + [135; 141) 'A::b()': A + [147; 148) 'a': A + [158; 159) 'c': A + [162; 166) 'A::c': fn c() -> A + [162; 168) 'A::c()': A + [174; 175) 'c': A "### ); } #[test] fn infer_associated_method_with_modules() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" mod a { struct A; @@ -1557,28 +1606,30 @@ fn test() { } "#), @r###" -[56; 64) '{ A {} }': A -[58; 62) 'A {}': A -[126; 132) '{ 99 }': u32 -[128; 130) '99': u32 -[202; 210) '{ C {} }': C -[204; 208) 'C {}': C -[241; 325) '{ ...g(); }': () -[251; 252) 'x': A -[255; 266) 'a::A::thing': fn thing() -> A -[255; 268) 'a::A::thing()': A -[278; 279) 'y': u32 -[282; 293) 'b::B::thing': fn thing() -> u32 -[282; 295) 'b::B::thing()': u32 -[305; 306) 'z': C -[309; 320) 'c::C::thing': fn thing() -> C -[309; 322) 'c::C::thing()': C"### + + [56; 64) '{ A {} }': A + [58; 62) 'A {}': A + [126; 132) '{ 99 }': u32 + [128; 130) '99': u32 + [202; 210) '{ C {} }': C + [204; 208) 'C {}': C + [241; 325) '{ ...g(); }': () + [251; 252) 'x': A + [255; 266) 'a::A::thing': fn thing() -> A + [255; 268) 'a::A::thing()': A + [278; 279) 'y': u32 + [282; 293) 'b::B::thing': fn thing() -> u32 + [282; 295) 'b::B::thing()': u32 + [305; 306) 'z': C + [309; 320) 'c::C::thing': fn thing() -> C + [309; 322) 'c::C::thing()': C + "### ); } #[test] fn infer_associated_method_generics() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct Gen { val: T @@ -1595,21 +1646,23 @@ fn test() { } "#), @r###" -[64; 67) 'val': T -[82; 109) '{ ... }': Gen -[92; 103) 'Gen { val }': Gen -[98; 101) 'val': T -[123; 155) '{ ...32); }': () -[133; 134) 'a': Gen -[137; 146) 'Gen::make': fn make(T) -> Gen -[137; 152) 'Gen::make(0u32)': Gen -[147; 151) '0u32': u32"### + + [64; 67) 'val': T + [82; 109) '{ ... }': Gen + [92; 103) 'Gen { val }': Gen + [98; 101) 'val': T + [123; 155) '{ ...32); }': () + [133; 134) 'a': Gen + [137; 146) 'Gen::make': fn make(T) -> Gen + [137; 152) 'Gen::make(0u32)': Gen + [147; 151) '0u32': u32 + "### ); } #[test] fn infer_associated_method_generics_with_default_param() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct Gen { val: T @@ -1626,19 +1679,21 @@ fn test() { } "#), @r###" -[80; 104) '{ ... }': ! -[90; 98) 'loop { }': ! -[95; 98) '{ }': () -[118; 146) '{ ...e(); }': () -[128; 129) 'a': Gen -[132; 141) 'Gen::make': fn make() -> Gen -[132; 143) 'Gen::make()': Gen"### + + [80; 104) '{ ... }': ! + [90; 98) 'loop { }': ! + [95; 98) '{ }': () + [118; 146) '{ ...e(); }': () + [128; 129) 'a': Gen + [132; 141) 'Gen::make': fn make() -> Gen + [132; 143) 'Gen::make()': Gen + "### ); } #[test] fn infer_associated_method_generics_without_args() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct Gen { val: T @@ -1655,19 +1710,21 @@ fn test() { } "#), @r###" -[76; 100) '{ ... }': ! -[86; 94) 'loop { }': ! -[91; 94) '{ }': () -[114; 149) '{ ...e(); }': () -[124; 125) 'a': Gen -[128; 144) 'Gen::<...::make': fn make() -> Gen -[128; 146) 'Gen::<...make()': Gen"### + + [76; 100) '{ ... }': ! + [86; 94) 'loop { }': ! + [91; 94) '{ }': () + [114; 149) '{ ...e(); }': () + [124; 125) 'a': Gen + [128; 144) 'Gen::<...::make': fn make() -> Gen + [128; 146) 'Gen::<...make()': Gen + "### ); } #[test] fn infer_associated_method_generics_2_type_params_without_args() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct Gen { val: T, @@ -1685,19 +1742,21 @@ fn test() { } "#), @r###" -[102; 126) '{ ... }': ! -[112; 120) 'loop { }': ! -[117; 120) '{ }': () -[140; 180) '{ ...e(); }': () -[150; 151) 'a': Gen -[154; 175) 'Gen::<...::make': fn make() -> Gen -[154; 177) 'Gen::<...make()': Gen"### + + [102; 126) '{ ... }': ! + [112; 120) 'loop { }': ! + [117; 120) '{ }': () + [140; 180) '{ ...e(); }': () + [150; 151) 'a': Gen + [154; 175) 'Gen::<...::make': fn make() -> Gen + [154; 177) 'Gen::<...make()': Gen + "### ); } #[test] fn infer_type_alias() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct A { x: X, y: Y } type Foo = A; @@ -1713,23 +1772,22 @@ fn test(x: Foo, y: Bar<&str>, z: Baz) { } "#), @r###" - ⋮ - ⋮[116; 117) 'x': A - ⋮[124; 125) 'y': A<&str, u128> - ⋮[138; 139) 'z': A - ⋮[154; 211) '{ ...z.y; }': () - ⋮[160; 161) 'x': A - ⋮[160; 163) 'x.x': u32 - ⋮[169; 170) 'x': A - ⋮[169; 172) 'x.y': i128 - ⋮[178; 179) 'y': A<&str, u128> - ⋮[178; 181) 'y.x': &str - ⋮[187; 188) 'y': A<&str, u128> - ⋮[187; 190) 'y.y': u128 - ⋮[196; 197) 'z': A - ⋮[196; 199) 'z.x': u8 - ⋮[205; 206) 'z': A - ⋮[205; 208) 'z.y': i8 + [116; 117) 'x': A + [124; 125) 'y': A<&str, u128> + [138; 139) 'z': A + [154; 211) '{ ...z.y; }': () + [160; 161) 'x': A + [160; 163) 'x.x': u32 + [169; 170) 'x': A + [169; 172) 'x.y': i128 + [178; 179) 'y': A<&str, u128> + [178; 181) 'y.x': &str + [187; 188) 'y': A<&str, u128> + [187; 190) 'y.y': u128 + [196; 197) 'z': A + [196; 199) 'z.x': u8 + [205; 206) 'z': A + [205; 208) 'z.y': i8 "### ) } @@ -1737,7 +1795,7 @@ fn test(x: Foo, y: Bar<&str>, z: Baz) { #[test] #[should_panic] // we currently can't handle this fn recursive_type_alias() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct A {} type Foo = Foo; @@ -1750,7 +1808,7 @@ fn test(x: Foo) {} #[test] fn no_panic_on_field_of_enum() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" enum X {} @@ -1759,16 +1817,18 @@ fn test(x: X) { } "#), @r###" -[20; 21) 'x': X -[26; 47) '{ ...eld; }': () -[32; 33) 'x': X -[32; 44) 'x.some_field': {unknown}"### + + [20; 21) 'x': X + [26; 47) '{ ...eld; }': () + [32; 33) 'x': X + [32; 44) 'x.some_field': {unknown} + "### ); } #[test] fn bug_585() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" fn test() { X {}; @@ -1779,20 +1839,22 @@ fn test() { } "#), @r###" -[11; 89) '{ ... } }': () -[17; 21) 'X {}': {unknown} -[27; 87) 'match ... }': () -[33; 34) 'x': {unknown} -[45; 52) 'A::B {}': {unknown} -[56; 58) '()': () -[68; 74) 'A::Y()': {unknown} -[78; 80) '()': ()"### + + [11; 89) '{ ... } }': () + [17; 21) 'X {}': {unknown} + [27; 87) 'match ... }': () + [33; 34) 'x': {unknown} + [45; 52) 'A::B {}': {unknown} + [56; 58) '()': () + [68; 74) 'A::Y()': {unknown} + [78; 80) '()': () + "### ); } #[test] fn bug_651() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" fn quux() { let y = 92; @@ -1800,12 +1862,14 @@ fn quux() { } "#), @r###" -[11; 41) '{ ...+ y; }': () -[21; 22) 'y': i32 -[25; 27) '92': i32 -[33; 34) '1': i32 -[33; 38) '1 + y': i32 -[37; 38) 'y': i32"### + + [11; 41) '{ ...+ y; }': () + [21; 22) 'y': i32 + [25; 27) '92': i32 + [33; 34) '1': i32 + [33; 38) '1 + y': i32 + [37; 38) 'y': i32 + "### ); } @@ -1813,7 +1877,7 @@ fn quux() { fn recursive_vars() { covers!(type_var_cycles_resolve_completely); covers!(type_var_cycles_resolve_as_possible); - assert_snapshot_matches!( + assert_snapshot!( infer(r#" fn test() { let y = unknown; @@ -1821,13 +1885,15 @@ fn test() { } "#), @r###" -[11; 48) '{ ...&y]; }': () -[21; 22) 'y': &{unknown} -[25; 32) 'unknown': &{unknown} -[38; 45) '[y, &y]': [&&{unknown};_] -[39; 40) 'y': &{unknown} -[42; 44) '&y': &&{unknown} -[43; 44) 'y': &{unknown}"### + + [11; 48) '{ ...&y]; }': () + [21; 22) 'y': &{unknown} + [25; 32) 'unknown': &{unknown} + [38; 45) '[y, &y]': [&&{unknown};_] + [39; 40) 'y': &{unknown} + [42; 44) '&y': &&{unknown} + [43; 44) 'y': &{unknown} + "### ); } @@ -1835,7 +1901,7 @@ fn test() { fn recursive_vars_2() { covers!(type_var_cycles_resolve_completely); covers!(type_var_cycles_resolve_as_possible); - assert_snapshot_matches!( + assert_snapshot!( infer(r#" fn test() { let x = unknown; @@ -1844,26 +1910,28 @@ fn test() { } "#), @r###" -[11; 80) '{ ...x)]; }': () -[21; 22) 'x': &&{unknown} -[25; 32) 'unknown': &&{unknown} -[42; 43) 'y': &&{unknown} -[46; 53) 'unknown': &&{unknown} -[59; 77) '[(x, y..., &x)]': [(&&{unknown}, &&{unknown});_] -[60; 66) '(x, y)': (&&{unknown}, &&{unknown}) -[61; 62) 'x': &&{unknown} -[64; 65) 'y': &&{unknown} -[68; 76) '(&y, &x)': (&&&{unknown}, &&&{unknown}) -[69; 71) '&y': &&&{unknown} -[70; 71) 'y': &&{unknown} -[73; 75) '&x': &&&{unknown} -[74; 75) 'x': &&{unknown}"### + + [11; 80) '{ ...x)]; }': () + [21; 22) 'x': &&{unknown} + [25; 32) 'unknown': &&{unknown} + [42; 43) 'y': &&{unknown} + [46; 53) 'unknown': &&{unknown} + [59; 77) '[(x, y..., &x)]': [(&&{unknown}, &&{unknown});_] + [60; 66) '(x, y)': (&&{unknown}, &&{unknown}) + [61; 62) 'x': &&{unknown} + [64; 65) 'y': &&{unknown} + [68; 76) '(&y, &x)': (&&&{unknown}, &&&{unknown}) + [69; 71) '&y': &&&{unknown} + [70; 71) 'y': &&{unknown} + [73; 75) '&x': &&&{unknown} + [74; 75) 'x': &&{unknown} + "### ); } #[test] fn infer_type_param() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" fn id(x: T) -> T { x @@ -1881,32 +1949,34 @@ fn test() { } "#), @r###" -[10; 11) 'x': T -[21; 30) '{ x }': T -[27; 28) 'x': T -[44; 45) 'x': &T -[56; 65) '{ x }': &T -[62; 63) 'x': &T -[77; 157) '{ ...(1); }': () -[87; 88) 'y': u32 -[91; 96) '10u32': u32 -[102; 104) 'id': fn id(T) -> T -[102; 107) 'id(y)': u32 -[105; 106) 'y': u32 -[117; 118) 'x': bool -[127; 132) 'clone': fn clone(&T) -> T -[127; 135) 'clone(z)': bool -[133; 134) 'z': &bool -[141; 151) 'id::': fn id(T) -> T -[141; 154) 'id::(1)': i128 -[152; 153) '1': i128"### + + [10; 11) 'x': T + [21; 30) '{ x }': T + [27; 28) 'x': T + [44; 45) 'x': &T + [56; 65) '{ x }': &T + [62; 63) 'x': &T + [77; 157) '{ ...(1); }': () + [87; 88) 'y': u32 + [91; 96) '10u32': u32 + [102; 104) 'id': fn id(T) -> T + [102; 107) 'id(y)': u32 + [105; 106) 'y': u32 + [117; 118) 'x': bool + [127; 132) 'clone': fn clone(&T) -> T + [127; 135) 'clone(z)': bool + [133; 134) 'z': &bool + [141; 151) 'id::': fn id(T) -> T + [141; 154) 'id::(1)': i128 + [152; 153) '1': i128 + "### ); } #[test] fn infer_std_crash_1() { // caused stack overflow, taken from std - assert_snapshot_matches!( + assert_snapshot!( infer(r#" enum Maybe { Real(T), @@ -1920,12 +1990,14 @@ fn write() { } "#), @r###" -[54; 139) '{ ... } }': () -[60; 137) 'match ... }': () -[66; 83) 'someth...nknown': Maybe<{unknown}> -[94; 124) 'Maybe:...thing)': Maybe<{unknown}> -[106; 123) 'ref mu...ething': &mut {unknown} -[128; 130) '()': ()"### + + [54; 139) '{ ... } }': () + [60; 137) 'match ... }': () + [66; 83) 'someth...nknown': Maybe<{unknown}> + [94; 124) 'Maybe:...thing)': Maybe<{unknown}> + [106; 123) 'ref mu...ething': &mut {unknown} + [128; 130) '()': () + "### ); } @@ -1933,27 +2005,29 @@ fn write() { fn infer_std_crash_2() { covers!(type_var_resolves_to_int_var); // caused "equating two type variables, ...", taken from std - assert_snapshot_matches!( + assert_snapshot!( infer(r#" fn test_line_buffer() { &[0, b'\n', 1, b'\n']; } "#), @r###" -[23; 53) '{ ...n']; }': () -[29; 50) '&[0, b...b'\n']': &[u8;_] -[30; 50) '[0, b'...b'\n']': [u8;_] -[31; 32) '0': u8 -[34; 39) 'b'\n'': u8 -[41; 42) '1': u8 -[44; 49) 'b'\n'': u8"### + + [23; 53) '{ ...n']; }': () + [29; 50) '&[0, b...b'\n']': &[u8;_] + [30; 50) '[0, b'...b'\n']': [u8;_] + [31; 32) '0': u8 + [34; 39) 'b'\n'': u8 + [41; 42) '1': u8 + [44; 49) 'b'\n'': u8 + "### ); } #[test] fn infer_std_crash_3() { // taken from rustc - assert_snapshot_matches!( + assert_snapshot!( infer(r#" pub fn compute() { match nope!() { @@ -1962,14 +2036,13 @@ pub fn compute() { } "#), @r###" - ⋮ - ⋮[18; 108) '{ ... } }': () - ⋮[24; 106) 'match ... }': () - ⋮[30; 37) 'nope!()': {unknown} - ⋮[48; 94) 'SizeSk...tail }': {unknown} - ⋮[82; 86) 'true': {unknown} - ⋮[88; 92) 'tail': {unknown} - ⋮[98; 100) '{}': () + [18; 108) '{ ... } }': () + [24; 106) 'match ... }': () + [30; 37) 'nope!()': {unknown} + [48; 94) 'SizeSk...tail }': {unknown} + [82; 86) 'true': {unknown} + [88; 92) 'tail': {unknown} + [98; 100) '{}': () "### ); } @@ -1977,7 +2050,7 @@ pub fn compute() { #[test] fn infer_std_crash_4() { // taken from rustc - assert_snapshot_matches!( + assert_snapshot!( infer(r#" pub fn primitive_type() { match *self { @@ -1986,15 +2059,14 @@ pub fn primitive_type() { } "#), @r###" - ⋮ - ⋮[25; 106) '{ ... } }': () - ⋮[31; 104) 'match ... }': () - ⋮[37; 42) '*self': {unknown} - ⋮[38; 42) 'self': {unknown} - ⋮[53; 91) 'Borrow...), ..}': {unknown} - ⋮[74; 86) 'Primitive(p)': {unknown} - ⋮[84; 85) 'p': {unknown} - ⋮[95; 97) '{}': () + [25; 106) '{ ... } }': () + [31; 104) 'match ... }': () + [37; 42) '*self': {unknown} + [38; 42) 'self': {unknown} + [53; 91) 'Borrow...), ..}': {unknown} + [74; 86) 'Primitive(p)': {unknown} + [84; 85) 'p': {unknown} + [95; 97) '{}': () "### ); } @@ -2002,7 +2074,7 @@ pub fn primitive_type() { #[test] fn infer_std_crash_5() { // taken from rustc - assert_snapshot_matches!( + assert_snapshot!( infer(r#" fn extra_compiler_flags() { for content in doesnt_matter { @@ -2021,36 +2093,38 @@ fn extra_compiler_flags() { } "#), @r###" -[27; 323) '{ ... } }': () -[33; 321) 'for co... }': () -[37; 44) 'content': &{unknown} -[48; 61) 'doesnt_matter': {unknown} -[62; 321) '{ ... }': () -[76; 80) 'name': &&{unknown} -[83; 167) 'if doe... }': &&{unknown} -[86; 99) 'doesnt_matter': bool -[100; 129) '{ ... }': &&{unknown} -[114; 119) 'first': &&{unknown} -[135; 167) '{ ... }': &&{unknown} -[149; 157) '&content': &&{unknown} -[150; 157) 'content': &{unknown} -[182; 189) 'content': &&{unknown} -[192; 314) 'if ICE... }': &&{unknown} -[195; 232) 'ICE_RE..._VALUE': {unknown} -[195; 248) 'ICE_RE...&name)': bool -[242; 247) '&name': &&&{unknown} -[243; 247) 'name': &&{unknown} -[249; 277) '{ ... }': &&{unknown} -[263; 267) 'name': &&{unknown} -[283; 314) '{ ... }': &{unknown} -[297; 304) 'content': &{unknown}"### + + [27; 323) '{ ... } }': () + [33; 321) 'for co... }': () + [37; 44) 'content': &{unknown} + [48; 61) 'doesnt_matter': {unknown} + [62; 321) '{ ... }': () + [76; 80) 'name': &&{unknown} + [83; 167) 'if doe... }': &&{unknown} + [86; 99) 'doesnt_matter': bool + [100; 129) '{ ... }': &&{unknown} + [114; 119) 'first': &&{unknown} + [135; 167) '{ ... }': &&{unknown} + [149; 157) '&content': &&{unknown} + [150; 157) 'content': &{unknown} + [182; 189) 'content': &&{unknown} + [192; 314) 'if ICE... }': &&{unknown} + [195; 232) 'ICE_RE..._VALUE': {unknown} + [195; 248) 'ICE_RE...&name)': bool + [242; 247) '&name': &&&{unknown} + [243; 247) 'name': &&{unknown} + [249; 277) '{ ... }': &&{unknown} + [263; 267) 'name': &&{unknown} + [283; 314) '{ ... }': &{unknown} + [297; 304) 'content': &{unknown} + "### ); } #[test] fn infer_nested_generics_crash() { // another crash found typechecking rustc - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct Canonical { value: V, @@ -2063,17 +2137,19 @@ fn test(query_response: Canonical>) { } "#), @r###" -[92; 106) 'query_response': Canonical> -[137; 167) '{ ...lue; }': () -[143; 164) '&query....value': &QueryResponse -[144; 158) 'query_response': Canonical> -[144; 164) 'query_....value': QueryResponse"### + + [92; 106) 'query_response': Canonical> + [137; 167) '{ ...lue; }': () + [143; 164) '&query....value': &QueryResponse + [144; 158) 'query_response': Canonical> + [144; 164) 'query_....value': QueryResponse + "### ); } #[test] fn bug_1030() { - assert_snapshot_matches!(infer(r#" + assert_snapshot!(infer(r#" struct HashSet; struct FxHasher; type FxHashSet = HashSet; @@ -2087,10 +2163,12 @@ pub fn main_loop() { } "#), @r###" -[144; 146) '{}': () -[169; 198) '{ ...t(); }': () -[175; 193) 'FxHash...efault': fn default<{unknown}, FxHasher>() -> HashSet -[175; 195) 'FxHash...ault()': HashSet<{unknown}, FxHasher>"### + + [144; 146) '{}': () + [169; 198) '{ ...t(); }': () + [175; 193) 'FxHash...efault': fn default<{unknown}, FxHasher>() -> HashSet + [175; 195) 'FxHash...ault()': HashSet<{unknown}, FxHasher> + "### ); } @@ -2122,7 +2200,7 @@ mod foo { #[test] fn infer_const() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct Foo; impl Foo { const ASSOC_CONST: u32 = 0; } @@ -2135,22 +2213,24 @@ fn test() { } "#), @r###" -[49; 50) '0': u32 -[80; 83) '101': u32 -[95; 213) '{ ...NST; }': () -[138; 139) 'x': {unknown} -[142; 153) 'LOCAL_CONST': {unknown} -[163; 164) 'z': u32 -[167; 179) 'GLOBAL_CONST': u32 -[189; 191) 'id': u32 -[194; 210) 'Foo::A..._CONST': u32 -[126; 128) '99': u32"### + + [49; 50) '0': u32 + [80; 83) '101': u32 + [95; 213) '{ ...NST; }': () + [138; 139) 'x': {unknown} + [142; 153) 'LOCAL_CONST': {unknown} + [163; 164) 'z': u32 + [167; 179) 'GLOBAL_CONST': u32 + [189; 191) 'id': u32 + [194; 210) 'Foo::A..._CONST': u32 + [126; 128) '99': u32 + "### ); } #[test] fn infer_static() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" static GLOBAL_STATIC: u32 = 101; static mut GLOBAL_STATIC_MUT: u32 = 101; @@ -2164,26 +2244,28 @@ fn test() { } "#), @r###" -[29; 32) '101': u32 -[70; 73) '101': u32 -[85; 280) '{ ...MUT; }': () -[173; 174) 'x': {unknown} -[177; 189) 'LOCAL_STATIC': {unknown} -[199; 200) 'y': {unknown} -[203; 219) 'LOCAL_...IC_MUT': {unknown} -[229; 230) 'z': u32 -[233; 246) 'GLOBAL_STATIC': u32 -[256; 257) 'w': u32 -[260; 277) 'GLOBAL...IC_MUT': u32 -[118; 120) '99': u32 -[161; 163) '99': u32"### + + [29; 32) '101': u32 + [70; 73) '101': u32 + [85; 280) '{ ...MUT; }': () + [173; 174) 'x': {unknown} + [177; 189) 'LOCAL_STATIC': {unknown} + [199; 200) 'y': {unknown} + [203; 219) 'LOCAL_...IC_MUT': {unknown} + [229; 230) 'z': u32 + [233; 246) 'GLOBAL_STATIC': u32 + [256; 257) 'w': u32 + [260; 277) 'GLOBAL...IC_MUT': u32 + [118; 120) '99': u32 + [161; 163) '99': u32 + "### ); } #[test] fn infer_trait_method_simple() { // the trait implementation is intentionally incomplete -- it shouldn't matter - assert_snapshot_matches!( + assert_snapshot!( infer(r#" trait Trait1 { fn method(&self) -> u32; @@ -2201,20 +2283,22 @@ fn test() { } "#), @r###" -[31; 35) 'self': &Self -[110; 114) 'self': &Self -[170; 228) '{ ...i128 }': () -[176; 178) 'S1': S1 -[176; 187) 'S1.method()': u32 -[203; 205) 'S2': S2 -[203; 214) 'S2.method()': i128"### + + [31; 35) 'self': &Self + [110; 114) 'self': &Self + [170; 228) '{ ...i128 }': () + [176; 178) 'S1': S1 + [176; 187) 'S1.method()': u32 + [203; 205) 'S2': S2 + [203; 214) 'S2.method()': i128 + "### ); } #[test] fn infer_trait_method_scoped() { // the trait implementation is intentionally incomplete -- it shouldn't matter - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct S; mod foo { @@ -2247,21 +2331,23 @@ mod bar_test { } "#), @r###" -[63; 67) 'self': &Self -[169; 173) 'self': &Self -[300; 337) '{ ... }': () -[310; 311) 'S': S -[310; 320) 'S.method()': u32 -[416; 454) '{ ... }': () -[426; 427) 'S': S -[426; 436) 'S.method()': i128"### + + [63; 67) 'self': &Self + [169; 173) 'self': &Self + [300; 337) '{ ... }': () + [310; 311) 'S': S + [310; 320) 'S.method()': u32 + [416; 454) '{ ... }': () + [426; 427) 'S': S + [426; 436) 'S.method()': i128 + "### ); } #[test] fn infer_trait_method_generic_1() { // the trait implementation is intentionally incomplete -- it shouldn't matter - assert_snapshot_matches!( + assert_snapshot!( infer(r#" trait Trait { fn method(&self) -> T; @@ -2273,17 +2359,19 @@ fn test() { } "#), @r###" -[33; 37) 'self': &Self -[92; 111) '{ ...d(); }': () -[98; 99) 'S': S -[98; 108) 'S.method()': u32"### + + [33; 37) 'self': &Self + [92; 111) '{ ...d(); }': () + [98; 99) 'S': S + [98; 108) 'S.method()': u32 + "### ); } #[test] fn infer_trait_method_generic_more_params() { // the trait implementation is intentionally incomplete -- it shouldn't matter - assert_snapshot_matches!( + assert_snapshot!( infer(r#" trait Trait { fn method1(&self) -> (T1, T2, T3); @@ -2301,24 +2389,26 @@ fn test() { } "#), @r###" -[43; 47) 'self': &Self -[82; 86) 'self': &Self -[210; 361) '{ ..., i8 }': () -[216; 218) 'S1': S1 -[216; 228) 'S1.method1()': (u8, u16, u32) -[250; 252) 'S1': S1 -[250; 262) 'S1.method2()': (u32, u16, u8) -[284; 286) 'S2': S2 -[284; 296) 'S2.method1()': (i8, i16, {unknown}) -[324; 326) 'S2': S2 -[324; 336) 'S2.method2()': ({unknown}, i16, i8)"### + + [43; 47) 'self': &Self + [82; 86) 'self': &Self + [210; 361) '{ ..., i8 }': () + [216; 218) 'S1': S1 + [216; 228) 'S1.method1()': (u8, u16, u32) + [250; 252) 'S1': S1 + [250; 262) 'S1.method2()': (u32, u16, u8) + [284; 286) 'S2': S2 + [284; 296) 'S2.method1()': (i8, i16, {unknown}) + [324; 326) 'S2': S2 + [324; 336) 'S2.method2()': ({unknown}, i16, i8) + "### ); } #[test] fn infer_trait_method_generic_2() { // the trait implementation is intentionally incomplete -- it shouldn't matter - assert_snapshot_matches!( + assert_snapshot!( infer(r#" trait Trait { fn method(&self) -> T; @@ -2330,18 +2420,20 @@ fn test() { } "#), @r###" -[33; 37) 'self': &Self -[102; 127) '{ ...d(); }': () -[108; 109) 'S': S(T) -> S -[108; 115) 'S(1u32)': S -[108; 124) 'S(1u32...thod()': u32 -[110; 114) '1u32': u32"### + + [33; 37) 'self': &Self + [102; 127) '{ ...d(); }': () + [108; 109) 'S': S(T) -> S + [108; 115) 'S(1u32)': S + [108; 124) 'S(1u32...thod()': u32 + [110; 114) '1u32': u32 + "### ); } #[test] fn infer_trait_assoc_method() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" trait Default { fn default() -> Self; @@ -2355,22 +2447,24 @@ fn test() { } "#), @r###" -[87; 193) '{ ...t(); }': () -[97; 99) 's1': S -[105; 121) 'Defaul...efault': {unknown} -[105; 123) 'Defaul...ault()': S -[133; 135) 's2': {unknown} -[138; 148) 'S::default': {unknown} -[138; 150) 'S::default()': {unknown} -[160; 162) 's3': {unknown} -[165; 188) ' {} struct S(T); @@ -2382,24 +2476,23 @@ fn test() { } "#), @r###" - ⋮ - ⋮[86; 87) 't': T - ⋮[92; 94) '{}': () - ⋮[105; 144) '{ ...(s); }': () - ⋮[115; 116) 's': S - ⋮[119; 120) 'S': S(T) -> S - ⋮[119; 129) 'S(unknown)': S - ⋮[121; 128) 'unknown': u32 - ⋮[135; 138) 'foo': fn foo>(T) -> () - ⋮[135; 141) 'foo(s)': () - ⋮[139; 140) 's': S + [86; 87) 't': T + [92; 94) '{}': () + [105; 144) '{ ...(s); }': () + [115; 116) 's': S + [119; 120) 'S': S(T) -> S + [119; 129) 'S(unknown)': S + [121; 128) 'unknown': u32 + [135; 138) 'foo': fn foo>(T) -> () + [135; 141) 'foo(s)': () + [139; 140) 's': S "### ); } #[test] fn infer_from_bound_2() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" trait Trait {} struct S(T); @@ -2411,25 +2504,24 @@ fn test() { } "#), @r###" - ⋮ - ⋮[87; 88) 't': T - ⋮[98; 100) '{}': () - ⋮[111; 163) '{ ...(s); }': () - ⋮[121; 122) 's': S - ⋮[125; 126) 'S': S(T) -> S - ⋮[125; 135) 'S(unknown)': S - ⋮[127; 134) 'unknown': u32 - ⋮[145; 146) 'x': u32 - ⋮[154; 157) 'foo': fn foo>(T) -> U - ⋮[154; 160) 'foo(s)': u32 - ⋮[158; 159) 's': S + [87; 88) 't': T + [98; 100) '{}': () + [111; 163) '{ ...(s); }': () + [121; 122) 's': S + [125; 126) 'S': S(T) -> S + [125; 135) 'S(unknown)': S + [127; 134) 'unknown': u32 + [145; 146) 'x': u32 + [154; 157) 'foo': fn foo>(T) -> U + [154; 160) 'foo(s)': u32 + [158; 159) 's': S "### ); } #[test] fn infer_call_trait_method_on_generic_param_1() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" trait Trait { fn method() -> u32; @@ -2439,16 +2531,18 @@ fn test(t: T) { } "#), @r###" -[59; 60) 't': T -[65; 84) '{ ...d(); }': () -[71; 72) 't': T -[71; 81) 't.method()': {unknown}"### + + [59; 60) 't': T + [65; 84) '{ ...d(); }': () + [71; 72) 't': T + [71; 81) 't.method()': {unknown} + "### ); } #[test] fn infer_call_trait_method_on_generic_param_2() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" trait Trait { fn method() -> T; @@ -2458,16 +2552,18 @@ fn test>(t: T) { } "#), @r###" -[66; 67) 't': T -[72; 91) '{ ...d(); }': () -[78; 79) 't': T -[78; 88) 't.method()': {unknown}"### + + [66; 67) 't': T + [72; 91) '{ ...d(); }': () + [78; 79) 't': T + [78; 88) 't.method()': {unknown} + "### ); } #[test] fn infer_with_multiple_trait_impls() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" trait Into { fn into(self) -> T; @@ -2482,26 +2578,25 @@ fn test() { } "#), @r###" - ⋮ - ⋮[29; 33) 'self': Self - ⋮[111; 202) '{ ...(S); }': () - ⋮[121; 122) 'x': u32 - ⋮[130; 131) 'S': S - ⋮[130; 138) 'S.into()': u32 - ⋮[148; 149) 'y': u64 - ⋮[157; 158) 'S': S - ⋮[157; 165) 'S.into()': u64 - ⋮[175; 176) 'z': {unknown} - ⋮[179; 196) 'Into::...::into': {unknown} - ⋮[179; 199) 'Into::...nto(S)': {unknown} - ⋮[197; 198) 'S': S + [29; 33) 'self': Self + [111; 202) '{ ...(S); }': () + [121; 122) 'x': u32 + [130; 131) 'S': S + [130; 138) 'S.into()': u32 + [148; 149) 'y': u64 + [157; 158) 'S': S + [157; 165) 'S.into()': u64 + [175; 176) 'z': {unknown} + [179; 196) 'Into::...::into': {unknown} + [179; 199) 'Into::...nto(S)': {unknown} + [197; 198) 'S': S "### ); } #[test] fn infer_project_associated_type() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" trait Iterable { type Item; @@ -2515,21 +2610,20 @@ fn test() { } "#), @r###" - ⋮ - ⋮[108; 227) '{ ...ter; }': () - ⋮[118; 119) 'x': u32 - ⋮[145; 146) '1': u32 - ⋮[156; 157) 'y': {unknown} - ⋮[183; 192) 'no_matter': {unknown} - ⋮[202; 203) 'z': {unknown} - ⋮[215; 224) 'no_matter': {unknown} + [108; 227) '{ ...ter; }': () + [118; 119) 'x': u32 + [145; 146) '1': u32 + [156; 157) 'y': {unknown} + [183; 192) 'no_matter': {unknown} + [202; 203) 'z': {unknown} + [215; 224) 'no_matter': {unknown} "### ); } #[test] fn infer_return_associated_type() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" trait Iterable { type Item; @@ -2544,27 +2638,26 @@ fn test() { } "#), @r###" - ⋮ - ⋮[106; 107) 't': T - ⋮[123; 125) '{}': () - ⋮[147; 148) 't': T - ⋮[178; 180) '{}': () - ⋮[191; 236) '{ ...(S); }': () - ⋮[201; 202) 'x': {unknown} - ⋮[205; 209) 'foo1': fn foo1(T) -> {unknown} - ⋮[205; 212) 'foo1(S)': {unknown} - ⋮[210; 211) 'S': S - ⋮[222; 223) 'y': u32 - ⋮[226; 230) 'foo2': fn foo2(T) -> ::Item - ⋮[226; 233) 'foo2(S)': u32 - ⋮[231; 232) 'S': S + [106; 107) 't': T + [123; 125) '{}': () + [147; 148) 't': T + [178; 180) '{}': () + [191; 236) '{ ...(S); }': () + [201; 202) 'x': {unknown} + [205; 209) 'foo1': fn foo1(T) -> {unknown} + [205; 212) 'foo1(S)': {unknown} + [210; 211) 'S': S + [222; 223) 'y': u32 + [226; 230) 'foo2': fn foo2(T) -> ::Item + [226; 233) 'foo2(S)': u32 + [231; 232) 'S': S "### ); } #[test] fn infer_associated_type_bound() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" trait Iterable { type Item; @@ -2574,33 +2667,37 @@ fn test>() { } "#), @r###" -[67; 100) '{ ...own; }': () -[77; 78) 'y': {unknown} -[90; 97) 'unknown': {unknown}"### + + [67; 100) '{ ...own; }': () + [77; 78) 'y': {unknown} + [90; 97) 'unknown': {unknown} + "### ); } #[test] fn infer_const_body() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" const A: u32 = 1 + 1; static B: u64 = { let x = 1; x }; "#), @r###" -[16; 17) '1': u32 -[16; 21) '1 + 1': u32 -[20; 21) '1': u32 -[39; 55) '{ let ...1; x }': u64 -[45; 46) 'x': u64 -[49; 50) '1': u64 -[52; 53) 'x': u64"### + + [16; 17) '1': u32 + [16; 21) '1 + 1': u32 + [20; 21) '1': u32 + [39; 55) '{ let ...1; x }': u64 + [45; 46) 'x': u64 + [49; 50) '1': u64 + [52; 53) 'x': u64 + "### ); } #[test] fn tuple_struct_fields() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct S(i32, u64); fn test() -> u64 { @@ -2610,23 +2707,25 @@ fn test() -> u64 { } "#), @r###" -[38; 87) '{ ... a.1 }': u64 -[48; 49) 'a': S -[52; 53) 'S': S(i32, u64) -> S -[52; 59) 'S(4, 6)': S -[54; 55) '4': i32 -[57; 58) '6': u64 -[69; 70) 'b': i32 -[73; 74) 'a': S -[73; 76) 'a.0': i32 -[82; 83) 'a': S -[82; 85) 'a.1': u64"### + + [38; 87) '{ ... a.1 }': u64 + [48; 49) 'a': S + [52; 53) 'S': S(i32, u64) -> S + [52; 59) 'S(4, 6)': S + [54; 55) '4': i32 + [57; 58) '6': u64 + [69; 70) 'b': i32 + [73; 74) 'a': S + [73; 76) 'a.0': i32 + [82; 83) 'a': S + [82; 85) 'a.1': u64 + "### ); } #[test] fn tuple_struct_with_fn() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct S(fn(u32) -> u64); fn test() -> u64 { @@ -2636,44 +2735,48 @@ fn test() -> u64 { } "#), @r###" -[44; 102) '{ ...0(2) }': u64 -[54; 55) 'a': S -[58; 59) 'S': S(fn(u32) -> u64) -> S -[58; 68) 'S(|i| 2*i)': S -[60; 67) '|i| 2*i': fn(u32) -> u64 -[61; 62) 'i': i32 -[64; 65) '2': i32 -[64; 67) '2*i': i32 -[66; 67) 'i': i32 -[78; 79) 'b': u64 -[82; 83) 'a': S -[82; 85) 'a.0': fn(u32) -> u64 -[82; 88) 'a.0(4)': u64 -[86; 87) '4': u32 -[94; 95) 'a': S -[94; 97) 'a.0': fn(u32) -> u64 -[94; 100) 'a.0(2)': u64 -[98; 99) '2': u32"### + + [44; 102) '{ ...0(2) }': u64 + [54; 55) 'a': S + [58; 59) 'S': S(fn(u32) -> u64) -> S + [58; 68) 'S(|i| 2*i)': S + [60; 67) '|i| 2*i': fn(u32) -> u64 + [61; 62) 'i': i32 + [64; 65) '2': i32 + [64; 67) '2*i': i32 + [66; 67) 'i': i32 + [78; 79) 'b': u64 + [82; 83) 'a': S + [82; 85) 'a.0': fn(u32) -> u64 + [82; 88) 'a.0(4)': u64 + [86; 87) '4': u32 + [94; 95) 'a': S + [94; 97) 'a.0': fn(u32) -> u64 + [94; 100) 'a.0(2)': u64 + [98; 99) '2': u32 + "### ); } #[test] fn indexing_arrays() { - assert_snapshot_matches!( + assert_snapshot!( infer("fn main() { &mut [9][2]; }"), @r###" -[10; 26) '{ &mut...[2]; }': () -[12; 23) '&mut [9][2]': &mut {unknown} -[17; 20) '[9]': [i32;_] -[17; 23) '[9][2]': {unknown} -[18; 19) '9': i32 -[21; 22) '2': i32"### + + [10; 26) '{ &mut...[2]; }': () + [12; 23) '&mut [9][2]': &mut {unknown} + [17; 20) '[9]': [i32;_] + [17; 23) '[9][2]': {unknown} + [18; 19) '9': i32 + [21; 22) '2': i32 + "### ) } #[test] fn infer_macros_expanded() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" struct Foo(Vec); @@ -2690,9 +2793,8 @@ fn main() { } "#), @r###" - ⋮ - ⋮[156; 182) '{ ...,2); }': () - ⋮[166; 167) 'x': Foo + [156; 182) '{ ...,2); }': () + [166; 167) 'x': Foo "### ); } @@ -3277,7 +3379,7 @@ fn test(t: T) { #[test] fn impl_trait() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" trait Trait { fn foo(&self) -> T; @@ -3298,37 +3400,36 @@ fn test(x: impl Trait, y: &impl Trait) { } "#), @r###" - ⋮ - ⋮[30; 34) 'self': &Self - ⋮[55; 59) 'self': &Self - ⋮[99; 101) '{}': () - ⋮[111; 112) 'x': impl Trait - ⋮[131; 132) 'y': &impl Trait - ⋮[152; 269) '{ ...2(); }': () - ⋮[158; 159) 'x': impl Trait - ⋮[165; 166) 'y': &impl Trait - ⋮[176; 177) 'z': impl Trait - ⋮[180; 183) 'bar': fn bar() -> impl Trait - ⋮[180; 185) 'bar()': impl Trait - ⋮[191; 192) 'x': impl Trait - ⋮[191; 198) 'x.foo()': {unknown} - ⋮[204; 205) 'y': &impl Trait - ⋮[204; 211) 'y.foo()': {unknown} - ⋮[217; 218) 'z': impl Trait - ⋮[217; 224) 'z.foo()': {unknown} - ⋮[230; 231) 'x': impl Trait - ⋮[230; 238) 'x.foo2()': i64 - ⋮[244; 245) 'y': &impl Trait - ⋮[244; 252) 'y.foo2()': i64 - ⋮[258; 259) 'z': impl Trait - ⋮[258; 266) 'z.foo2()': i64 + [30; 34) 'self': &Self + [55; 59) 'self': &Self + [99; 101) '{}': () + [111; 112) 'x': impl Trait + [131; 132) 'y': &impl Trait + [152; 269) '{ ...2(); }': () + [158; 159) 'x': impl Trait + [165; 166) 'y': &impl Trait + [176; 177) 'z': impl Trait + [180; 183) 'bar': fn bar() -> impl Trait + [180; 185) 'bar()': impl Trait + [191; 192) 'x': impl Trait + [191; 198) 'x.foo()': {unknown} + [204; 205) 'y': &impl Trait + [204; 211) 'y.foo()': {unknown} + [217; 218) 'z': impl Trait + [217; 224) 'z.foo()': {unknown} + [230; 231) 'x': impl Trait + [230; 238) 'x.foo2()': i64 + [244; 245) 'y': &impl Trait + [244; 252) 'y.foo2()': i64 + [258; 259) 'z': impl Trait + [258; 266) 'z.foo2()': i64 "### ); } #[test] fn dyn_trait() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" trait Trait { fn foo(&self) -> T; @@ -3349,37 +3450,36 @@ fn test(x: dyn Trait, y: &dyn Trait) { } "#), @r###" - ⋮ - ⋮[30; 34) 'self': &Self - ⋮[55; 59) 'self': &Self - ⋮[98; 100) '{}': () - ⋮[110; 111) 'x': dyn Trait - ⋮[129; 130) 'y': &dyn Trait - ⋮[149; 266) '{ ...2(); }': () - ⋮[155; 156) 'x': dyn Trait - ⋮[162; 163) 'y': &dyn Trait - ⋮[173; 174) 'z': dyn Trait - ⋮[177; 180) 'bar': fn bar() -> dyn Trait - ⋮[177; 182) 'bar()': dyn Trait - ⋮[188; 189) 'x': dyn Trait - ⋮[188; 195) 'x.foo()': {unknown} - ⋮[201; 202) 'y': &dyn Trait - ⋮[201; 208) 'y.foo()': {unknown} - ⋮[214; 215) 'z': dyn Trait - ⋮[214; 221) 'z.foo()': {unknown} - ⋮[227; 228) 'x': dyn Trait - ⋮[227; 235) 'x.foo2()': i64 - ⋮[241; 242) 'y': &dyn Trait - ⋮[241; 249) 'y.foo2()': i64 - ⋮[255; 256) 'z': dyn Trait - ⋮[255; 263) 'z.foo2()': i64 + [30; 34) 'self': &Self + [55; 59) 'self': &Self + [98; 100) '{}': () + [110; 111) 'x': dyn Trait + [129; 130) 'y': &dyn Trait + [149; 266) '{ ...2(); }': () + [155; 156) 'x': dyn Trait + [162; 163) 'y': &dyn Trait + [173; 174) 'z': dyn Trait + [177; 180) 'bar': fn bar() -> dyn Trait + [177; 182) 'bar()': dyn Trait + [188; 189) 'x': dyn Trait + [188; 195) 'x.foo()': {unknown} + [201; 202) 'y': &dyn Trait + [201; 208) 'y.foo()': {unknown} + [214; 215) 'z': dyn Trait + [214; 221) 'z.foo()': {unknown} + [227; 228) 'x': dyn Trait + [227; 235) 'x.foo2()': i64 + [241; 242) 'y': &dyn Trait + [241; 249) 'y.foo2()': i64 + [255; 256) 'z': dyn Trait + [255; 263) 'z.foo2()': i64 "### ); } #[test] fn dyn_trait_bare() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" trait Trait { fn foo(&self) -> u64; @@ -3396,30 +3496,29 @@ fn test(x: Trait, y: &Trait) -> u64 { } "#), @r###" - ⋮ - ⋮[27; 31) 'self': &Self - ⋮[61; 63) '{}': () - ⋮[73; 74) 'x': {unknown} - ⋮[83; 84) 'y': &{unknown} - ⋮[101; 176) '{ ...o(); }': () - ⋮[107; 108) 'x': {unknown} - ⋮[114; 115) 'y': &{unknown} - ⋮[125; 126) 'z': {unknown} - ⋮[129; 132) 'bar': fn bar() -> {unknown} - ⋮[129; 134) 'bar()': {unknown} - ⋮[140; 141) 'x': {unknown} - ⋮[140; 147) 'x.foo()': {unknown} - ⋮[153; 154) 'y': &{unknown} - ⋮[153; 160) 'y.foo()': {unknown} - ⋮[166; 167) 'z': {unknown} - ⋮[166; 173) 'z.foo()': {unknown} + [27; 31) 'self': &Self + [61; 63) '{}': () + [73; 74) 'x': {unknown} + [83; 84) 'y': &{unknown} + [101; 176) '{ ...o(); }': () + [107; 108) 'x': {unknown} + [114; 115) 'y': &{unknown} + [125; 126) 'z': {unknown} + [129; 132) 'bar': fn bar() -> {unknown} + [129; 134) 'bar()': {unknown} + [140; 141) 'x': {unknown} + [140; 147) 'x.foo()': {unknown} + [153; 154) 'y': &{unknown} + [153; 160) 'y.foo()': {unknown} + [166; 167) 'z': {unknown} + [166; 173) 'z.foo()': {unknown} "### ); } #[test] fn weird_bounds() { - assert_snapshot_matches!( + assert_snapshot!( infer(r#" trait Trait {} fn test() { @@ -3432,20 +3531,19 @@ fn test() { } "#), @r###" - ⋮ - ⋮[26; 237) '{ ...foo; }': () - ⋮[36; 37) 'a': impl Trait + {error} - ⋮[64; 67) 'foo': impl Trait + {error} - ⋮[77; 78) 'b': impl {error} - ⋮[97; 100) 'foo': impl {error} - ⋮[110; 111) 'b': impl Trait - ⋮[128; 131) 'foo': impl Trait - ⋮[141; 142) 'b': impl {error} - ⋮[163; 166) 'foo': impl {error} - ⋮[176; 177) 'd': impl {error} - ⋮[193; 196) 'foo': impl {error} - ⋮[206; 207) 'e': impl Trait + {error} - ⋮[231; 234) 'foo': impl Trait + {error} + [26; 237) '{ ...foo; }': () + [36; 37) 'a': impl Trait + {error} + [64; 67) 'foo': impl Trait + {error} + [77; 78) 'b': impl {error} + [97; 100) 'foo': impl {error} + [110; 111) 'b': impl Trait + [128; 131) 'foo': impl Trait + [141; 142) 'b': impl {error} + [163; 166) 'foo': impl {error} + [176; 177) 'd': impl {error} + [193; 196) 'foo': impl {error} + [206; 207) 'e': impl Trait + {error} + [231; 234) 'foo': impl Trait + {error} "### ); } @@ -3468,7 +3566,7 @@ fn infer(content: &str) -> String { let source_file = db.parse(file_id).ok().unwrap(); let mut acc = String::new(); - acc.push_str("\n"); + // acc.push_str("\n"); let mut infer_def = |inference_result: Arc, body_source_map: Arc| { @@ -3590,10 +3688,10 @@ fn no_such_field_diagnostics() { ) .diagnostics(); - assert_snapshot_matches!(diagnostics, @r###" -"baz: 62": no such field -"{\n foo: 92,\n baz: 62,\n }": fill structure fields -"### + assert_snapshot!(diagnostics, @r###" + "baz: 62": no such field + "{\n foo: 92,\n baz: 62,\n }": fill structure fields + "### ); } diff --git a/crates/ra_ide_api/Cargo.toml b/crates/ra_ide_api/Cargo.toml index a7dc0b63acb..0006946209b 100644 --- a/crates/ra_ide_api/Cargo.toml +++ b/crates/ra_ide_api/Cargo.toml @@ -27,7 +27,7 @@ test_utils = { path = "../test_utils" } ra_assists = { path = "../ra_assists" } [dev-dependencies] -insta = "0.10.0" +insta = "0.11.0" [dev-dependencies.proptest] version = "0.9.0" diff --git a/crates/ra_ide_api/src/completion/complete_dot.rs b/crates/ra_ide_api/src/completion/complete_dot.rs index 27256f87960..2325cdf088a 100644 --- a/crates/ra_ide_api/src/completion/complete_dot.rs +++ b/crates/ra_ide_api/src/completion/complete_dot.rs @@ -68,7 +68,7 @@ fn complete_methods(acc: &mut Completions, ctx: &CompletionContext, receiver: Ty #[cfg(test)] mod tests { use crate::completion::{do_completion, CompletionItem, CompletionKind}; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; fn do_ref_completion(code: &str) -> Vec { do_completion(code, CompletionKind::Reference) @@ -76,7 +76,7 @@ mod tests { #[test] fn test_struct_field_completion() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_ref_completion( r" struct A { the_field: u32 } @@ -102,7 +102,7 @@ mod tests { #[test] fn test_struct_field_completion_self() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_ref_completion( r" struct A { @@ -144,7 +144,7 @@ mod tests { #[test] fn test_struct_field_completion_autoderef() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_ref_completion( r" struct A { the_field: (u32, i32) } @@ -180,7 +180,7 @@ mod tests { #[test] fn test_no_struct_field_completion_for_method_call() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_ref_completion( r" struct A { the_field: u32 } @@ -195,7 +195,7 @@ mod tests { #[test] fn test_method_completion() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_ref_completion( r" struct A {} @@ -224,7 +224,7 @@ mod tests { #[test] fn test_trait_method_completion() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_ref_completion( r" struct A {} @@ -252,7 +252,7 @@ mod tests { #[test] fn test_trait_method_completion_deduplicated() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_ref_completion( r" struct A {} @@ -280,7 +280,7 @@ mod tests { #[test] fn test_no_non_self_method() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_ref_completion( r" struct A {} @@ -298,7 +298,7 @@ mod tests { #[test] fn test_method_attr_filtering() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_ref_completion( r" struct A {} @@ -331,7 +331,7 @@ mod tests { #[test] fn test_tuple_field_completion() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_ref_completion( r" fn foo() { @@ -365,7 +365,7 @@ mod tests { #[test] fn test_tuple_field_inference() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_ref_completion( r" pub struct S; @@ -400,7 +400,7 @@ mod tests { #[test] fn test_completion_works_in_consts() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_ref_completion( r" struct A { the_field: u32 } @@ -426,7 +426,7 @@ mod tests { #[test] fn test_completion_await_impls_future() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_completion( r###" //- /main.rs diff --git a/crates/ra_ide_api/src/completion/complete_fn_param.rs b/crates/ra_ide_api/src/completion/complete_fn_param.rs index 0887ef1f687..6639b6fffed 100644 --- a/crates/ra_ide_api/src/completion/complete_fn_param.rs +++ b/crates/ra_ide_api/src/completion/complete_fn_param.rs @@ -51,7 +51,7 @@ pub(super) fn complete_fn_param(acc: &mut Completions, ctx: &CompletionContext) #[cfg(test)] mod tests { use crate::completion::{do_completion, CompletionItem, CompletionKind}; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; fn do_magic_completion(code: &str) -> Vec { do_completion(code, CompletionKind::Magic) @@ -59,7 +59,7 @@ mod tests { #[test] fn test_param_completion_last_param() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_magic_completion( r" fn foo(file_id: FileId) {} @@ -83,7 +83,7 @@ mod tests { #[test] fn test_param_completion_nth_param() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_magic_completion( r" fn foo(file_id: FileId) {} @@ -107,7 +107,7 @@ mod tests { #[test] fn test_param_completion_trait_param() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_magic_completion( r" pub(crate) trait SourceRoot { diff --git a/crates/ra_ide_api/src/completion/complete_keyword.rs b/crates/ra_ide_api/src/completion/complete_keyword.rs index 18c1839dcc5..c527a9f6317 100644 --- a/crates/ra_ide_api/src/completion/complete_keyword.rs +++ b/crates/ra_ide_api/src/completion/complete_keyword.rs @@ -113,7 +113,7 @@ fn complete_return( #[cfg(test)] mod tests { use crate::completion::{do_completion, CompletionItem, CompletionKind}; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; fn do_keyword_completion(code: &str) -> Vec { do_completion(code, CompletionKind::Keyword) @@ -121,7 +121,7 @@ mod tests { #[test] fn completes_keywords_in_use_stmt() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" use <|> @@ -152,7 +152,7 @@ mod tests { ]"### ); - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" use a::<|> @@ -176,7 +176,7 @@ mod tests { ]"### ); - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" use a::{b, <|>} @@ -203,7 +203,7 @@ mod tests { #[test] fn completes_various_keywords_in_function() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" fn quux() { @@ -253,7 +253,7 @@ mod tests { #[test] fn completes_else_after_if() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" fn quux() { @@ -319,7 +319,7 @@ mod tests { #[test] fn test_completion_return_value() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" fn quux() -> i32 { @@ -366,7 +366,7 @@ mod tests { }, ]"### ); - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" fn quux() { @@ -417,7 +417,7 @@ mod tests { #[test] fn dont_add_semi_after_return_if_not_a_statement() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" fn quux() -> i32 { @@ -469,7 +469,7 @@ mod tests { #[test] fn last_return_in_block_has_semi() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" fn quux() -> i32 { @@ -517,7 +517,7 @@ mod tests { }, ]"### ); - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" fn quux() -> i32 { @@ -571,7 +571,7 @@ mod tests { #[test] fn completes_break_and_continue_in_loops() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" fn quux() -> i32 { @@ -633,7 +633,7 @@ mod tests { ); // No completion: lambda isolates control flow - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" fn quux() -> i32 { @@ -683,7 +683,7 @@ mod tests { #[test] fn no_semi_after_break_continue_in_expr() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_keyword_completion( r" fn f() { diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs index 5fd41eeb35c..d6b5ac9ad7c 100644 --- a/crates/ra_ide_api/src/completion/complete_path.rs +++ b/crates/ra_ide_api/src/completion/complete_path.rs @@ -79,7 +79,7 @@ mod tests { use test_utils::covers; use crate::completion::{do_completion, CompletionItem, CompletionKind}; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; fn do_reference_completion(code: &str) -> Vec { do_completion(code, CompletionKind::Reference) @@ -120,7 +120,7 @@ mod tests { #[test] fn completes_mod_with_docs() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" use self::my<|>; @@ -149,7 +149,7 @@ mod tests { #[test] fn completes_use_item_starting_with_self() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" use self::m::<|>; @@ -173,7 +173,7 @@ mod tests { #[test] fn completes_use_item_starting_with_crate() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs @@ -204,7 +204,7 @@ mod tests { #[test] fn completes_nested_use_tree() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs @@ -235,7 +235,7 @@ mod tests { #[test] fn completes_deeply_nested_use_tree() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs @@ -263,7 +263,7 @@ mod tests { #[test] fn completes_enum_variant() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs @@ -306,7 +306,7 @@ mod tests { #[test] fn completes_enum_variant_with_details() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs @@ -363,7 +363,7 @@ mod tests { #[test] fn completes_struct_associated_method() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs @@ -396,7 +396,7 @@ mod tests { #[test] fn completes_struct_associated_const() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs @@ -429,7 +429,7 @@ mod tests { #[test] fn completes_struct_associated_type() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs @@ -462,7 +462,7 @@ mod tests { #[test] fn completes_enum_associated_method() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs @@ -495,7 +495,7 @@ mod tests { #[test] fn completes_union_associated_method() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs @@ -528,7 +528,7 @@ mod tests { #[test] fn completes_use_paths_across_crates() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /main.rs @@ -554,7 +554,7 @@ mod tests { #[test] fn completes_type_alias() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " struct S; diff --git a/crates/ra_ide_api/src/completion/complete_pattern.rs b/crates/ra_ide_api/src/completion/complete_pattern.rs index f12dfcc17f7..fb02844fad7 100644 --- a/crates/ra_ide_api/src/completion/complete_pattern.rs +++ b/crates/ra_ide_api/src/completion/complete_pattern.rs @@ -28,7 +28,7 @@ pub(super) fn complete_pattern(acc: &mut Completions, ctx: &CompletionContext) { #[cfg(test)] mod tests { use crate::completion::{do_completion, CompletionItem, CompletionKind}; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; fn complete(code: &str) -> Vec { do_completion(code, CompletionKind::Reference) @@ -53,7 +53,7 @@ mod tests { } ", ); - assert_debug_snapshot_matches!(completions, @r###" + assert_debug_snapshot!(completions, @r###" ⋮[ ⋮ CompletionItem { ⋮ label: "E", diff --git a/crates/ra_ide_api/src/completion/complete_postfix.rs b/crates/ra_ide_api/src/completion/complete_postfix.rs index 6d834f6cec4..3970d1af341 100644 --- a/crates/ra_ide_api/src/completion/complete_postfix.rs +++ b/crates/ra_ide_api/src/completion/complete_postfix.rs @@ -72,7 +72,7 @@ pub(super) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) { #[cfg(test)] mod tests { use crate::completion::{do_completion, CompletionItem, CompletionKind}; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; fn do_postfix_completion(code: &str) -> Vec { do_completion(code, CompletionKind::Postfix) @@ -80,7 +80,7 @@ mod tests { #[test] fn postfix_completion_works_for_trivial_path_expression() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_postfix_completion( r#" fn main() { @@ -152,7 +152,7 @@ mod tests { #[test] fn some_postfix_completions_ignored() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_postfix_completion( r#" fn main() { diff --git a/crates/ra_ide_api/src/completion/complete_record_literal.rs b/crates/ra_ide_api/src/completion/complete_record_literal.rs index 6b929a8acfa..ed402996472 100644 --- a/crates/ra_ide_api/src/completion/complete_record_literal.rs +++ b/crates/ra_ide_api/src/completion/complete_record_literal.rs @@ -23,7 +23,7 @@ pub(super) fn complete_record_literal(acc: &mut Completions, ctx: &CompletionCon #[cfg(test)] mod tests { use crate::completion::{do_completion, CompletionItem, CompletionKind}; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; fn complete(code: &str) -> Vec { do_completion(code, CompletionKind::Reference) @@ -39,7 +39,7 @@ mod tests { } ", ); - assert_debug_snapshot_matches!(completions, @r###" + assert_debug_snapshot!(completions, @r###" ⋮[ ⋮ CompletionItem { ⋮ label: "the_field", @@ -65,7 +65,7 @@ mod tests { } ", ); - assert_debug_snapshot_matches!(completions, @r###" + assert_debug_snapshot!(completions, @r###" ⋮[ ⋮ CompletionItem { ⋮ label: "a", @@ -91,7 +91,7 @@ mod tests { } ", ); - assert_debug_snapshot_matches!(completions, @r###" + assert_debug_snapshot!(completions, @r###" ⋮[ ⋮ CompletionItem { ⋮ label: "b", @@ -116,7 +116,7 @@ mod tests { } ", ); - assert_debug_snapshot_matches!(completions, @r###" + assert_debug_snapshot!(completions, @r###" ⋮[ ⋮ CompletionItem { ⋮ label: "a", diff --git a/crates/ra_ide_api/src/completion/complete_record_pattern.rs b/crates/ra_ide_api/src/completion/complete_record_pattern.rs index 8c8b47ea464..70716b3d608 100644 --- a/crates/ra_ide_api/src/completion/complete_record_pattern.rs +++ b/crates/ra_ide_api/src/completion/complete_record_pattern.rs @@ -22,7 +22,7 @@ pub(super) fn complete_record_pattern(acc: &mut Completions, ctx: &CompletionCon #[cfg(test)] mod tests { use crate::completion::{do_completion, CompletionItem, CompletionKind}; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; fn complete(code: &str) -> Vec { do_completion(code, CompletionKind::Reference) @@ -41,7 +41,7 @@ mod tests { } ", ); - assert_debug_snapshot_matches!(completions, @r###" + assert_debug_snapshot!(completions, @r###" ⋮[ ⋮ CompletionItem { ⋮ label: "foo", @@ -70,7 +70,7 @@ mod tests { } ", ); - assert_debug_snapshot_matches!(completions, @r###" + assert_debug_snapshot!(completions, @r###" ⋮[ ⋮ CompletionItem { ⋮ label: "bar", diff --git a/crates/ra_ide_api/src/completion/complete_scope.rs b/crates/ra_ide_api/src/completion/complete_scope.rs index 2000d953ad4..d6a44c3e03f 100644 --- a/crates/ra_ide_api/src/completion/complete_scope.rs +++ b/crates/ra_ide_api/src/completion/complete_scope.rs @@ -122,7 +122,7 @@ impl ImportResolver { #[cfg(test)] mod tests { use crate::completion::{do_completion, CompletionItem, CompletionKind}; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; fn do_reference_completion(code: &str) -> Vec { do_completion(code, CompletionKind::Reference) @@ -130,7 +130,7 @@ mod tests { #[test] fn completes_bindings_from_let() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" fn quux(x: i32) { @@ -171,7 +171,7 @@ mod tests { #[test] fn completes_bindings_from_if_let() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" fn quux() { @@ -215,7 +215,7 @@ mod tests { #[test] fn completes_bindings_from_for() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" fn quux() { @@ -247,7 +247,7 @@ mod tests { #[test] fn completes_generic_params() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" fn quux() { @@ -277,7 +277,7 @@ mod tests { #[test] fn completes_generic_params_in_struct() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" struct X { @@ -306,7 +306,7 @@ mod tests { #[test] fn completes_module_items() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" struct Foo; @@ -345,7 +345,7 @@ mod tests { #[test] fn completes_extern_prelude() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" //- /lib.rs @@ -369,7 +369,7 @@ mod tests { #[test] fn completes_module_items_in_nested_modules() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" struct Foo; @@ -401,7 +401,7 @@ mod tests { #[test] fn completes_return_type() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" struct Foo; @@ -430,7 +430,7 @@ mod tests { #[test] fn dont_show_both_completions_for_shadowing() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" fn foo() { @@ -465,7 +465,7 @@ mod tests { #[test] fn completes_self_in_methods() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion(r"impl S { fn foo(&self) { <|> } }"), @r#"[ CompletionItem { @@ -489,7 +489,7 @@ mod tests { #[test] fn completes_prelude() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /main.rs diff --git a/crates/ra_ide_api/src/completion/complete_snippet.rs b/crates/ra_ide_api/src/completion/complete_snippet.rs index a35f315118c..b06221c2a65 100644 --- a/crates/ra_ide_api/src/completion/complete_snippet.rs +++ b/crates/ra_ide_api/src/completion/complete_snippet.rs @@ -40,7 +40,7 @@ fn ${1:feature}() { #[cfg(test)] mod tests { use crate::completion::{do_completion, CompletionItem, CompletionKind}; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; fn do_snippet_completion(code: &str) -> Vec { do_completion(code, CompletionKind::Snippet) @@ -48,7 +48,7 @@ mod tests { #[test] fn completes_snippets_in_expressions() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_snippet_completion(r"fn foo(x: i32) { <|> }"), @r#"[ CompletionItem { @@ -71,11 +71,11 @@ mod tests { #[test] fn should_not_complete_snippets_in_path() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_snippet_completion(r"fn foo(x: i32) { ::foo<|> }"), @r#"[]"# ); - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_snippet_completion(r"fn foo(x: i32) { ::<|> }"), @r#"[]"# ); @@ -83,7 +83,7 @@ mod tests { #[test] fn completes_snippets_in_items() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_snippet_completion( r" #[cfg(test)] diff --git a/crates/ra_ide_api/src/completion/presentation.rs b/crates/ra_ide_api/src/completion/presentation.rs index 147ceda0c7c..f19eec9b767 100644 --- a/crates/ra_ide_api/src/completion/presentation.rs +++ b/crates/ra_ide_api/src/completion/presentation.rs @@ -186,7 +186,7 @@ impl Completions { #[cfg(test)] mod tests { use crate::completion::{do_completion, CompletionItem, CompletionKind}; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; use test_utils::covers; fn do_reference_completion(code: &str) -> Vec { @@ -196,7 +196,7 @@ mod tests { #[test] fn inserts_parens_for_function_calls() { covers!(inserts_parens_for_function_calls); - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" fn no_args() {} @@ -222,7 +222,7 @@ mod tests { }, ]"### ); - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" fn with_args(x: i32, y: String) {} @@ -248,7 +248,7 @@ mod tests { }, ]"### ); - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( r" struct S {} @@ -275,7 +275,7 @@ mod tests { #[test] fn dont_render_function_parens_in_use_item() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs @@ -298,7 +298,7 @@ mod tests { #[test] fn dont_render_function_parens_if_already_call() { - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs @@ -327,7 +327,7 @@ mod tests { }, ]"# ); - assert_debug_snapshot_matches!( + assert_debug_snapshot!( do_reference_completion( " //- /lib.rs diff --git a/crates/ra_ide_api/src/diagnostics.rs b/crates/ra_ide_api/src/diagnostics.rs index 1a4882824f6..c448aa8c5d4 100644 --- a/crates/ra_ide_api/src/diagnostics.rs +++ b/crates/ra_ide_api/src/diagnostics.rs @@ -183,7 +183,7 @@ fn check_struct_shorthand_initialization( #[cfg(test)] mod tests { - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; use join_to_string::join; use ra_syntax::SourceFile; use test_utils::assert_eq_text; @@ -519,7 +519,7 @@ mod tests { fn test_unresolved_module_diagnostic() { let (analysis, file_id) = single_file("mod foo;"); let diagnostics = analysis.diagnostics(file_id).unwrap(); - assert_debug_snapshot_matches!(diagnostics, @r###" + assert_debug_snapshot!(diagnostics, @r###" ⋮[ ⋮ Diagnostic { ⋮ message: "unresolved module", diff --git a/crates/ra_ide_api/src/display/structure.rs b/crates/ra_ide_api/src/display/structure.rs index a2025ed591c..be042ed176e 100644 --- a/crates/ra_ide_api/src/display/structure.rs +++ b/crates/ra_ide_api/src/display/structure.rs @@ -161,7 +161,7 @@ fn structure_node(node: &SyntaxNode) -> Option { #[cfg(test)] mod tests { use super::*; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; #[test] fn test_file_structure() { @@ -204,7 +204,7 @@ fn very_obsolete() {} .ok() .unwrap(); let structure = file_structure(&file); - assert_debug_snapshot_matches!(structure, + assert_debug_snapshot!(structure, @r#"[ StructureNode { parent: None, diff --git a/crates/ra_ide_api/src/inlay_hints.rs b/crates/ra_ide_api/src/inlay_hints.rs index 61ccb74b61d..16bdcf9d16b 100644 --- a/crates/ra_ide_api/src/inlay_hints.rs +++ b/crates/ra_ide_api/src/inlay_hints.rs @@ -169,7 +169,7 @@ fn get_node_displayable_type( #[cfg(test)] mod tests { use crate::mock_analysis::single_file; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; #[test] fn let_statement() { @@ -210,7 +210,7 @@ fn main() { }"#, ); - assert_debug_snapshot_matches!(analysis.inlay_hints(file_id).unwrap(), @r#"[ + assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r#"[ InlayHint { range: [193; 197), kind: TypeHint, @@ -277,7 +277,7 @@ fn main() { }"#, ); - assert_debug_snapshot_matches!(analysis.inlay_hints(file_id).unwrap(), @r#"[ + assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r#"[ InlayHint { range: [21; 30), kind: TypeHint, @@ -304,7 +304,7 @@ fn main() { }"#, ); - assert_debug_snapshot_matches!(analysis.inlay_hints(file_id).unwrap(), @r#"[ + assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r#"[ InlayHint { range: [21; 30), kind: TypeHint, @@ -350,7 +350,7 @@ fn main() { }"#, ); - assert_debug_snapshot_matches!(analysis.inlay_hints(file_id).unwrap(), @r#"[ + assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r#"[ InlayHint { range: [166; 170), kind: TypeHint, @@ -411,7 +411,7 @@ fn main() { }"#, ); - assert_debug_snapshot_matches!(analysis.inlay_hints(file_id).unwrap(), @r###" + assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r###" ⋮[ ⋮ InlayHint { ⋮ range: [166; 170), @@ -474,7 +474,7 @@ fn main() { }"#, ); - assert_debug_snapshot_matches!(analysis.inlay_hints(file_id).unwrap(), @r#"[ + assert_debug_snapshot!(analysis.inlay_hints(file_id).unwrap(), @r#"[ InlayHint { range: [311; 315), kind: TypeHint, diff --git a/crates/ra_ide_api/src/references.rs b/crates/ra_ide_api/src/references.rs index 342e73fd344..d8a00067fe9 100644 --- a/crates/ra_ide_api/src/references.rs +++ b/crates/ra_ide_api/src/references.rs @@ -200,7 +200,7 @@ mod tests { mock_analysis::analysis_and_position, mock_analysis::single_file_with_position, FileId, ReferenceSearchResult, }; - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; use test_utils::assert_eq_text; #[test] @@ -341,7 +341,7 @@ mod tests { ); let new_name = "foo2"; let source_change = analysis.rename(position, new_name).unwrap(); - assert_debug_snapshot_matches!(&source_change, + assert_debug_snapshot!(&source_change, @r#"Some( SourceChange { label: "rename", @@ -388,7 +388,7 @@ mod tests { ); let new_name = "foo2"; let source_change = analysis.rename(position, new_name).unwrap(); - assert_debug_snapshot_matches!(&source_change, + assert_debug_snapshot!(&source_change, @r###"Some( SourceChange { label: "rename", diff --git a/crates/ra_ide_api/src/runnables.rs b/crates/ra_ide_api/src/runnables.rs index 9ea96909e73..9d84b3d0847 100644 --- a/crates/ra_ide_api/src/runnables.rs +++ b/crates/ra_ide_api/src/runnables.rs @@ -71,7 +71,7 @@ fn runnable_mod(db: &RootDatabase, file_id: FileId, module: ast::Module) -> Opti #[cfg(test)] mod tests { - use insta::assert_debug_snapshot_matches; + use insta::assert_debug_snapshot; use crate::mock_analysis::analysis_and_position; @@ -92,7 +92,7 @@ mod tests { "#, ); let runnables = analysis.runnables(pos.file_id).unwrap(); - assert_debug_snapshot_matches!(&runnables, + assert_debug_snapshot!(&runnables, @r#"[ Runnable { range: [1; 21), @@ -127,7 +127,7 @@ mod tests { "#, ); let runnables = analysis.runnables(pos.file_id).unwrap(); - assert_debug_snapshot_matches!(&runnables, + assert_debug_snapshot!(&runnables, @r#"[ Runnable { range: [1; 59), @@ -160,7 +160,7 @@ mod tests { "#, ); let runnables = analysis.runnables(pos.file_id).unwrap(); - assert_debug_snapshot_matches!(&runnables, + assert_debug_snapshot!(&runnables, @r#"[ Runnable { range: [23; 85), @@ -195,7 +195,7 @@ mod tests { "#, ); let runnables = analysis.runnables(pos.file_id).unwrap(); - assert_debug_snapshot_matches!(&runnables, + assert_debug_snapshot!(&runnables, @r#"[ Runnable { range: [41; 115),