1
Fork 0

Auto merge of #58777 - Centril:rollup, r=Centril

Rollup of 14 pull requests

Successful merges:

 - #58075 (Fix for issue  #58050)
 - #58627 (rustdoc: move collapse and unindent docs passes earlier)
 - #58630 (Make `visit_clobber` panic-safe.)
 - #58678 (Deny `async fn` in 2015 edition)
 - #58680 (Fix an indexing error when using `x.py help`)
 - #58703 (Fix copy-pasted typo for read_string return value)
 - #58744 (Update dlmalloc to 0.1.3)
 - #58746 (std: docs: Disable running several Stdio doctests)
 - #58748 (update scoped_tls to 1.0)
 - #58749 (Reduce Repetitions of (n << amt) >> amt)
 - #58752 (Update string_cache_codegen to 0.4.2)
 - #58755 (Clarify `rotate_{left,right}` docs)
 - #58757 (Normalize the type Self resolves to in an impl)
 - #58761 (Add tracking issue for the unwind attribute)

Failed merges:

r? @ghost
This commit is contained in:
bors 2019-02-27 15:54:48 +00:00
commit 7e001e5c6c
55 changed files with 409 additions and 283 deletions

View file

@ -744,7 +744,7 @@ dependencies = [
[[package]] [[package]]
name = "dlmalloc" name = "dlmalloc"
version = "0.1.2" version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1399,7 +1399,7 @@ dependencies = [
"serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_codegen 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1936,14 +1936,6 @@ dependencies = [
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "proc-macro2"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "0.4.24" version = "0.4.24"
@ -2015,14 +2007,6 @@ name = "quote"
version = "0.3.15" version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "quote"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "quote" name = "quote"
version = "0.6.10" version = "0.6.10"
@ -2092,7 +2076,7 @@ name = "rand_chacha"
version = "0.1.0" version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -2114,7 +2098,7 @@ name = "rand_hc"
version = "0.1.0" version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -2139,7 +2123,7 @@ name = "rand_xorshift"
version = "0.1.0" version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -2381,7 +2365,7 @@ dependencies = [
"rustc_errors 0.0.0", "rustc_errors 0.0.0",
"rustc_fs_util 0.0.0", "rustc_fs_util 0.0.0",
"rustc_target 0.0.0", "rustc_target 0.0.0",
"scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serialize 0.0.0", "serialize 0.0.0",
"smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)",
"syntax 0.0.0", "syntax 0.0.0",
@ -2726,7 +2710,7 @@ dependencies = [
"rustc_target 0.0.0", "rustc_target 0.0.0",
"rustc_traits 0.0.0", "rustc_traits 0.0.0",
"rustc_typeck 0.0.0", "rustc_typeck 0.0.0",
"scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serialize 0.0.0", "serialize 0.0.0",
"smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)",
"syntax 0.0.0", "syntax 0.0.0",
@ -3090,6 +3074,11 @@ name = "scoped-tls"
version = "0.1.2" version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "scoped-tls"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "scoped_threadpool" name = "scoped_threadpool"
version = "0.1.9" version = "0.1.9"
@ -3230,7 +3219,7 @@ dependencies = [
"cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"core 0.0.0", "core 0.0.0",
"dlmalloc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "dlmalloc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"fortanix-sgx-abi 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "fortanix-sgx-abi 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)",
"panic_abort 0.0.0", "panic_abort 0.0.0",
@ -3255,19 +3244,19 @@ dependencies = [
"phf_shared 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", "phf_shared 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)",
"precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_codegen 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "string_cache_codegen" name = "string_cache_codegen"
version = "0.4.1" version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"phf_generator 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", "phf_generator 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_shared 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)", "phf_shared 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -3345,7 +3334,7 @@ dependencies = [
"rustc_data_structures 0.0.0", "rustc_data_structures 0.0.0",
"rustc_errors 0.0.0", "rustc_errors 0.0.0",
"rustc_target 0.0.0", "rustc_target 0.0.0",
"scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serialize 0.0.0", "serialize 0.0.0",
"smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)",
"syntax_pos 0.0.0", "syntax_pos 0.0.0",
@ -3372,7 +3361,7 @@ dependencies = [
"arena 0.0.0", "arena 0.0.0",
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_data_structures 0.0.0", "rustc_data_structures 0.0.0",
"scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serialize 0.0.0", "serialize 0.0.0",
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -4000,7 +3989,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "03b072242a8cbaf9c145665af9d250c59af3b958f83ed6824e13533cf76d5b90" "checksum digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "03b072242a8cbaf9c145665af9d250c59af3b958f83ed6824e13533cf76d5b90"
"checksum directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "72d337a64190607d4fcca2cb78982c5dd57f4916e19696b48a575fa746b6cb0f" "checksum directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "72d337a64190607d4fcca2cb78982c5dd57f4916e19696b48a575fa746b6cb0f"
"checksum dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "88972de891f6118092b643d85a0b28e0678e0f948d7f879aa32f2d5aafe97d2a" "checksum dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "88972de891f6118092b643d85a0b28e0678e0f948d7f879aa32f2d5aafe97d2a"
"checksum dlmalloc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d56ad71b31043818d0ee10a7fb9664882f8e45849c81647585e6a3124f185517" "checksum dlmalloc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f283302e035e61c23f2b86b3093e8c6273a4c3125742d6087e96ade001ca5e63"
"checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0" "checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0"
"checksum elasticlunr-rs 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a99a310cd1f9770e7bf8e48810c7bcbb0e078c8fb23a8c7bcf0da4c2bf61a455" "checksum elasticlunr-rs 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a99a310cd1f9770e7bf8e48810c7bcbb0e078c8fb23a8c7bcf0da4c2bf61a455"
"checksum ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f56c93cc076508c549d9bb747f79aa9b4eb098be7b8cad8830c3137ef52d1e00" "checksum ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f56c93cc076508c549d9bb747f79aa9b4eb098be7b8cad8830c3137ef52d1e00"
@ -4124,7 +4113,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" "checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
"checksum pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a029430f0d744bc3d15dd474d591bed2402b645d024583082b9f63bb936dac6" "checksum pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a029430f0d744bc3d15dd474d591bed2402b645d024583082b9f63bb936dac6"
"checksum pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df8b3f4e0475def7d9c2e5de8e5a1306949849761e107b360d03e98eafaffd61" "checksum pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df8b3f4e0475def7d9c2e5de8e5a1306949849761e107b360d03e98eafaffd61"
"checksum proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1b06e2f335f48d24442b35a19df506a835fb3547bc3c06ef27340da9acf5cae7"
"checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" "checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09"
"checksum proptest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "926d0604475349f463fe44130aae73f2294b5309ab2ca0310b998bd334ef191f" "checksum proptest 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "926d0604475349f463fe44130aae73f2294b5309ab2ca0310b998bd334ef191f"
"checksum pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d6fdf85cda6cadfae5428a54661d431330b312bc767ddbc57adbedc24da66e32" "checksum pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d6fdf85cda6cadfae5428a54661d431330b312bc767ddbc57adbedc24da66e32"
@ -4132,7 +4120,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
"checksum quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "07589615d719a60c8dd8a4622e7946465dfef20d1a428f969e3443e7386d5f45" "checksum quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "07589615d719a60c8dd8a4622e7946465dfef20d1a428f969e3443e7386d5f45"
"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
"checksum quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8"
"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" "checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c"
"checksum racer 2.1.19 (registry+https://github.com/rust-lang/crates.io-index)" = "d634483bed41bb116122b84ffe0ef8740345c2ceb2784ce86c33499700eb13a7" "checksum racer 2.1.19 (registry+https://github.com/rust-lang/crates.io-index)" = "d634483bed41bb116122b84ffe0ef8740345c2ceb2784ce86c33499700eb13a7"
"checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd" "checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd"
@ -4183,6 +4170,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267" "checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267"
"checksum schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "0e1a231dc10abf6749cfa5d7767f25888d484201accbd919b66ab5413c502d56" "checksum schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "0e1a231dc10abf6749cfa5d7767f25888d484201accbd919b66ab5413c502d56"
"checksum scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" "checksum scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28"
"checksum scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
"checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" "checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8"
"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
@ -4201,7 +4189,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7" "checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7"
"checksum stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbc596e092fe5f598b12ef46cc03754085ac2f4d8c739ad61c4ae266cc3b3fa" "checksum stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbc596e092fe5f598b12ef46cc03754085ac2f4d8c739ad61c4ae266cc3b3fa"
"checksum string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25d70109977172b127fe834e5449e5ab1740b9ba49fa18a2020f509174f25423" "checksum string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25d70109977172b127fe834e5449e5ab1740b9ba49fa18a2020f509174f25423"
"checksum string_cache_codegen 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "35293b05cf1494e8ddd042a7df6756bf18d07f42d234f32e71dce8a7aabb0191" "checksum string_cache_codegen 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eea1eee654ef80933142157fdad9dd8bc43cf7c74e999e369263496f04ff4da"
"checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc" "checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc"
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
"checksum strum 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f6c3a2071519ab6a48f465808c4c1ffdd00dfc8e93111d02b4fc5abab177676e" "checksum strum 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f6c3a2071519ab6a48f465808c4c1ffdd00dfc8e93111d02b4fc5abab177676e"

View file

@ -830,7 +830,7 @@ def main():
# x.py help <cmd> ... # x.py help <cmd> ...
if len(sys.argv) > 1 and sys.argv[1] == 'help': if len(sys.argv) > 1 and sys.argv[1] == 'help':
sys.argv = sys.argv[:1] + [sys.argv[2], '-h'] + sys.argv[3:] sys.argv = [sys.argv[0], '-h'] + sys.argv[2:]
help_triggered = ( help_triggered = (
'-h' in sys.argv) or ('--help' in sys.argv) or (len(sys.argv) == 1) '-h' in sys.argv) or ('--help' in sys.argv) or (len(sys.argv) == 1)

View file

@ -346,7 +346,7 @@ $EndFeature, "
concat!("Shifts the bits to the left by a specified amount, `n`, concat!("Shifts the bits to the left by a specified amount, `n`,
wrapping the truncated bits to the end of the resulting integer. wrapping the truncated bits to the end of the resulting integer.
Please note this isn't the same operation as `<<`! Please note this isn't the same operation as the `<<` shifting operator!
# Examples # Examples
@ -370,7 +370,7 @@ assert_eq!(n.rotate_left(", $rot, "), m);
wrapping the truncated bits to the beginning of the resulting wrapping the truncated bits to the beginning of the resulting
integer. integer.
Please note this isn't the same operation as `>>`! Please note this isn't the same operation as the `>>` shifting operator!
# Examples # Examples
@ -2300,7 +2300,7 @@ assert_eq!(n.trailing_zeros(), 3);", $EndFeature, "
concat!("Shifts the bits to the left by a specified amount, `n`, concat!("Shifts the bits to the left by a specified amount, `n`,
wrapping the truncated bits to the end of the resulting integer. wrapping the truncated bits to the end of the resulting integer.
Please note this isn't the same operation as `<<`! Please note this isn't the same operation as the `<<` shifting operator!
# Examples # Examples
@ -2324,7 +2324,7 @@ assert_eq!(n.rotate_left(", $rot, "), m);
wrapping the truncated bits to the beginning of the resulting wrapping the truncated bits to the beginning of the resulting
integer. integer.
Please note this isn't the same operation as `>>`! Please note this isn't the same operation as the `>>` shifting operator!
# Examples # Examples

View file

@ -429,7 +429,8 @@ assert_eq!(n.trailing_zeros(), 3);
/// wrapping the truncated bits to the end of the resulting /// wrapping the truncated bits to the end of the resulting
/// integer. /// integer.
/// ///
/// Please note this isn't the same operation as `>>`! /// Please note this isn't the same operation as the `>>` shifting
/// operator!
/// ///
/// # Examples /// # Examples
/// ///
@ -454,7 +455,8 @@ assert_eq!(n.trailing_zeros(), 3);
/// wrapping the truncated bits to the beginning of the resulting /// wrapping the truncated bits to the beginning of the resulting
/// integer. /// integer.
/// ///
/// Please note this isn't the same operation as `<<`! /// Please note this isn't the same operation as the `<<` shifting
/// operator!
/// ///
/// # Examples /// # Examples
/// ///

View file

@ -17,7 +17,7 @@ graphviz = { path = "../libgraphviz" }
jobserver = "0.1" jobserver = "0.1"
lazy_static = "1.0.0" lazy_static = "1.0.0"
num_cpus = "1.0" num_cpus = "1.0"
scoped-tls = { version = "0.1.1", features = ["nightly"] } scoped-tls = "1.0"
log = { version = "0.4", features = ["release_max_level_info", "std"] } log = { version = "0.4", features = ["release_max_level_info", "std"] }
polonius-engine = "0.6.2" polonius-engine = "0.6.2"
rustc-rayon = "0.1.1" rustc-rayon = "0.1.1"

View file

@ -2892,7 +2892,7 @@ impl<'a> LoweringContext<'a> {
// `impl Future<Output = T>` here because lower_body // `impl Future<Output = T>` here because lower_body
// only cares about the input argument patterns in the function // only cares about the input argument patterns in the function
// declaration (decl), not the return types. // declaration (decl), not the return types.
let body_id = this.lower_async_body(decl, header.asyncness, body); let body_id = this.lower_async_body(decl, header.asyncness.node, body);
let (generics, fn_decl) = this.add_in_band_defs( let (generics, fn_decl) = this.add_in_band_defs(
generics, generics,
@ -2902,7 +2902,7 @@ impl<'a> LoweringContext<'a> {
decl, decl,
Some((fn_def_id, idty)), Some((fn_def_id, idty)),
true, true,
header.asyncness.opt_return_id() header.asyncness.node.opt_return_id()
), ),
); );
@ -3398,14 +3398,14 @@ impl<'a> LoweringContext<'a> {
) )
} }
ImplItemKind::Method(ref sig, ref body) => { ImplItemKind::Method(ref sig, ref body) => {
let body_id = self.lower_async_body(&sig.decl, sig.header.asyncness, body); let body_id = self.lower_async_body(&sig.decl, sig.header.asyncness.node, body);
let impl_trait_return_allow = !self.is_in_trait_impl; let impl_trait_return_allow = !self.is_in_trait_impl;
let (generics, sig) = self.lower_method_sig( let (generics, sig) = self.lower_method_sig(
&i.generics, &i.generics,
sig, sig,
impl_item_def_id, impl_item_def_id,
impl_trait_return_allow, impl_trait_return_allow,
sig.header.asyncness.opt_return_id(), sig.header.asyncness.node.opt_return_id(),
); );
(generics, hir::ImplItemKind::Method(sig, body_id)) (generics, hir::ImplItemKind::Method(sig, body_id))
} }
@ -3624,7 +3624,7 @@ impl<'a> LoweringContext<'a> {
fn lower_fn_header(&mut self, h: FnHeader) -> hir::FnHeader { fn lower_fn_header(&mut self, h: FnHeader) -> hir::FnHeader {
hir::FnHeader { hir::FnHeader {
unsafety: self.lower_unsafety(h.unsafety), unsafety: self.lower_unsafety(h.unsafety),
asyncness: self.lower_asyncness(h.asyncness), asyncness: self.lower_asyncness(h.asyncness.node),
constness: self.lower_constness(h.constness), constness: self.lower_constness(h.constness),
abi: h.abi, abi: h.abi,
} }

View file

@ -73,7 +73,7 @@ impl<'a> DefCollector<'a> {
decl: &'a FnDecl, decl: &'a FnDecl,
body: &'a Block, body: &'a Block,
) { ) {
let (closure_id, return_impl_trait_id) = match header.asyncness { let (closure_id, return_impl_trait_id) = match header.asyncness.node {
IsAsync::Async { IsAsync::Async {
closure_id, closure_id,
return_impl_trait_id, return_impl_trait_id,
@ -129,10 +129,10 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
} }
ItemKind::Fn( ItemKind::Fn(
ref decl, ref decl,
ref header @ FnHeader { asyncness: IsAsync::Async { .. }, .. }, ref header,
ref generics, ref generics,
ref body, ref body,
) => { ) if header.asyncness.node.is_async() => {
return self.visit_async_fn( return self.visit_async_fn(
i.id, i.id,
i.ident.name, i.ident.name,
@ -242,9 +242,9 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
fn visit_impl_item(&mut self, ii: &'a ImplItem) { fn visit_impl_item(&mut self, ii: &'a ImplItem) {
let def_data = match ii.node { let def_data = match ii.node {
ImplItemKind::Method(MethodSig { ImplItemKind::Method(MethodSig {
header: ref header @ FnHeader { asyncness: IsAsync::Async { .. }, .. }, ref header,
ref decl, ref decl,
}, ref body) => { }, ref body) if header.asyncness.node.is_async() => {
return self.visit_async_fn( return self.visit_async_fn(
ii.id, ii.id,
ii.ident.name, ii.ident.name,

View file

@ -4,6 +4,7 @@ use crate::hir::def::Def;
use crate::hir::def_id::DefId; use crate::hir::def_id::DefId;
use crate::hir::map::DefPathData; use crate::hir::map::DefPathData;
use crate::hir::{self, Node}; use crate::hir::{self, Node};
use crate::mir::interpret::{sign_extend, truncate};
use crate::ich::NodeIdHashingMode; use crate::ich::NodeIdHashingMode;
use crate::traits::{self, ObligationCause}; use crate::traits::{self, ObligationCause};
use crate::ty::{self, Ty, TyCtxt, GenericParamDefKind, TypeFoldable}; use crate::ty::{self, Ty, TyCtxt, GenericParamDefKind, TypeFoldable};
@ -32,12 +33,12 @@ impl<'tcx> fmt::Display for Discr<'tcx> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.ty.sty { match self.ty.sty {
ty::Int(ity) => { ty::Int(ity) => {
let bits = ty::tls::with(|tcx| { let size = ty::tls::with(|tcx| {
Integer::from_attr(&tcx, SignedInt(ity)).size().bits() Integer::from_attr(&tcx, SignedInt(ity)).size()
}); });
let x = self.val as i128; let x = self.val;
// sign extend the raw representation to be an i128 // sign extend the raw representation to be an i128
let x = (x << (128 - bits)) >> (128 - bits); let x = sign_extend(x, size) as i128;
write!(fmt, "{}", x) write!(fmt, "{}", x)
}, },
_ => write!(fmt, "{}", self.val), _ => write!(fmt, "{}", self.val),
@ -57,12 +58,12 @@ impl<'tcx> Discr<'tcx> {
_ => bug!("non integer discriminant"), _ => bug!("non integer discriminant"),
}; };
let size = int.size();
let bit_size = int.size().bits(); let bit_size = int.size().bits();
let shift = 128 - bit_size; let shift = 128 - bit_size;
if signed { if signed {
let sext = |u| { let sext = |u| {
let i = u as i128; sign_extend(u, size) as i128
(i << shift) >> shift
}; };
let min = sext(1_u128 << (bit_size - 1)); let min = sext(1_u128 << (bit_size - 1));
let max = i128::max_value() >> shift; let max = i128::max_value() >> shift;
@ -77,7 +78,7 @@ impl<'tcx> Discr<'tcx> {
}; };
// zero the upper bits // zero the upper bits
let val = val as u128; let val = val as u128;
let val = (val << shift) >> shift; let val = truncate(val, size);
(Self { (Self {
val: val as u128, val: val as u128,
ty: self.ty, ty: self.ty,

View file

@ -14,7 +14,7 @@ graphviz = { path = "../libgraphviz" }
log = "0.4" log = "0.4"
env_logger = { version = "0.5", default-features = false } env_logger = { version = "0.5", default-features = false }
rustc-rayon = "0.1.1" rustc-rayon = "0.1.1"
scoped-tls = { version = "0.1.1", features = ["nightly"] } scoped-tls = "1.0"
rustc = { path = "../librustc" } rustc = { path = "../librustc" }
rustc_allocator = { path = "../librustc_allocator" } rustc_allocator = { path = "../librustc_allocator" }
rustc_target = { path = "../librustc_target" } rustc_target = { path = "../librustc_target" }

View file

@ -463,7 +463,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
self.invalid_visibility(&impl_item.vis, None); self.invalid_visibility(&impl_item.vis, None);
if let ImplItemKind::Method(ref sig, _) = impl_item.node { if let ImplItemKind::Method(ref sig, _) = impl_item.node {
self.check_trait_fn_not_const(sig.header.constness); self.check_trait_fn_not_const(sig.header.constness);
self.check_trait_fn_not_async(impl_item.span, sig.header.asyncness); self.check_trait_fn_not_async(impl_item.span, sig.header.asyncness.node);
} }
} }
} }
@ -482,9 +482,10 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
.note("only trait implementations may be annotated with default").emit(); .note("only trait implementations may be annotated with default").emit();
} }
} }
ItemKind::Fn(_, header, ref generics, _) => { ItemKind::Fn(_, ref header, ref generics, _) => {
// We currently do not permit const generics in `const fn`, as // We currently do not permit const generics in `const fn`, as
// this is tantamount to allowing compile-time dependent typing. // this is tantamount to allowing compile-time dependent typing.
self.visit_fn_header(header);
if header.constness.node == Constness::Const { if header.constness.node == Constness::Const {
// Look for const generics and error if we find any. // Look for const generics and error if we find any.
for param in &generics.params { for param in &generics.params {
@ -535,7 +536,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
self.no_questions_in_bounds(bounds, "supertraits", true); self.no_questions_in_bounds(bounds, "supertraits", true);
for trait_item in trait_items { for trait_item in trait_items {
if let TraitItemKind::Method(ref sig, ref block) = trait_item.node { if let TraitItemKind::Method(ref sig, ref block) = trait_item.node {
self.check_trait_fn_not_async(trait_item.span, sig.header.asyncness); self.check_trait_fn_not_async(trait_item.span, sig.header.asyncness.node);
self.check_trait_fn_not_const(sig.header.constness); self.check_trait_fn_not_const(sig.header.constness);
if block.is_none() { if block.is_none() {
self.check_decl_no_pat(&sig.decl, |span, mut_ident| { self.check_decl_no_pat(&sig.decl, |span, mut_ident| {
@ -702,6 +703,13 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
.span_bug(mac.span, "macro invocation missed in expansion; did you forget to override \ .span_bug(mac.span, "macro invocation missed in expansion; did you forget to override \
the relevant `fold_*()` method in `PlaceholderExpander`?"); the relevant `fold_*()` method in `PlaceholderExpander`?");
} }
fn visit_fn_header(&mut self, header: &'a FnHeader) {
if header.asyncness.node.is_async() && self.session.rust_2015() {
struct_span_err!(self.session, header.asyncness.span, E0670,
"`async fn` is not permitted in the 2015 edition").emit();
}
}
} }
pub fn check_crate(session: &Session, krate: &Crate) -> (bool, bool) { pub fn check_crate(session: &Session, krate: &Crate) -> (bool, bool) {

View file

@ -310,6 +310,18 @@ loop {
break; break;
} }
``` ```
"##,
E0670: r##"
Rust 2015 does not permit the use of `async fn`.
Example of erroneous code:
```compile_fail,E0670
async fn foo() {}
```
Switch to the Rust 2018 edition to use `async fn`.
"## "##
} }

View file

@ -806,9 +806,9 @@ impl<'a, 'tcx> Visitor<'tcx> for Resolver<'a> {
debug!("(resolving function) entering function"); debug!("(resolving function) entering function");
let (rib_kind, asyncness) = match function_kind { let (rib_kind, asyncness) = match function_kind {
FnKind::ItemFn(_, ref header, ..) => FnKind::ItemFn(_, ref header, ..) =>
(ItemRibKind, header.asyncness), (ItemRibKind, header.asyncness.node),
FnKind::Method(_, ref sig, _, _) => FnKind::Method(_, ref sig, _, _) =>
(TraitOrImplItemRibKind, sig.header.asyncness), (TraitOrImplItemRibKind, sig.header.asyncness.node),
FnKind::Closure(_) => FnKind::Closure(_) =>
// Async closures aren't resolved through `visit_fn`-- they're // Async closures aren't resolved through `visit_fn`-- they're
// processed separately // processed separately

View file

@ -378,7 +378,7 @@ impl Sig for ast::Item {
if header.constness.node == ast::Constness::Const { if header.constness.node == ast::Constness::Const {
text.push_str("const "); text.push_str("const ");
} }
if header.asyncness.is_async() { if header.asyncness.node.is_async() {
text.push_str("async "); text.push_str("async ");
} }
if header.unsafety == ast::Unsafety::Unsafe { if header.unsafety == ast::Unsafety::Unsafe {
@ -936,7 +936,7 @@ fn make_method_signature(
if m.header.constness.node == ast::Constness::Const { if m.header.constness.node == ast::Constness::Const {
text.push_str("const "); text.push_str("const ");
} }
if m.header.asyncness.is_async() { if m.header.asyncness.node.is_async() {
text.push_str("async "); text.push_str("async ");
} }
if m.header.unsafety == ast::Unsafety::Unsafe { if m.header.unsafety == ast::Unsafety::Unsafe {

View file

@ -1700,7 +1700,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
// `Self` in impl (we know the concrete type). // `Self` in impl (we know the concrete type).
assert_eq!(opt_self_ty, None); assert_eq!(opt_self_ty, None);
self.prohibit_generics(&path.segments); self.prohibit_generics(&path.segments);
tcx.at(span).type_of(def_id) // Try to evaluate any array length constants
self.normalize_ty(span, tcx.at(span).type_of(def_id))
} }
Def::SelfTy(Some(_), None) => { Def::SelfTy(Some(_), None) => {
// `Self` in trait. // `Self` in trait.

View file

@ -214,7 +214,7 @@ impl Options {
if matches.opt_strs("passes") == ["list"] { if matches.opt_strs("passes") == ["list"] {
println!("Available passes for running rustdoc:"); println!("Available passes for running rustdoc:");
for pass in passes::PASSES { for pass in passes::PASSES {
println!("{:>20} - {}", pass.name(), pass.description()); println!("{:>20} - {}", pass.name, pass.description);
} }
println!("\nDefault passes for rustdoc:"); println!("\nDefault passes for rustdoc:");
for &name in passes::DEFAULT_PASSES { for &name in passes::DEFAULT_PASSES {

View file

@ -603,10 +603,12 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
passes::defaults(default_passes).iter().map(|p| p.to_string()).collect(); passes::defaults(default_passes).iter().map(|p| p.to_string()).collect();
passes.extend(manual_passes); passes.extend(manual_passes);
info!("Executing passes");
for pass in &passes { for pass in &passes {
// the "unknown pass" error will be reported when late passes are run match passes::find_pass(pass).map(|p| p.pass) {
if let Some(pass) = passes::find_pass(pass).and_then(|p| p.early_fn()) { Some(pass) => krate = pass(krate, &ctxt),
krate = pass(krate, &ctxt); None => error!("unknown pass {}, skipping", *pass),
} }
} }

View file

@ -441,28 +441,6 @@ where R: 'static + Send,
krate.version = crate_version; krate.version = crate_version;
info!("Executing passes");
for pass in &passes {
// determine if we know about this pass
let pass = match passes::find_pass(pass) {
Some(pass) => if let Some(pass) = pass.late_fn() {
pass
} else {
// not a late pass, but still valid so don't report the error
continue
}
None => {
error!("unknown pass {}, skipping", *pass);
continue
},
};
// run it
krate = pass(krate);
}
tx.send(f(Output { tx.send(f(Output {
krate: krate, krate: krate,
renderinfo: renderinfo, renderinfo: renderinfo,

View file

@ -10,9 +10,11 @@ use crate::fold::DocFolder;
use crate::html::markdown::{self, RustCodeBlock}; use crate::html::markdown::{self, RustCodeBlock};
use crate::passes::Pass; use crate::passes::Pass;
pub const CHECK_CODE_BLOCK_SYNTAX: Pass = pub const CHECK_CODE_BLOCK_SYNTAX: Pass = Pass {
Pass::early("check-code-block-syntax", check_code_block_syntax, name: "check-code-block-syntax",
"validates syntax inside Rust code blocks"); pass: check_code_block_syntax,
description: "validates syntax inside Rust code blocks",
};
pub fn check_code_block_syntax(krate: clean::Crate, cx: &DocContext<'_, '_, '_>) -> clean::Crate { pub fn check_code_block_syntax(krate: clean::Crate, cx: &DocContext<'_, '_, '_>) -> clean::Crate {
SyntaxChecker { cx }.fold_crate(krate) SyntaxChecker { cx }.fold_crate(krate)

View file

@ -1,13 +1,16 @@
use crate::clean::{self, DocFragment, Item}; use crate::clean::{self, DocFragment, Item};
use crate::core::DocContext;
use crate::fold; use crate::fold;
use crate::fold::{DocFolder}; use crate::fold::{DocFolder};
use crate::passes::Pass; use crate::passes::Pass;
use std::mem::replace; use std::mem::replace;
pub const COLLAPSE_DOCS: Pass = pub const COLLAPSE_DOCS: Pass = Pass {
Pass::late("collapse-docs", collapse_docs, name: "collapse-docs",
"concatenates all document attributes into one document attribute"); pass: collapse_docs,
description: "concatenates all document attributes into one document attribute",
};
#[derive(Copy, Clone, Debug, PartialEq, Eq)] #[derive(Copy, Clone, Debug, PartialEq, Eq)]
enum DocFragmentKind { enum DocFragmentKind {
@ -26,7 +29,7 @@ impl DocFragment {
} }
} }
pub fn collapse_docs(krate: clean::Crate) -> clean::Crate { pub fn collapse_docs(krate: clean::Crate, _: &DocContext<'_, '_, '_>) -> clean::Crate {
Collapser.fold_crate(krate) Collapser.fold_crate(krate)
} }

View file

@ -19,9 +19,11 @@ use crate::passes::{look_for_tests, Pass};
use super::span_of_attrs; use super::span_of_attrs;
pub const COLLECT_INTRA_DOC_LINKS: Pass = pub const COLLECT_INTRA_DOC_LINKS: Pass = Pass {
Pass::early("collect-intra-doc-links", collect_intra_doc_links, name: "collect-intra-doc-links",
"reads a crate's documentation to resolve intra-doc-links"); pass: collect_intra_doc_links,
description: "reads a crate's documentation to resolve intra-doc-links",
};
pub fn collect_intra_doc_links(krate: Crate, cx: &DocContext<'_, '_, '_>) -> Crate { pub fn collect_intra_doc_links(krate: Crate, cx: &DocContext<'_, '_, '_>) -> Crate {
if !UnstableFeatures::from_environment().is_nightly_build() { if !UnstableFeatures::from_environment().is_nightly_build() {

View file

@ -6,9 +6,11 @@ use super::Pass;
use rustc::util::nodemap::FxHashSet; use rustc::util::nodemap::FxHashSet;
use rustc::hir::def_id::DefId; use rustc::hir::def_id::DefId;
pub const COLLECT_TRAIT_IMPLS: Pass = pub const COLLECT_TRAIT_IMPLS: Pass = Pass {
Pass::early("collect-trait-impls", collect_trait_impls, name: "collect-trait-impls",
"retrieves trait impls for items in the crate"); pass: collect_trait_impls,
description: "retrieves trait impls for items in the crate",
};
pub fn collect_trait_impls(krate: Crate, cx: &DocContext<'_, '_, '_>) -> Crate { pub fn collect_trait_impls(krate: Crate, cx: &DocContext<'_, '_, '_>) -> Crate {
let mut synth = SyntheticImplCollector::new(cx); let mut synth = SyntheticImplCollector::new(cx);

View file

@ -6,7 +6,6 @@ use rustc::lint as lint;
use rustc::middle::privacy::AccessLevels; use rustc::middle::privacy::AccessLevels;
use rustc::util::nodemap::DefIdSet; use rustc::util::nodemap::DefIdSet;
use std::mem; use std::mem;
use std::fmt;
use syntax::ast::NodeId; use syntax::ast::NodeId;
use syntax_pos::{DUMMY_SP, Span}; use syntax_pos::{DUMMY_SP, Span};
use std::ops::Range; use std::ops::Range;
@ -46,84 +45,14 @@ pub use self::collect_trait_impls::COLLECT_TRAIT_IMPLS;
mod check_code_block_syntax; mod check_code_block_syntax;
pub use self::check_code_block_syntax::CHECK_CODE_BLOCK_SYNTAX; pub use self::check_code_block_syntax::CHECK_CODE_BLOCK_SYNTAX;
/// Represents a single pass. /// A single pass over the cleaned documentation.
///
/// Runs in the compiler context, so it has access to types and traits and the like.
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
pub enum Pass { pub struct Pass {
/// An "early pass" is run in the compiler context, and can gather information about types and pub name: &'static str,
/// traits and the like. pub pass: fn(clean::Crate, &DocContext<'_, '_, '_>) -> clean::Crate,
EarlyPass { pub description: &'static str,
name: &'static str,
pass: fn(clean::Crate, &DocContext<'_, '_, '_>) -> clean::Crate,
description: &'static str,
},
/// A "late pass" is run between crate cleaning and page generation.
LatePass {
name: &'static str,
pass: fn(clean::Crate) -> clean::Crate,
description: &'static str,
},
}
impl fmt::Debug for Pass {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut dbg = match *self {
Pass::EarlyPass { .. } => f.debug_struct("EarlyPass"),
Pass::LatePass { .. } => f.debug_struct("LatePass"),
};
dbg.field("name", &self.name())
.field("pass", &"...")
.field("description", &self.description())
.finish()
}
}
impl Pass {
/// Constructs a new early pass.
pub const fn early(name: &'static str,
pass: fn(clean::Crate, &DocContext<'_, '_, '_>) -> clean::Crate,
description: &'static str) -> Pass {
Pass::EarlyPass { name, pass, description }
}
/// Constructs a new late pass.
pub const fn late(name: &'static str,
pass: fn(clean::Crate) -> clean::Crate,
description: &'static str) -> Pass {
Pass::LatePass { name, pass, description }
}
/// Returns the name of this pass.
pub fn name(self) -> &'static str {
match self {
Pass::EarlyPass { name, .. } |
Pass::LatePass { name, .. } => name,
}
}
/// Returns the description of this pass.
pub fn description(self) -> &'static str {
match self {
Pass::EarlyPass { description, .. } |
Pass::LatePass { description, .. } => description,
}
}
/// If this pass is an early pass, returns the pointer to its function.
pub fn early_fn(self) -> Option<fn(clean::Crate, &DocContext<'_, '_, '_>) -> clean::Crate> {
match self {
Pass::EarlyPass { pass, .. } => Some(pass),
_ => None,
}
}
/// If this pass is a late pass, returns the pointer to its function.
pub fn late_fn(self) -> Option<fn(clean::Crate) -> clean::Crate> {
match self {
Pass::LatePass { pass, .. } => Some(pass),
_ => None,
}
}
} }
/// The full list of passes. /// The full list of passes.
@ -141,27 +70,27 @@ pub const PASSES: &'static [Pass] = &[
]; ];
/// The list of passes run by default. /// The list of passes run by default.
pub const DEFAULT_PASSES: &'static [&'static str] = &[ pub const DEFAULT_PASSES: &[&str] = &[
"collect-trait-impls", "collect-trait-impls",
"collapse-docs",
"unindent-comments",
"check-private-items-doc-tests", "check-private-items-doc-tests",
"strip-hidden", "strip-hidden",
"strip-private", "strip-private",
"collect-intra-doc-links", "collect-intra-doc-links",
"check-code-block-syntax", "check-code-block-syntax",
"collapse-docs",
"unindent-comments",
"propagate-doc-cfg", "propagate-doc-cfg",
]; ];
/// The list of default passes run with `--document-private-items` is passed to rustdoc. /// The list of default passes run with `--document-private-items` is passed to rustdoc.
pub const DEFAULT_PRIVATE_PASSES: &'static [&'static str] = &[ pub const DEFAULT_PRIVATE_PASSES: &[&str] = &[
"collect-trait-impls", "collect-trait-impls",
"collapse-docs",
"unindent-comments",
"check-private-items-doc-tests", "check-private-items-doc-tests",
"strip-priv-imports", "strip-priv-imports",
"collect-intra-doc-links", "collect-intra-doc-links",
"check-code-block-syntax", "check-code-block-syntax",
"collapse-docs",
"unindent-comments",
"propagate-doc-cfg", "propagate-doc-cfg",
]; ];
@ -184,8 +113,8 @@ pub fn defaults(default_set: DefaultPassOption) -> &'static [&'static str] {
} }
/// If the given name matches a known pass, returns its information. /// If the given name matches a known pass, returns its information.
pub fn find_pass(pass_name: &str) -> Option<Pass> { pub fn find_pass(pass_name: &str) -> Option<&'static Pass> {
PASSES.iter().find(|p| p.name() == pass_name).cloned() PASSES.iter().find(|p| p.name == pass_name)
} }
struct Stripper<'a> { struct Stripper<'a> {
@ -438,11 +367,11 @@ crate fn source_span_for_markdown_range(
.span_to_snippet(span_of_attrs(attrs)) .span_to_snippet(span_of_attrs(attrs))
.ok()?; .ok()?;
let starting_line = markdown[..md_range.start].lines().count() - 1; let starting_line = markdown[..md_range.start].matches('\n').count();
let ending_line = markdown[..md_range.end].lines().count() - 1; let ending_line = starting_line + markdown[md_range.start..md_range.end].matches('\n').count();
// We use `split_terminator('\n')` instead of `lines()` when counting bytes so that we only // We use `split_terminator('\n')` instead of `lines()` when counting bytes so that we treat
// we can treat CRLF and LF line endings the same way. // CRLF and LF line endings the same way.
let mut src_lines = snippet.split_terminator('\n'); let mut src_lines = snippet.split_terminator('\n');
let md_lines = markdown.split_terminator('\n'); let md_lines = markdown.split_terminator('\n');

View file

@ -3,10 +3,11 @@ use crate::core::DocContext;
use crate::fold::DocFolder; use crate::fold::DocFolder;
use crate::passes::{look_for_tests, Pass}; use crate::passes::{look_for_tests, Pass};
pub const CHECK_PRIVATE_ITEMS_DOC_TESTS: Pass = Pass {
pub const CHECK_PRIVATE_ITEMS_DOC_TESTS: Pass = name: "check-private-items-doc-tests",
Pass::early("check-private-items-doc-tests", check_private_items_doc_tests, pass: check_private_items_doc_tests,
"check private items doc tests"); description: "check private items doc tests",
};
struct PrivateItemDocTestLinter<'a, 'tcx: 'a, 'rcx: 'a> { struct PrivateItemDocTestLinter<'a, 'tcx: 'a, 'rcx: 'a> {
cx: &'a DocContext<'a, 'tcx, 'rcx>, cx: &'a DocContext<'a, 'tcx, 'rcx>,

View file

@ -2,14 +2,17 @@ use std::sync::Arc;
use crate::clean::{Crate, Item}; use crate::clean::{Crate, Item};
use crate::clean::cfg::Cfg; use crate::clean::cfg::Cfg;
use crate::core::DocContext;
use crate::fold::DocFolder; use crate::fold::DocFolder;
use crate::passes::Pass; use crate::passes::Pass;
pub const PROPAGATE_DOC_CFG: Pass = pub const PROPAGATE_DOC_CFG: Pass = Pass {
Pass::late("propagate-doc-cfg", propagate_doc_cfg, name: "propagate-doc-cfg",
"propagates `#[doc(cfg(...))]` to child items"); pass: propagate_doc_cfg,
description: "propagates `#[doc(cfg(...))]` to child items",
};
pub fn propagate_doc_cfg(cr: Crate) -> Crate { pub fn propagate_doc_cfg(cr: Crate, _: &DocContext<'_, '_, '_>) -> Crate {
CfgPropagator { parent_cfg: None }.fold_crate(cr) CfgPropagator { parent_cfg: None }.fold_crate(cr)
} }

View file

@ -7,9 +7,11 @@ use crate::core::DocContext;
use crate::fold::{DocFolder, StripItem}; use crate::fold::{DocFolder, StripItem};
use crate::passes::{ImplStripper, Pass}; use crate::passes::{ImplStripper, Pass};
pub const STRIP_HIDDEN: Pass = pub const STRIP_HIDDEN: Pass = Pass {
Pass::early("strip-hidden", strip_hidden, name: "strip-hidden",
"strips all doc(hidden) items from the output"); pass: strip_hidden,
description: "strips all doc(hidden) items from the output",
};
/// Strip items marked `#[doc(hidden)]` /// Strip items marked `#[doc(hidden)]`
pub fn strip_hidden(krate: clean::Crate, _: &DocContext<'_, '_, '_>) -> clean::Crate { pub fn strip_hidden(krate: clean::Crate, _: &DocContext<'_, '_, '_>) -> clean::Crate {

View file

@ -3,8 +3,11 @@ use crate::fold::{DocFolder};
use crate::core::DocContext; use crate::core::DocContext;
use crate::passes::{ImportStripper, Pass}; use crate::passes::{ImportStripper, Pass};
pub const STRIP_PRIV_IMPORTS: Pass = Pass::early("strip-priv-imports", strip_priv_imports, pub const STRIP_PRIV_IMPORTS: Pass = Pass {
"strips all private import statements (`use`, `extern crate`) from a crate"); name: "strip-priv-imports",
pass: strip_priv_imports,
description: "strips all private import statements (`use`, `extern crate`) from a crate",
};
pub fn strip_priv_imports(krate: clean::Crate, _: &DocContext<'_, '_, '_>) -> clean::Crate { pub fn strip_priv_imports(krate: clean::Crate, _: &DocContext<'_, '_, '_>) -> clean::Crate {
ImportStripper.fold_crate(krate) ImportStripper.fold_crate(krate)

View file

@ -5,10 +5,12 @@ use crate::fold::{DocFolder};
use crate::core::DocContext; use crate::core::DocContext;
use crate::passes::{ImplStripper, ImportStripper, Stripper, Pass}; use crate::passes::{ImplStripper, ImportStripper, Stripper, Pass};
pub const STRIP_PRIVATE: Pass = pub const STRIP_PRIVATE: Pass = Pass {
Pass::early("strip-private", strip_private, name: "strip-private",
"strips all private items from a crate which cannot be seen externally, \ pass: strip_private,
implies strip-priv-imports"); description: "strips all private items from a crate which cannot be seen externally, \
implies strip-priv-imports",
};
/// Strip private items from the point of view of a crate or externally from a /// Strip private items from the point of view of a crate or externally from a
/// crate, specified by the `xcrate` flag. /// crate, specified by the `xcrate` flag.

View file

@ -3,14 +3,17 @@ use std::string::String;
use std::usize; use std::usize;
use crate::clean::{self, DocFragment, Item}; use crate::clean::{self, DocFragment, Item};
use crate::core::DocContext;
use crate::fold::{self, DocFolder}; use crate::fold::{self, DocFolder};
use crate::passes::Pass; use crate::passes::Pass;
pub const UNINDENT_COMMENTS: Pass = pub const UNINDENT_COMMENTS: Pass = Pass {
Pass::late("unindent-comments", unindent_comments, name: "unindent-comments",
"removes excess indentation on comments in order for markdown to like it"); pass: unindent_comments,
description: "removes excess indentation on comments in order for markdown to like it",
};
pub fn unindent_comments(krate: clean::Crate) -> clean::Crate { pub fn unindent_comments(krate: clean::Crate, _: &DocContext<'_, '_, '_>) -> clean::Crate {
CommentCleaner.fold_crate(krate) CommentCleaner.fold_crate(krate)
} }

View file

@ -1578,7 +1578,7 @@ pub trait BufRead: Read {
/// ///
/// If successful, this function will return the total number of bytes read. /// If successful, this function will return the total number of bytes read.
/// ///
/// An empty buffer returned indicates that the stream has reached EOF. /// If this function returns `Ok(0)`, the stream has reached EOF.
/// ///
/// # Errors /// # Errors
/// ///

View file

@ -1015,7 +1015,7 @@ impl From<ChildStdin> for Stdio {
/// ///
/// `ChildStdin` will be converted to `Stdio` using `Stdio::from` under the hood. /// `ChildStdin` will be converted to `Stdio` using `Stdio::from` under the hood.
/// ///
/// ```rust /// ```rust,no_run
/// use std::process::{Command, Stdio}; /// use std::process::{Command, Stdio};
/// ///
/// let reverse = Command::new("rev") /// let reverse = Command::new("rev")
@ -1044,7 +1044,7 @@ impl From<ChildStdout> for Stdio {
/// ///
/// `ChildStdout` will be converted to `Stdio` using `Stdio::from` under the hood. /// `ChildStdout` will be converted to `Stdio` using `Stdio::from` under the hood.
/// ///
/// ```rust /// ```rust,no_run
/// use std::process::{Command, Stdio}; /// use std::process::{Command, Stdio};
/// ///
/// let hello = Command::new("echo") /// let hello = Command::new("echo")

View file

@ -13,7 +13,7 @@ crate-type = ["dylib"]
bitflags = "1.0" bitflags = "1.0"
serialize = { path = "../libserialize" } serialize = { path = "../libserialize" }
log = "0.4" log = "0.4"
scoped-tls = "0.1" scoped-tls = "1.0"
syntax_pos = { path = "../libsyntax_pos" } syntax_pos = { path = "../libsyntax_pos" }
errors = { path = "../librustc_errors", package = "rustc_errors" } errors = { path = "../librustc_errors", package = "rustc_errors" }
rustc_data_structures = { path = "../librustc_data_structures" } rustc_data_structures = { path = "../librustc_data_structures" }

View file

@ -2216,7 +2216,7 @@ impl Item {
#[derive(Clone, Copy, RustcEncodable, RustcDecodable, Debug)] #[derive(Clone, Copy, RustcEncodable, RustcDecodable, Debug)]
pub struct FnHeader { pub struct FnHeader {
pub unsafety: Unsafety, pub unsafety: Unsafety,
pub asyncness: IsAsync, pub asyncness: Spanned<IsAsync>,
pub constness: Spanned<Constness>, pub constness: Spanned<Constness>,
pub abi: Abi, pub abi: Abi,
} }
@ -2225,7 +2225,7 @@ impl Default for FnHeader {
fn default() -> FnHeader { fn default() -> FnHeader {
FnHeader { FnHeader {
unsafety: Unsafety::Normal, unsafety: Unsafety::Normal,
asyncness: IsAsync::NotAsync, asyncness: dummy_spanned(IsAsync::NotAsync),
constness: dummy_spanned(Constness::NotConst), constness: dummy_spanned(Constness::NotConst),
abi: Abi::Rust, abi: Abi::Rust,
} }

View file

@ -1017,7 +1017,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
ast::ItemKind::Fn(self.fn_decl(inputs, ast::FunctionRetTy::Ty(output)), ast::ItemKind::Fn(self.fn_decl(inputs, ast::FunctionRetTy::Ty(output)),
ast::FnHeader { ast::FnHeader {
unsafety: ast::Unsafety::Normal, unsafety: ast::Unsafety::Normal,
asyncness: ast::IsAsync::NotAsync, asyncness: dummy_spanned(ast::IsAsync::NotAsync),
constness: dummy_spanned(ast::Constness::NotConst), constness: dummy_spanned(ast::Constness::NotConst),
abi: Abi::Rust, abi: Abi::Rust,
}, },

View file

@ -475,11 +475,13 @@ where
// #1 is a separator and #2 should be a KleepeOp. // #1 is a separator and #2 should be a KleepeOp.
// (N.B. We need to advance the input iterator.) // (N.B. We need to advance the input iterator.)
match parse_kleene_op(input, span) { match parse_kleene_op(input, span) {
// #2 is `?`, which is not allowed as a Kleene op in 2015 edition. // #2 is `?`, which is not allowed as a Kleene op in 2015 edition,
// but is allowed in the 2018 edition.
Ok(Ok((op, op2_span))) if op == KleeneOp::ZeroOrOne => { Ok(Ok((op, op2_span))) if op == KleeneOp::ZeroOrOne => {
sess.span_diagnostic sess.span_diagnostic
.struct_span_err(op2_span, "expected `*` or `+`") .struct_span_err(op2_span, "expected `*` or `+`")
.note("`?` is not a macro repetition operator") .note("`?` is not a macro repetition operator in the 2015 edition, \
but is accepted in the 2018 edition")
.emit(); .emit();
// Return a dummy // Return a dummy
@ -507,10 +509,12 @@ where
Err(_) => op1_span, Err(_) => op1_span,
} }
} else { } else {
// `?` is not allowed as a Kleene op in 2015 // `?` is not allowed as a Kleene op in 2015,
// but is allowed in the 2018 edition
sess.span_diagnostic sess.span_diagnostic
.struct_span_err(op1_span, "expected `*` or `+`") .struct_span_err(op1_span, "expected `*` or `+`")
.note("`?` is not a macro repetition operator") .note("`?` is not a macro repetition operator in the 2015 edition, \
but is accepted in the 2018 edition")
.emit(); .emit();
// Return a dummy // Return a dummy
@ -520,11 +524,13 @@ where
// #1 is a separator followed by #2, a KleeneOp // #1 is a separator followed by #2, a KleeneOp
Ok(Err((tok, span))) => match parse_kleene_op(input, span) { Ok(Err((tok, span))) => match parse_kleene_op(input, span) {
// #2 is a `?`, which is not allowed as a Kleene op in 2015 edition. // #2 is a `?`, which is not allowed as a Kleene op in 2015 edition,
// but is allowed in the 2018 edition
Ok(Ok((op, op2_span))) if op == KleeneOp::ZeroOrOne => { Ok(Ok((op, op2_span))) if op == KleeneOp::ZeroOrOne => {
sess.span_diagnostic sess.span_diagnostic
.struct_span_err(op2_span, "expected `*` or `+`") .struct_span_err(op2_span, "expected `*` or `+`")
.note("`?` is not a macro repetition operator") .note("`?` is not a macro repetition operator in the 2015 edition, \
but is accepted in the 2018 edition")
.emit(); .emit();
// Return a dummy // Return a dummy

View file

@ -233,8 +233,8 @@ declare_features! (
// Allows `#[unwind(..)]`. // Allows `#[unwind(..)]`.
// //
// rustc internal for rust runtime // Permits specifying whether a function should permit unwinding or abort on unwind.
(active, unwind_attributes, "1.4.0", None, None), (active, unwind_attributes, "1.4.0", Some(58760), None),
// Allows the use of `#[naked]` on functions. // Allows the use of `#[naked]` on functions.
(active, naked_functions, "1.9.0", Some(32408), None), (active, naked_functions, "1.9.0", Some(32408), None),
@ -1898,7 +1898,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
match fn_kind { match fn_kind {
FnKind::ItemFn(_, header, _, _) => { FnKind::ItemFn(_, header, _, _) => {
// Check for const fn and async fn declarations. // Check for const fn and async fn declarations.
if header.asyncness.is_async() { if header.asyncness.node.is_async() {
gate_feature_post!(&self, async_await, span, "async fn is unstable"); gate_feature_post!(&self, async_await, span, "async fn is unstable");
} }
// Stability of const fn methods are covered in // Stability of const fn methods are covered in

View file

@ -21,6 +21,7 @@ use syntax_pos::Span;
use rustc_data_structures::sync::Lrc; use rustc_data_structures::sync::Lrc;
use std::ops::DerefMut; use std::ops::DerefMut;
use std::{panic, process, ptr};
pub trait ExpectOne<A: Array> { pub trait ExpectOne<A: Array> {
fn expect_one(self, err: &'static str) -> A::Item; fn expect_one(self, err: &'static str) -> A::Item;
@ -305,11 +306,18 @@ pub trait MutVisitor: Sized {
/// Use a map-style function (`FnOnce(T) -> T`) to overwrite a `&mut T`. Useful /// Use a map-style function (`FnOnce(T) -> T`) to overwrite a `&mut T`. Useful
/// when using a `flat_map_*` or `filter_map_*` method within a `visit_` /// when using a `flat_map_*` or `filter_map_*` method within a `visit_`
/// method. /// method. Abort the program if the closure panics.
// //
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`. // No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
pub fn visit_clobber<T, F>(t: &mut T, f: F) where F: FnOnce(T) -> T { pub fn visit_clobber<T, F>(t: &mut T, f: F) where F: FnOnce(T) -> T {
unsafe { std::ptr::write(t, f(std::ptr::read(t))); } unsafe {
// Safe because `t` is used in a read-only fashion by `read()` before
// being overwritten by `write()`.
let old_t = ptr::read(t);
let new_t = panic::catch_unwind(panic::AssertUnwindSafe(|| f(old_t)))
.unwrap_or_else(|_| process::abort());
ptr::write(t, new_t);
}
} }
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`. // No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
@ -926,7 +934,7 @@ pub fn noop_flat_map_impl_item<T: MutVisitor>(mut item: ImplItem, visitor: &mut
pub fn noop_visit_fn_header<T: MutVisitor>(header: &mut FnHeader, vis: &mut T) { pub fn noop_visit_fn_header<T: MutVisitor>(header: &mut FnHeader, vis: &mut T) {
let FnHeader { unsafety: _, asyncness, constness: _, abi: _ } = header; let FnHeader { unsafety: _, asyncness, constness: _, abi: _ } = header;
vis.visit_asyncness(asyncness); vis.visit_asyncness(&mut asyncness.node);
} }
pub fn noop_visit_mod<T: MutVisitor>(Mod { inner, items, inline: _ }: &mut Mod, vis: &mut T) { pub fn noop_visit_mod<T: MutVisitor>(Mod { inner, items, inline: _ }: &mut Mod, vis: &mut T) {

View file

@ -5001,6 +5001,11 @@ impl<'a> Parser<'a> {
) )
} }
fn is_async_fn(&mut self) -> bool {
self.token.is_keyword(keywords::Async) &&
self.look_ahead(1, |t| t.is_keyword(keywords::Fn))
}
fn is_do_catch_block(&mut self) -> bool { fn is_do_catch_block(&mut self) -> bool {
self.token.is_keyword(keywords::Do) && self.token.is_keyword(keywords::Do) &&
self.look_ahead(1, |t| t.is_keyword(keywords::Catch)) && self.look_ahead(1, |t| t.is_keyword(keywords::Catch)) &&
@ -5133,7 +5138,8 @@ impl<'a> Parser<'a> {
!self.is_union_item() && !self.is_union_item() &&
!self.is_crate_vis() && !self.is_crate_vis() &&
!self.is_existential_type_decl() && !self.is_existential_type_decl() &&
!self.is_auto_trait_item() { !self.is_auto_trait_item() &&
!self.is_async_fn() {
let pth = self.parse_path(PathStyle::Expr)?; let pth = self.parse_path(PathStyle::Expr)?;
if !self.eat(&token::Not) { if !self.eat(&token::Not) {
@ -6384,7 +6390,7 @@ impl<'a> Parser<'a> {
/// Parses an item-position function declaration. /// Parses an item-position function declaration.
fn parse_item_fn(&mut self, fn parse_item_fn(&mut self,
unsafety: Unsafety, unsafety: Unsafety,
asyncness: IsAsync, asyncness: Spanned<IsAsync>,
constness: Spanned<Constness>, constness: Spanned<Constness>,
abi: Abi) abi: Abi)
-> PResult<'a, ItemInfo> { -> PResult<'a, ItemInfo> {
@ -6416,7 +6422,7 @@ impl<'a> Parser<'a> {
-> PResult<'a, ( -> PResult<'a, (
Spanned<Constness>, Spanned<Constness>,
Unsafety, Unsafety,
IsAsync, Spanned<IsAsync>,
Abi Abi
)> )>
{ {
@ -6424,6 +6430,7 @@ impl<'a> Parser<'a> {
let const_span = self.prev_span; let const_span = self.prev_span;
let unsafety = self.parse_unsafety(); let unsafety = self.parse_unsafety();
let asyncness = self.parse_asyncness(); let asyncness = self.parse_asyncness();
let asyncness = respan(self.prev_span, asyncness);
let (constness, unsafety, abi) = if is_const_fn { let (constness, unsafety, abi) = if is_const_fn {
(respan(const_span, Constness::Const), unsafety, Abi::Rust) (respan(const_span, Constness::Const), unsafety, Abi::Rust)
} else { } else {
@ -7834,7 +7841,7 @@ impl<'a> Parser<'a> {
let abi = opt_abi.unwrap_or(Abi::C); let abi = opt_abi.unwrap_or(Abi::C);
let (ident, item_, extra_attrs) = let (ident, item_, extra_attrs) =
self.parse_item_fn(Unsafety::Normal, self.parse_item_fn(Unsafety::Normal,
IsAsync::NotAsync, respan(fn_span, IsAsync::NotAsync),
respan(fn_span, Constness::NotConst), respan(fn_span, Constness::NotConst),
abi)?; abi)?;
let prev_span = self.prev_span; let prev_span = self.prev_span;
@ -7878,7 +7885,7 @@ impl<'a> Parser<'a> {
self.bump(); self.bump();
let (ident, item_, extra_attrs) = let (ident, item_, extra_attrs) =
self.parse_item_fn(unsafety, self.parse_item_fn(unsafety,
IsAsync::NotAsync, respan(const_span, IsAsync::NotAsync),
respan(const_span, Constness::Const), respan(const_span, Constness::Const),
Abi::Rust)?; Abi::Rust)?;
let prev_span = self.prev_span; let prev_span = self.prev_span;
@ -7926,14 +7933,15 @@ impl<'a> Parser<'a> {
// ASYNC FUNCTION ITEM // ASYNC FUNCTION ITEM
let unsafety = self.parse_unsafety(); let unsafety = self.parse_unsafety();
self.expect_keyword(keywords::Async)?; self.expect_keyword(keywords::Async)?;
let async_span = self.prev_span;
self.expect_keyword(keywords::Fn)?; self.expect_keyword(keywords::Fn)?;
let fn_span = self.prev_span; let fn_span = self.prev_span;
let (ident, item_, extra_attrs) = let (ident, item_, extra_attrs) =
self.parse_item_fn(unsafety, self.parse_item_fn(unsafety,
IsAsync::Async { respan(async_span, IsAsync::Async {
closure_id: ast::DUMMY_NODE_ID, closure_id: ast::DUMMY_NODE_ID,
return_impl_trait_id: ast::DUMMY_NODE_ID, return_impl_trait_id: ast::DUMMY_NODE_ID,
}, }),
respan(fn_span, Constness::NotConst), respan(fn_span, Constness::NotConst),
Abi::Rust)?; Abi::Rust)?;
let prev_span = self.prev_span; let prev_span = self.prev_span;
@ -7942,6 +7950,13 @@ impl<'a> Parser<'a> {
item_, item_,
visibility, visibility,
maybe_append(attrs, extra_attrs)); maybe_append(attrs, extra_attrs));
if self.span.rust_2015() {
self.diagnostic().struct_span_err_with_code(
async_span,
"`async fn` is not permitted in the 2015 edition",
DiagnosticId::Error("E0670".into())
).emit();
}
return Ok(Some(item)); return Ok(Some(item));
} }
if self.check_keyword(keywords::Unsafe) && if self.check_keyword(keywords::Unsafe) &&
@ -7989,7 +8004,7 @@ impl<'a> Parser<'a> {
let fn_span = self.prev_span; let fn_span = self.prev_span;
let (ident, item_, extra_attrs) = let (ident, item_, extra_attrs) =
self.parse_item_fn(Unsafety::Normal, self.parse_item_fn(Unsafety::Normal,
IsAsync::NotAsync, respan(fn_span, IsAsync::NotAsync),
respan(fn_span, Constness::NotConst), respan(fn_span, Constness::NotConst),
Abi::Rust)?; Abi::Rust)?;
let prev_span = self.prev_span; let prev_span = self.prev_span;
@ -8015,7 +8030,7 @@ impl<'a> Parser<'a> {
let fn_span = self.prev_span; let fn_span = self.prev_span;
let (ident, item_, extra_attrs) = let (ident, item_, extra_attrs) =
self.parse_item_fn(Unsafety::Unsafe, self.parse_item_fn(Unsafety::Unsafe,
IsAsync::NotAsync, respan(fn_span, IsAsync::NotAsync),
respan(fn_span, Constness::NotConst), respan(fn_span, Constness::NotConst),
abi)?; abi)?;
let prev_span = self.prev_span; let prev_span = self.prev_span;
@ -8282,7 +8297,8 @@ impl<'a> Parser<'a> {
lo: Span, lo: Span,
visibility: Visibility visibility: Visibility
) -> PResult<'a, Option<P<Item>>> { ) -> PResult<'a, Option<P<Item>>> {
if macros_allowed && self.token.is_path_start() { if macros_allowed && self.token.is_path_start() &&
!(self.is_async_fn() && self.span.rust_2015()) {
// MACRO INVOCATION ITEM // MACRO INVOCATION ITEM
let prev_span = self.prev_span; let prev_span = self.prev_span;
@ -8337,7 +8353,8 @@ impl<'a> Parser<'a> {
fn parse_assoc_macro_invoc(&mut self, item_kind: &str, vis: Option<&Visibility>, fn parse_assoc_macro_invoc(&mut self, item_kind: &str, vis: Option<&Visibility>,
at_end: &mut bool) -> PResult<'a, Option<Mac>> at_end: &mut bool) -> PResult<'a, Option<Mac>>
{ {
if self.token.is_path_start() { if self.token.is_path_start() &&
!(self.is_async_fn() && self.span.rust_2015()) {
let prev_span = self.prev_span; let prev_span = self.prev_span;
let lo = self.span; let lo = self.span;
let pth = self.parse_path(PathStyle::Mod)?; let pth = self.parse_path(PathStyle::Mod)?;

View file

@ -3195,7 +3195,7 @@ impl<'a> State<'a> {
ast::Constness::Const => self.word_nbsp("const")? ast::Constness::Const => self.word_nbsp("const")?
} }
self.print_asyncness(header.asyncness)?; self.print_asyncness(header.asyncness.node)?;
self.print_unsafety(header.unsafety)?; self.print_unsafety(header.unsafety)?;
if header.abi != Abi::Rust { if header.abi != Abi::Rust {
@ -3247,7 +3247,7 @@ mod tests {
ast::FnHeader { ast::FnHeader {
unsafety: ast::Unsafety::Normal, unsafety: ast::Unsafety::Normal,
constness: source_map::dummy_spanned(ast::Constness::NotConst), constness: source_map::dummy_spanned(ast::Constness::NotConst),
asyncness: ast::IsAsync::NotAsync, asyncness: source_map::dummy_spanned(ast::IsAsync::NotAsync),
abi: Abi::Rust, abi: Abi::Rust,
}, },
abba_ident, abba_ident,

View file

@ -22,7 +22,7 @@ use syntax_pos::Span;
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
pub enum FnKind<'a> { pub enum FnKind<'a> {
/// fn foo() or extern "Abi" fn foo() /// fn foo() or extern "Abi" fn foo()
ItemFn(Ident, FnHeader, &'a Visibility, &'a Block), ItemFn(Ident, &'a FnHeader, &'a Visibility, &'a Block),
/// fn foo(&self) /// fn foo(&self)
Method(Ident, &'a MethodSig, Option<&'a Visibility>, &'a Block), Method(Ident, &'a MethodSig, Option<&'a Visibility>, &'a Block),
@ -149,6 +149,9 @@ pub trait Visitor<'ast>: Sized {
fn visit_fn_ret_ty(&mut self, ret_ty: &'ast FunctionRetTy) { fn visit_fn_ret_ty(&mut self, ret_ty: &'ast FunctionRetTy) {
walk_fn_ret_ty(self, ret_ty) walk_fn_ret_ty(self, ret_ty)
} }
fn visit_fn_header(&mut self, _header: &'ast FnHeader) {
// Nothing to do
}
} }
#[macro_export] #[macro_export]
@ -225,8 +228,9 @@ pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) {
visitor.visit_ty(typ); visitor.visit_ty(typ);
visitor.visit_expr(expr); visitor.visit_expr(expr);
} }
ItemKind::Fn(ref declaration, header, ref generics, ref body) => { ItemKind::Fn(ref declaration, ref header, ref generics, ref body) => {
visitor.visit_generics(generics); visitor.visit_generics(generics);
visitor.visit_fn_header(header);
visitor.visit_fn(FnKind::ItemFn(item.ident, header, visitor.visit_fn(FnKind::ItemFn(item.ident, header,
&item.vis, body), &item.vis, body),
declaration, declaration,
@ -539,11 +543,13 @@ pub fn walk_fn<'a, V>(visitor: &mut V, kind: FnKind<'a>, declaration: &'a FnDecl
where V: Visitor<'a>, where V: Visitor<'a>,
{ {
match kind { match kind {
FnKind::ItemFn(_, _, _, body) => { FnKind::ItemFn(_, header, _, body) => {
visitor.visit_fn_header(header);
walk_fn_decl(visitor, declaration); walk_fn_decl(visitor, declaration);
visitor.visit_block(body); visitor.visit_block(body);
} }
FnKind::Method(_, _, _, body) => { FnKind::Method(_, sig, _, body) => {
visitor.visit_fn_header(&sig.header);
walk_fn_decl(visitor, declaration); walk_fn_decl(visitor, declaration);
visitor.visit_block(body); visitor.visit_block(body);
} }
@ -564,6 +570,7 @@ pub fn walk_trait_item<'a, V: Visitor<'a>>(visitor: &mut V, trait_item: &'a Trai
walk_list!(visitor, visit_expr, default); walk_list!(visitor, visit_expr, default);
} }
TraitItemKind::Method(ref sig, None) => { TraitItemKind::Method(ref sig, None) => {
visitor.visit_fn_header(&sig.header);
walk_fn_decl(visitor, &sig.decl); walk_fn_decl(visitor, &sig.decl);
} }
TraitItemKind::Method(ref sig, Some(ref body)) => { TraitItemKind::Method(ref sig, Some(ref body)) => {

View file

@ -257,7 +257,7 @@ fn has_test_signature(cx: &ExtCtxt<'_>, i: &ast::Item) -> bool {
); );
return false return false
} }
if header.asyncness.is_async() { if header.asyncness.node.is_async() {
sd.span_err( sd.span_err(
i.span, i.span,
"async functions cannot be used for tests" "async functions cannot be used for tests"

View file

@ -13,6 +13,6 @@ crate-type = ["dylib"]
serialize = { path = "../libserialize" } serialize = { path = "../libserialize" }
rustc_data_structures = { path = "../librustc_data_structures" } rustc_data_structures = { path = "../librustc_data_structures" }
arena = { path = "../libarena" } arena = { path = "../libarena" }
scoped-tls = { version = "0.1.1", features = ["nightly"] } scoped-tls = "1.0"
unicode-width = "0.1.4" unicode-width = "0.1.4"
cfg-if = "0.1.2" cfg-if = "0.1.2"

View file

@ -0,0 +1,13 @@
trait FromUnchecked {
unsafe fn from_unchecked();
}
impl FromUnchecked for [u8; 1] {
unsafe fn from_unchecked() {
let mut array: Self = std::mem::uninitialized();
let _ptr = &mut array as *mut [u8] as *mut u8;
}
}
fn main() {
}

View file

@ -105,8 +105,8 @@ LL | | /// [error]
| |
= note: the link appears in this line: = note: the link appears in this line:
[error] [error]
^^^^^ ^^^^^
= help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]` = help: to escape `[` and `]` characters, just add '/' before them like `/[` or `/]`
warning: `[error1]` cannot be resolved, ignoring it... warning: `[error1]` cannot be resolved, ignoring it...

View file

@ -0,0 +1,12 @@
// compile-pass
#![deny(private_doc_tests)]
mod foo {
/**
Does nothing, returns `()`
yadda-yadda-yadda
*/
fn foo() {}
}

View file

@ -0,0 +1,10 @@
// compile-pass
pub trait Foo {
/**
Does nothing, returns `()`
yadda-yadda-yadda
*/
fn foo() {}
}

View file

@ -0,0 +1,34 @@
// edition:2015
#![feature(futures_api, async_await)]
async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition
fn baz() { async fn foo() {} } //~ ERROR `async fn` is not permitted in the 2015 edition
async fn async_baz() { //~ ERROR `async fn` is not permitted in the 2015 edition
async fn bar() {} //~ ERROR `async fn` is not permitted in the 2015 edition
}
struct Foo {}
impl Foo {
async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition
}
trait Bar {
async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition
//~^ ERROR trait fns cannot be declared `async`
}
fn main() {
macro_rules! accept_item { ($x:item) => {} }
accept_item! {
async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition
}
let inside_closure = || {
async fn bar() {} //~ ERROR `async fn` is not permitted in the 2015 edition
};
}

View file

@ -0,0 +1,58 @@
error[E0670]: `async fn` is not permitted in the 2015 edition
--> $DIR/edition-deny-async-fns-2015.rs:5:1
|
LL | async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition
| ^^^^^
error[E0670]: `async fn` is not permitted in the 2015 edition
--> $DIR/edition-deny-async-fns-2015.rs:7:12
|
LL | fn baz() { async fn foo() {} } //~ ERROR `async fn` is not permitted in the 2015 edition
| ^^^^^
error[E0670]: `async fn` is not permitted in the 2015 edition
--> $DIR/edition-deny-async-fns-2015.rs:10:5
|
LL | async fn bar() {} //~ ERROR `async fn` is not permitted in the 2015 edition
| ^^^^^
error[E0670]: `async fn` is not permitted in the 2015 edition
--> $DIR/edition-deny-async-fns-2015.rs:9:1
|
LL | async fn async_baz() { //~ ERROR `async fn` is not permitted in the 2015 edition
| ^^^^^
error[E0670]: `async fn` is not permitted in the 2015 edition
--> $DIR/edition-deny-async-fns-2015.rs:32:9
|
LL | async fn bar() {} //~ ERROR `async fn` is not permitted in the 2015 edition
| ^^^^^
error[E0670]: `async fn` is not permitted in the 2015 edition
--> $DIR/edition-deny-async-fns-2015.rs:28:9
|
LL | async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition
| ^^^^^
error[E0670]: `async fn` is not permitted in the 2015 edition
--> $DIR/edition-deny-async-fns-2015.rs:16:5
|
LL | async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition
| ^^^^^
error[E0706]: trait fns cannot be declared `async`
--> $DIR/edition-deny-async-fns-2015.rs:20:5
|
LL | async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition
| ^^^^^^^^^^^^^^^^^
error[E0670]: `async fn` is not permitted in the 2015 edition
--> $DIR/edition-deny-async-fns-2015.rs:20:5
|
LL | async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition
| ^^^^^
error: aborting due to 9 previous errors
Some errors occurred: E0670, E0706.
For more information about an error, try `rustc --explain E0670`.

View file

@ -2,7 +2,8 @@
#![feature(futures_api)] #![feature(futures_api)]
async fn foo() {} //~ ERROR async fn is unstable async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition
//~^ ERROR async fn is unstable
fn main() { fn main() {
let _ = async {}; //~ ERROR cannot find struct, variant or union type `async` let _ = async {}; //~ ERROR cannot find struct, variant or union type `async`

View file

@ -1,11 +1,17 @@
error[E0670]: `async fn` is not permitted in the 2015 edition
--> $DIR/feature-gate-async-await-2015-edition.rs:5:1
|
LL | async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition
| ^^^^^
error[E0422]: cannot find struct, variant or union type `async` in this scope error[E0422]: cannot find struct, variant or union type `async` in this scope
--> $DIR/feature-gate-async-await-2015-edition.rs:8:13 --> $DIR/feature-gate-async-await-2015-edition.rs:9:13
| |
LL | let _ = async {}; //~ ERROR cannot find struct, variant or union type `async` LL | let _ = async {}; //~ ERROR cannot find struct, variant or union type `async`
| ^^^^^ not found in this scope | ^^^^^ not found in this scope
error[E0425]: cannot find value `async` in this scope error[E0425]: cannot find value `async` in this scope
--> $DIR/feature-gate-async-await-2015-edition.rs:9:13 --> $DIR/feature-gate-async-await-2015-edition.rs:10:13
| |
LL | let _ = async || { true }; //~ ERROR cannot find value `async` in this scope LL | let _ = async || { true }; //~ ERROR cannot find value `async` in this scope
| ^^^^^ not found in this scope | ^^^^^ not found in this scope
@ -13,12 +19,12 @@ LL | let _ = async || { true }; //~ ERROR cannot find value `async` in this
error[E0658]: async fn is unstable (see issue #50547) error[E0658]: async fn is unstable (see issue #50547)
--> $DIR/feature-gate-async-await-2015-edition.rs:5:1 --> $DIR/feature-gate-async-await-2015-edition.rs:5:1
| |
LL | async fn foo() {} //~ ERROR async fn is unstable LL | async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
| |
= help: add #![feature(async_await)] to the crate attributes to enable = help: add #![feature(async_await)] to the crate attributes to enable
error: aborting due to 3 previous errors error: aborting due to 4 previous errors
Some errors occurred: E0422, E0425, E0658. Some errors occurred: E0422, E0425, E0658, E0670.
For more information about an error, try `rustc --explain E0422`. For more information about an error, try `rustc --explain E0422`.

View file

@ -1,4 +1,4 @@
error[E0658]: #[unwind] is experimental error[E0658]: #[unwind] is experimental (see issue #58760)
--> $DIR/feature-gate-unwind-attributes.rs:11:5 --> $DIR/feature-gate-unwind-attributes.rs:11:5
| |
LL | #[unwind(allowed)] //~ ERROR #[unwind] is experimental LL | #[unwind(allowed)] //~ ERROR #[unwind] is experimental

View file

@ -0,0 +1,11 @@
// edition:2018
// Test that impl trait does not allow creating recursive types that are
// otherwise forbidden when using `async` and `await`.
#![feature(await_macro, async_await, futures_api, generators)]
async fn recursive_async_function() -> () { //~ ERROR
await!(recursive_async_function());
}
fn main() {}

View file

@ -0,0 +1,11 @@
error[E0720]: opaque type expands to a recursive type
--> $DIR/recursive-async-impl-trait-type.rs:7:40
|
LL | async fn recursive_async_function() -> () { //~ ERROR
| ^^ expands to self-referential type
|
= note: expanded type is `std::future::GenFuture<[static generator@$DIR/recursive-async-impl-trait-type.rs:7:43: 9:2 {impl std::future::Future, ()}]>`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0720`.

View file

@ -1,7 +1,7 @@
// Test that impl trait does not allow creating recursive types that are // Test that impl trait does not allow creating recursive types that are
// otherwise forbidden. // otherwise forbidden.
#![feature(await_macro, async_await, futures_api, generators)] #![feature(futures_api, generators)]
fn option(i: i32) -> impl Sized { //~ ERROR fn option(i: i32) -> impl Sized { //~ ERROR
if i < 0 { if i < 0 {
@ -62,10 +62,6 @@ fn generator_hold() -> impl Sized { //~ ERROR
} }
} }
async fn recursive_async_function() -> () { //~ ERROR
await!(recursive_async_function());
}
fn use_fn_ptr() -> impl Sized { // OK, error already reported fn use_fn_ptr() -> impl Sized { // OK, error already reported
fn_ptr() fn_ptr()
} }

View file

@ -95,15 +95,7 @@ LL | fn generator_hold() -> impl Sized { //~ ERROR
= note: expanded type is `[generator@$DIR/recursive-impl-trait-type.rs:58:5: 62:6 {impl Sized, ()}]` = note: expanded type is `[generator@$DIR/recursive-impl-trait-type.rs:58:5: 62:6 {impl Sized, ()}]`
error[E0720]: opaque type expands to a recursive type error[E0720]: opaque type expands to a recursive type
--> $DIR/recursive-impl-trait-type.rs:65:40 --> $DIR/recursive-impl-trait-type.rs:69:26
|
LL | async fn recursive_async_function() -> () { //~ ERROR
| ^^ expands to self-referential type
|
= note: expanded type is `std::future::GenFuture<[static generator@$DIR/recursive-impl-trait-type.rs:65:43: 67:2 {impl std::future::Future, ()}]>`
error[E0720]: opaque type expands to a recursive type
--> $DIR/recursive-impl-trait-type.rs:73:26
| |
LL | fn mutual_recursion() -> impl Sync { //~ ERROR LL | fn mutual_recursion() -> impl Sync { //~ ERROR
| ^^^^^^^^^ expands to self-referential type | ^^^^^^^^^ expands to self-referential type
@ -111,13 +103,13 @@ LL | fn mutual_recursion() -> impl Sync { //~ ERROR
= note: type resolves to itself = note: type resolves to itself
error[E0720]: opaque type expands to a recursive type error[E0720]: opaque type expands to a recursive type
--> $DIR/recursive-impl-trait-type.rs:77:28 --> $DIR/recursive-impl-trait-type.rs:73:28
| |
LL | fn mutual_recursion_b() -> impl Sized { //~ ERROR LL | fn mutual_recursion_b() -> impl Sized { //~ ERROR
| ^^^^^^^^^^ expands to self-referential type | ^^^^^^^^^^ expands to self-referential type
| |
= note: type resolves to itself = note: type resolves to itself
error: aborting due to 15 previous errors error: aborting due to 14 previous errors
For more information about this error, try `rustc --explain E0720`. For more information about this error, try `rustc --explain E0720`.

View file

@ -4,7 +4,7 @@ error: expected `*` or `+`
LL | ($(a)?) => {} //~ERROR expected `*` or `+` LL | ($(a)?) => {} //~ERROR expected `*` or `+`
| ^ | ^
| |
= note: `?` is not a macro repetition operator = note: `?` is not a macro repetition operator in the 2015 edition, but is accepted in the 2018 edition
error: expected `*` or `+` error: expected `*` or `+`
--> $DIR/macro-at-most-once-rep-2015-ques-rep.rs:10:11 --> $DIR/macro-at-most-once-rep-2015-ques-rep.rs:10:11
@ -12,7 +12,7 @@ error: expected `*` or `+`
LL | ($(a),?) => {} //~ERROR expected `*` or `+` LL | ($(a),?) => {} //~ERROR expected `*` or `+`
| ^ | ^
| |
= note: `?` is not a macro repetition operator = note: `?` is not a macro repetition operator in the 2015 edition, but is accepted in the 2018 edition
error: aborting due to 2 previous errors error: aborting due to 2 previous errors