Auto merge of #66438 - JohnTitor:rollup-qpv3wia, r=JohnTitor

Rollup of 12 pull requests

Successful merges:

 - #65557 (rename Error::iter_chain() and remove Error::iter_sources())
 - #66013 (Avoid hashing the key twice in `get_query()`.)
 - #66306 (Remove cannot mutate statics in initializer of another static error)
 - #66338 (Update mdbook.)
 - #66388 (Do not ICE on recovery from unmet associated type bound obligation)
 - #66390 (Fix ICE when trying to suggest `Type<>` instead of `Type()`)
 - #66391 (Do not ICE in `if` without `else` in `async fn`)
 - #66398 (Remove some stack frames from `.async` calls)
 - #66410 (miri: helper methods for max values of machine's usize/isize)
 - #66418 (Link to tracking issue in HIR const-check error code description)
 - #66419 (Don't warn labels beginning with `_` on unused_labels lint)
 - #66428 (Cleanup unused function)

Failed merges:

r? @ghost
This commit is contained in:
bors 2019-11-15 09:37:24 +00:00
commit ce36ab2b06
29 changed files with 354 additions and 384 deletions

View File

@ -54,7 +54,7 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
dependencies = [ dependencies = [
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -104,7 +104,7 @@ checksum = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
dependencies = [ dependencies = [
"libc", "libc",
"termion", "termion",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -212,12 +212,6 @@ dependencies = [
"toml", "toml",
] ]
[[package]]
name = "build_const"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39"
[[package]] [[package]]
name = "build_helper" name = "build_helper"
version = "0.1.0" version = "0.1.0"
@ -311,7 +305,7 @@ dependencies = [
"num_cpus", "num_cpus",
"opener", "opener",
"openssl", "openssl",
"percent-encoding 2.0.0", "percent-encoding 2.1.0",
"pretty_env_logger", "pretty_env_logger",
"remove_dir_all", "remove_dir_all",
"rustc-workspace-hack", "rustc-workspace-hack",
@ -330,7 +324,7 @@ dependencies = [
"unicode-width", "unicode-width",
"url 2.1.0", "url 2.1.0",
"walkdir", "walkdir",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -482,7 +476,7 @@ dependencies = [
"itertools 0.8.0", "itertools 0.8.0",
"lazy_static 1.3.0", "lazy_static 1.3.0",
"matches", "matches",
"pulldown-cmark 0.6.0", "pulldown-cmark 0.6.1",
"quine-mc_cluskey", "quine-mc_cluskey",
"regex-syntax", "regex-syntax",
"semver", "semver",
@ -511,6 +505,26 @@ dependencies = [
"cc", "cc",
] ]
[[package]]
name = "codespan"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de67bdcd653002a6dba3eb53850ce3a485547225d81cb6c2bbdbc5a0cba5d15d"
dependencies = [
"unicode-segmentation",
]
[[package]]
name = "codespan-reporting"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efd1d915d9e2b2ad696b2cd73215a84823ef3f0e3084d90304204415921b62c6"
dependencies = [
"codespan",
"termcolor",
"unicode-width",
]
[[package]] [[package]]
name = "colored" name = "colored"
version = "1.6.0" version = "1.6.0"
@ -564,7 +578,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"walkdir", "walkdir",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -585,7 +599,7 @@ dependencies = [
"serde_derive", "serde_derive",
"serde_json", "serde_json",
"tempfile", "tempfile",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -594,6 +608,34 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" checksum = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e"
[[package]]
name = "cookie"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "888604f00b3db336d2af898ec3c1d5d0ddf5e6d462220f2ededc33a87ac4bbd5"
dependencies = [
"time",
"url 1.7.2",
]
[[package]]
name = "cookie_store"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46750b3f362965f197996c4448e4a0935e791bf7d6631bfce9ee0af3d24c919c"
dependencies = [
"cookie",
"failure",
"idna 0.1.5",
"log",
"publicsuffix",
"serde",
"serde_json",
"time",
"try_from",
"url 1.7.2",
]
[[package]] [[package]]
name = "core" name = "core"
version = "0.0.0" version = "0.0.0"
@ -623,22 +665,13 @@ version = "0.29.0"
dependencies = [ dependencies = [
"curl", "curl",
"failure", "failure",
"percent-encoding 2.0.0", "percent-encoding 2.1.0",
"serde", "serde",
"serde_derive", "serde_derive",
"serde_json", "serde_json",
"url 2.1.0", "url 2.1.0",
] ]
[[package]]
name = "crc"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb"
dependencies = [
"build_const",
]
[[package]] [[package]]
name = "crc32fast" name = "crc32fast"
version = "1.1.2" version = "1.1.2"
@ -754,7 +787,7 @@ dependencies = [
"commoncrypto", "commoncrypto",
"hex 0.3.2", "hex 0.3.2",
"openssl", "openssl",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -769,7 +802,7 @@ dependencies = [
"openssl-sys", "openssl-sys",
"schannel", "schannel",
"socket2", "socket2",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -785,7 +818,7 @@ dependencies = [
"openssl-sys", "openssl-sys",
"pkg-config", "pkg-config",
"vcpkg", "vcpkg",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -901,7 +934,7 @@ dependencies = [
"cfg-if", "cfg-if",
"libc", "libc",
"redox_users", "redox_users",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -921,6 +954,12 @@ version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e" checksum = "ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e"
[[package]]
name = "dunce"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0ad6bf6a88548d1126045c413548df1453d9be094a8ab9fd59bf1fdd338da4f"
[[package]] [[package]]
name = "either" name = "either"
version = "1.5.0" version = "1.5.0"
@ -1050,15 +1089,15 @@ checksum = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33"
[[package]] [[package]]
name = "flate2" name = "flate2"
version = "1.0.6" version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2291c165c8e703ee54ef3055ad6188e3d51108e2ded18e9f2476e774fc5ad3d4" checksum = "ad3c5233c9a940c8719031b423d7e6c16af66e031cb0420b0896f5245bf181d3"
dependencies = [ dependencies = [
"cfg-if",
"crc32fast", "crc32fast",
"libc", "libc",
"libz-sys", "libz-sys",
"miniz-sys", "miniz_oxide",
"miniz_oxide_c_api",
] ]
[[package]] [[package]]
@ -1107,7 +1146,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213"
dependencies = [ dependencies = [
"libc", "libc",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -1359,7 +1398,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3753954f7bd71f0e671afb8b5a992d1724cf43b7f95a563cd4a0bde94659ca8" checksum = "a3753954f7bd71f0e671afb8b5a992d1724cf43b7f95a563cd4a0bde94659ca8"
dependencies = [ dependencies = [
"scopeguard 1.0.0", "scopeguard 1.0.0",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -1378,9 +1417,9 @@ dependencies = [
[[package]] [[package]]
name = "http" name = "http"
version = "0.1.16" version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe67e3678f2827030e89cc4b9e7ecd16d52f132c0b940ab5005f88e821500f6a" checksum = "d7e06e336150b178206af098a055e3621e8336027e2b4d126bda0bc64824baaf"
dependencies = [ dependencies = [
"bytes", "bytes",
"fnv", "fnv",
@ -1539,7 +1578,7 @@ dependencies = [
"remove_dir_all", "remove_dir_all",
"tar", "tar",
"walkdir", "walkdir",
"winapi 0.3.6", "winapi 0.3.8",
"xz2", "xz2",
] ]
@ -1704,7 +1743,7 @@ dependencies = [
"num_cpus", "num_cpus",
"tokio", "tokio",
"tokio-codec", "tokio-codec",
"unicase 2.5.1", "unicase",
] ]
[[package]] [[package]]
@ -1744,19 +1783,6 @@ dependencies = [
"rustc-std-workspace-core", "rustc-std-workspace-core",
] ]
[[package]]
name = "libflate"
version = "0.1.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90c6f86f4b0caa347206f916f8b687b51d77c6ef8ff18d52dd007491fd580529"
dependencies = [
"adler32",
"byteorder",
"crc32fast",
"rle-decode-fast",
"take_mut",
]
[[package]] [[package]]
name = "libgit2-sys" name = "libgit2-sys"
version = "0.9.0" version = "0.9.0"
@ -1926,9 +1952,9 @@ checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
[[package]] [[package]]
name = "mdbook" name = "mdbook"
version = "0.3.3" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a070268274c566082efb6b2ace7743e43ba91a70d5c6982981e96d3c05ac81c" checksum = "031bdd9d4893c983e2f69ebc4b59070feee8276a584c4aabdcb351235ea28016"
dependencies = [ dependencies = [
"ammonia", "ammonia",
"chrono", "chrono",
@ -1942,7 +1968,7 @@ dependencies = [
"log", "log",
"memchr", "memchr",
"open", "open",
"pulldown-cmark 0.5.3", "pulldown-cmark 0.6.1",
"regex", "regex",
"serde", "serde",
"serde_derive", "serde_derive",
@ -1955,16 +1981,21 @@ dependencies = [
[[package]] [[package]]
name = "mdbook-linkcheck" name = "mdbook-linkcheck"
version = "0.3.0" version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77d1f0ba4d1e6b86fa18e8853d026d7d76a97eb7eb5eb052ed80901e43b7fc10" checksum = "c0a04db564ca37c47771f8455c825dc941ea851ff0deffcf55a04c512406b409"
dependencies = [ dependencies = [
"env_logger 0.6.2", "codespan",
"codespan-reporting",
"dunce",
"either",
"env_logger 0.7.1",
"failure", "failure",
"http",
"log", "log",
"mdbook", "mdbook",
"memchr", "percent-encoding 2.1.0",
"pulldown-cmark 0.5.3", "pulldown-cmark 0.6.1",
"rayon", "rayon",
"regex", "regex",
"reqwest", "reqwest",
@ -1972,8 +2003,7 @@ dependencies = [
"serde", "serde",
"serde_derive", "serde_derive",
"serde_json", "serde_json",
"structopt 0.2.18", "structopt",
"url 1.7.2",
] ]
[[package]] [[package]]
@ -2000,7 +2030,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2ffa2c986de11a9df78620c01eeaaf27d94d3ff02bf81bfcca953102dd0c6ff" checksum = "e2ffa2c986de11a9df78620c01eeaaf27d94d3ff02bf81bfcca953102dd0c6ff"
dependencies = [ dependencies = [
"libc", "libc",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -2024,19 +2054,17 @@ version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e27ca21f40a310bd06d9031785f4801710d566c184a6e15bad4f1d9b65f9425" checksum = "3e27ca21f40a310bd06d9031785f4801710d566c184a6e15bad4f1d9b65f9425"
dependencies = [ dependencies = [
"unicase 2.5.1", "unicase",
] ]
[[package]] [[package]]
name = "mime_guess" name = "mime_guess"
version = "2.0.0-alpha.6" version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30de2e4613efcba1ec63d8133f344076952090c122992a903359be5a4f99c3ed" checksum = "1a0ed03949aef72dbdf3116a383d7b38b4768e6f960528cd6a6044aa9ed68599"
dependencies = [ dependencies = [
"mime", "mime",
"phf", "unicase",
"phf_codegen",
"unicase 1.4.2",
] ]
[[package]] [[package]]
@ -2048,37 +2076,15 @@ dependencies = [
"macro-utils", "macro-utils",
] ]
[[package]]
name = "miniz-sys"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649"
dependencies = [
"cc",
"libc",
]
[[package]] [[package]]
name = "miniz_oxide" name = "miniz_oxide"
version = "0.2.0" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ad30a47319c16cde58d0314f5d98202a80c9083b5f61178457403dfb14e509c" checksum = "6f3f74f726ae935c3f514300cc6773a0c9492abc5e972d42ba0c0ebb88757625"
dependencies = [ dependencies = [
"adler32", "adler32",
] ]
[[package]]
name = "miniz_oxide_c_api"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28edaef377517fd9fe3e085c37d892ce7acd1fbeab9239c5a36eec352d8a8b7e"
dependencies = [
"cc",
"crc",
"libc",
"miniz_oxide",
]
[[package]] [[package]]
name = "mio" name = "mio"
version = "0.6.16" version = "0.6.16"
@ -2107,7 +2113,7 @@ dependencies = [
"log", "log",
"mio", "mio",
"miow 0.3.3", "miow 0.3.3",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -2140,7 +2146,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "396aa0f2003d7df8395cb93e09871561ccc3e785f0acb369170e8cc74ddf9226" checksum = "396aa0f2003d7df8395cb93e09871561ccc3e785f0acb369170e8cc74ddf9226"
dependencies = [ dependencies = [
"socket2", "socket2",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -2190,7 +2196,7 @@ checksum = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"libc", "libc",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -2247,7 +2253,7 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "998c59e83d9474c01127a96e023b7a04bb061dd286bf8bb939d31dc8d31a7448" checksum = "998c59e83d9474c01127a96e023b7a04bb061dd286bf8bb939d31dc8d31a7448"
dependencies = [ dependencies = [
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -2359,7 +2365,7 @@ dependencies = [
"tokio", "tokio",
"tokio-named-pipes", "tokio-named-pipes",
"tokio-uds", "tokio-uds",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -2393,7 +2399,7 @@ dependencies = [
"rand 0.6.1", "rand 0.6.1",
"rustc_version", "rustc_version",
"smallvec 0.6.10", "smallvec 0.6.10",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -2408,7 +2414,7 @@ dependencies = [
"redox_syscall", "redox_syscall",
"rustc_version", "rustc_version",
"smallvec 0.6.10", "smallvec 0.6.10",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -2419,9 +2425,9 @@ checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
[[package]] [[package]]
name = "percent-encoding" name = "percent-encoding"
version = "2.0.0" version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba4f28a6faf4ffea762ba8f4baef48c61a6db348647c73095034041fc79dd954" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
[[package]] [[package]]
name = "pest" name = "pest"
@ -2512,7 +2518,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0" checksum = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0"
dependencies = [ dependencies = [
"siphasher", "siphasher",
"unicase 1.4.2",
] ]
[[package]] [[package]]
@ -2619,6 +2624,19 @@ dependencies = [
"core", "core",
] ]
[[package]]
name = "publicsuffix"
version = "1.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bf259a81de2b2eb9850ec990ec78e6a25319715584fd7652b9b26f96fcb1510"
dependencies = [
"error-chain",
"idna 0.2.0",
"lazy_static 1.3.0",
"regex",
"url 2.1.0",
]
[[package]] [[package]]
name = "pulldown-cmark" name = "pulldown-cmark"
version = "0.5.3" version = "0.5.3"
@ -2626,21 +2644,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77043da1282374688ee212dc44b3f37ff929431de9c9adc3053bd3cee5630357" checksum = "77043da1282374688ee212dc44b3f37ff929431de9c9adc3053bd3cee5630357"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"getopts",
"memchr", "memchr",
"unicase 2.5.1", "unicase",
] ]
[[package]] [[package]]
name = "pulldown-cmark" name = "pulldown-cmark"
version = "0.6.0" version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85b0ad0d4c1702965ee6bb5b4ff5e71f83850b497d497e9444302987bf9e26a4" checksum = "1c205cc82214f3594e2d50686730314f817c67ffa80fe800cf0db78c3c2b9d9e"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"getopts", "getopts",
"memchr", "memchr",
"unicase 2.5.1", "unicase",
] ]
[[package]] [[package]]
@ -2712,7 +2729,7 @@ dependencies = [
"rand_pcg", "rand_pcg",
"rand_xorshift 0.1.0", "rand_xorshift 0.1.0",
"rustc_version", "rustc_version",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -2807,7 +2824,7 @@ dependencies = [
"libc", "libc",
"rand_core 0.4.0", "rand_core 0.4.0",
"rdrand", "rdrand",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -2934,23 +2951,25 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" checksum = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e"
dependencies = [ dependencies = [
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
name = "reqwest" name = "reqwest"
version = "0.9.11" version = "0.9.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e542d9f077c126af32536b6aacc75bb7325400eab8cd0743543be5d91660780d" checksum = "2c2064233e442ce85c77231ebd67d9eca395207dec2127fe0bbedde4bd29a650"
dependencies = [ dependencies = [
"base64", "base64",
"bytes", "bytes",
"cookie",
"cookie_store",
"encoding_rs", "encoding_rs",
"flate2",
"futures", "futures",
"http", "http",
"hyper", "hyper",
"hyper-tls", "hyper-tls",
"libflate",
"log", "log",
"mime", "mime",
"mime_guess", "mime_guess",
@ -2958,6 +2977,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"serde_urlencoded", "serde_urlencoded",
"time",
"tokio", "tokio",
"tokio-executor", "tokio-executor",
"tokio-io", "tokio-io",
@ -2965,14 +2985,9 @@ dependencies = [
"tokio-timer", "tokio-timer",
"url 1.7.2", "url 1.7.2",
"uuid", "uuid",
"winreg",
] ]
[[package]]
name = "rle-decode-fast"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac"
[[package]] [[package]]
name = "rls" name = "rls"
version = "1.40.0" version = "1.40.0"
@ -3100,6 +3115,7 @@ name = "rustbook"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"clap", "clap",
"codespan-reporting",
"failure", "failure",
"mdbook", "mdbook",
"mdbook-linkcheck", "mdbook-linkcheck",
@ -3397,7 +3413,7 @@ dependencies = [
"smallvec 0.6.10", "smallvec 0.6.10",
"syn 0.15.35", "syn 0.15.35",
"url 2.1.0", "url 2.1.0",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -3946,7 +3962,7 @@ dependencies = [
"rustfmt-config_proc_macro", "rustfmt-config_proc_macro",
"serde", "serde",
"serde_json", "serde_json",
"structopt 0.3.1", "structopt",
"term 0.6.0", "term 0.6.0",
"toml", "toml",
"unicode-segmentation", "unicode-segmentation",
@ -3976,7 +3992,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e1a231dc10abf6749cfa5d7767f25888d484201accbd919b66ab5413c502d56" checksum = "0e1a231dc10abf6749cfa5d7767f25888d484201accbd919b66ab5413c502d56"
dependencies = [ dependencies = [
"lazy_static 1.3.0", "lazy_static 1.3.0",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -4187,7 +4203,7 @@ dependencies = [
"cfg-if", "cfg-if",
"libc", "libc",
"redox_syscall", "redox_syscall",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -4280,16 +4296,6 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]]
name = "structopt"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16c2cdbf9cc375f15d1b4141bc48aeef444806655cd0e904207edc8d68d86ed7"
dependencies = [
"clap",
"structopt-derive 0.2.18",
]
[[package]] [[package]]
name = "structopt" name = "structopt"
version = "0.3.1" version = "0.3.1"
@ -4297,19 +4303,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ac9d6e93dd792b217bf89cda5c14566e3043960c6f9da890c2ba5d09d07804c" checksum = "2ac9d6e93dd792b217bf89cda5c14566e3043960c6f9da890c2ba5d09d07804c"
dependencies = [ dependencies = [
"clap", "clap",
"structopt-derive 0.3.1", "structopt-derive",
]
[[package]]
name = "structopt-derive"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53010261a84b37689f9ed7d395165029f9cc7abb9f56bbfe86bee2597ed25107"
dependencies = [
"heck",
"proc-macro2 0.4.30",
"quote 0.6.12",
"syn 0.15.35",
] ]
[[package]] [[package]]
@ -4453,12 +4447,6 @@ dependencies = [
"unicode-width", "unicode-width",
] ]
[[package]]
name = "take_mut"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60"
[[package]] [[package]]
name = "tar" name = "tar"
version = "0.4.20" version = "0.4.20"
@ -4482,7 +4470,7 @@ dependencies = [
"rand 0.7.0", "rand 0.7.0",
"redox_syscall", "redox_syscall",
"remove_dir_all", "remove_dir_all",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -4512,7 +4500,7 @@ checksum = "0dd90505d5006a4422d3520b30c781d480b3f36768c2fa2187c3e950bc110464"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"dirs", "dirs",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -4591,13 +4579,13 @@ dependencies = [
[[package]] [[package]]
name = "time" name = "time"
version = "0.1.40" version = "0.1.42"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d825be0eb33fda1a7e68012d51e9c7f451dc1a69391e7fdc197060bb8c56667b" checksum = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
dependencies = [ dependencies = [
"libc", "libc",
"redox_syscall", "redox_syscall",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -4713,7 +4701,7 @@ dependencies = [
"tokio-io", "tokio-io",
"tokio-reactor", "tokio-reactor",
"tokio-signal", "tokio-signal",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -4757,7 +4745,7 @@ dependencies = [
"tokio-executor", "tokio-executor",
"tokio-io", "tokio-io",
"tokio-reactor", "tokio-reactor",
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -4876,6 +4864,15 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382"
[[package]]
name = "try_from"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "283d3b89e1368717881a9d51dad843cc435380d8109c9e47d38780a324698d8b"
dependencies = [
"cfg-if",
]
[[package]] [[package]]
name = "typenum" name = "typenum"
version = "1.10.0" version = "1.10.0"
@ -4894,15 +4891,6 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" checksum = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86"
[[package]]
name = "unicase"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33"
dependencies = [
"version_check",
]
[[package]] [[package]]
name = "unicase" name = "unicase"
version = "2.5.1" version = "2.5.1"
@ -4929,9 +4917,9 @@ checksum = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25"
[[package]] [[package]]
name = "unicode-segmentation" name = "unicode-segmentation"
version = "1.2.1" version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1" checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0"
[[package]] [[package]]
name = "unicode-width" name = "unicode-width"
@ -5000,7 +4988,7 @@ checksum = "75b414f6c464c879d7f9babf951f23bc3743fb7313c081b2e6ca719067ea9d61"
dependencies = [ dependencies = [
"idna 0.2.0", "idna 0.2.0",
"matches", "matches",
"percent-encoding 2.0.0", "percent-encoding 2.1.0",
"serde", "serde",
] ]
@ -5076,7 +5064,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d9d7ed3431229a144296213105a390676cc49c9b6a72bd19f3176c98e129fa1" checksum = "9d9d7ed3431229a144296213105a390676cc49c9b6a72bd19f3176c98e129fa1"
dependencies = [ dependencies = [
"same-file", "same-file",
"winapi 0.3.6", "winapi 0.3.8",
"winapi-util", "winapi-util",
] ]
@ -5110,9 +5098,9 @@ checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
[[package]] [[package]]
name = "winapi" name = "winapi"
version = "0.3.6" version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
dependencies = [ dependencies = [
"winapi-i686-pc-windows-gnu", "winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu",
@ -5136,7 +5124,7 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" checksum = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9"
dependencies = [ dependencies = [
"winapi 0.3.6", "winapi 0.3.8",
] ]
[[package]] [[package]]
@ -5151,10 +5139,19 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" checksum = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba"
dependencies = [ dependencies = [
"winapi 0.3.6", "winapi 0.3.8",
"winapi-util", "winapi-util",
] ]
[[package]]
name = "winreg"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9"
dependencies = [
"winapi 0.3.8",
]
[[package]] [[package]]
name = "ws2_32-sys" name = "ws2_32-sys"
version = "0.2.1" version = "0.2.1"

View File

@ -1862,7 +1862,7 @@ impl<'a> LoweringContext<'a> {
if let Ok(snippet) = self.sess.source_map().span_to_snippet(data.span) { if let Ok(snippet) = self.sess.source_map().span_to_snippet(data.span) {
// Do not suggest going from `Trait()` to `Trait<>` // Do not suggest going from `Trait()` to `Trait<>`
if data.inputs.len() > 0 { if data.inputs.len() > 0 {
let split = snippet.find('(').unwrap(); if let Some(split) = snippet.find('(') {
let trait_name = &snippet[0..split]; let trait_name = &snippet[0..split];
let args = &snippet[split + 1 .. snippet.len() - 1]; let args = &snippet[split + 1 .. snippet.len() - 1];
err.span_suggestion( err.span_suggestion(
@ -1872,6 +1872,7 @@ impl<'a> LoweringContext<'a> {
Applicability::MaybeIncorrect, Applicability::MaybeIncorrect,
); );
} }
}
}; };
err.emit(); err.emit();
( (

View File

@ -59,6 +59,7 @@
#![feature(log_syntax)] #![feature(log_syntax)]
#![feature(associated_type_bounds)] #![feature(associated_type_bounds)]
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![feature(hash_raw_entry)]
#![recursion_limit="512"] #![recursion_limit="512"]

View File

@ -1,4 +1,5 @@
use std::fmt::{self, Display}; use std::fmt::{self, Display};
use std::convert::TryFrom;
use crate::mir; use crate::mir;
use crate::ty::layout::{self, HasDataLayout, Size}; use crate::ty::layout::{self, HasDataLayout, Size};
@ -40,6 +41,18 @@ pub trait PointerArithmetic: layout::HasDataLayout {
self.data_layout().pointer_size self.data_layout().pointer_size
} }
#[inline]
fn usize_max(&self) -> u64 {
let max_usize_plus_1 = 1u128 << self.pointer_size().bits();
u64::try_from(max_usize_plus_1-1).unwrap()
}
#[inline]
fn isize_max(&self) -> i64 {
let max_isize_plus_1 = 1u128 << (self.pointer_size().bits()-1);
i64::try_from(max_isize_plus_1-1).unwrap()
}
/// Helper function: truncate given value-"overflowed flag" pair to pointer size and /// Helper function: truncate given value-"overflowed flag" pair to pointer size and
/// update "overflowed flag" if there was an overflow. /// update "overflowed flag" if there was an overflow.
/// This should be called by all the other methods before returning! /// This should be called by all the other methods before returning!

View File

@ -14,12 +14,13 @@ use errors::Level;
use errors::Diagnostic; use errors::Diagnostic;
use errors::FatalError; use errors::FatalError;
use errors::Handler; use errors::Handler;
use rustc_data_structures::fx::{FxHashMap}; use rustc_data_structures::fx::{FxHasher, FxHashMap};
use rustc_data_structures::sync::{Lrc, Lock}; use rustc_data_structures::sync::{Lrc, Lock};
use rustc_data_structures::sharded::Sharded; use rustc_data_structures::sharded::Sharded;
use rustc_data_structures::thin_vec::ThinVec; use rustc_data_structures::thin_vec::ThinVec;
#[cfg(not(parallel_compiler))] #[cfg(not(parallel_compiler))]
use rustc_data_structures::cold_path; use rustc_data_structures::cold_path;
use std::hash::{Hash, Hasher};
use std::mem; use std::mem;
use std::ptr; use std::ptr;
use std::collections::hash_map::Entry; use std::collections::hash_map::Entry;
@ -82,8 +83,17 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> {
pub(super) fn try_get(tcx: TyCtxt<'tcx>, span: Span, key: &Q::Key) -> TryGetJob<'a, 'tcx, Q> { pub(super) fn try_get(tcx: TyCtxt<'tcx>, span: Span, key: &Q::Key) -> TryGetJob<'a, 'tcx, Q> {
let cache = Q::query_cache(tcx); let cache = Q::query_cache(tcx);
loop { loop {
let mut lock = cache.get_shard_by_value(key).lock(); // We compute the key's hash once and then use it for both the
if let Some(value) = lock.results.get(key) { // shard lookup and the hashmap lookup. This relies on the fact
// that both of them use `FxHasher`.
let mut state = FxHasher::default();
key.hash(&mut state);
let key_hash = state.finish();
let mut lock = cache.get_shard_by_hash(key_hash).lock();
if let Some((_, value)) =
lock.results.raw_entry().from_key_hashed_nocheck(key_hash, key)
{
tcx.prof.query_cache_hit(Q::NAME); tcx.prof.query_cache_hit(Q::NAME);
let result = (value.value.clone(), value.index); let result = (value.value.clone(), value.index);
#[cfg(debug_assertions)] #[cfg(debug_assertions)]

View File

@ -60,6 +60,7 @@ impl<T> Sharded<T> {
} }
} }
/// The shard is selected by hashing `val` with `FxHasher`.
#[inline] #[inline]
pub fn get_shard_by_value<K: Hash + ?Sized>(&self, val: &K) -> &Lock<T> { pub fn get_shard_by_value<K: Hash + ?Sized>(&self, val: &K) -> &Lock<T> {
if SHARDS == 1 { if SHARDS == 1 {
@ -69,6 +70,11 @@ impl<T> Sharded<T> {
} }
} }
/// Get a shard with a pre-computed hash value. If `get_shard_by_value` is
/// ever used in combination with `get_shard_by_hash` on a single `Sharded`
/// instance, then `hash` must be computed with `FxHasher`. Otherwise,
/// `hash` can be computed with any hasher, so long as that hasher is used
/// consistently for each `Sharded` instance.
#[inline] #[inline]
pub fn get_shard_by_hash(&self, hash: u64) -> &Lock<T> { pub fn get_shard_by_hash(&self, hash: u64) -> &Lock<T> {
let hash_len = mem::size_of::<usize>(); let hash_len = mem::size_of::<usize>();

View File

@ -15,3 +15,10 @@ const _: i32 = {
x x
}; };
``` ```
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.
[conditionals]: https://github.com/rust-lang/rust/issues/49146
[loops]: https://github.com/rust-lang/rust/issues/52000

View File

@ -326,17 +326,7 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
let is_thread_local = self.tcx.has_attr(*def_id, sym::thread_local); let is_thread_local = self.tcx.has_attr(*def_id, sym::thread_local);
if is_thread_local { if is_thread_local {
self.check_op(ops::ThreadLocalAccess); self.check_op(ops::ThreadLocalAccess);
} else if self.const_kind() == ConstKind::Static && context.is_mutating_use() { } else if self.const_kind() != ConstKind::Static || !context.is_mutating_use() {
// this is not strictly necessary as miri will also bail out
// For interior mutability we can't really catch this statically as that
// goes through raw pointers and intermediate temporaries, so miri has
// to catch this anyway
self.tcx.sess.span_err(
self.span,
"cannot mutate statics in the initializer of another static",
);
} else {
self.check_op(ops::StaticAccess); self.check_op(ops::StaticAccess);
} }
} }

View File

@ -787,19 +787,6 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> {
// Only allow statics (not consts) to refer to other statics. // Only allow statics (not consts) to refer to other statics.
if self.mode == Mode::Static || self.mode == Mode::StaticMut { if self.mode == Mode::Static || self.mode == Mode::StaticMut {
if self.mode == Mode::Static
&& context.is_mutating_use()
&& !self.suppress_errors
{
// this is not strictly necessary as miri will also bail out
// For interior mutability we can't really catch this statically as that
// goes through raw pointers and intermediate temporaries, so miri has
// to catch this anyway
self.tcx.sess.span_err(
self.span,
"cannot mutate statics in the initializer of another static",
);
}
return; return;
} }
unleash_miri!(self); unleash_miri!(self);

View File

@ -1767,7 +1767,9 @@ impl<'a, 'b> LateResolutionVisitor<'a, '_> {
fn with_resolved_label(&mut self, label: Option<Label>, id: NodeId, f: impl FnOnce(&mut Self)) { fn with_resolved_label(&mut self, label: Option<Label>, id: NodeId, f: impl FnOnce(&mut Self)) {
if let Some(label) = label { if let Some(label) = label {
if label.ident.as_str().as_bytes()[1] != b'_' {
self.diagnostic_metadata.unused_labels.insert(id, label.ident.span); self.diagnostic_metadata.unused_labels.insert(id, label.ident.span);
}
self.with_label_rib(NormalRibKind, |this| { self.with_label_rib(NormalRibKind, |this| {
let ident = label.ident.modern_and_legacy(); let ident = label.ident.modern_and_legacy();
this.label_ribs.last_mut().unwrap().bindings.insert(ident, id); this.label_ribs.last_mut().unwrap().bindings.insert(ident, id);

View File

@ -244,7 +244,13 @@ impl<'a, 'tcx> Visitor<'tcx> for InteriorVisitor<'a, 'tcx> {
// can be reborrowed without needing to spill to a temporary. // can be reborrowed without needing to spill to a temporary.
// If this were not the case, then we could conceivably have // If this were not the case, then we could conceivably have
// to create intermediate temporaries.) // to create intermediate temporaries.)
let ty = self.fcx.tables.borrow().expr_ty(expr); //
// The type table might not have information for this expression
// if it is in a malformed scope. (#66387)
if let Some(ty) = self.fcx.tables.borrow().expr_ty_opt(expr) {
self.record(ty, scope, Some(expr), expr.span); self.record(ty, scope, Some(expr), expr.span);
} else {
self.fcx.tcx.sess.delay_span_bug(expr.span, "no type for node");
}
} }
} }

View File

@ -3108,7 +3108,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
fallback_has_occurred: bool, fallback_has_occurred: bool,
mutate_fullfillment_errors: impl Fn(&mut Vec<traits::FulfillmentError<'tcx>>), mutate_fullfillment_errors: impl Fn(&mut Vec<traits::FulfillmentError<'tcx>>),
) { ) {
if let Err(mut errors) = self.fulfillment_cx.borrow_mut().select_where_possible(self) { let result = self.fulfillment_cx.borrow_mut().select_where_possible(self);
if let Err(mut errors) = result {
mutate_fullfillment_errors(&mut errors); mutate_fullfillment_errors(&mut errors);
self.report_fulfillment_errors(&errors, self.inh.body_id, fallback_has_occurred); self.report_fulfillment_errors(&errors, self.inh.body_id, fallback_has_occurred);
} }

View File

@ -1081,14 +1081,13 @@ function getSearchElement() {
val = paths[paths.length - 1]; val = paths[paths.length - 1];
var contains = paths.slice(0, paths.length > 1 ? paths.length - 1 : 1); var contains = paths.slice(0, paths.length > 1 ? paths.length - 1 : 1);
for (j = 0; j < nSearchWords; ++j) {
var lev; var lev;
var lev_distance; var lev_distance;
for (j = 0; j < nSearchWords; ++j) {
ty = searchIndex[j]; ty = searchIndex[j];
if (!ty || (filterCrates !== undefined && ty.crate !== filterCrates)) { if (!ty || (filterCrates !== undefined && ty.crate !== filterCrates)) {
continue; continue;
} }
var lev_distance;
var lev_add = 0; var lev_add = 0;
if (paths.length > 1) { if (paths.length > 1) {
lev = checkPath(contains, paths[paths.length - 1], ty); lev = checkPath(contains, paths[paths.length - 1], ty);
@ -1633,7 +1632,7 @@ function getSearchElement() {
} }
var filterCrates = getFilterCrates(); var filterCrates = getFilterCrates();
showResults(execSearch(query, index, filterCrates), filterCrates); showResults(execSearch(query, index, filterCrates));
} }
function buildIndex(rawSearchIndex) { function buildIndex(rawSearchIndex) {

View File

@ -725,6 +725,9 @@ impl dyn Error {
/// Returns an iterator starting with the current error and continuing with /// Returns an iterator starting with the current error and continuing with
/// recursively calling [`source`]. /// recursively calling [`source`].
/// ///
/// If you want to omit the current error and only use its sources,
/// use `skip(1)`.
///
/// # Examples /// # Examples
/// ///
/// ``` /// ```
@ -763,7 +766,7 @@ impl dyn Error {
/// // let err : Box<Error> = b.into(); // or /// // let err : Box<Error> = b.into(); // or
/// let err = &b as &(dyn Error); /// let err = &b as &(dyn Error);
/// ///
/// let mut iter = err.iter_chain(); /// let mut iter = err.chain();
/// ///
/// assert_eq!("B".to_string(), iter.next().unwrap().to_string()); /// assert_eq!("B".to_string(), iter.next().unwrap().to_string());
/// assert_eq!("A".to_string(), iter.next().unwrap().to_string()); /// assert_eq!("A".to_string(), iter.next().unwrap().to_string());
@ -774,98 +777,27 @@ impl dyn Error {
/// [`source`]: trait.Error.html#method.source /// [`source`]: trait.Error.html#method.source
#[unstable(feature = "error_iter", issue = "58520")] #[unstable(feature = "error_iter", issue = "58520")]
#[inline] #[inline]
pub fn iter_chain(&self) -> ErrorIter<'_> { pub fn chain(&self) -> Chain<'_> {
ErrorIter { Chain {
current: Some(self), current: Some(self),
} }
} }
/// Returns an iterator starting with the [`source`] of this error
/// and continuing with recursively calling [`source`].
///
/// # Examples
///
/// ```
/// #![feature(error_iter)]
/// use std::error::Error;
/// use std::fmt;
///
/// #[derive(Debug)]
/// struct A;
///
/// #[derive(Debug)]
/// struct B(Option<Box<dyn Error + 'static>>);
///
/// #[derive(Debug)]
/// struct C(Option<Box<dyn Error + 'static>>);
///
/// impl fmt::Display for A {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// write!(f, "A")
/// }
/// }
///
/// impl fmt::Display for B {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// write!(f, "B")
/// }
/// }
///
/// impl fmt::Display for C {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// write!(f, "C")
/// }
/// }
///
/// impl Error for A {}
///
/// impl Error for B {
/// fn source(&self) -> Option<&(dyn Error + 'static)> {
/// self.0.as_ref().map(|e| e.as_ref())
/// }
/// }
///
/// impl Error for C {
/// fn source(&self) -> Option<&(dyn Error + 'static)> {
/// self.0.as_ref().map(|e| e.as_ref())
/// }
/// }
///
/// let b = B(Some(Box::new(A)));
/// let c = C(Some(Box::new(b)));
///
/// // let err : Box<Error> = c.into(); // or
/// let err = &c as &(dyn Error);
///
/// let mut iter = err.iter_sources();
///
/// assert_eq!("B".to_string(), iter.next().unwrap().to_string());
/// assert_eq!("A".to_string(), iter.next().unwrap().to_string());
/// assert!(iter.next().is_none());
/// assert!(iter.next().is_none());
/// ```
///
/// [`source`]: trait.Error.html#method.source
#[inline]
#[unstable(feature = "error_iter", issue = "58520")]
pub fn iter_sources(&self) -> ErrorIter<'_> {
ErrorIter {
current: self.source(),
}
}
} }
/// An iterator over [`Error`] /// An iterator over an [`Error`] and its sources.
///
/// If you want to omit the initial error and only process
/// its sources, use `skip(1)`.
/// ///
/// [`Error`]: trait.Error.html /// [`Error`]: trait.Error.html
#[unstable(feature = "error_iter", issue = "58520")] #[unstable(feature = "error_iter", issue = "58520")]
#[derive(Copy, Clone, Debug)] #[derive(Copy, Clone, Debug)]
pub struct ErrorIter<'a> { pub struct Chain<'a> {
current: Option<&'a (dyn Error + 'static)>, current: Option<&'a (dyn Error + 'static)>,
} }
#[unstable(feature = "error_iter", issue = "58520")] #[unstable(feature = "error_iter", issue = "58520")]
impl<'a> Iterator for ErrorIter<'a> { impl<'a> Iterator for Chain<'a> {
type Item = &'a (dyn Error + 'static); type Item = &'a (dyn Error + 'static);
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {

View File

@ -40,10 +40,11 @@ impl<T: Generator<Yield = ()>> Future for GenFuture<T> {
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
// Safe because we're !Unpin + !Drop mapping to a ?Unpin value // Safe because we're !Unpin + !Drop mapping to a ?Unpin value
let gen = unsafe { Pin::map_unchecked_mut(self, |s| &mut s.0) }; let gen = unsafe { Pin::map_unchecked_mut(self, |s| &mut s.0) };
set_task_context(cx, || match gen.resume() { let _guard = unsafe { set_task_context(cx) };
match gen.resume() {
GeneratorState::Yielded(()) => Poll::Pending, GeneratorState::Yielded(()) => Poll::Pending,
GeneratorState::Complete(x) => Poll::Ready(x), GeneratorState::Complete(x) => Poll::Ready(x),
}) }
} }
} }
@ -61,35 +62,23 @@ impl Drop for SetOnDrop {
} }
} }
#[doc(hidden)] // Safety: the returned guard must drop before `cx` is dropped and before
#[unstable(feature = "gen_future", issue = "50547")] // any previous guard is dropped.
/// Sets the thread-local task context used by async/await futures. unsafe fn set_task_context(cx: &mut Context<'_>) -> SetOnDrop {
pub fn set_task_context<F, R>(cx: &mut Context<'_>, f: F) -> R
where
F: FnOnce() -> R
{
// transmute the context's lifetime to 'static so we can store it. // transmute the context's lifetime to 'static so we can store it.
let cx = unsafe { let cx = core::mem::transmute::<&mut Context<'_>, &mut Context<'static>>(cx);
core::mem::transmute::<&mut Context<'_>, &mut Context<'static>>(cx)
};
let old_cx = TLS_CX.with(|tls_cx| { let old_cx = TLS_CX.with(|tls_cx| {
tls_cx.replace(Some(NonNull::from(cx))) tls_cx.replace(Some(NonNull::from(cx)))
}); });
let _reset = SetOnDrop(old_cx); SetOnDrop(old_cx)
f()
} }
#[doc(hidden)] #[doc(hidden)]
#[unstable(feature = "gen_future", issue = "50547")] #[unstable(feature = "gen_future", issue = "50547")]
/// Retrieves the thread-local task context used by async/await futures. /// Polls a future in the current thread-local task waker.
/// pub fn poll_with_tls_context<F>(f: Pin<&mut F>) -> Poll<F::Output>
/// This function acquires exclusive access to the task context.
///
/// Panics if no context has been set or if the context has already been
/// retrieved by a surrounding call to get_task_context.
pub fn get_task_context<F, R>(f: F) -> R
where where
F: FnOnce(&mut Context<'_>) -> R F: Future
{ {
let cx_ptr = TLS_CX.with(|tls_cx| { let cx_ptr = TLS_CX.with(|tls_cx| {
// Clear the entry so that nested `get_task_waker` calls // Clear the entry so that nested `get_task_waker` calls
@ -108,15 +97,5 @@ where
// //
// The pointer that was inserted came from an `&mut Context<'_>`, // The pointer that was inserted came from an `&mut Context<'_>`,
// so it is safe to treat as mutable. // so it is safe to treat as mutable.
unsafe { f(cx_ptr.as_mut()) } unsafe { F::poll(f, cx_ptr.as_mut()) }
}
#[doc(hidden)]
#[unstable(feature = "gen_future", issue = "50547")]
/// Polls a future in the current thread-local task waker.
pub fn poll_with_tls_context<F>(f: Pin<&mut F>) -> Poll<F::Output>
where
F: Future
{
get_task_context(|cx| F::poll(f, cx))
} }

View File

@ -0,0 +1,10 @@
// edition:2018
async fn f() -> i32 {
if true { //~ ERROR if may be missing an else clause
return 0;
}
// An `if` block without `else` causes the type table not to have a type for this expr.
// Check that we do not unconditionally access the type table and we don't ICE.
}
fn main() {}

View File

@ -0,0 +1,16 @@
error[E0317]: if may be missing an else clause
--> $DIR/issue-66387-if-without-else.rs:3:5
|
LL | / if true {
LL | | return 0;
LL | | }
| |_____^ expected (), found i32
|
= note: expected type `()`
found type `i32`
= note: `if` expressions without `else` evaluate to `()`
= help: consider adding an `else` block that evaluates to the expected type
error: aborting due to previous error
For more information about this error, try `rustc --explain E0317`.

View File

@ -7,7 +7,8 @@ use std::cell::UnsafeCell;
static mut FOO: u32 = 42; static mut FOO: u32 = 42;
static BOO: () = unsafe { static BOO: () = unsafe {
FOO = 5; //~ ERROR cannot mutate statics in the initializer of another static FOO = 5;
//~^ could not evaluate static initializer [E0080]
}; };
fn main() {} fn main() {}

View File

@ -1,8 +1,9 @@
error: cannot mutate statics in the initializer of another static error[E0080]: could not evaluate static initializer
--> $DIR/assign-to-static-within-other-static.rs:10:5 --> $DIR/assign-to-static-within-other-static.rs:10:5
| |
LL | FOO = 5; LL | FOO = 5;
| ^^^^^^^ | ^^^^^^^ tried to modify a static's initial value from another static's initializer
error: aborting due to previous error error: aborting due to previous error
For more information about this error, try `rustc --explain E0080`.

View File

@ -4,6 +4,5 @@ const C: i32 = 2;
const CR: &'static mut i32 = &mut C; //~ ERROR E0017 const CR: &'static mut i32 = &mut C; //~ ERROR E0017
static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
//~| ERROR cannot borrow //~| ERROR cannot borrow
//~| ERROR cannot mutate statics
static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017
fn main() {} fn main() {}

View File

@ -10,12 +10,6 @@ error[E0017]: references in statics may only refer to immutable values
LL | static STATIC_REF: &'static mut i32 = &mut X; LL | static STATIC_REF: &'static mut i32 = &mut X;
| ^^^^^^ statics require immutable values | ^^^^^^ statics require immutable values
error: cannot mutate statics in the initializer of another static
--> $DIR/E0017.rs:5:39
|
LL | static STATIC_REF: &'static mut i32 = &mut X;
| ^^^^^^
error[E0596]: cannot borrow immutable static item `X` as mutable error[E0596]: cannot borrow immutable static item `X` as mutable
--> $DIR/E0017.rs:5:39 --> $DIR/E0017.rs:5:39
| |
@ -23,12 +17,12 @@ LL | static STATIC_REF: &'static mut i32 = &mut X;
| ^^^^^^ cannot borrow as mutable | ^^^^^^ cannot borrow as mutable
error[E0017]: references in statics may only refer to immutable values error[E0017]: references in statics may only refer to immutable values
--> $DIR/E0017.rs:8:38 --> $DIR/E0017.rs:7:38
| |
LL | static CONST_REF: &'static mut i32 = &mut C; LL | static CONST_REF: &'static mut i32 = &mut C;
| ^^^^^^ statics require immutable values | ^^^^^^ statics require immutable values
error: aborting due to 5 previous errors error: aborting due to 4 previous errors
Some errors have detailed explanations: E0017, E0596. Some errors have detailed explanations: E0017, E0596.
For more information about an error, try `rustc --explain E0017`. For more information about an error, try `rustc --explain E0017`.

View File

@ -4,7 +4,6 @@ const C: i32 = 2;
const CR: &'static mut i32 = &mut C; //~ ERROR E0017 const CR: &'static mut i32 = &mut C; //~ ERROR E0017
static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017 static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0017
//~| ERROR cannot borrow //~| ERROR cannot borrow
//~| ERROR cannot mutate statics
static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017 static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0017
fn main() {} fn main() {}

View File

@ -10,12 +10,6 @@ error[E0017]: references in statics may only refer to immutable values
LL | static STATIC_REF: &'static mut i32 = &mut X; LL | static STATIC_REF: &'static mut i32 = &mut X;
| ^^^^^^ statics require immutable values | ^^^^^^ statics require immutable values
error: cannot mutate statics in the initializer of another static
--> $DIR/E0388.rs:5:39
|
LL | static STATIC_REF: &'static mut i32 = &mut X;
| ^^^^^^
error[E0596]: cannot borrow immutable static item `X` as mutable error[E0596]: cannot borrow immutable static item `X` as mutable
--> $DIR/E0388.rs:5:39 --> $DIR/E0388.rs:5:39
| |
@ -23,12 +17,12 @@ LL | static STATIC_REF: &'static mut i32 = &mut X;
| ^^^^^^ cannot borrow as mutable | ^^^^^^ cannot borrow as mutable
error[E0017]: references in statics may only refer to immutable values error[E0017]: references in statics may only refer to immutable values
--> $DIR/E0388.rs:8:38 --> $DIR/E0388.rs:7:38
| |
LL | static CONST_REF: &'static mut i32 = &mut C; LL | static CONST_REF: &'static mut i32 = &mut C;
| ^^^^^^ statics require immutable values | ^^^^^^ statics require immutable values
error: aborting due to 5 previous errors error: aborting due to 4 previous errors
Some errors have detailed explanations: E0017, E0596. Some errors have detailed explanations: E0017, E0596.
For more information about an error, try `rustc --explain E0017`. For more information about an error, try `rustc --explain E0017`.

View File

@ -0,0 +1,15 @@
// #66353: ICE when trying to recover from incorrect associated type
trait _Func<T> {
fn func(_: Self);
}
trait _A {
type AssocT;
}
fn main() {
_Func::< <() as _A>::AssocT >::func(());
//~^ ERROR the trait bound `(): _A` is not satisfied
//~| ERROR the trait bound `(): _Func<_>` is not satisfied
}

View File

@ -0,0 +1,18 @@
error[E0277]: the trait bound `(): _A` is not satisfied
--> $DIR/issue-66353.rs:12:14
|
LL | _Func::< <() as _A>::AssocT >::func(());
| ^^^^^^^^^^^^^^^^^^ the trait `_A` is not implemented for `()`
error[E0277]: the trait bound `(): _Func<_>` is not satisfied
--> $DIR/issue-66353.rs:12:41
|
LL | fn func(_: Self);
| ----------------- required by `_Func::func`
...
LL | _Func::< <() as _A>::AssocT >::func(());
| ^^ the trait `_Func<_>` is not implemented for `()`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.

View File

@ -0,0 +1,10 @@
// check-pass
#![deny(unused_labels)]
fn main() {
// `unused_label` shouldn't warn labels beginning with `_`
'_unused: loop {
break;
}
}

View File

@ -6,12 +6,15 @@ license = "MIT OR Apache-2.0"
edition = "2018" edition = "2018"
[features] [features]
linkcheck = ["mdbook-linkcheck"] linkcheck = ["mdbook-linkcheck", "codespan-reporting"]
[dependencies] [dependencies]
clap = "2.25.0" clap = "2.25.0"
failure = "0.1" failure = "0.1"
mdbook-linkcheck = { version = "0.3.0", optional = true } mdbook-linkcheck = { version = "0.5.0", optional = true }
# Keep in sync with mdbook-linkcheck.
codespan-reporting = { version = "0.5", optional = true }
# A noop dependency that changes in the Rust repository, it's a bit of a hack. # A noop dependency that changes in the Rust repository, it's a bit of a hack.
# See the `src/tools/rustc-workspace-hack/README.md` file in `rust-lang/rust` # See the `src/tools/rustc-workspace-hack/README.md` file in `rust-lang/rust`

View File

@ -12,8 +12,6 @@ use mdbook::MDBook;
use failure::Error; use failure::Error;
#[cfg(feature = "linkcheck")] #[cfg(feature = "linkcheck")]
use mdbook::renderer::RenderContext; use mdbook::renderer::RenderContext;
#[cfg(feature = "linkcheck")]
use mdbook_linkcheck::{self, errors::BrokenLinks};
fn main() { fn main() {
let d_message = "-d, --dest-dir=[dest-dir] let d_message = "-d, --dest-dir=[dest-dir]
@ -57,26 +55,7 @@ fn main() {
{ {
if let Err(err) = linkcheck(sub_matches) { if let Err(err) = linkcheck(sub_matches) {
eprintln!("Error: {}", err); eprintln!("Error: {}", err);
// HACK: ignore timeouts
let actually_broken = err
.downcast::<BrokenLinks>()
.map(|broken_links| {
broken_links
.links()
.iter()
.inspect(|cause| eprintln!("\tCaused By: {}", cause))
.fold(false, |already_broken, cause| {
already_broken || !format!("{}", cause).contains("timed out")
})
})
.unwrap_or(false);
if actually_broken {
std::process::exit(101); std::process::exit(101);
} else {
std::process::exit(0);
}
} }
} }
@ -99,8 +78,9 @@ pub fn linkcheck(args: &ArgMatches<'_>) -> Result<(), Error> {
let book = MDBook::load(&book_dir).unwrap(); let book = MDBook::load(&book_dir).unwrap();
let cfg = book.config; let cfg = book.config;
let render_ctx = RenderContext::new(&book_dir, book.book, cfg, &book_dir); let render_ctx = RenderContext::new(&book_dir, book.book, cfg, &book_dir);
let cache_file = render_ctx.destination.join("cache.json");
mdbook_linkcheck::check_links(&render_ctx) let color = codespan_reporting::term::termcolor::ColorChoice::Auto;
mdbook_linkcheck::run(&cache_file, color, &render_ctx)
} }
// Build command implementation // Build command implementation
@ -124,11 +104,7 @@ fn get_book_dir(args: &ArgMatches<'_>) -> PathBuf {
if let Some(dir) = args.value_of("dir") { if let Some(dir) = args.value_of("dir") {
// Check if path is relative from current dir, or absolute... // Check if path is relative from current dir, or absolute...
let p = Path::new(dir); let p = Path::new(dir);
if p.is_relative() { if p.is_relative() { env::current_dir().unwrap().join(dir) } else { p.to_path_buf() }
env::current_dir().unwrap().join(dir)
} else {
p.to_path_buf()
}
} else { } else {
env::current_dir().unwrap() env::current_dir().unwrap()
} }

View File

@ -55,6 +55,9 @@ const EXCEPTIONS: &[&str] = &[
"sized-chunks", // MPL-2.0+, cargo via im-rc "sized-chunks", // MPL-2.0+, cargo via im-rc
// FIXME: this dependency violates the documentation comment above: // FIXME: this dependency violates the documentation comment above:
"fortanix-sgx-abi", // MPL-2.0+, libstd but only for `sgx` target "fortanix-sgx-abi", // MPL-2.0+, libstd but only for `sgx` target
"dunce", // CC0-1.0 mdbook-linkcheck
"codespan-reporting", // Apache-2.0 mdbook-linkcheck
"codespan", // Apache-2.0 mdbook-linkcheck
]; ];
/// Which crates to check against the whitelist? /// Which crates to check against the whitelist?