Auto merge of #75060 - JohnTitor:rollup-aq8sfxf, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #74686 (BTreeMap: remove into_slices and its unsafe block)
 - #74762 (BTreeMap::drain_filter should not touch the root during iteration)
 - #74781 (Clean up E0733 explanation)
 - #74874 (BTreeMap: define forget_type only when relevant)
 - #74974 (Make tests faster in Miri)
 - #75010 (Update elasticlunr-rs and ammonia transitive deps)
 - #75041 (Replaced log with tracing crate)
 - #75044 (Clean up E0744 explanation)
 - #75054 (Rename rustc_middle::cstore::DepKind to CrateDepKind)
 - #75057 (Avoid dumping rustc invocations to stdout)

Failed merges:

 - #74827 (Move bulk of BTreeMap::insert method down to new method on handle)

r? @ghost
This commit is contained in:
bors 2020-08-02 16:06:54 +00:00
commit a99ae95c72
30 changed files with 642 additions and 350 deletions

View File

@ -37,19 +37,20 @@ version = "0.0.0"
dependencies = [
"compiler_builtins",
"core",
"rand 0.7.3",
"rand_xorshift 0.2.0",
"rand",
"rand_xorshift",
]
[[package]]
name = "ammonia"
version = "3.0.0"
version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e266e1f4be5ffa05309f650e2586fe1d3ae6034eb24025a7ae1dfecc330823a"
checksum = "89eac85170f4b3fb3dc5e442c1cfb036cb8eecf9dbbd431a161ffad15d90ea3b"
dependencies = [
"html5ever",
"lazy_static",
"maplit",
"markup5ever_rcdom",
"matches",
"tendril",
"url 2.1.0",
@ -343,7 +344,7 @@ dependencies = [
"termcolor",
"toml",
"unicode-width",
"unicode-xid 0.2.0",
"unicode-xid",
"url 2.1.0",
"walkdir",
"winapi 0.3.8",
@ -444,9 +445,9 @@ version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d463e01905d607e181de72e8608721d3269f29176c9a14ce037011316ae7131d"
dependencies = [
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
"proc-macro2",
"quote",
"syn",
"synstructure",
]
@ -547,12 +548,12 @@ dependencies = [
"lazy_static",
"pulldown-cmark",
"quine-mc_cluskey",
"quote 1.0.2",
"quote",
"regex-syntax",
"semver 0.9.0",
"serde",
"smallvec 1.4.0",
"syn 1.0.11",
"syn",
"toml",
"unicode-normalization",
"url 2.1.0",
@ -667,7 +668,7 @@ checksum = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e"
name = "core"
version = "0.0.0"
dependencies = [
"rand 0.7.3",
"rand",
]
[[package]]
@ -788,8 +789,8 @@ version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47c5e5ac752e18207b12e16b10631ae5f7f68f8805f335f9b817ead83d9ffce1"
dependencies = [
"quote 1.0.2",
"syn 1.0.11",
"quote",
"syn",
]
[[package]]
@ -835,9 +836,9 @@ version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71f31892cd5c62e414316f2963c5689242c43d8e7bbcaaeca97e5e28c95d91d9"
dependencies = [
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
"proc-macro2",
"quote",
"syn",
]
[[package]]
@ -846,9 +847,9 @@ version = "0.99.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2159be042979966de68315bce7034bb000c775f22e3e834e1c52ff78f041cae8"
dependencies = [
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
"proc-macro2",
"quote",
"syn",
]
[[package]]
@ -923,9 +924,9 @@ checksum = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0"
[[package]]
name = "elasticlunr-rs"
version = "2.3.4"
version = "2.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a99a310cd1f9770e7bf8e48810c7bcbb0e078c8fb23a8c7bcf0da4c2bf61a455"
checksum = "35622eb004c8f0c5e7e2032815f3314a93df0db30a1ce5c94e62c1ecc81e22b9"
dependencies = [
"lazy_static",
"regex",
@ -1003,9 +1004,9 @@ version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4"
dependencies = [
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
"proc-macro2",
"quote",
"syn",
"synstructure",
]
@ -1298,16 +1299,16 @@ dependencies = [
[[package]]
name = "html5ever"
version = "0.24.1"
version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "025483b0a1e4577bb28578318c886ee5f817dda6eb62473269349044406644cb"
checksum = "aafcf38a1a36118242d29b92e1b08ef84e67e4a5ed06e0a80be20e6a32bfed6b"
dependencies = [
"log",
"mac",
"markup5ever",
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
"proc-macro2",
"quote",
"syn",
]
[[package]]
@ -1515,9 +1516,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8609af8f63b626e8e211f52441fcdb6ec54f1a446606b10d5c89ae9bf8a20058"
dependencies = [
"proc-macro-crate",
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
"proc-macro2",
"quote",
"syn",
]
[[package]]
@ -1735,9 +1736,9 @@ checksum = "08cbb6b4fef96b6d77bfc40ec491b1690c779e77b05cd9f07f787ed376fd4c43"
[[package]]
name = "markup5ever"
version = "0.9.0"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65381d9d47506b8592b97c4efd936afcf673b09b059f2bef39c7211ee78b9d03"
checksum = "aae38d669396ca9b707bfc3db254bc382ddb94f57cc5c235f34623a669a01dab"
dependencies = [
"log",
"phf",
@ -1750,6 +1751,18 @@ dependencies = [
"tendril",
]
[[package]]
name = "markup5ever_rcdom"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f015da43bcd8d4f144559a3423f4591d69b8ce0652c905374da7205df336ae2b"
dependencies = [
"html5ever",
"markup5ever",
"tendril",
"xml5ever",
]
[[package]]
name = "matchers"
version = "0.0.1"
@ -1937,7 +1950,7 @@ dependencies = [
"hex 0.4.0",
"libc",
"log",
"rand 0.7.3",
"rand",
"rustc-workspace-hack",
"rustc_version",
"shell-escape",
@ -2131,7 +2144,7 @@ dependencies = [
"log",
"mio-named-pipes",
"miow 0.3.3",
"rand 0.7.3",
"rand",
"tokio",
"tokio-named-pipes",
"tokio-uds",
@ -2233,9 +2246,9 @@ checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55"
dependencies = [
"pest",
"pest_meta",
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
"proc-macro2",
"quote",
"syn",
]
[[package]]
@ -2261,18 +2274,18 @@ dependencies = [
[[package]]
name = "phf"
version = "0.7.24"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3da44b85f8e8dfaec21adae67f95d93244b2ecf6ad2a692320598dcc8e6dd18"
checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12"
dependencies = [
"phf_shared",
]
[[package]]
name = "phf_codegen"
version = "0.7.24"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b03e85129e324ad4166b06b2c7491ae27fe3ec353af72e72cd1654c7225d517e"
checksum = "cbffee61585b0411840d3ece935cce9cb6321f01c45477d30066498cd5e1a815"
dependencies = [
"phf_generator",
"phf_shared",
@ -2280,19 +2293,19 @@ dependencies = [
[[package]]
name = "phf_generator"
version = "0.7.24"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09364cc93c159b8b06b1f4dd8a4398984503483891b0c26b867cf431fb132662"
checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526"
dependencies = [
"phf_shared",
"rand 0.6.1",
"rand",
]
[[package]]
name = "phf_shared"
version = "0.7.24"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0"
checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7"
dependencies = [
"siphasher",
]
@ -2363,18 +2376,9 @@ version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aeccfe4d5d8ea175d5f0e4a2ad0637e0f4121d63bd99d356fb1f39ab2e7c6097"
dependencies = [
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
]
[[package]]
name = "proc-macro2"
version = "0.4.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
dependencies = [
"unicode-xid 0.1.0",
"proc-macro2",
"quote",
"syn",
]
[[package]]
@ -2383,7 +2387,7 @@ version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e98a83a9f9b331f54b924e68a66acb1bb35cb01fb0a23645139967abefb697e8"
dependencies = [
"unicode-xid 0.2.0",
"unicode-xid",
]
[[package]]
@ -2441,22 +2445,13 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07589615d719a60c8dd8a4622e7946465dfef20d1a428f969e3443e7386d5f45"
[[package]]
name = "quote"
version = "0.6.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db"
dependencies = [
"proc-macro2 0.4.30",
]
[[package]]
name = "quote"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
dependencies = [
"proc-macro2 1.0.3",
"proc-macro2",
]
[[package]]
@ -2482,25 +2477,6 @@ dependencies = [
"rustc-ap-rustc_span",
]
[[package]]
name = "rand"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae9d223d52ae411a33cf7e54ec6034ec165df296ccd23533d671a28252b6f66a"
dependencies = [
"cloudabi",
"fuchsia-zircon",
"libc",
"rand_chacha 0.1.0",
"rand_core 0.3.0",
"rand_hc 0.1.0",
"rand_isaac",
"rand_pcg",
"rand_xorshift 0.1.0",
"rustc_version",
"winapi 0.3.8",
]
[[package]]
name = "rand"
version = "0.7.3"
@ -2509,19 +2485,10 @@ checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
dependencies = [
"getrandom",
"libc",
"rand_chacha 0.2.2",
"rand_chacha",
"rand_core 0.5.1",
"rand_hc 0.2.0",
]
[[package]]
name = "rand_chacha"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "771b009e3a508cb67e8823dda454aaa5368c7bc1c16829fb77d3e980440dd34a"
dependencies = [
"rand_core 0.3.0",
"rustc_version",
"rand_hc",
"rand_pcg",
]
[[package]]
@ -2555,15 +2522,6 @@ dependencies = [
"getrandom",
]
[[package]]
name = "rand_hc"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4"
dependencies = [
"rand_core 0.3.0",
]
[[package]]
name = "rand_hc"
version = "0.2.0"
@ -2573,15 +2531,6 @@ dependencies = [
"rand_core 0.5.1",
]
[[package]]
name = "rand_isaac"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08"
dependencies = [
"rand_core 0.3.0",
]
[[package]]
name = "rand_os"
version = "0.1.3"
@ -2598,21 +2547,11 @@ dependencies = [
[[package]]
name = "rand_pcg"
version = "0.1.1"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "086bd09a33c7044e56bb44d5bdde5a60e7f119a9e95b0775f545de759a32fe05"
checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429"
dependencies = [
"rand_core 0.3.0",
"rustc_version",
]
[[package]]
name = "rand_xorshift"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "effa3fcaa47e18db002bdde6060944b6d2f9cfd8db471c30e873448ad9187be3"
dependencies = [
"rand_core 0.3.0",
"rand_core 0.5.1",
]
[[package]]
@ -2752,7 +2691,7 @@ dependencies = [
"num_cpus",
"ordslice",
"racer",
"rand 0.7.3",
"rand",
"rayon",
"regex",
"rls-analysis",
@ -2824,7 +2763,7 @@ dependencies = [
"env_logger 0.7.1",
"futures",
"log",
"rand 0.7.3",
"rand",
"rls-data",
"rls-ipc",
"serde",
@ -3051,7 +2990,7 @@ version = "669.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "456af5f09c006cf6c22c1a433ee0232c4bb74bdc6c647a010166a47c94ed2a63"
dependencies = [
"unicode-xid 0.2.0",
"unicode-xid",
]
[[package]]
@ -3060,9 +2999,9 @@ version = "669.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64f6acd192f313047759a346b892998b626466b93fe04f415da5f38906bb3b4c"
dependencies = [
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
"proc-macro2",
"quote",
"syn",
"synstructure",
]
@ -3224,13 +3163,13 @@ name = "rustc-workspace-hack"
version = "1.0.0"
dependencies = [
"crossbeam-utils 0.7.2",
"proc-macro2 1.0.3",
"quote 1.0.2",
"proc-macro2",
"quote",
"serde",
"serde_json",
"smallvec 0.6.10",
"smallvec 1.4.0",
"syn 1.0.11",
"syn",
"url 2.1.0",
"winapi 0.3.8",
]
@ -3555,7 +3494,7 @@ dependencies = [
name = "rustc_incremental"
version = "0.0.0"
dependencies = [
"rand 0.7.3",
"rand",
"rustc_ast",
"rustc_data_structures",
"rustc_fs_util",
@ -3644,7 +3583,7 @@ dependencies = [
name = "rustc_lexer"
version = "0.1.0"
dependencies = [
"unicode-xid 0.2.0",
"unicode-xid",
]
[[package]]
@ -3681,9 +3620,9 @@ dependencies = [
name = "rustc_macros"
version = "0.1.0"
dependencies = [
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
"proc-macro2",
"quote",
"syn",
"synstructure",
]
@ -4135,10 +4074,10 @@ dependencies = [
name = "rustfmt-config_proc_macro"
version = "0.2.0"
dependencies = [
"proc-macro2 1.0.3",
"quote 1.0.2",
"proc-macro2",
"quote",
"serde",
"syn 1.0.11",
"syn",
]
[[package]]
@ -4265,9 +4204,9 @@ version = "1.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e549e3abf4fb8621bd1609f11dfc9f5e50320802273b12f3811a67e6716ea6c"
dependencies = [
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
"proc-macro2",
"quote",
"syn",
]
[[package]]
@ -4296,9 +4235,9 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd02c7587ec314570041b2754829f84d873ced14a96d1fd1823531e11db40573"
dependencies = [
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
"proc-macro2",
"quote",
"syn",
]
[[package]]
@ -4346,9 +4285,9 @@ dependencies = [
[[package]]
name = "siphasher"
version = "0.2.2"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0df90a788073e8d0235a67e50441d47db7c8ad9debd91cbf43736a2a92d36537"
checksum = "fa8f3741c7372e75519bd9346068370c9cdaabcc1f9599cbcf2a2719352286b7"
[[package]]
name = "sized-chunks"
@ -4428,7 +4367,7 @@ dependencies = [
"panic_abort",
"panic_unwind",
"profiler_builtins",
"rand 0.7.3",
"rand",
"rustc-demangle",
"unwind",
"wasi",
@ -4436,38 +4375,29 @@ dependencies = [
[[package]]
name = "string_cache"
version = "0.7.3"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25d70109977172b127fe834e5449e5ab1740b9ba49fa18a2020f509174f25423"
checksum = "2940c75beb4e3bf3a494cef919a747a2cb81e52571e212bfbd185074add7208a"
dependencies = [
"lazy_static",
"new_debug_unreachable",
"phf_shared",
"precomputed-hash",
"serde",
"string_cache_codegen",
"string_cache_shared",
]
[[package]]
name = "string_cache_codegen"
version = "0.4.2"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1eea1eee654ef80933142157fdad9dd8bc43cf7c74e999e369263496f04ff4da"
checksum = "f24c8e5e19d22a726626f1a5e16fe15b132dcf21d10177fa5a45ce7962996b97"
dependencies = [
"phf_generator",
"phf_shared",
"proc-macro2 0.4.30",
"quote 0.6.12",
"string_cache_shared",
"proc-macro2",
"quote",
]
[[package]]
name = "string_cache_shared"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc"
[[package]]
name = "strip-ansi-escapes"
version = "0.1.0"
@ -4501,38 +4431,27 @@ checksum = "2ae9e5165d463a0dea76967d021f8d0f9316057bf5163aa2a4843790e842ff37"
dependencies = [
"heck",
"proc-macro-error",
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "strum"
version = "0.11.0"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6c3a2071519ab6a48f465808c4c1ffdd00dfc8e93111d02b4fc5abab177676e"
checksum = "57bd81eb48f4c437cadc685403cad539345bf703d78e63707418431cecd4522b"
[[package]]
name = "strum_macros"
version = "0.11.0"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8baacebd7b7c9b864d83a6ba7a246232983e277b86fa5cdec77f565715a4b136"
checksum = "87c85aa3f8ea653bfd3ddf25f7ee357ee4d204731f6aa9ad04002306f6e2774c"
dependencies = [
"heck",
"proc-macro2 0.4.30",
"quote 0.6.12",
"syn 0.15.35",
]
[[package]]
name = "syn"
version = "0.15.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "641e117d55514d6d918490e47102f7e08d096fdde360247e4a10f7a91a8478d3"
dependencies = [
"proc-macro2 0.4.30",
"quote 0.6.12",
"unicode-xid 0.1.0",
"proc-macro2",
"quote",
"syn",
]
[[package]]
@ -4541,9 +4460,9 @@ version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dff0acdb207ae2fe6d5976617f887eb1e35a2ba52c13c7234c790960cdad9238"
dependencies = [
"proc-macro2 1.0.3",
"quote 1.0.2",
"unicode-xid 0.2.0",
"proc-macro2",
"quote",
"unicode-xid",
]
[[package]]
@ -4552,10 +4471,10 @@ version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f085a5855930c0441ca1288cf044ea4aecf4f43a91668abdb870b4ba546a203"
dependencies = [
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
"unicode-xid 0.2.0",
"proc-macro2",
"quote",
"syn",
"unicode-xid",
]
[[package]]
@ -4578,7 +4497,7 @@ checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
dependencies = [
"cfg-if",
"libc",
"rand 0.7.3",
"rand",
"redox_syscall",
"remove_dir_all",
"winapi 0.3.8",
@ -4683,9 +4602,9 @@ version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24069c0ba08aab54289d6a25f5036d94afc61e1538bbc42ae5501df141c9027d"
dependencies = [
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
"proc-macro2",
"quote",
"syn",
]
[[package]]
@ -4984,9 +4903,9 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0693bf8d6f2bf22c690fc61a9d21ac69efdbb894a17ed596b9af0f01e64b84b"
dependencies = [
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
"proc-macro2",
"quote",
"syn",
]
[[package]]
@ -5103,12 +5022,6 @@ dependencies = [
"rustc-std-workspace-std",
]
[[package]]
name = "unicode-xid"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
[[package]]
name = "unicode-xid"
version = "0.2.0"
@ -5296,6 +5209,18 @@ dependencies = [
"libc",
]
[[package]]
name = "xml5ever"
version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b1b52e6e8614d4a58b8e70cf51ec0cc21b256ad8206708bcff8139b5bbd6a59"
dependencies = [
"log",
"mac",
"markup5ever",
"time",
]
[[package]]
name = "xz2"
version = "0.1.5"

View File

@ -282,3 +282,305 @@ pub fn iter_10k(b: &mut Bencher) {
pub fn iter_1m(b: &mut Bencher) {
bench_iter(b, 1_000, 1_000_000);
}
const FAT: usize = 256;
// The returned map has small keys and values.
// Benchmarks on it have a counterpart in set.rs with the same keys and no values at all.
fn slim_map(n: usize) -> BTreeMap<usize, usize> {
(0..n).map(|i| (i, i)).collect::<BTreeMap<_, _>>()
}
// The returned map has small keys and large values.
fn fat_val_map(n: usize) -> BTreeMap<usize, [usize; FAT]> {
(0..n).map(|i| (i, [i; FAT])).collect::<BTreeMap<_, _>>()
}
// The returned map has large keys and values.
fn fat_map(n: usize) -> BTreeMap<[usize; FAT], [usize; FAT]> {
(0..n).map(|i| ([i; FAT], [i; FAT])).collect::<BTreeMap<_, _>>()
}
#[bench]
pub fn clone_slim_100(b: &mut Bencher) {
let src = slim_map(100);
b.iter(|| src.clone())
}
#[bench]
pub fn clone_slim_100_and_clear(b: &mut Bencher) {
let src = slim_map(100);
b.iter(|| src.clone().clear())
}
#[bench]
pub fn clone_slim_100_and_drain_all(b: &mut Bencher) {
let src = slim_map(100);
b.iter(|| src.clone().drain_filter(|_, _| true).count())
}
#[bench]
pub fn clone_slim_100_and_drain_half(b: &mut Bencher) {
let src = slim_map(100);
b.iter(|| {
let mut map = src.clone();
assert_eq!(map.drain_filter(|i, _| i % 2 == 0).count(), 100 / 2);
assert_eq!(map.len(), 100 / 2);
})
}
#[bench]
pub fn clone_slim_100_and_into_iter(b: &mut Bencher) {
let src = slim_map(100);
b.iter(|| src.clone().into_iter().count())
}
#[bench]
pub fn clone_slim_100_and_pop_all(b: &mut Bencher) {
let src = slim_map(100);
b.iter(|| {
let mut map = src.clone();
while map.pop_first().is_some() {}
map
});
}
#[bench]
pub fn clone_slim_100_and_remove_all(b: &mut Bencher) {
let src = slim_map(100);
b.iter(|| {
let mut map = src.clone();
while let Some(elt) = map.iter().map(|(&i, _)| i).next() {
let v = map.remove(&elt);
debug_assert!(v.is_some());
}
map
});
}
#[bench]
pub fn clone_slim_100_and_remove_half(b: &mut Bencher) {
let src = slim_map(100);
b.iter(|| {
let mut map = src.clone();
for i in (0..100).step_by(2) {
let v = map.remove(&i);
debug_assert!(v.is_some());
}
assert_eq!(map.len(), 100 / 2);
map
})
}
#[bench]
pub fn clone_slim_10k(b: &mut Bencher) {
let src = slim_map(10_000);
b.iter(|| src.clone())
}
#[bench]
pub fn clone_slim_10k_and_clear(b: &mut Bencher) {
let src = slim_map(10_000);
b.iter(|| src.clone().clear())
}
#[bench]
pub fn clone_slim_10k_and_drain_all(b: &mut Bencher) {
let src = slim_map(10_000);
b.iter(|| src.clone().drain_filter(|_, _| true).count())
}
#[bench]
pub fn clone_slim_10k_and_drain_half(b: &mut Bencher) {
let src = slim_map(10_000);
b.iter(|| {
let mut map = src.clone();
assert_eq!(map.drain_filter(|i, _| i % 2 == 0).count(), 10_000 / 2);
assert_eq!(map.len(), 10_000 / 2);
})
}
#[bench]
pub fn clone_slim_10k_and_into_iter(b: &mut Bencher) {
let src = slim_map(10_000);
b.iter(|| src.clone().into_iter().count())
}
#[bench]
pub fn clone_slim_10k_and_pop_all(b: &mut Bencher) {
let src = slim_map(10_000);
b.iter(|| {
let mut map = src.clone();
while map.pop_first().is_some() {}
map
});
}
#[bench]
pub fn clone_slim_10k_and_remove_all(b: &mut Bencher) {
let src = slim_map(10_000);
b.iter(|| {
let mut map = src.clone();
while let Some(elt) = map.iter().map(|(&i, _)| i).next() {
let v = map.remove(&elt);
debug_assert!(v.is_some());
}
map
});
}
#[bench]
pub fn clone_slim_10k_and_remove_half(b: &mut Bencher) {
let src = slim_map(10_000);
b.iter(|| {
let mut map = src.clone();
for i in (0..10_000).step_by(2) {
let v = map.remove(&i);
debug_assert!(v.is_some());
}
assert_eq!(map.len(), 10_000 / 2);
map
})
}
#[bench]
pub fn clone_fat_val_100(b: &mut Bencher) {
let src = fat_val_map(100);
b.iter(|| src.clone())
}
#[bench]
pub fn clone_fat_val_100_and_clear(b: &mut Bencher) {
let src = fat_val_map(100);
b.iter(|| src.clone().clear())
}
#[bench]
pub fn clone_fat_val_100_and_drain_all(b: &mut Bencher) {
let src = fat_val_map(100);
b.iter(|| src.clone().drain_filter(|_, _| true).count())
}
#[bench]
pub fn clone_fat_val_100_and_drain_half(b: &mut Bencher) {
let src = fat_val_map(100);
b.iter(|| {
let mut map = src.clone();
assert_eq!(map.drain_filter(|i, _| i % 2 == 0).count(), 100 / 2);
assert_eq!(map.len(), 100 / 2);
})
}
#[bench]
pub fn clone_fat_val_100_and_into_iter(b: &mut Bencher) {
let src = fat_val_map(100);
b.iter(|| src.clone().into_iter().count())
}
#[bench]
pub fn clone_fat_val_100_and_pop_all(b: &mut Bencher) {
let src = fat_val_map(100);
b.iter(|| {
let mut map = src.clone();
while map.pop_first().is_some() {}
map
});
}
#[bench]
pub fn clone_fat_val_100_and_remove_all(b: &mut Bencher) {
let src = fat_val_map(100);
b.iter(|| {
let mut map = src.clone();
while let Some(elt) = map.iter().map(|(&i, _)| i).next() {
let v = map.remove(&elt);
debug_assert!(v.is_some());
}
map
});
}
#[bench]
pub fn clone_fat_val_100_and_remove_half(b: &mut Bencher) {
let src = fat_val_map(100);
b.iter(|| {
let mut map = src.clone();
for i in (0..100).step_by(2) {
let v = map.remove(&i);
debug_assert!(v.is_some());
}
assert_eq!(map.len(), 100 / 2);
map
})
}
#[bench]
pub fn clone_fat_100(b: &mut Bencher) {
let src = fat_map(100);
b.iter(|| src.clone())
}
#[bench]
pub fn clone_fat_100_and_clear(b: &mut Bencher) {
let src = fat_map(100);
b.iter(|| src.clone().clear())
}
#[bench]
pub fn clone_fat_100_and_drain_all(b: &mut Bencher) {
let src = fat_map(100);
b.iter(|| src.clone().drain_filter(|_, _| true).count())
}
#[bench]
pub fn clone_fat_100_and_drain_half(b: &mut Bencher) {
let src = fat_map(100);
b.iter(|| {
let mut map = src.clone();
assert_eq!(map.drain_filter(|i, _| i[0] % 2 == 0).count(), 100 / 2);
assert_eq!(map.len(), 100 / 2);
})
}
#[bench]
pub fn clone_fat_100_and_into_iter(b: &mut Bencher) {
let src = fat_map(100);
b.iter(|| src.clone().into_iter().count())
}
#[bench]
pub fn clone_fat_100_and_pop_all(b: &mut Bencher) {
let src = fat_map(100);
b.iter(|| {
let mut map = src.clone();
while map.pop_first().is_some() {}
map
});
}
#[bench]
pub fn clone_fat_100_and_remove_all(b: &mut Bencher) {
let src = fat_map(100);
b.iter(|| {
let mut map = src.clone();
while let Some(elt) = map.iter().map(|(&i, _)| i).next() {
let v = map.remove(&elt);
debug_assert!(v.is_some());
}
map
});
}
#[bench]
pub fn clone_fat_100_and_remove_half(b: &mut Bencher) {
let src = fat_map(100);
b.iter(|| {
let mut map = src.clone();
for i in (0..100).step_by(2) {
let v = map.remove(&[i; FAT]);
debug_assert!(v.is_some());
}
assert_eq!(map.len(), 100 / 2);
map
})
}

View File

@ -50,27 +50,31 @@ macro_rules! set_bench {
};
}
fn slim_set(n: usize) -> BTreeSet<usize> {
(0..n).collect::<BTreeSet<_>>()
}
#[bench]
pub fn clone_100(b: &mut Bencher) {
let src = pos(100);
let src = slim_set(100);
b.iter(|| src.clone())
}
#[bench]
pub fn clone_100_and_clear(b: &mut Bencher) {
let src = pos(100);
let src = slim_set(100);
b.iter(|| src.clone().clear())
}
#[bench]
pub fn clone_100_and_drain_all(b: &mut Bencher) {
let src = pos(100);
let src = slim_set(100);
b.iter(|| src.clone().drain_filter(|_| true).count())
}
#[bench]
pub fn clone_100_and_drain_half(b: &mut Bencher) {
let src = pos(100);
let src = slim_set(100);
b.iter(|| {
let mut set = src.clone();
assert_eq!(set.drain_filter(|i| i % 2 == 0).count(), 100 / 2);
@ -80,13 +84,13 @@ pub fn clone_100_and_drain_half(b: &mut Bencher) {
#[bench]
pub fn clone_100_and_into_iter(b: &mut Bencher) {
let src = pos(100);
let src = slim_set(100);
b.iter(|| src.clone().into_iter().count())
}
#[bench]
pub fn clone_100_and_pop_all(b: &mut Bencher) {
let src = pos(100);
let src = slim_set(100);
b.iter(|| {
let mut set = src.clone();
while set.pop_first().is_some() {}
@ -96,11 +100,12 @@ pub fn clone_100_and_pop_all(b: &mut Bencher) {
#[bench]
pub fn clone_100_and_remove_all(b: &mut Bencher) {
let src = pos(100);
let src = slim_set(100);
b.iter(|| {
let mut set = src.clone();
while let Some(elt) = set.iter().copied().next() {
set.remove(&elt);
let ok = set.remove(&elt);
debug_assert!(ok);
}
set
});
@ -108,11 +113,12 @@ pub fn clone_100_and_remove_all(b: &mut Bencher) {
#[bench]
pub fn clone_100_and_remove_half(b: &mut Bencher) {
let src = pos(100);
let src = slim_set(100);
b.iter(|| {
let mut set = src.clone();
for i in (2..=100 as i32).step_by(2) {
set.remove(&i);
for i in (0..100).step_by(2) {
let ok = set.remove(&i);
debug_assert!(ok);
}
assert_eq!(set.len(), 100 / 2);
set
@ -121,25 +127,25 @@ pub fn clone_100_and_remove_half(b: &mut Bencher) {
#[bench]
pub fn clone_10k(b: &mut Bencher) {
let src = pos(10_000);
let src = slim_set(10_000);
b.iter(|| src.clone())
}
#[bench]
pub fn clone_10k_and_clear(b: &mut Bencher) {
let src = pos(10_000);
let src = slim_set(10_000);
b.iter(|| src.clone().clear())
}
#[bench]
pub fn clone_10k_and_drain_all(b: &mut Bencher) {
let src = pos(10_000);
let src = slim_set(10_000);
b.iter(|| src.clone().drain_filter(|_| true).count())
}
#[bench]
pub fn clone_10k_and_drain_half(b: &mut Bencher) {
let src = pos(10_000);
let src = slim_set(10_000);
b.iter(|| {
let mut set = src.clone();
assert_eq!(set.drain_filter(|i| i % 2 == 0).count(), 10_000 / 2);
@ -149,13 +155,13 @@ pub fn clone_10k_and_drain_half(b: &mut Bencher) {
#[bench]
pub fn clone_10k_and_into_iter(b: &mut Bencher) {
let src = pos(10_000);
let src = slim_set(10_000);
b.iter(|| src.clone().into_iter().count())
}
#[bench]
pub fn clone_10k_and_pop_all(b: &mut Bencher) {
let src = pos(10_000);
let src = slim_set(10_000);
b.iter(|| {
let mut set = src.clone();
while set.pop_first().is_some() {}
@ -165,11 +171,12 @@ pub fn clone_10k_and_pop_all(b: &mut Bencher) {
#[bench]
pub fn clone_10k_and_remove_all(b: &mut Bencher) {
let src = pos(10_000);
let src = slim_set(10_000);
b.iter(|| {
let mut set = src.clone();
while let Some(elt) = set.iter().copied().next() {
set.remove(&elt);
let ok = set.remove(&elt);
debug_assert!(ok);
}
set
});
@ -177,11 +184,12 @@ pub fn clone_10k_and_remove_all(b: &mut Bencher) {
#[bench]
pub fn clone_10k_and_remove_half(b: &mut Bencher) {
let src = pos(10_000);
let src = slim_set(10_000);
b.iter(|| {
let mut set = src.clone();
for i in (2..=10_000 as i32).step_by(2) {
set.remove(&i);
for i in (0..10_000).step_by(2) {
let ok = set.remove(&i);
debug_assert!(ok);
}
assert_eq!(set.len(), 10_000 / 2);
set

View File

@ -174,7 +174,7 @@ impl<K: Clone, V: Clone> Clone for BTreeMap<K, V> {
{
let out_root = BTreeMap::ensure_is_owned(&mut out_tree.root);
let mut out_node = out_root.push_level();
let mut out_node = out_root.push_internal_level();
let mut in_edge = internal.first_edge();
while let Ok(kv) = in_edge.right_kv() {
let (k, v) = kv.into_kv();
@ -1080,9 +1080,9 @@ impl<K: Ord, V> BTreeMap<K, V> {
test_node = parent.forget_type();
}
}
Err(node) => {
Err(_) => {
// We are at the top, create a new root node and push there.
open_node = node.into_root_mut().push_level();
open_node = root.push_internal_level();
break;
}
}
@ -1092,7 +1092,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
let tree_height = open_node.height() - 1;
let mut right_tree = node::Root::new_leaf();
for _ in 0..tree_height {
right_tree.push_level();
right_tree.push_internal_level();
}
open_node.push(key, value, right_tree);
@ -1171,7 +1171,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
let mut right = Self::new();
let right_root = Self::ensure_is_owned(&mut right.root);
for _ in 0..left_root.height() {
right_root.push_level();
right_root.push_internal_level();
}
{
@ -1255,7 +1255,11 @@ impl<K: Ord, V> BTreeMap<K, V> {
}
pub(super) fn drain_filter_inner(&mut self) -> DrainFilterInner<'_, K, V> {
let front = self.root.as_mut().map(|r| r.as_mut().first_leaf_edge());
DrainFilterInner { length: &mut self.length, cur_leaf_edge: front }
DrainFilterInner {
length: &mut self.length,
cur_leaf_edge: front,
emptied_internal_root: false,
}
}
/// Calculates the number of elements if it is incorrect.
@ -1625,6 +1629,7 @@ where
pub(super) struct DrainFilterInner<'a, K: 'a, V: 'a> {
length: &'a mut usize,
cur_leaf_edge: Option<Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge>>,
emptied_internal_root: bool,
}
#[unstable(feature = "btree_drain_filter", issue = "70530")]
@ -1665,6 +1670,17 @@ where
}
}
impl<K, V> Drop for DrainFilterInner<'_, K, V> {
fn drop(&mut self) {
if self.emptied_internal_root {
if let Some(handle) = self.cur_leaf_edge.take() {
let root = handle.into_node().into_root_mut();
root.pop_internal_level();
}
}
}
}
impl<'a, K: 'a, V: 'a> DrainFilterInner<'a, K, V> {
/// Allow Debug implementations to predict the next element.
pub(super) fn peek(&self) -> Option<(&K, &V)> {
@ -1681,9 +1697,10 @@ impl<'a, K: 'a, V: 'a> DrainFilterInner<'a, K, V> {
let (k, v) = kv.kv_mut();
if pred(k, v) {
*self.length -= 1;
let (k, v, leaf_edge_location) = kv.remove_kv_tracking();
self.cur_leaf_edge = Some(leaf_edge_location);
return Some((k, v));
let RemoveResult { old_kv, pos, emptied_internal_root } = kv.remove_kv_tracking();
self.cur_leaf_edge = Some(pos);
self.emptied_internal_root |= emptied_internal_root;
return Some(old_kv);
}
self.cur_leaf_edge = Some(kv.next_leaf_edge());
}
@ -2477,7 +2494,7 @@ impl<'a, K: Ord, V> VacantEntry<'a, K, V> {
}
},
Err(root) => {
root.push_level().push(ins_k, ins_v, ins_edge);
root.push_internal_level().push(ins_k, ins_v, ins_edge);
return unsafe { &mut *out_ptr };
}
}
@ -2647,20 +2664,35 @@ impl<'a, K: Ord, V> OccupiedEntry<'a, K, V> {
self.remove_kv().1
}
// Body of `remove_entry`, separate to keep the above implementations short.
fn remove_kv(self) -> (K, V) {
*self.length -= 1;
let (old_key, old_val, _) = self.handle.remove_kv_tracking();
(old_key, old_val)
let RemoveResult { old_kv, pos, emptied_internal_root } = self.handle.remove_kv_tracking();
let root = pos.into_node().into_root_mut();
if emptied_internal_root {
root.pop_internal_level();
}
old_kv
}
}
struct RemoveResult<'a, K, V> {
// Key and value removed.
old_kv: (K, V),
// Unique location at the leaf level that the removed KV lopgically collapsed into.
pos: Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge>,
// Whether the remove left behind and empty internal root node, that should be removed
// using `pop_internal_level`.
emptied_internal_root: bool,
}
impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal>, marker::KV> {
/// Removes a key/value-pair from the map, and returns that pair, as well as
/// the leaf edge corresponding to that former pair.
fn remove_kv_tracking(
self,
) -> (K, V, Handle<NodeRef<marker::Mut<'a>, K, V, marker::Leaf>, marker::Edge>) {
/// Removes a key/value-pair from the tree, and returns that pair, as well as
/// the leaf edge corresponding to that former pair. It's possible this leaves
/// an empty internal root node, which the caller should subsequently pop from
/// the map holding the tree. The caller should also decrement the map's length.
fn remove_kv_tracking(self) -> RemoveResult<'a, K, V> {
let (mut pos, old_key, old_val, was_internal) = match self.force() {
Leaf(leaf) => {
let (hole, old_key, old_val) = leaf.remove();
@ -2689,6 +2721,7 @@ impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInter
};
// Handle underflow
let mut emptied_internal_root = false;
let mut cur_node = unsafe { ptr::read(&pos).into_node().forget_type() };
let mut at_leaf = true;
while cur_node.len() < node::MIN_LEN {
@ -2709,8 +2742,8 @@ impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInter
let parent = edge.into_node();
if parent.len() == 0 {
// We must be at the root
parent.into_root_mut().pop_level();
// This empty parent must be the root, and should be popped off the tree.
emptied_internal_root = true;
break;
} else {
cur_node = parent.forget_type();
@ -2737,7 +2770,7 @@ impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInter
pos = unsafe { unwrap_unchecked(pos.next_kv().ok()).next_leaf_edge() };
}
(old_key, old_val, pos)
RemoveResult { old_kv: (old_key, old_val), pos, emptied_internal_root }
}
}
@ -2745,7 +2778,7 @@ impl<K, V> node::Root<K, V> {
/// Removes empty levels on the top, but keep an empty leaf if the entire tree is empty.
fn fix_top(&mut self) {
while self.height() > 0 && self.as_ref().len() == 0 {
self.pop_level();
self.pop_internal_level();
}
}
@ -2817,8 +2850,16 @@ fn handle_underfull_node<K, V>(
let (is_left, mut handle) = match parent.left_kv() {
Ok(left) => (true, left),
Err(parent) => {
let right = unsafe { unwrap_unchecked(parent.right_kv().ok()) };
(false, right)
match parent.right_kv() {
Ok(right) => (false, right),
Err(_) => {
// The underfull node has an empty parent, so it is the only child
// of an empty root. It is destined to become the new root, thus
// allowed to be underfull. The empty parent should be removed later
// by `pop_internal_level`.
return AtRoot;
}
}
}
};

View File

@ -19,7 +19,7 @@ impl<BorrowType, K, V> Handle<NodeRef<BorrowType, K, V, marker::Leaf>, marker::E
Ok(internal_kv) => return Ok(internal_kv),
Err(last_edge) => match last_edge.into_node().ascend() {
Ok(parent_edge) => parent_edge.forget_node_type(),
Err(root) => return Err(root.forget_type()),
Err(root) => return Err(root),
},
}
}
@ -40,7 +40,7 @@ impl<BorrowType, K, V> Handle<NodeRef<BorrowType, K, V, marker::Leaf>, marker::E
Ok(internal_kv) => return Ok(internal_kv),
Err(last_edge) => match last_edge.into_node().ascend() {
Ok(parent_edge) => parent_edge.forget_node_type(),
Err(root) => return Err(root.forget_type()),
Err(root) => return Err(root),
},
}
}

View File

@ -191,8 +191,9 @@ impl<K, V> Root<K, V> {
}
/// Adds a new internal node with a single edge, pointing to the previous root, and make that
/// new node the root. This increases the height by 1 and is the opposite of `pop_level`.
pub fn push_level(&mut self) -> NodeRef<marker::Mut<'_>, K, V, marker::Internal> {
/// new node the root. This increases the height by 1 and is the opposite of
/// `pop_internal_level`.
pub fn push_internal_level(&mut self) -> NodeRef<marker::Mut<'_>, K, V, marker::Internal> {
let mut new_node = Box::new(unsafe { InternalNode::new() });
new_node.edges[0].write(unsafe { BoxedNode::from_ptr(self.node.as_ptr()) });
@ -213,11 +214,12 @@ impl<K, V> Root<K, V> {
ret
}
/// Removes the root node, using its first child as the new root. This cannot be called when
/// the tree consists only of a leaf node. As it is intended only to be called when the root
/// has only one edge, no cleanup is done on any of the other children of the root.
/// This decreases the height by 1 and is the opposite of `push_level`.
pub fn pop_level(&mut self) {
/// Removes the internal root node, using its first child as the new root.
/// As it is intended only to be called when the root has only one child,
/// no cleanup is done on any of the other children of the root.
/// This decreases the height by 1 and is the opposite of `push_internal_level`.
/// Panics if there is no internal level, i.e. if the root is a leaf.
pub fn pop_internal_level(&mut self) {
assert!(self.height > 0);
let top = self.node.ptr;
@ -305,12 +307,6 @@ impl<BorrowType, K, V, Type> NodeRef<BorrowType, K, V, Type> {
self.height
}
/// Removes any static information about whether this node is a `Leaf` or an
/// `Internal` node.
pub fn forget_type(self) -> NodeRef<BorrowType, K, V, marker::LeafOrInternal> {
NodeRef { height: self.height, node: self.node, root: self.root, _marker: PhantomData }
}
/// Temporarily takes out another, immutable reference to the same node.
fn reborrow(&self) -> NodeRef<marker::Immut<'_>, K, V, Type> {
NodeRef { height: self.height, node: self.node, root: self.root, _marker: PhantomData }
@ -466,12 +462,6 @@ impl<'a, K: 'a, V: 'a, Type> NodeRef<marker::Immut<'a>, K, V, Type> {
fn into_val_slice(self) -> &'a [V] {
unsafe { slice::from_raw_parts(MaybeUninit::first_ptr(&self.as_leaf().vals), self.len()) }
}
fn into_slices(self) -> (&'a [K], &'a [V]) {
// SAFETY: equivalent to reborrow() except not requiring Type: 'a
let k = unsafe { ptr::read(&self) };
(k.into_key_slice(), self.into_val_slice())
}
}
impl<'a, K: 'a, V: 'a, Type> NodeRef<marker::Mut<'a>, K, V, Type> {
@ -980,10 +970,9 @@ impl<BorrowType, K, V> Handle<NodeRef<BorrowType, K, V, marker::Internal>, marke
impl<'a, K: 'a, V: 'a, NodeType> Handle<NodeRef<marker::Immut<'a>, K, V, NodeType>, marker::KV> {
pub fn into_kv(self) -> (&'a K, &'a V) {
unsafe {
let (keys, vals) = self.node.into_slices();
(keys.get_unchecked(self.idx), vals.get_unchecked(self.idx))
}
let keys = self.node.into_key_slice();
let vals = self.node.into_val_slice();
unsafe { (keys.get_unchecked(self.idx), vals.get_unchecked(self.idx)) }
}
}
@ -1362,6 +1351,20 @@ unsafe fn move_edges<K, V>(
}
}
impl<BorrowType, K, V> NodeRef<BorrowType, K, V, marker::Leaf> {
/// Removes any static information asserting that this node is a `Leaf` node.
pub fn forget_type(self) -> NodeRef<BorrowType, K, V, marker::LeafOrInternal> {
NodeRef { height: self.height, node: self.node, root: self.root, _marker: PhantomData }
}
}
impl<BorrowType, K, V> NodeRef<BorrowType, K, V, marker::Internal> {
/// Removes any static information asserting that this node is an `Internal` node.
pub fn forget_type(self) -> NodeRef<BorrowType, K, V, marker::LeafOrInternal> {
NodeRef { height: self.height, node: self.node, root: self.root, _marker: PhantomData }
}
}
impl<BorrowType, K, V> Handle<NodeRef<BorrowType, K, V, marker::Leaf>, marker::Edge> {
pub fn forget_node_type(
self,

View File

@ -107,7 +107,8 @@ fn test_insert() {
let cap = tester.capacity();
// len is the length *after* insertion
for len in 1..cap {
let minlen = if cfg!(miri) { cap - 1 } else { 1 }; // Miri is too slow
for len in minlen..cap {
// 0, 1, 2, .., len - 1
let expected = (0..).take(len).collect::<VecDeque<_>>();
for tail_pos in 0..cap {
@ -221,7 +222,8 @@ fn test_remove() {
let cap = tester.capacity();
// len is the length *after* removal
for len in 0..cap - 1 {
let minlen = if cfg!(miri) { cap - 2 } else { 0 }; // Miri is too slow
for len in minlen..cap - 1 {
// 0, 1, 2, .., len - 1
let expected = (0..).take(len).collect::<VecDeque<_>>();
for tail_pos in 0..cap {
@ -251,7 +253,8 @@ fn test_range() {
let mut tester: VecDeque<usize> = VecDeque::with_capacity(7);
let cap = tester.capacity();
for len in 0..=cap {
let minlen = if cfg!(miri) { cap - 1 } else { 0 }; // Miri is too slow
for len in minlen..=cap {
for tail in 0..=cap {
for start in 0..=len {
for end in start..=len {
@ -384,7 +387,8 @@ fn test_split_off() {
let cap = tester.capacity();
// len is the length *before* splitting
for len in 0..cap {
let minlen = if cfg!(miri) { cap - 1 } else { 0 }; // Miri is too slow
for len in minlen..cap {
// index to split at
for at in 0..=len {
// 0, 1, 2, .., at - 1 (may be empty)
@ -495,8 +499,9 @@ fn test_vec_from_vecdeque() {
fn test_clone_from() {
let m = vec![1; 8];
let n = vec![2; 12];
for pfv in 0..8 {
for pfu in 0..8 {
let limit = if cfg!(miri) { 4 } else { 8 }; // Miri is too slow
for pfv in 0..limit {
for pfu in 0..limit {
for longer in 0..2 {
let (vr, ur) = if longer == 0 { (&m, &n) } else { (&n, &m) };
let mut v = VecDeque::from(vr.clone());

View File

@ -1721,8 +1721,8 @@ fn panic_safe() {
let mut rng = thread_rng();
// Miri is too slow
let lens = if cfg!(miri) { (1..10).chain(20..21) } else { (1..20).chain(70..MAX_LEN) };
// Miri is too slow (but still need to `chain` to make the types match)
let lens = if cfg!(miri) { (1..10).chain(0..0) } else { (1..20).chain(70..MAX_LEN) };
let moduli: &[u32] = if cfg!(miri) { &[5] } else { &[5, 20, 50] };
for len in lens {

View File

@ -188,7 +188,7 @@ fn exact_f32_random_equivalence_test() {
fn exact_f64_random_equivalence_test() {
use core::num::flt2dec::strategy::dragon::format_exact as fallback;
// Miri is too slow
let n = if cfg!(miri) { 3 } else { 1_000 };
let n = if cfg!(miri) { 2 } else { 1_000 };
for k in 1..21 {
f64_random_equivalence_test(

View File

@ -2,6 +2,7 @@ use super::super::*;
use core::num::flt2dec::strategy::grisu::*;
#[test]
#[cfg_attr(miri, ignore)] // Miri is too slow
fn test_cached_power() {
assert_eq!(CACHED_POW10.first().unwrap().1, CACHED_POW10_FIRST_E);
assert_eq!(CACHED_POW10.last().unwrap().1, CACHED_POW10_LAST_E);

View File

@ -1358,15 +1358,15 @@ fn sort_unstable() {
use core::slice::heapsort;
use rand::{rngs::StdRng, seq::SliceRandom, Rng, SeedableRng};
// Miri is too slow
let large_range = if cfg!(miri) { 0..0 } else { 500..510 };
// Miri is too slow (but still need to `chain` to make the types match)
let lens = if cfg!(miri) { (2..20).chain(0..0) } else { (2..25).chain(500..510) };
let rounds = if cfg!(miri) { 1 } else { 100 };
let mut v = [0; 600];
let mut tmp = [0; 600];
let mut rng = StdRng::from_entropy();
for len in (2..25).chain(large_range) {
for len in lens {
let v = &mut v[0..len];
let tmp = &mut tmp[0..len];

View File

@ -171,7 +171,9 @@ fn main() {
// note: everything below here is unreachable. do not put code that
// should run on success, after this block.
}
println!("\nDid not run successfully: {}\n{:?}\n-------------", status, cmd);
if verbose > 0 {
println!("\nDid not run successfully: {}\n{:?}\n-------------", status, cmd);
}
if let Some(mut on_fail) = on_fail {
on_fail.status().expect("Could not run the on_fail command");

View File

@ -11,7 +11,7 @@ doctest = false
[dependencies]
rustc_arena = { path = "../librustc_arena" }
log = { package = "tracing", version = "0.1" }
tracing = "0.1"
rustc_ast_pretty = { path = "../librustc_ast_pretty" }
rustc_hir = { path = "../librustc_hir" }
rustc_target = { path = "../librustc_target" }

View File

@ -17,9 +17,9 @@ use rustc_span::symbol::{kw, sym, Ident};
use rustc_span::Span;
use rustc_target::spec::abi;
use log::debug;
use smallvec::{smallvec, SmallVec};
use std::collections::BTreeSet;
use tracing::debug;
pub(super) struct ItemLowerer<'a, 'lowering, 'hir> {
pub(super) lctx: &'a mut LoweringContext<'lowering, 'hir>,

View File

@ -64,10 +64,10 @@ use rustc_span::source_map::{respan, DesugaringKind, ExpnData, ExpnKind};
use rustc_span::symbol::{kw, sym, Ident, Symbol};
use rustc_span::Span;
use log::{debug, trace};
use smallvec::{smallvec, SmallVec};
use std::collections::BTreeMap;
use std::mem;
use tracing::{debug, trace};
macro_rules! arena_vec {
($this:expr; $($x:expr),*) => ({

View File

@ -12,8 +12,8 @@ use rustc_session::lint::BuiltinLintDiagnostics;
use rustc_span::symbol::Ident;
use rustc_span::Span;
use log::debug;
use smallvec::smallvec;
use tracing::debug;
impl<'a, 'hir> LoweringContext<'a, 'hir> {
crate fn lower_qpath(

View File

@ -10,7 +10,7 @@ path = "lib.rs"
[dependencies]
itertools = "0.8"
log = { package = "tracing", version = "0.1" }
tracing = "0.1"
rustc_ast_pretty = { path = "../librustc_ast_pretty" }
rustc_attr = { path = "../librustc_attr" }
rustc_data_structures = { path = "../librustc_data_structures" }

View File

@ -10,7 +10,7 @@ use rustc_span::source_map::Spanned;
use rustc_span::symbol::{sym, Symbol};
use rustc_span::Span;
use log::debug;
use tracing::debug;
macro_rules! gate_feature_fn {
($cx: expr, $has_feature: expr, $span: expr, $name: expr, $explain: expr) => {{

View File

@ -10,7 +10,7 @@ path = "lib.rs"
doctest = false
[dependencies]
log = { package = "tracing", version = "0.1" }
tracing = "0.1"
rustc_span = { path = "../librustc_span" }
rustc_ast = { path = "../librustc_ast" }
rustc_target = { path = "../librustc_target" }

View File

@ -132,10 +132,10 @@
//! methods called `Printer::scan_*`, and the 'PRINT' process is the
//! method called `Printer::print`.
use log::debug;
use std::borrow::Cow;
use std::collections::VecDeque;
use std::fmt;
use tracing::debug;
/// How to break. Described in more detail in the module docs.
#[derive(Clone, Copy, PartialEq)]

View File

@ -1,4 +1,6 @@
Recursion in an `async fn` requires boxing. For example, this will not compile:
An [`async`] function used recursion without boxing.
Erroneous code example:
```edition2018,compile_fail,E0733
async fn foo(n: usize) {
@ -8,8 +10,8 @@ async fn foo(n: usize) {
}
```
To achieve async recursion, the `async fn` needs to be desugared
such that the `Future` is explicit in the return type:
To perform async recursion, the `async fn` needs to be desugared such that the
`Future` is explicit in the return type:
```edition2018,compile_fail,E0720
use std::future::Future;
@ -36,5 +38,7 @@ fn foo_recursive(n: usize) -> Pin<Box<dyn Future<Output = ()>>> {
}
```
The `Box<...>` ensures that the result is of known size,
and the pin is required to keep it in the same place in memory.
The `Box<...>` ensures that the result is of known size, and the pin is
required to keep it in the same place in memory.
[`async`]: https://doc.rust-lang.org/std/keyword.async.html

View File

@ -1,7 +1,6 @@
Control-flow expressions are not allowed inside a const context.
A control-flow expression was used inside a const context.
At the moment, `if` and `match`, as well as the looping constructs `for`,
`while`, and `loop`, are forbidden inside a `const`, `static`, or `const fn`.
Erroneous code example:
```compile_fail,E0744
const _: i32 = {
@ -13,6 +12,9 @@ const _: i32 = {
};
```
At the moment, `if` and `match`, as well as the looping constructs `for`,
`while`, and `loop`, are forbidden inside a `const`, `static`, or `const fn`.
This will be allowed at some point in the future, but the implementation is not
yet complete. See the tracking issue for [conditionals] or [loops] in a const
context for the current status.

View File

@ -13,7 +13,7 @@ use rustc_expand::base::SyntaxExtension;
use rustc_hir::def_id::{CrateNum, LocalDefId, LOCAL_CRATE};
use rustc_hir::definitions::Definitions;
use rustc_index::vec::IndexVec;
use rustc_middle::middle::cstore::{CrateSource, DepKind, ExternCrate};
use rustc_middle::middle::cstore::{CrateDepKind, CrateSource, ExternCrate};
use rustc_middle::middle::cstore::{ExternCrateSource, MetadataLoaderDyn};
use rustc_middle::ty::TyCtxt;
use rustc_session::config::{self, CrateType, ExternLocation};
@ -306,7 +306,7 @@ impl<'a> CrateLoader<'a> {
host_lib: Option<Library>,
root: Option<&CratePaths>,
lib: Library,
dep_kind: DepKind,
dep_kind: CrateDepKind,
name: Symbol,
) -> Result<CrateNum, CrateError> {
let _prof_timer = self.sess.prof.generic_activity("metadata_register_crate");
@ -437,7 +437,7 @@ impl<'a> CrateLoader<'a> {
&'b mut self,
name: Symbol,
span: Span,
dep_kind: DepKind,
dep_kind: CrateDepKind,
dep: Option<(&'b CratePaths, &'b CrateDep)>,
) -> CrateNum {
if dep.is_none() {
@ -450,7 +450,7 @@ impl<'a> CrateLoader<'a> {
fn maybe_resolve_crate<'b>(
&'b mut self,
name: Symbol,
mut dep_kind: DepKind,
mut dep_kind: CrateDepKind,
dep: Option<(&'b CratePaths, &'b CrateDep)>,
) -> Result<CrateNum, CrateError> {
info!("resolving crate `{}`", name);
@ -487,7 +487,7 @@ impl<'a> CrateLoader<'a> {
match self.load(&mut locator)? {
Some(res) => (res, None),
None => {
dep_kind = DepKind::MacrosOnly;
dep_kind = CrateDepKind::MacrosOnly;
match self.load_proc_macro(&mut locator, path_kind)? {
Some(res) => res,
None => return Err(locator.into_error()),
@ -500,7 +500,7 @@ impl<'a> CrateLoader<'a> {
(LoadResult::Previous(cnum), None) => {
let data = self.cstore.get_crate_data(cnum);
if data.is_proc_macro_crate() {
dep_kind = DepKind::MacrosOnly;
dep_kind = CrateDepKind::MacrosOnly;
}
data.update_dep_kind(|data_dep_kind| cmp::max(data_dep_kind, dep_kind));
Ok(cnum)
@ -560,7 +560,7 @@ impl<'a> CrateLoader<'a> {
crate_root: &CrateRoot<'_>,
metadata: &MetadataBlob,
krate: CrateNum,
dep_kind: DepKind,
dep_kind: CrateDepKind,
) -> Result<CrateNumMap, CrateError> {
debug!("resolving deps of external crate");
if crate_root.is_proc_macro_crate() {
@ -579,7 +579,7 @@ impl<'a> CrateLoader<'a> {
dep.name, dep.hash, dep.extra_filename
);
let dep_kind = match dep_kind {
DepKind::MacrosOnly => DepKind::MacrosOnly,
CrateDepKind::MacrosOnly => CrateDepKind::MacrosOnly,
_ => dep.kind,
};
let cnum = self.maybe_resolve_crate(dep.name, dep_kind, Some((root, &dep)))?;
@ -646,7 +646,7 @@ impl<'a> CrateLoader<'a> {
self.inject_dependency_if(cnum, "a panic runtime", &|data| {
data.needs_panic_runtime()
});
runtime_found = runtime_found || data.dep_kind() == DepKind::Explicit;
runtime_found = runtime_found || data.dep_kind() == CrateDepKind::Explicit;
}
});
@ -675,7 +675,7 @@ impl<'a> CrateLoader<'a> {
};
info!("panic runtime not found -- loading {}", name);
let cnum = self.resolve_crate(name, DUMMY_SP, DepKind::Implicit, None);
let cnum = self.resolve_crate(name, DUMMY_SP, CrateDepKind::Implicit, None);
let data = self.cstore.get_crate_data(cnum);
// Sanity check the loaded crate to ensure it is indeed a panic runtime
@ -705,7 +705,7 @@ impl<'a> CrateLoader<'a> {
info!("loading profiler");
let name = sym::profiler_builtins;
let cnum = self.resolve_crate(name, DUMMY_SP, DepKind::Implicit, None);
let cnum = self.resolve_crate(name, DUMMY_SP, CrateDepKind::Implicit, None);
let data = self.cstore.get_crate_data(cnum);
// Sanity check the loaded crate to ensure it is indeed a profiler runtime
@ -901,9 +901,9 @@ impl<'a> CrateLoader<'a> {
None => item.ident.name,
};
let dep_kind = if attr::contains_name(&item.attrs, sym::no_link) {
DepKind::MacrosOnly
CrateDepKind::MacrosOnly
} else {
DepKind::Explicit
CrateDepKind::Explicit
};
let cnum = self.resolve_crate(name, item.span, dep_kind, None);
@ -925,7 +925,7 @@ impl<'a> CrateLoader<'a> {
}
pub fn process_path_extern(&mut self, name: Symbol, span: Span) -> CrateNum {
let cnum = self.resolve_crate(name, span, DepKind::Explicit, None);
let cnum = self.resolve_crate(name, span, CrateDepKind::Explicit, None);
self.update_extern_crate(
cnum,
@ -942,6 +942,6 @@ impl<'a> CrateLoader<'a> {
}
pub fn maybe_process_path_extern(&mut self, name: Symbol) -> Option<CrateNum> {
self.maybe_resolve_crate(name, DepKind::Explicit, None).ok()
self.maybe_resolve_crate(name, CrateDepKind::Explicit, None).ok()
}
}

View File

@ -56,7 +56,7 @@ use crate::creader::CStore;
use rustc_data_structures::fx::FxHashMap;
use rustc_hir::def_id::CrateNum;
use rustc_middle::middle::cstore::LinkagePreference::{self, RequireDynamic, RequireStatic};
use rustc_middle::middle::cstore::{self, DepKind};
use rustc_middle::middle::cstore::{self, CrateDepKind};
use rustc_middle::middle::dependency_format::{Dependencies, DependencyList, Linkage};
use rustc_middle::ty::TyCtxt;
use rustc_session::config::CrateType;
@ -188,7 +188,7 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: CrateType) -> DependencyList {
let src = tcx.used_crate_source(cnum);
if src.dylib.is_none()
&& !formats.contains_key(&cnum)
&& tcx.dep_kind(cnum) == DepKind::Explicit
&& tcx.dep_kind(cnum) == CrateDepKind::Explicit
{
assert!(src.rlib.is_some() || src.rmeta.is_some());
log::info!("adding staticlib: {}", tcx.crate_name(cnum));
@ -284,7 +284,7 @@ fn attempt_static(tcx: TyCtxt<'_>) -> Option<DependencyList> {
let last_crate = tcx.crates().len();
let mut ret = (1..last_crate + 1)
.map(|cnum| {
if tcx.dep_kind(CrateNum::new(cnum)) == DepKind::Explicit {
if tcx.dep_kind(CrateNum::new(cnum)) == CrateDepKind::Explicit {
Linkage::Static
} else {
Linkage::NotLinked

View File

@ -100,7 +100,7 @@ crate struct CrateMetadata {
/// Same ID set as `cnum_map` plus maybe some injected crates like panic runtime.
dependencies: Lock<Vec<CrateNum>>,
/// How to link (or not link) this crate to the currently compiled crate.
dep_kind: Lock<DepKind>,
dep_kind: Lock<CrateDepKind>,
/// Filesystem location of this crate.
source: CrateSource,
/// Whether or not this crate should be consider a private dependency
@ -1669,7 +1669,7 @@ impl CrateMetadata {
raw_proc_macros: Option<&'static [ProcMacro]>,
cnum: CrateNum,
cnum_map: CrateNumMap,
dep_kind: DepKind,
dep_kind: CrateDepKind,
source: CrateSource,
private_dep: bool,
host_hash: Option<Svh>,
@ -1727,11 +1727,11 @@ impl CrateMetadata {
&self.source
}
crate fn dep_kind(&self) -> DepKind {
crate fn dep_kind(&self) -> CrateDepKind {
*self.dep_kind.lock()
}
crate fn update_dep_kind(&self, f: impl FnOnce(DepKind) -> DepKind) {
crate fn update_dep_kind(&self, f: impl FnOnce(CrateDepKind) -> CrateDepKind) {
self.dep_kind.with_lock(|dep_kind| *dep_kind = f(*dep_kind))
}

View File

@ -11,7 +11,7 @@ use rustc_hir::def_id::{DefId, DefIndex};
use rustc_hir::lang_items;
use rustc_index::{bit_set::FiniteBitSet, vec::IndexVec};
use rustc_middle::hir::exports::Export;
use rustc_middle::middle::cstore::{DepKind, ForeignModule, LinkagePreference, NativeLib};
use rustc_middle::middle::cstore::{CrateDepKind, ForeignModule, LinkagePreference, NativeLib};
use rustc_middle::middle::exported_symbols::{ExportedSymbol, SymbolExportLevel};
use rustc_middle::mir;
use rustc_middle::ty::{self, ReprOptions, Ty};
@ -226,7 +226,7 @@ crate struct CrateDep {
pub name: Symbol,
pub hash: Svh,
pub host_hash: Option<Svh>,
pub kind: DepKind,
pub kind: CrateDepKind,
pub extra_filename: String,
}

View File

@ -40,7 +40,7 @@ impl CrateSource {
#[derive(RustcEncodable, RustcDecodable, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Debug)]
#[derive(HashStable)]
pub enum DepKind {
pub enum CrateDepKind {
/// A dependency that is only used for its macros.
MacrosOnly,
/// A dependency that is always injected into the dependency list and so
@ -51,11 +51,11 @@ pub enum DepKind {
Explicit,
}
impl DepKind {
impl CrateDepKind {
pub fn macros_only(self) -> bool {
match self {
DepKind::MacrosOnly => true,
DepKind::Implicit | DepKind::Explicit => false,
CrateDepKind::MacrosOnly => true,
CrateDepKind::Implicit | CrateDepKind::Explicit => false,
}
}
}

View File

@ -1186,7 +1186,7 @@ rustc_queries! {
}
Other {
query dep_kind(_: CrateNum) -> DepKind {
query dep_kind(_: CrateNum) -> CrateDepKind {
eval_always
desc { "fetching what a dependency looks like" }
}

View File

@ -1,10 +1,10 @@
use crate::dep_graph::{self, DepNode, DepNodeParams};
use crate::dep_graph::{self, DepKind, DepNode, DepNodeParams};
use crate::hir::exports::Export;
use crate::hir::map;
use crate::infer::canonical::{self, Canonical};
use crate::lint::LintLevelMap;
use crate::middle::codegen_fn_attrs::CodegenFnAttrs;
use crate::middle::cstore::{CrateSource, DepKind};
use crate::middle::cstore::{CrateDepKind, CrateSource};
use crate::middle::cstore::{ExternCrate, ForeignModule, LinkagePreference, NativeLib};
use crate::middle::exported_symbols::{ExportedSymbol, SymbolExportLevel};
use crate::middle::lib_features::LibFeatures;
@ -161,7 +161,7 @@ pub fn force_from_dep_node<'tcx>(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> bool
// hit the cache instead of having to go through `force_from_dep_node`.
// This assertion makes sure, we actually keep applying the solution above.
debug_assert!(
dep_node.kind != crate::dep_graph::DepKind::codegen_unit,
dep_node.kind != DepKind::codegen_unit,
"calling force_from_dep_node() on DepKind::codegen_unit"
);
@ -172,14 +172,14 @@ pub fn force_from_dep_node<'tcx>(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> bool
rustc_dep_node_force!([dep_node, tcx]
// These are inputs that are expected to be pre-allocated and that
// should therefore always be red or green already.
crate::dep_graph::DepKind::CrateMetadata |
DepKind::CrateMetadata |
// These are anonymous nodes.
crate::dep_graph::DepKind::TraitSelect |
DepKind::TraitSelect |
// We don't have enough information to reconstruct the query key of
// these.
crate::dep_graph::DepKind::CompileCodegenUnit => {
DepKind::CompileCodegenUnit => {
bug!("force_from_dep_node: encountered {:?}", dep_node)
}
);

View File

@ -138,7 +138,6 @@ const PERMITTED_DEPENDENCIES: &[&str] = &[
"rand_chacha",
"rand_core",
"rand_hc",
"rand_isaac",
"rand_pcg",
"rand_xorshift",
"redox_syscall",