diff --git a/.mailmap b/.mailmap index 14797092475a2..e5aad52ef4b79 100644 --- a/.mailmap +++ b/.mailmap @@ -114,6 +114,7 @@ James Deng James Miller James Perry Jason Fager +Jason Liquorish Jason Orendorff Jason Orendorff Jason Toffaletti Jason Toffaletti diff --git a/Cargo.lock b/Cargo.lock index bbfda0fa2c846..beda3993353f4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -121,9 +121,9 @@ checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" [[package]] name = "backtrace" -version = "0.3.40" +version = "0.3.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "924c76597f0d9ca25d762c25a4d369d51267536465dc5064bdf0eb073ed477ea" +checksum = "e4036b9bf40f3cf16aba72a3d65e8a520fc4bafcdc7079aea8f848c58c5b5536" dependencies = [ "backtrace-sys", "cfg-if", @@ -281,7 +281,7 @@ dependencies = [ [[package]] name = "cargo" -version = "0.43.0" +version = "0.44.0" dependencies = [ "anyhow", "atty", @@ -292,6 +292,7 @@ dependencies = [ "clap", "core-foundation 0.7.0", "crates-io", + "crossbeam-channel", "crossbeam-utils 0.7.0", "crypto-hash", "curl", @@ -497,7 +498,7 @@ dependencies = [ "itertools 0.8.0", "lazy_static 1.4.0", "matches", - "pulldown-cmark 0.6.1", + "pulldown-cmark 0.7.0", "quine-mc_cluskey", "regex-syntax", "semver", @@ -575,9 +576,9 @@ dependencies = [ [[package]] name = "compiler_builtins" -version = "0.1.24" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9975aefa63997ef75ca9cf013ff1bb81487aaa0b622c21053afd3b92979a7af" +checksum = "438ac08ddc5efe81452f984a9e33ba425b00b31d1f48e6acd9e2210aa28cc52e" dependencies = [ "cc", "rustc-std-workspace-core", @@ -721,12 +722,11 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.3.8" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f0ed1a4de2235cabda8558ff5840bffb97fcb64c97827f354a451307df5f72b" +checksum = "acec9a3b0b3559f15aee4f90746c4e5e293b701c0f7d3925d24e01645267b68c" dependencies = [ - "crossbeam-utils 0.6.5", - "smallvec 0.6.10", + "crossbeam-utils 0.7.0", ] [[package]] @@ -879,14 +879,13 @@ dependencies = [ [[package]] name = "derive_more" -version = "0.13.0" +version = "0.99.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f57d78cf3bd45270dad4e70c21ec77a960b36c7a841ff9db76aaa775a8fb871" +checksum = "2159be042979966de68315bce7034bb000c775f22e3e834e1c52ff78f041cae8" dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.12", - "rustc_version", - "syn 0.15.35", + "proc-macro2 1.0.3", + "quote 1.0.2", + "syn 1.0.11", ] [[package]] @@ -1077,13 +1076,14 @@ checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "filetime" -version = "0.2.4" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2df5c1a8c4be27e7707789dc42ae65976e60b394afd293d1419ab915833e646" +checksum = "1ff6d4dab0aa0c8e6346d46052e93b13a16cf847b54ed357087c35011048cc7d" dependencies = [ "cfg-if", "libc", "redox_syscall", + "winapi 0.3.8", ] [[package]] @@ -1537,9 +1537,9 @@ checksum = "c3360c7b59e5ffa2653671fb74b4741a5d343c03f331c0a4aeda42b5c2b0ec7d" [[package]] name = "ignore" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ec16832258409d571aaef8273f3c3cc5b060d784e159d1a0f3b0017308f84a7" +checksum = "522daefc3b69036f80c7d2990b28ff9e0471c683bad05ca258e0a01dd22c5a1e" dependencies = [ "crossbeam-channel", "globset", @@ -1548,7 +1548,7 @@ dependencies = [ "memchr", "regex", "same-file", - "thread_local", + "thread_local 1.0.1", "walkdir", "winapi-util", ] @@ -1564,7 +1564,7 @@ dependencies = [ "rand_xoshiro", "sized-chunks", "typenum", - "version_check 0.9.1", + "version_check", ] [[package]] @@ -1657,9 +1657,9 @@ checksum = "9ad0485404155f45cce53a40d4b2d6ac356418300daed05273d9e26f91c390be" [[package]] name = "jsonrpc-client-transports" -version = "13.1.0" +version = "14.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39577db48b004cffb4c5b8e5c9b993c177c52599ecbee88711e815acf65144db" +checksum = "0a9ae166c4d1f702d297cd76d4b55758ace80272ffc6dbb139fdc1bf810de40b" dependencies = [ "failure", "futures", @@ -1676,9 +1676,9 @@ dependencies = [ [[package]] name = "jsonrpc-core" -version = "13.2.0" +version = "14.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91d767c183a7e58618a609499d359ce3820700b3ebb4823a18c343b4a2a41a0d" +checksum = "fe3b688648f1ef5d5072229e2d672ecb92cbff7d1c79bcf3fd5898f3f3df0970" dependencies = [ "futures", "log", @@ -1689,63 +1689,62 @@ dependencies = [ [[package]] name = "jsonrpc-core-client" -version = "13.1.0" +version = "14.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f047c10738edee7c3c6acf5241a0ce33df32ef9230c1a7fb03e4a77ee72c992f" +checksum = "080dc110be17701097df238fad3c816d4a478a1899dfbcf8ec8957dd40ec7304" dependencies = [ "jsonrpc-client-transports", ] [[package]] name = "jsonrpc-derive" -version = "13.1.0" +version = "14.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29f9149f785deaae92a4c834a9a1a83a4313b8cfedccf15362cd4cf039a64501" +checksum = "8609af8f63b626e8e211f52441fcdb6ec54f1a446606b10d5c89ae9bf8a20058" dependencies = [ "proc-macro-crate", - "proc-macro2 0.4.30", - "quote 0.6.12", - "syn 0.15.35", + "proc-macro2 1.0.3", + "quote 1.0.2", + "syn 1.0.11", ] [[package]] name = "jsonrpc-ipc-server" -version = "13.1.0" +version = "14.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "256c5e4292c17b4c2ecdf542299dc8e9d6b3939c075c54825570ad9317fe5751" +checksum = "b579cd0840d7db3ebaadf52f6f31ec601a260e78d610e44f68634f919e34497a" dependencies = [ "jsonrpc-core", "jsonrpc-server-utils", "log", "parity-tokio-ipc", - "parking_lot", + "parking_lot 0.9.0", "tokio-service", ] [[package]] name = "jsonrpc-pubsub" -version = "13.1.0" +version = "14.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2c08b444cc0ed70263798834343d0ac875e664257df8079160f23ac1ea79446" +checksum = "5b31c9b90731276fdd24d896f31bb10aecf2e5151733364ae81123186643d939" dependencies = [ "jsonrpc-core", "log", - "parking_lot", + "parking_lot 0.10.0", "serde", ] [[package]] name = "jsonrpc-server-utils" -version = "13.1.0" +version = "14.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44561bfdd31401bad790527f1e951dde144f2341ddc3e1b859d32945e1a34eff" +checksum = "95b7635e618a0edbbe0d2a2bbbc69874277c49383fcf6c3c0414491cfb517d22" dependencies = [ "bytes", "globset", "jsonrpc-core", "lazy_static 1.4.0", "log", - "num_cpus", "tokio", "tokio-codec", "unicase", @@ -2009,15 +2008,15 @@ checksum = "fef709d3257013bba7cff14fc504e07e80631d3fe0f6d38ce63b8f6510ccb932" dependencies = [ "byteorder", "memmap", - "parking_lot", + "parking_lot 0.9.0", "rustc-hash", ] [[package]] name = "memchr" -version = "2.2.0" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" +checksum = "53445de381a1f436797497c61d851644d0e8e88e6140f22872ad33a704933978" [[package]] name = "memmap" @@ -2351,10 +2350,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" dependencies = [ "lock_api", - "parking_lot_core", + "parking_lot_core 0.6.2", "rustc_version", ] +[[package]] +name = "parking_lot" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e98c49ab0b7ce5b222f2cc9193fc4efe11c6d0bd4f648e374684a6857b1cfc" +dependencies = [ + "lock_api", + "parking_lot_core 0.7.0", +] + [[package]] name = "parking_lot_core" version = "0.6.2" @@ -2370,6 +2379,20 @@ dependencies = [ "winapi 0.3.8", ] +[[package]] +name = "parking_lot_core" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7582838484df45743c8434fbff785e8edf260c28748353d44bc0da32e0ceabf1" +dependencies = [ + "cfg-if", + "cloudabi", + "libc", + "redox_syscall", + "smallvec 1.0.0", + "winapi 0.3.8", +] + [[package]] name = "percent-encoding" version = "1.0.1" @@ -2504,12 +2527,11 @@ dependencies = [ [[package]] name = "pretty_env_logger" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df8b3f4e0475def7d9c2e5de8e5a1306949849761e107b360d03e98eafaffd61" +checksum = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d" dependencies = [ - "chrono", - "env_logger 0.6.2", + "env_logger 0.7.1", "log", ] @@ -2582,23 +2604,23 @@ dependencies = [ [[package]] name = "pulldown-cmark" -version = "0.5.3" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77043da1282374688ee212dc44b3f37ff929431de9c9adc3053bd3cee5630357" +checksum = "1c205cc82214f3594e2d50686730314f817c67ffa80fe800cf0db78c3c2b9d9e" dependencies = [ "bitflags", + "getopts", "memchr", "unicase", ] [[package]] name = "pulldown-cmark" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c205cc82214f3594e2d50686730314f817c67ffa80fe800cf0db78c3c2b9d9e" +checksum = "2c2d7fd131800e0d63df52aff46201acaab70b431a4a1ec6f0343fe8e64f35a4" dependencies = [ "bitflags", - "getopts", "memchr", "unicase", ] @@ -2641,18 +2663,24 @@ dependencies = [ [[package]] name = "racer" -version = "2.1.29" +version = "2.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6d7ffceb4da3e0a29c18986f0469c209f4db3ab9f2ffe286eaa1104a3e5028" +checksum = "0ff33fa15ac0384376741d16ddb05a65263dde4e2c5d0f7a9f3747db788764aa" dependencies = [ "bitflags", "clap", "derive_more", - "env_logger 0.6.2", - "humantime 1.3.0", + "env_logger 0.7.1", + "humantime 2.0.0", "lazy_static 1.4.0", "log", "rls-span", + "rustc-ap-rustc_ast_pretty", + "rustc-ap-rustc_data_structures", + "rustc-ap-rustc_errors", + "rustc-ap-rustc_parse", + "rustc-ap-rustc_session", + "rustc-ap-rustc_span", "rustc-ap-syntax", ] @@ -2876,7 +2904,7 @@ dependencies = [ "aho-corasick", "memchr", "regex-syntax", - "thread_local", + "thread_local 0.3.6", "utf8-ranges", ] @@ -3033,7 +3061,6 @@ version = "0.6.0" dependencies = [ "clippy_lints", "env_logger 0.7.1", - "failure", "futures", "log", "rand 0.7.3", @@ -3084,12 +3111,10 @@ dependencies = [ "bitflags", "byteorder", "chalk-engine", - "fmt_macros", - "graphviz", "jobserver", "log", "measureme", - "parking_lot", + "parking_lot 0.9.0", "polonius-engine", "rustc-rayon", "rustc-rayon-core", @@ -3112,26 +3137,57 @@ dependencies = [ [[package]] name = "rustc-ap-arena" -version = "610.0.0" +version = "642.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7475f4c707269b56eb7144c53591e3cd6369a5aa1d66434829ea11df96d5e7e3" +checksum = "ea82fa3d9a8add7422228ca1a2cbba0784fa8861f56148ff64da08b3c7921b03" dependencies = [ "rustc-ap-rustc_data_structures", - "smallvec 0.6.10", + "smallvec 1.0.0", ] [[package]] name = "rustc-ap-graphviz" -version = "610.0.0" +version = "642.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e59a55520f140a70a3e0fad80a36e807caa85e9d7016167b91a5b521ea929be" +checksum = "638d0b2b3bcf99824e0cb5a25dbc547b61dc20942e11daf6a97e981918aa18e5" + +[[package]] +name = "rustc-ap-rustc_ast_pretty" +version = "642.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d38bab04dd676dee6d2f9670506a18c31bfce38bf7f8420aa83eb1140ecde049" +dependencies = [ + "log", + "rustc-ap-rustc_data_structures", + "rustc-ap-rustc_span", + "rustc-ap-syntax", +] + +[[package]] +name = "rustc-ap-rustc_attr" +version = "642.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10b843ba8b1ed43739133047673b9f6a54d3b3b4d328d69c6ea89ff971395f35" +dependencies = [ + "rustc-ap-rustc_ast_pretty", + "rustc-ap-rustc_data_structures", + "rustc-ap-rustc_errors", + "rustc-ap-rustc_feature", + "rustc-ap-rustc_macros", + "rustc-ap-rustc_session", + "rustc-ap-rustc_span", + "rustc-ap-serialize", + "rustc-ap-syntax", + "smallvec 1.0.0", +] [[package]] name = "rustc-ap-rustc_data_structures" -version = "610.0.0" +version = "642.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6420857d5a088f680ec1ba736ffba4ee9c1964b0d397e6318f38d461f4f7d5cb" +checksum = "dc3d1c6d0a80ab0c1df76405377cec0f3d5423fb5b0953a8eac70a2ad6c44df2" dependencies = [ + "bitflags", "cfg-if", "crossbeam-utils 0.6.5", "ena", @@ -3139,58 +3195,78 @@ dependencies = [ "jobserver", "lazy_static 1.4.0", "log", - "parking_lot", + "measureme", + "parking_lot 0.9.0", "rustc-ap-graphviz", "rustc-ap-rustc_index", "rustc-ap-serialize", "rustc-hash", "rustc-rayon", "rustc-rayon-core", - "smallvec 0.6.10", + "smallvec 1.0.0", "stable_deref_trait", + "winapi 0.3.8", ] [[package]] name = "rustc-ap-rustc_errors" -version = "610.0.0" +version = "642.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8abfca0960131262254a91d02ff4903526a261ede730d7a2c75b4234c867cdc0" +checksum = "4909a1eca29331332257230f29120a8ff68c9e37d868c564fcd599e430cf8914" dependencies = [ "annotate-snippets", "atty", "log", "rustc-ap-rustc_data_structures", + "rustc-ap-rustc_span", "rustc-ap-serialize", - "rustc-ap-syntax_pos", - "term_size", "termcolor", + "termize", "unicode-width", + "winapi 0.3.8", ] +[[package]] +name = "rustc-ap-rustc_feature" +version = "642.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63ab887a181d795cf5fd3edadf367760deafb90aefb844f168ab5255266e3478" +dependencies = [ + "lazy_static 1.4.0", + "rustc-ap-rustc_data_structures", + "rustc-ap-rustc_span", +] + +[[package]] +name = "rustc-ap-rustc_fs_util" +version = "642.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70814116df3c5fbec8f06f6a1d013ca481f620fd22a9475754e9bf3ee9ba70d8" + [[package]] name = "rustc-ap-rustc_index" -version = "610.0.0" +version = "642.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a395509dcb90a92c1479c085639594624e06b4ab3fc7c1b795b46a61f2d4f65" +checksum = "ac1bf1d3cf3d119d41353d6fd229ef7272d5097bc0924de021c0294bf86d48bf" dependencies = [ "rustc-ap-serialize", - "smallvec 0.6.10", + "smallvec 1.0.0", ] [[package]] name = "rustc-ap-rustc_lexer" -version = "610.0.0" +version = "642.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64eac8a0e6efb8f55292aa24be0208c7c0538236c613e79952fd1fa3d54bcf8e" +checksum = "4cda21a32cebdc11ec4f5393aa2fcde5ed1b2f673a8571e5a4dcdf07e4ae9cac" dependencies = [ "unicode-xid 0.2.0", ] [[package]] name = "rustc-ap-rustc_macros" -version = "610.0.0" +version = "642.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f99795e8be4877e9e05d59f201e1740c1cf673364655def5848606d9e25b75af" +checksum = "75c47b48ea51910ecfd853c9248a9bf4c767bc823449ab6a1d864dff65fbae16" dependencies = [ "itertools 0.8.0", "proc-macro2 1.0.3", @@ -3200,63 +3276,102 @@ dependencies = [ ] [[package]] -name = "rustc-ap-rustc_target" -version = "610.0.0" +name = "rustc-ap-rustc_parse" +version = "642.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f22e21fdd8e1c0030f507158fa79b9f1e080e6241aba994d0f97c14a0a07a826" +checksum = "abd88e89cd5b5d28dcd3a347a3d534c08627d9455570dc1a2d402cb8437b9d30" dependencies = [ "bitflags", "log", + "rustc-ap-rustc_ast_pretty", + "rustc-ap-rustc_attr", "rustc-ap-rustc_data_structures", + "rustc-ap-rustc_errors", + "rustc-ap-rustc_feature", + "rustc-ap-rustc_lexer", + "rustc-ap-rustc_session", + "rustc-ap-rustc_span", + "rustc-ap-syntax", + "smallvec 1.0.0", + "unicode-normalization", +] + +[[package]] +name = "rustc-ap-rustc_session" +version = "642.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b8487b4575fbb2d1fc6f1cd61225efd108a4d36817e6fb9b643d57fcae9cb12" +dependencies = [ + "log", + "num_cpus", + "rustc-ap-rustc_data_structures", + "rustc-ap-rustc_errors", + "rustc-ap-rustc_feature", + "rustc-ap-rustc_fs_util", "rustc-ap-rustc_index", + "rustc-ap-rustc_span", + "rustc-ap-rustc_target", "rustc-ap-serialize", - "rustc-ap-syntax_pos", + "rustc-ap-syntax", ] [[package]] -name = "rustc-ap-serialize" -version = "610.0.0" +name = "rustc-ap-rustc_span" +version = "642.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb1cd6ef5135408d62559866e79986ca261f4c1333253d500e5e66fe66d1432e" +checksum = "f69746c0d4c21bf20a5bb2bd247261a1aa8631f04202d7303352942dde70d987" dependencies = [ - "indexmap", - "smallvec 0.6.10", + "cfg-if", + "log", + "rustc-ap-arena", + "rustc-ap-rustc_data_structures", + "rustc-ap-rustc_index", + "rustc-ap-rustc_macros", + "rustc-ap-serialize", + "scoped-tls", + "unicode-width", ] [[package]] -name = "rustc-ap-syntax" -version = "610.0.0" +name = "rustc-ap-rustc_target" +version = "642.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61fc1c901d2cbd24cae95d7bc5a58aa7661ec3dc5320c78c32830a52a685c33c" +checksum = "8bbc6ae09b5d42ec66edd520e8412e0615c53a7c93607fe33dc4abab60ba7c8b" dependencies = [ "bitflags", - "lazy_static 1.4.0", "log", "rustc-ap-rustc_data_structures", - "rustc-ap-rustc_errors", "rustc-ap-rustc_index", - "rustc-ap-rustc_lexer", - "rustc-ap-rustc_target", + "rustc-ap-rustc_macros", + "rustc-ap-rustc_span", "rustc-ap-serialize", - "rustc-ap-syntax_pos", - "scoped-tls", - "smallvec 0.6.10", ] [[package]] -name = "rustc-ap-syntax_pos" -version = "610.0.0" +name = "rustc-ap-serialize" +version = "642.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "230534f638255853bb9f13987537e00a818435a0cc54b68d97221b6822c8f1bc" +checksum = "e13a1ead0252fc3d96da4c336a95950be6795f2b00c84a67ccadf26142f8cb41" dependencies = [ - "cfg-if", - "rustc-ap-arena", + "indexmap", + "smallvec 1.0.0", +] + +[[package]] +name = "rustc-ap-syntax" +version = "642.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1f59f48ca3a2ec16a7e82e718ed5aadf9c9e08cf63015d28b4e774767524a6a" +dependencies = [ + "log", "rustc-ap-rustc_data_structures", "rustc-ap-rustc_index", + "rustc-ap-rustc_lexer", "rustc-ap-rustc_macros", + "rustc-ap-rustc_span", "rustc-ap-serialize", "scoped-tls", - "unicode-width", + "smallvec 1.0.0", ] [[package]] @@ -3442,6 +3557,7 @@ dependencies = [ "flate2", "libc", "log", + "measureme", "rustc", "rustc-demangle", "rustc_attr", @@ -3522,7 +3638,7 @@ dependencies = [ "lazy_static 1.4.0", "log", "measureme", - "parking_lot", + "parking_lot 0.9.0", "rustc-hash", "rustc-rayon", "rustc-rayon-core", @@ -3542,6 +3658,7 @@ dependencies = [ "log", "rustc", "rustc_ast_pretty", + "rustc_codegen_ssa", "rustc_codegen_utils", "rustc_data_structures", "rustc_error_codes", @@ -3619,6 +3736,7 @@ version = "0.0.0" name = "rustc_hir" version = "0.0.0" dependencies = [ + "lazy_static 1.4.0", "rustc_ast_pretty", "rustc_data_structures", "rustc_errors", @@ -3656,6 +3774,28 @@ dependencies = [ "smallvec 1.0.0", ] +[[package]] +name = "rustc_infer" +version = "0.0.0" +dependencies = [ + "fmt_macros", + "graphviz", + "log", + "rustc", + "rustc_attr", + "rustc_data_structures", + "rustc_error_codes", + "rustc_errors", + "rustc_hir", + "rustc_index", + "rustc_macros", + "rustc_session", + "rustc_span", + "rustc_target", + "smallvec 1.0.0", + "syntax", +] + [[package]] name = "rustc_interface" version = "0.0.0" @@ -3676,6 +3816,7 @@ dependencies = [ "rustc_expand", "rustc_hir", "rustc_incremental", + "rustc_infer", "rustc_lint", "rustc_metadata", "rustc_mir", @@ -3718,6 +3859,7 @@ dependencies = [ "rustc_feature", "rustc_hir", "rustc_index", + "rustc_infer", "rustc_session", "rustc_span", "rustc_target", @@ -3738,7 +3880,6 @@ dependencies = [ name = "rustc_macros" version = "0.1.0" dependencies = [ - "itertools 0.8.0", "proc-macro2 1.0.3", "quote 1.0.2", "syn 1.0.11", @@ -3788,6 +3929,7 @@ dependencies = [ "rustc_errors", "rustc_hir", "rustc_index", + "rustc_infer", "rustc_lexer", "rustc_macros", "rustc_span", @@ -3802,7 +3944,6 @@ name = "rustc_mir_build" version = "0.0.0" dependencies = [ "arena", - "itertools 0.8.0", "log", "rustc", "rustc_apfloat", @@ -3811,6 +3952,7 @@ dependencies = [ "rustc_errors", "rustc_hir", "rustc_index", + "rustc_infer", "rustc_macros", "rustc_session", "rustc_span", @@ -3851,6 +3993,7 @@ dependencies = [ "rustc_feature", "rustc_hir", "rustc_index", + "rustc_infer", "rustc_session", "rustc_span", "rustc_target", @@ -3901,6 +4044,7 @@ dependencies = [ "rustc_expand", "rustc_feature", "rustc_hir", + "rustc_infer", "rustc_metadata", "rustc_session", "rustc_span", @@ -3990,6 +4134,7 @@ dependencies = [ "rustc", "rustc_data_structures", "rustc_hir", + "rustc_infer", "rustc_macros", "rustc_span", "rustc_target", @@ -4005,7 +4150,9 @@ dependencies = [ "rustc", "rustc_data_structures", "rustc_hir", + "rustc_infer", "rustc_span", + "rustc_target", ] [[package]] @@ -4020,6 +4167,7 @@ dependencies = [ "rustc_errors", "rustc_hir", "rustc_index", + "rustc_infer", "rustc_span", "rustc_target", "smallvec 1.0.0", @@ -4041,7 +4189,7 @@ version = "0.0.0" dependencies = [ "itertools 0.8.0", "minifier", - "pulldown-cmark 0.5.3", + "pulldown-cmark 0.7.0", "rustc-rayon", "serde", "serde_json", @@ -4095,7 +4243,7 @@ dependencies = [ [[package]] name = "rustfmt-nightly" -version = "1.4.11" +version = "1.4.12" dependencies = [ "annotate-snippets", "bytecount", @@ -4111,9 +4259,14 @@ dependencies = [ "lazy_static 1.4.0", "log", "regex", + "rustc-ap-rustc_ast_pretty", + "rustc-ap-rustc_data_structures", + "rustc-ap-rustc_errors", + "rustc-ap-rustc_parse", + "rustc-ap-rustc_session", + "rustc-ap-rustc_span", "rustc-ap-rustc_target", "rustc-ap-syntax", - "rustc-ap-syntax_pos", "rustc-workspace-hack", "rustfmt-config_proc_macro", "serde", @@ -4547,9 +4700,9 @@ dependencies = [ [[package]] name = "tar" -version = "0.4.20" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a303ba60a099fcd2aaa646b14d2724591a96a75283e4b7ed3d1a1658909d9ae2" +checksum = "b3196bfbffbba3e57481b6ea32249fbaf590396a52505a2615adbb79d9d826d3" dependencies = [ "filetime", "libc", @@ -4601,17 +4754,6 @@ dependencies = [ "winapi 0.3.8", ] -[[package]] -name = "term_size" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5b9a66db815dcfd2da92db471106457082577c3c278d4138ab3e3b4e189327" -dependencies = [ - "kernel32-sys", - "libc", - "winapi 0.2.8", -] - [[package]] name = "termcolor" version = "1.0.4" @@ -4685,6 +4827,15 @@ dependencies = [ "lazy_static 1.4.0", ] +[[package]] +name = "thread_local" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" +dependencies = [ + "lazy_static 1.4.0", +] + [[package]] name = "tidy" version = "0.1.0" @@ -4839,7 +4990,7 @@ dependencies = [ "log", "mio", "num_cpus", - "parking_lot", + "parking_lot 0.9.0", "slab", "tokio-executor", "tokio-io", @@ -5038,11 +5189,11 @@ checksum = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" [[package]] name = "unicase" -version = "2.5.1" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e2e6bd1e59e56598518beb94fd6db628ded570326f0a98c679a304bd9f00150" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" dependencies = [ - "version_check 0.1.5", + "version_check", ] [[package]] @@ -5212,12 +5363,6 @@ dependencies = [ "failure", ] -[[package]] -name = "version_check" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" - [[package]] name = "version_check" version = "0.9.1" diff --git a/RELEASES.md b/RELEASES.md index 2a2bcfb0ea247..7e18f1befddec 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -95,6 +95,17 @@ Compatibility Notes [`CondVar::wait_timeout_while`]: https://doc.rust-lang.org/stable/std/sync/struct.Condvar.html#method.wait_timeout_while +Version 1.41.1 (2020-02-27) +=========================== + +* [Always check types of static items][69145] +* [Always check lifetime bounds of `Copy` impls][69145] +* [Fix miscompilation in callers of `Layout::repeat`][69225] + +[69225]: https://github.com/rust-lang/rust/issues/69225 +[69145]: https://github.com/rust-lang/rust/pull/69145 + + Version 1.41.0 (2020-01-30) =========================== diff --git a/config.toml.example b/config.toml.example index c9e17337ee23f..9b7327ea69e0b 100644 --- a/config.toml.example +++ b/config.toml.example @@ -395,6 +395,15 @@ # rustc to execute. #lld = false +# Indicates whether LLD will be used to link Rust crates during bootstrap on +# supported platforms. The LLD from the bootstrap distribution will be used +# and not the LLD compiled during the bootstrap. +# +# LLD will not be used if we're cross linking or running tests. +# +# Explicitly setting the linker for a target will override this option. +#use-lld = false + # Indicates whether some LLVM tools, like llvm-objdump, will be made available in the # sysroot. #llvm-tools = false @@ -435,6 +444,10 @@ # Use LLVM libunwind as the implementation for Rust's unwinder. #llvm-libunwind = false +# Enable Windows Control Flow Guard checks in the standard library. +# This only applies from stage 1 onwards, and only for Windows targets. +#control-flow-guard = false + # ============================================================================= # Options for specific targets # @@ -463,6 +476,7 @@ # Linker to be used to link Rust code. Note that the # default value is platform specific, and if not specified it may also depend on # what platform is crossing to what platform. +# Setting this will override the `use-lld` option for Rust code. #linker = "cc" # Path to the `llvm-config` binary of the installation of a custom LLVM to link diff --git a/rustfmt.toml b/rustfmt.toml index 2a034845c6e0b..8f4c901fb9740 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -7,6 +7,7 @@ merge_derives = false # tidy only checks files which are not ignored, each entry follows gitignore style ignore = [ "build", + "/vendor/", # tests for now are not formatted, as they are sometimes pretty-printing constrained # (and generally rustfmt can move around comments in UI-testing incompatible ways) diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index a8c00c8c3ca88..daa030c59d641 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -134,6 +134,11 @@ fn main() { cmd.arg(format!("-Clinker={}", host_linker)); } + // Override linker flavor if necessary. + if let Ok(host_linker_flavor) = env::var("RUSTC_HOST_LINKER_FLAVOR") { + cmd.arg(format!("-Clinker-flavor={}", host_linker_flavor)); + } + if let Ok(s) = env::var("RUSTC_HOST_CRT_STATIC") { if s == "true" { cmd.arg("-C").arg("target-feature=+crt-static"); diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 1935759a5628e..50e1726240fff 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -80,7 +80,7 @@ def _download(path, url, probably_big, verbose, exception): option = "-s" run(["curl", option, "-y", "30", "-Y", "10", # timeout if speed is < 10 bytes/sec for > 30 seconds - "--connect-timeout", "30", # timeout if cannot connect within 30 seconds + "--connect-timeout", "30", # timeout if cannot connect within 30 seconds "--retry", "3", "-Sf", "-o", path, url], verbose=verbose, exception=exception) @@ -332,7 +332,6 @@ def __init__(self): self.use_vendored_sources = '' self.verbose = False - def download_stage0(self): """Fetch the build system for Rust, written in Rust @@ -351,7 +350,7 @@ def support_xz(): try: with tempfile.NamedTemporaryFile(delete=False) as temp_file: temp_path = temp_file.name - with tarfile.open(temp_path, "w:xz") as tar: + with tarfile.open(temp_path, "w:xz"): pass return True except tarfile.CompressionError: @@ -825,7 +824,7 @@ def check_vendored_status(self): if not os.path.exists(vendor_dir): print('error: vendoring required, but vendor directory does not exist.') print(' Run `cargo vendor` without sudo to initialize the ' - 'vendor directory.') + 'vendor directory.') raise Exception("{} not found".format(vendor_dir)) if self.use_vendored_sources: @@ -839,7 +838,7 @@ def check_vendored_status(self): "\n" "[source.vendored-sources]\n" "directory = '{}/vendor'\n" - .format(self.rust_root)) + .format(self.rust_root)) else: if os.path.exists('.cargo'): shutil.rmtree('.cargo') diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index d12ee2935ebf5..e4b57cddfb891 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -692,7 +692,7 @@ impl<'a> Builder<'a> { cmd.env_remove("MAKEFLAGS"); cmd.env_remove("MFLAGS"); - if let Some(linker) = self.linker(compiler.host) { + if let Some(linker) = self.linker(compiler.host, true) { cmd.env("RUSTC_TARGET_LINKER", linker); } cmd @@ -952,10 +952,31 @@ impl<'a> Builder<'a> { } } - if let Some(host_linker) = self.linker(compiler.host) { + // FIXME: Don't use LLD if we're compiling libtest, since it fails to link it. + // See https://github.com/rust-lang/rust/issues/68647. + let can_use_lld = mode != Mode::Std; + + // FIXME: The beta compiler doesn't pick the `lld-link` flavor for `*-pc-windows-msvc` + // Remove `RUSTC_HOST_LINKER_FLAVOR` when this is fixed + let lld_linker_flavor = |linker: &Path, target: Interned| { + compiler.stage == 0 + && linker.file_name() == Some(OsStr::new("rust-lld")) + && target.contains("pc-windows-msvc") + }; + + if let Some(host_linker) = self.linker(compiler.host, can_use_lld) { + if lld_linker_flavor(host_linker, compiler.host) { + cargo.env("RUSTC_HOST_LINKER_FLAVOR", "lld-link"); + } + cargo.env("RUSTC_HOST_LINKER", host_linker); } - if let Some(target_linker) = self.linker(target) { + + if let Some(target_linker) = self.linker(target, can_use_lld) { + if lld_linker_flavor(target_linker, target) { + rustflags.arg("-Clinker-flavor=lld-link"); + } + let target = crate::envify(&target); cargo.env(&format!("CARGO_TARGET_{}_LINKER", target), target_linker); } @@ -1114,6 +1135,20 @@ impl<'a> Builder<'a> { ); } + // If Control Flow Guard is enabled, pass the `control_flow_guard=checks` flag to rustc + // when compiling the standard library, since this might be linked into the final outputs + // produced by rustc. Since this mitigation is only available on Windows, only enable it + // for the standard library in case the compiler is run on a non-Windows platform. + // This is not needed for stage 0 artifacts because these will only be used for building + // the stage 1 compiler. + if cfg!(windows) + && mode == Mode::Std + && self.config.control_flow_guard + && compiler.stage >= 1 + { + rustflags.arg("-Zcontrol_flow_guard=checks"); + } + // For `cargo doc` invocations, make rustdoc print the Rust version into the docs cargo.env("RUSTDOC_CRATE_VERSION", self.rust_version()); diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 709cf2908eadf..746cddbabd639 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -82,6 +82,7 @@ pub struct Config { pub llvm_use_linker: Option, pub llvm_allow_old_toolchain: Option, + pub use_lld: bool, pub lld_enabled: bool, pub lldb_enabled: bool, pub llvm_tools_enabled: bool, @@ -115,6 +116,7 @@ pub struct Config { pub targets: Vec>, pub local_rebuild: bool, pub jemalloc: bool, + pub control_flow_guard: bool, // dist misc pub dist_sign_folder: Option, @@ -175,6 +177,15 @@ pub struct Target { pub no_std: bool, } +impl Target { + pub fn from_triple(triple: &str) -> Self { + let mut target: Self = Default::default(); + if triple.contains("-none-") || triple.contains("nvptx") { + target.no_std = true; + } + target + } +} /// Structure of the `config.toml` file that configuration is read from. /// /// This structure uses `Decodable` to automatically decode a TOML configuration @@ -321,6 +332,7 @@ struct Rust { save_toolstates: Option, codegen_backends: Option>, lld: Option, + use_lld: Option, llvm_tools: Option, lldb: Option, deny_warnings: Option, @@ -331,6 +343,7 @@ struct Rust { jemalloc: Option, test_compare_mode: Option, llvm_libunwind: Option, + control_flow_guard: Option, } /// TOML representation of how each build target is configured. @@ -349,6 +362,7 @@ struct TomlTarget { musl_root: Option, wasi_root: Option, qemu_rootfs: Option, + no_std: Option, } impl Config { @@ -565,6 +579,7 @@ impl Config { if let Some(true) = rust.incremental { config.incremental = true; } + set(&mut config.use_lld, rust.use_lld); set(&mut config.lld_enabled, rust.lld); set(&mut config.lldb_enabled, rust.lldb); set(&mut config.llvm_tools_enabled, rust.llvm_tools); @@ -577,6 +592,7 @@ impl Config { set(&mut config.rust_verify_llvm_ir, rust.verify_llvm_ir); config.rust_thin_lto_import_instr_limit = rust.thin_lto_import_instr_limit; set(&mut config.rust_remap_debuginfo, rust.remap_debuginfo); + set(&mut config.control_flow_guard, rust.control_flow_guard); if let Some(ref backends) = rust.codegen_backends { config.rust_codegen_backends = @@ -589,7 +605,7 @@ impl Config { if let Some(ref t) = toml.target { for (triple, cfg) in t { - let mut target = Target::default(); + let mut target = Target::from_triple(triple); if let Some(ref s) = cfg.llvm_config { target.llvm_config = Some(config.src.join(s)); @@ -600,6 +616,9 @@ impl Config { if let Some(ref s) = cfg.android_ndk { target.ndk = Some(config.src.join(s)); } + if let Some(s) = cfg.no_std { + target.no_std = s; + } target.cc = cfg.cc.clone().map(PathBuf::from); target.cxx = cfg.cxx.clone().map(PathBuf::from); target.ar = cfg.ar.clone().map(PathBuf::from); diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py index 7cfc5385e2104..2a46c563d1f87 100755 --- a/src/bootstrap/configure.py +++ b/src/bootstrap/configure.py @@ -60,10 +60,11 @@ def v(*args): o("lldb", "rust.lldb", "build lldb") o("missing-tools", "dist.missing-tools", "allow failures when building tools") o("use-libcxx", "llvm.use-libcxx", "build LLVM with libc++") +o("control-flow-guard", "rust.control-flow-guard", "Enable Control Flow Guard") -o("cflags", "llvm.cflags", "build LLVM with these extra compiler flags") -o("cxxflags", "llvm.cxxflags", "build LLVM with these extra compiler flags") -o("ldflags", "llvm.ldflags", "build LLVM with these extra linker flags") +v("llvm-cflags", "llvm.cflags", "build LLVM with these extra compiler flags") +v("llvm-cxxflags", "llvm.cxxflags", "build LLVM with these extra compiler flags") +v("llvm-ldflags", "llvm.ldflags", "build LLVM with these extra linker flags") o("llvm-libunwind", "rust.llvm-libunwind", "use LLVM libunwind") @@ -392,11 +393,12 @@ def set(key, value): def is_number(value): - try: - float(value) - return True - except ValueError: - return False + try: + float(value) + return True + except ValueError: + return False + # Here we walk through the constructed configuration we have from the parsed # command line arguments. We then apply each piece of configuration by diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 0db4fb3890100..a476d25f10214 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -103,7 +103,6 @@ //! More documentation can be found in each respective module below, and you can //! also check out the `src/bootstrap/README.md` file for more information. -#![feature(core_intrinsics)] #![feature(drain_filter)] use std::cell::{Cell, RefCell}; @@ -239,9 +238,10 @@ pub struct Build { hosts: Vec>, targets: Vec>, - // Stage 0 (downloaded) compiler and cargo or their local rust equivalents + // Stage 0 (downloaded) compiler, lld and cargo or their local rust equivalents initial_rustc: PathBuf, initial_cargo: PathBuf, + initial_lld: PathBuf, // Runtime state filled in later on // C/C++ compilers and archiver for all targets @@ -343,9 +343,18 @@ impl Build { // we always try to use git for LLVM builds let in_tree_llvm_info = channel::GitInfo::new(false, &src.join("src/llvm-project")); + let initial_sysroot = config.initial_rustc.parent().unwrap().parent().unwrap(); + let initial_lld = initial_sysroot + .join("lib") + .join("rustlib") + .join(config.build) + .join("bin") + .join("rust-lld"); + let mut build = Build { initial_rustc: config.initial_rustc.clone(), initial_cargo: config.initial_cargo.clone(), + initial_lld, local_rebuild: config.local_rebuild, fail_fast: config.cmd.fail_fast(), doc_tests: config.cmd.doc_tests(), @@ -810,7 +819,7 @@ impl Build { } /// Returns the path to the linker for the given target if it needs to be overridden. - fn linker(&self, target: Interned) -> Option<&Path> { + fn linker(&self, target: Interned, can_use_lld: bool) -> Option<&Path> { if let Some(linker) = self.config.target_config.get(&target).and_then(|c| c.linker.as_ref()) { Some(linker) @@ -819,6 +828,8 @@ impl Build { && !target.contains("msvc") { Some(self.cc(target)) + } else if can_use_lld && self.config.use_lld && self.build == target { + Some(&self.initial_lld) } else { None } diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 1cfb4b2f63b57..21dcb1d8aa0e1 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -262,7 +262,7 @@ impl Step for Llvm { cfg.define("PYTHON_EXECUTABLE", python); } - configure_cmake(builder, target, &mut cfg); + configure_cmake(builder, target, &mut cfg, true); // FIXME: we don't actually need to build all LLVM tools and all LLVM // libraries here, e.g., we just want a few components and a few @@ -301,7 +301,12 @@ fn check_llvm_version(builder: &Builder<'_>, llvm_config: &Path) { panic!("\n\nbad LLVM version: {}, need >=7.0\n\n", version) } -fn configure_cmake(builder: &Builder<'_>, target: Interned, cfg: &mut cmake::Config) { +fn configure_cmake( + builder: &Builder<'_>, + target: Interned, + cfg: &mut cmake::Config, + use_compiler_launcher: bool, +) { // Do not print installation messages for up-to-date files. // LLVM and LLD builds can produce a lot of those and hit CI limits on log size. cfg.define("CMAKE_INSTALL_MESSAGE", "LAZY"); @@ -372,9 +377,11 @@ fn configure_cmake(builder: &Builder<'_>, target: Interned, cfg: &mut cm } else { // If ccache is configured we inform the build a little differently how // to invoke ccache while also invoking our compilers. - if let Some(ref ccache) = builder.config.ccache { - cfg.define("CMAKE_C_COMPILER_LAUNCHER", ccache) - .define("CMAKE_CXX_COMPILER_LAUNCHER", ccache); + if use_compiler_launcher { + if let Some(ref ccache) = builder.config.ccache { + cfg.define("CMAKE_C_COMPILER_LAUNCHER", ccache) + .define("CMAKE_CXX_COMPILER_LAUNCHER", ccache); + } } cfg.define("CMAKE_C_COMPILER", sanitize_cc(cc)) .define("CMAKE_CXX_COMPILER", sanitize_cc(cxx)); @@ -458,7 +465,7 @@ impl Step for Lld { t!(fs::create_dir_all(&out_dir)); let mut cfg = cmake::Config::new(builder.src.join("src/llvm-project/lld")); - configure_cmake(builder, target, &mut cfg); + configure_cmake(builder, target, &mut cfg, true); // This is an awful, awful hack. Discovered when we migrated to using // clang-cl to compile LLVM/LLD it turns out that LLD, when built out of @@ -571,7 +578,7 @@ impl Step for Sanitizers { } let out_dir = builder.native_dir(self.target).join("sanitizers"); - let runtimes = supported_sanitizers(&out_dir, self.target); + let runtimes = supported_sanitizers(&out_dir, self.target, &builder.config.channel); if runtimes.is_empty() { return runtimes; } @@ -595,10 +602,7 @@ impl Step for Sanitizers { let _time = util::timeit(&builder); let mut cfg = cmake::Config::new(&compiler_rt_dir); - cfg.target(&self.target); - cfg.host(&builder.config.build); cfg.profile("Release"); - cfg.define("CMAKE_C_COMPILER_TARGET", self.target); cfg.define("COMPILER_RT_BUILD_BUILTINS", "OFF"); cfg.define("COMPILER_RT_BUILD_CRT", "OFF"); @@ -610,6 +614,12 @@ impl Step for Sanitizers { cfg.define("COMPILER_RT_USE_LIBCXX", "OFF"); cfg.define("LLVM_CONFIG_PATH", &llvm_config); + // On Darwin targets the sanitizer runtimes are build as universal binaries. + // Unfortunately sccache currently lacks support to build them successfully. + // Disable compiler launcher on Darwin targets to avoid potential issues. + let use_compiler_launcher = !self.target.contains("apple-darwin"); + configure_cmake(builder, self.target, &mut cfg, use_compiler_launcher); + t!(fs::create_dir_all(&out_dir)); cfg.out_dir(out_dir); @@ -635,7 +645,11 @@ pub struct SanitizerRuntime { } /// Returns sanitizers available on a given target. -fn supported_sanitizers(out_dir: &Path, target: Interned) -> Vec { +fn supported_sanitizers( + out_dir: &Path, + target: Interned, + channel: &str, +) -> Vec { let mut result = Vec::new(); match &*target { "x86_64-apple-darwin" => { @@ -644,7 +658,7 @@ fn supported_sanitizers(out_dir: &Path, target: Interned) -> Vec) -> Vec) -> Vec) -> Vec, mode: &'static str, suite: &'static str, - path: Option<&'static str>, + path: &'static str, compare_mode: Option<&'static str>, } @@ -949,7 +951,7 @@ impl Step for Compiletest { let suite = self.suite; // Path for test suite - let suite_path = self.path.unwrap_or(""); + let suite_path = self.path; // Skip codegen tests if they aren't enabled in configuration. if !builder.config.codegen_tests && suite == "codegen" { @@ -1035,7 +1037,8 @@ impl Step for Compiletest { flags.push("-Zunstable-options".to_string()); flags.push(builder.config.cmd.rustc_args().join(" ")); - if let Some(linker) = builder.linker(target) { + // Don't use LLD here since we want to test that rustc finds and uses a linker by itself. + if let Some(linker) = builder.linker(target, false) { cmd.arg("--linker").arg(linker); } @@ -1050,10 +1053,10 @@ impl Step for Compiletest { cmd.arg("--docck-python").arg(builder.python()); if builder.config.build.ends_with("apple-darwin") { - // Force /usr/bin/python on macOS for LLDB tests because we're loading the + // Force /usr/bin/python3 on macOS for LLDB tests because we're loading the // LLDB plugin's compiled module which only works with the system python // (namely not Homebrew-installed python) - cmd.arg("--lldb-python").arg("/usr/bin/python"); + cmd.arg("--lldb-python").arg("/usr/bin/python3"); } else { cmd.arg("--lldb-python").arg(builder.python()); } @@ -1263,15 +1266,15 @@ impl Step for Compiletest { } } -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -struct DocTest { +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +struct BookTest { compiler: Compiler, - path: &'static str, + path: PathBuf, name: &'static str, is_ext_doc: bool, } -impl Step for DocTest { +impl Step for BookTest { type Output = (); const ONLY_HOSTS: bool = true; @@ -1279,12 +1282,59 @@ impl Step for DocTest { run.never() } - /// Runs `rustdoc --test` for all documentation in `src/doc`. + /// Runs the documentation tests for a book in `src/doc`. /// - /// This will run all tests in our markdown documentation (e.g., the book) - /// located in `src/doc`. The `rustdoc` that's run is the one that sits next to - /// `compiler`. + /// This uses the `rustdoc` that sits next to `compiler`. fn run(self, builder: &Builder<'_>) { + // External docs are different from local because: + // - Some books need pre-processing by mdbook before being tested. + // - They need to save their state to toolstate. + // - They are only tested on the "checktools" builders. + // + // The local docs are tested by default, and we don't want to pay the + // cost of building mdbook, so they use `rustdoc --test` directly. + // Also, the unstable book is special because SUMMARY.md is generated, + // so it is easier to just run `rustdoc` on its files. + if self.is_ext_doc { + self.run_ext_doc(builder); + } else { + self.run_local_doc(builder); + } + } +} + +impl BookTest { + /// This runs the equivalent of `mdbook test` (via the rustbook wrapper) + /// which in turn runs `rustdoc --test` on each file in the book. + fn run_ext_doc(self, builder: &Builder<'_>) { + let compiler = self.compiler; + + builder.ensure(compile::Std { compiler, target: compiler.host }); + + // mdbook just executes a binary named "rustdoc", so we need to update + // PATH so that it points to our rustdoc. + let mut rustdoc_path = builder.rustdoc(compiler); + rustdoc_path.pop(); + let old_path = env::var_os("PATH").unwrap_or_default(); + let new_path = env::join_paths(iter::once(rustdoc_path).chain(env::split_paths(&old_path))) + .expect("could not add rustdoc to PATH"); + + let mut rustbook_cmd = builder.tool_cmd(Tool::Rustbook); + let path = builder.src.join(&self.path); + rustbook_cmd.env("PATH", new_path).arg("test").arg(path); + builder.add_rust_test_threads(&mut rustbook_cmd); + builder.info(&format!("Testing rustbook {}", self.path.display())); + let _time = util::timeit(&builder); + let toolstate = if try_run(builder, &mut rustbook_cmd) { + ToolState::TestPass + } else { + ToolState::TestFail + }; + builder.save_toolstate(self.name, toolstate); + } + + /// This runs `rustdoc --test` on all `.md` files in the path. + fn run_local_doc(self, builder: &Builder<'_>) { let compiler = self.compiler; builder.ensure(compile::Std { compiler, target: compiler.host }); @@ -1293,7 +1343,6 @@ impl Step for DocTest { // tests for all files that end in `*.md` let mut stack = vec![builder.src.join(self.path)]; let _time = util::timeit(&builder); - let mut files = Vec::new(); while let Some(p) = stack.pop() { if p.is_dir() { @@ -1305,25 +1354,13 @@ impl Step for DocTest { continue; } - // The nostarch directory in the book is for no starch, and so isn't - // guaranteed to builder. We don't care if it doesn't build, so skip it. - if p.to_str().map_or(false, |p| p.contains("nostarch")) { - continue; - } - files.push(p); } files.sort(); - let mut toolstate = ToolState::TestPass; for file in files { - if !markdown_test(builder, compiler, &file) { - toolstate = ToolState::TestFail; - } - } - if self.is_ext_doc { - builder.save_toolstate(self.name, toolstate); + markdown_test(builder, compiler, &file); } } } @@ -1352,9 +1389,9 @@ macro_rules! test_book { } fn run(self, builder: &Builder<'_>) { - builder.ensure(DocTest { + builder.ensure(BookTest { compiler: self.compiler, - path: $path, + path: PathBuf::from($path), name: $book_name, is_ext_doc: !$default, }); diff --git a/src/ci/azure-pipelines/auto.yml b/src/ci/azure-pipelines/auto.yml index 79a49fc48be72..74b7469ea27b7 100644 --- a/src/ci/azure-pipelines/auto.yml +++ b/src/ci/azure-pipelines/auto.yml @@ -63,7 +63,7 @@ jobs: - job: macOS timeoutInMinutes: 600 pool: - vmImage: macos-10.13 + vmImage: macos-10.15 steps: - template: steps/run.yml strategy: diff --git a/src/ci/azure-pipelines/steps/run.yml b/src/ci/azure-pipelines/steps/run.yml index f536388b25b96..ee9425aa1c51f 100644 --- a/src/ci/azure-pipelines/steps/run.yml +++ b/src/ci/azure-pipelines/steps/run.yml @@ -31,6 +31,9 @@ steps: - bash: src/ci/scripts/setup-environment.sh displayName: Setup environment +- bash: src/ci/scripts/clean-disk.sh + displayName: Clean disk + - bash: src/ci/scripts/should-skip-this.sh displayName: Decide whether to run this job @@ -48,10 +51,6 @@ steps: displayName: Install clang condition: and(succeeded(), not(variables.SKIP_JOB)) -- bash: src/ci/scripts/switch-xcode.sh - displayName: Switch to Xcode 9.3 - condition: and(succeeded(), not(variables.SKIP_JOB)) - - bash: src/ci/scripts/install-wix.sh displayName: Install wix condition: and(succeeded(), not(variables.SKIP_JOB)) diff --git a/src/ci/azure-pipelines/try.yml b/src/ci/azure-pipelines/try.yml index b6177b2cc9b25..f8ddf0eb46cfd 100644 --- a/src/ci/azure-pipelines/try.yml +++ b/src/ci/azure-pipelines/try.yml @@ -25,7 +25,7 @@ jobs: # - job: macOS # timeoutInMinutes: 600 # pool: -# vmImage: macos-10.13 +# vmImage: macos-10.15 # steps: # - template: steps/run.yml # strategy: diff --git a/src/ci/cpu-usage-over-time.py b/src/ci/cpu-usage-over-time.py index daf21670b3339..78ac060368193 100644 --- a/src/ci/cpu-usage-over-time.py +++ b/src/ci/cpu-usage-over-time.py @@ -148,11 +148,11 @@ def idle_since(self, prev): print('unknown platform', sys.platform) sys.exit(1) -cur_state = State(); +cur_state = State() print("Time,Idle") while True: - time.sleep(1); - next_state = State(); + time.sleep(1) + next_state = State() now = datetime.datetime.utcnow().isoformat() idle = next_state.idle_since(cur_state) print("%s,%s" % (now, idle)) diff --git a/src/ci/docker/dist-various-2/Dockerfile b/src/ci/docker/dist-various-2/Dockerfile index 2ae6c58941e4c..5bb5436bec59d 100644 --- a/src/ci/docker/dist-various-2/Dockerfile +++ b/src/ci/docker/dist-various-2/Dockerfile @@ -48,7 +48,7 @@ RUN /tmp/build-solaris-toolchain.sh sparcv9 sparcv9 solaris-sparc COPY dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh /tmp/ # We pass the commit id of the port of LLVM's libunwind to the build script. # Any update to the commit id here, should cause the container image to be re-built from this point on. -RUN /tmp/build-x86_64-fortanix-unknown-sgx-toolchain.sh "53b586346f2c7870e20b170decdc30729d97c42b" +RUN /tmp/build-x86_64-fortanix-unknown-sgx-toolchain.sh "5125c169b30837208a842f85f7ae44a83533bd0e" COPY dist-various-2/build-wasi-toolchain.sh /tmp/ RUN /tmp/build-wasi-toolchain.sh diff --git a/src/ci/scripts/clean-disk.sh b/src/ci/scripts/clean-disk.sh new file mode 100755 index 0000000000000..c50de37c492b4 --- /dev/null +++ b/src/ci/scripts/clean-disk.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# This script deletes some of the Azure-provided artifacts. We don't use these, +# and disk space is at a premium on our builders. + +set -euo pipefail +IFS=$'\n\t' + +source "$(cd "$(dirname "$0")" && pwd)/../shared.sh" + +# All the Linux builds happen inside Docker. +if isLinux; then + # 6.7GB + sudo rm -rf /opt/ghc + # 16GB + sudo rm -rf /usr/share/dotnet +fi diff --git a/src/ci/scripts/install-clang.sh b/src/ci/scripts/install-clang.sh index e16a4814197b3..c242f5d456269 100755 --- a/src/ci/scripts/install-clang.sh +++ b/src/ci/scripts/install-clang.sh @@ -19,9 +19,7 @@ if isMacOS; then # native clang is configured to use the correct path, but our custom one # doesn't. This sets the SDKROOT environment variable to the SDK so that # our own clang can figure out the correct include path on its own. - if ! [[ -d "/usr/include" ]]; then - ciCommandSetEnv SDKROOT "$(xcrun --sdk macosx --show-sdk-path)" - fi + ciCommandSetEnv SDKROOT "$(xcrun --sdk macosx --show-sdk-path)" # Configure `AR` specifically so rustbuild doesn't try to infer it as # `clang-ar` by accident. diff --git a/src/ci/scripts/switch-xcode.sh b/src/ci/scripts/switch-xcode.sh deleted file mode 100755 index 2cbb2ddbc7046..0000000000000 --- a/src/ci/scripts/switch-xcode.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -# Switch to XCode 9.3 on OSX since it seems to be the last version that supports -# i686-apple-darwin. We'll eventually want to upgrade this and it will probably -# force us to drop i686-apple-darwin, but let's keep the wheels turning for now. - -set -euo pipefail -IFS=$'\n\t' - -source "$(cd "$(dirname "$0")" && pwd)/../shared.sh" - -if isMacOS; then - sudo xcode-select --switch /Applications/Xcode_9.3.app -fi diff --git a/src/doc/book b/src/doc/book index 87dd684367857..6fb3705e52303 160000 --- a/src/doc/book +++ b/src/doc/book @@ -1 +1 @@ -Subproject commit 87dd6843678575f8dda962f239d14ef4be14b352 +Subproject commit 6fb3705e5230311b096d47f7e2c91f9ce24393d0 diff --git a/src/doc/edition-guide b/src/doc/edition-guide index 1a2390247ad6d..37f9e68484111 160000 --- a/src/doc/edition-guide +++ b/src/doc/edition-guide @@ -1 +1 @@ -Subproject commit 1a2390247ad6d08160e0dd74f40a01a9578659c2 +Subproject commit 37f9e6848411188a1062ead1bd8ebe4b8aa16899 diff --git a/src/doc/embedded-book b/src/doc/embedded-book index 4d78994915af1..b2e1092bf67bd 160000 --- a/src/doc/embedded-book +++ b/src/doc/embedded-book @@ -1 +1 @@ -Subproject commit 4d78994915af1bde9a95c04a8c27d8dca066232a +Subproject commit b2e1092bf67bd4d7686c4553f186edbb7f5f92db diff --git a/src/doc/reference b/src/doc/reference index 11e893fc1357b..64239df6d1735 160000 --- a/src/doc/reference +++ b/src/doc/reference @@ -1 +1 @@ -Subproject commit 11e893fc1357bc688418ddf1087c2b7aa25d154d +Subproject commit 64239df6d173562b9deb4f012e4c3e6e960c4754 diff --git a/src/doc/rust-by-example b/src/doc/rust-by-example index 1c2bd024d13f8..32facd5522ddb 160000 --- a/src/doc/rust-by-example +++ b/src/doc/rust-by-example @@ -1 +1 @@ -Subproject commit 1c2bd024d13f8011307e13386cf1fea2180352b5 +Subproject commit 32facd5522ddbbf37baf01e4e4b6562bc55c071a diff --git a/src/doc/rustc/src/command-line-arguments.md b/src/doc/rustc/src/command-line-arguments.md index 577d03d1038f8..659f8f65e65d2 100644 --- a/src/doc/rustc/src/command-line-arguments.md +++ b/src/doc/rustc/src/command-line-arguments.md @@ -215,21 +215,29 @@ This controls which [target](targets/index.md) to produce. This flag will set which lints should be set to the [warn level](lints/levels.md#warn). +_Note:_ The order of these lint level arguments is taken into account, see [lint level via compiler flag](lints/levels.md#via-compiler-flag) for more information. + ## `-A`: set lint allowed This flag will set which lints should be set to the [allow level](lints/levels.md#allow). +_Note:_ The order of these lint level arguments is taken into account, see [lint level via compiler flag](lints/levels.md#via-compiler-flag) for more information. + ## `-D`: set lint denied This flag will set which lints should be set to the [deny level](lints/levels.md#deny). +_Note:_ The order of these lint level arguments is taken into account, see [lint level via compiler flag](lints/levels.md#via-compiler-flag) for more information. + ## `-F`: set lint forbidden This flag will set which lints should be set to the [forbid level](lints/levels.md#forbid). +_Note:_ The order of these lint level arguments is taken into account, see [lint level via compiler flag](lints/levels.md#via-compiler-flag) for more information. + ## `-Z`: set unstable options diff --git a/src/doc/rustc/src/lints/levels.md b/src/doc/rustc/src/lints/levels.md index 2944e86566313..3cfe2f698f3e0 100644 --- a/src/doc/rustc/src/lints/levels.md +++ b/src/doc/rustc/src/lints/levels.md @@ -164,6 +164,18 @@ And of course, you can mix these four flags together: $ rustc lib.rs --crate-type=lib -D missing-docs -A unused-variables ``` +The order of these command line arguments is taken into account. The following allows the `unused-variables` lint, because it is the last argument for that lint: + +```bash +$ rustc lib.rs --crate-type=lib -D unused-variables -A unused-variables +``` + +You can make use of this behavior by overriding the level of one specific lint out of a group of lints. The following example denies all the lints in the `unused` group, but explicitly allows the `unused-variables` lint in that group: + +```bash +$ rustc lib.rs --crate-type=lib -D unused -A unused-variables +``` + ### Via an attribute You can also modify the lint level with a crate-wide attribute: diff --git a/src/doc/rustdoc/book.toml b/src/doc/rustdoc/book.toml new file mode 100644 index 0000000000000..ba30c107667ed --- /dev/null +++ b/src/doc/rustdoc/book.toml @@ -0,0 +1,4 @@ +[book] +authors = ["The Rust Project Developers"] +src = "src" +title = "The rustdoc book" diff --git a/src/doc/unstable-book/src/compiler-flags/control-flow-guard.md b/src/doc/unstable-book/src/compiler-flags/control-flow-guard.md new file mode 100644 index 0000000000000..f871df46250ba --- /dev/null +++ b/src/doc/unstable-book/src/compiler-flags/control-flow-guard.md @@ -0,0 +1,34 @@ +# `control_flow_guard` + +The tracking issue for this feature is: [#68793](https://github.com/rust-lang/rust/issues/68793). + +------------------------ + +The `-Zcontrol_flow_guard=checks` compiler flag enables the Windows [Control Flow Guard][cfguard-docs] platform security feature. When enabled, the compiler outputs a list of valid indirect call targets, and inserts runtime checks on all indirect jump instructions to ensure that the destination is in the list of valid call targets. + +[cfguard-docs]: https://docs.microsoft.com/en-us/windows/win32/secbp/control-flow-guard + +For testing purposes, the `-Zcontrol_flow_guard=nochecks` compiler flag can be used to emit only the list of valid call targets, but not the runtime checks. + +It is strongly recommended to also enable Control Flow Guard checks in all linked libraries, including the standard library. + +To enable Control Flow Guard in the standard library, you can use the [cargo `-Zbuild-std` functionality][build-std] to recompile the standard library with the same configuration options as the main program. + +[build-std]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-std + +For example: +```cmd +rustup toolchain install --force nightly +rustup component add rust-src +SET RUSTFLAGS=-Zcontrol_flow_guard=checks +cargo +nightly build -Z build-std --target x86_64-pc-windows-msvc +``` + +```PowerShell +rustup toolchain install --force nightly +rustup component add rust-src +$Env:RUSTFLAGS = "-Zcontrol_flow_guard=checks" +cargo +nightly build -Z build-std --target x86_64-pc-windows-msvc +``` + +Alternatively, if you are building the standard library from source, you can set `control-flow-guard = true` in the config.toml file. diff --git a/src/doc/unstable-book/src/compiler-flags/self-profile-events.md b/src/doc/unstable-book/src/compiler-flags/self-profile-events.md new file mode 100644 index 0000000000000..3ce18743be508 --- /dev/null +++ b/src/doc/unstable-book/src/compiler-flags/self-profile-events.md @@ -0,0 +1,74 @@ +# `self-profile-events` + +--------------------- + +The `-Zself-profile-events` compiler flag controls what events are recorded by the self-profiler when it is enabled via the `-Zself-profile` flag. + +This flag takes a comma delimited list of event types to record. + +For example: + +```console +$ rustc -Zself-profile -Zself-profile-events=default,args +``` + +## Event types + +- `query-provider` + - Traces each query used internally by the compiler. + +- `generic-activity` + - Traces other parts of the compiler not covered by the query system. + +- `query-cache-hit` + - Adds tracing information that records when the in-memory query cache is "hit" and does not need to re-execute a query which has been cached. + - Disabled by default because this significantly increases the trace file size. + +- `query-blocked` + - Tracks time that a query tries to run but is blocked waiting on another thread executing the same query to finish executing. + - Query blocking only occurs when the compiler is built with parallel mode support. + +- `incr-cache-load` + - Tracks time that is spent loading and deserializing query results from the incremental compilation on-disk cache. + +- `query-keys` + - Adds a serialized representation of each query's query key to the tracing data. + - Disabled by default because this significantly increases the trace file size. + +- `function-args` + - Adds additional tracing data to some `generic-activity` events. + - Disabled by default for parity with `query-keys`. + +- `llvm` + - Adds tracing information about LLVM passes and codegeneration. + - Disabled by default because this only works when `-Znew-llvm-pass-manager` is enabled. + +## Event synonyms + +- `none` + - Disables all events. + Equivalent to the self-profiler being disabled. + +- `default` + - The default set of events which stikes a balance between providing detailed tracing data and adding additional overhead to the compilation. + +- `args` + - Equivalent to `query-keys` and `function-args`. + +- `all` + - Enables all events. + +## Examples + +Enable the profiler and capture the default set of events (both invocations are equivalent): + +```console +$ rustc -Zself-profile +$ rustc -Zself-profile -Zself-profile-events=default +``` + +Enable the profiler and capture the default events and their arguments: + +```console +$ rustc -Zself-profile -Zself-profile-events=default,args +``` diff --git a/src/doc/unstable-book/src/compiler-flags/self-profile.md b/src/doc/unstable-book/src/compiler-flags/self-profile.md new file mode 100644 index 0000000000000..6de1c774f7cd7 --- /dev/null +++ b/src/doc/unstable-book/src/compiler-flags/self-profile.md @@ -0,0 +1,47 @@ +# `self-profile` + +-------------------- + +The `-Zself-profile` compiler flag enables rustc's internal profiler. +When enabled, the compiler will output three binary files in the specified directory (or the current working directory if no directory is specified). +These files can be analyzed by using the tools in the [`measureme`] repository. + +To control the data recorded in the trace files, use the `-Zself-profile-events` flag. + +For example: + +First, run a compilation session and provide the `-Zself-profile` flag: + +```console +$ rustc --crate-name foo -Zself-profile` +``` + +This will generate three files in the working directory such as: + +- `foo-1234.events` +- `foo-1234.string_data` +- `foo-1234.string_index` + +Where `foo` is the name of the crate and `1234` is the process id of the rustc process. + +To get a summary of where the compiler is spending its time: + +```console +$ ../measureme/target/release/summarize summarize foo-1234 +``` + +To generate a flamegraph of the same data: + +```console +$ ../measureme/target/release/inferno foo-1234 +``` + +To dump the event data in a Chromium-profiler compatible format: + +```console +$ ../measureme/target/release/crox foo-1234 +``` + +For more information, consult the [`measureme`] documentation. + +[`measureme`]: https://github.com/rust-lang/measureme.git diff --git a/src/etc/debugger_pretty_printers_common.py b/src/etc/debugger_pretty_printers_common.py index 385ce8efab87b..b3f8f50636bee 100644 --- a/src/etc/debugger_pretty_printers_common.py +++ b/src/etc/debugger_pretty_printers_common.py @@ -212,7 +212,6 @@ def __classify_struct(self): # REGULAR STRUCT return TYPE_KIND_REGULAR_STRUCT - def __classify_union(self): assert self.get_dwarf_type_kind() == DWARF_TYPE_CODE_UNION @@ -233,7 +232,6 @@ def __classify_union(self): else: return TYPE_KIND_REGULAR_UNION - def __conforms_to_field_layout(self, expected_fields): actual_fields = self.get_fields() actual_field_count = len(actual_fields) @@ -363,6 +361,7 @@ def extract_tail_head_ptr_and_cap_from_std_vecdeque(vec_val): assert data_ptr.type.get_dwarf_type_kind() == DWARF_TYPE_CODE_PTR return (tail, head, data_ptr, capacity) + def extract_length_and_ptr_from_slice(slice_val): assert (slice_val.type.get_type_kind() == TYPE_KIND_SLICE or slice_val.type.get_type_kind() == TYPE_KIND_STR_SLICE) @@ -376,8 +375,10 @@ def extract_length_and_ptr_from_slice(slice_val): assert data_ptr.type.get_dwarf_type_kind() == DWARF_TYPE_CODE_PTR return (length, data_ptr) + UNQUALIFIED_TYPE_MARKERS = frozenset(["(", "[", "&", "*"]) + def extract_type_name(qualified_type_name): """Extracts the type name from a fully qualified path""" if qualified_type_name[0] in UNQUALIFIED_TYPE_MARKERS: @@ -393,6 +394,7 @@ def extract_type_name(qualified_type_name): else: return qualified_type_name[index + 2:] + try: compat_str = unicode # Python 2 except NameError: diff --git a/src/etc/dec2flt_table.py b/src/etc/dec2flt_table.py index 85395d2ecdfc7..4979882ffeaff 100755 --- a/src/etc/dec2flt_table.py +++ b/src/etc/dec2flt_table.py @@ -14,7 +14,6 @@ even larger, and it's already uncomfortably large (6 KiB). """ from __future__ import print_function -import sys from math import ceil, log from fractions import Fraction from collections import namedtuple @@ -82,6 +81,7 @@ def error(f, e, z): ulp_err = abs_err / Fraction(2) ** z.exp return float(ulp_err) + HEADER = """ //! Tables of approximations of powers of ten. //! DO NOT MODIFY: Generated by `src/etc/dec2flt_table.py` diff --git a/src/etc/gdb_rust_pretty_printing.py b/src/etc/gdb_rust_pretty_printing.py index 5da01b96fa5e3..0914c22eb13f0 100755 --- a/src/etc/gdb_rust_pretty_printing.py +++ b/src/etc/gdb_rust_pretty_printing.py @@ -9,7 +9,7 @@ if sys.version_info[0] >= 3: xrange = range -rust_enabled = 'set language rust' in gdb.execute('complete set language ru', to_string = True) +rust_enabled = 'set language rust' in gdb.execute('complete set language ru', to_string=True) # The btree pretty-printers fail in a confusing way unless # https://sourceware.org/bugzilla/show_bug.cgi?id=21763 is fixed. @@ -21,9 +21,10 @@ if int(_match.group(1)) > 8 or (int(_match.group(1)) == 8 and int(_match.group(2)) >= 1): gdb_81 = True -#=============================================================================== +# =============================================================================== # GDB Pretty Printing Module for Rust -#=============================================================================== +# =============================================================================== + class GdbType(rustpp.Type): @@ -133,39 +134,39 @@ def rust_pretty_printer_lookup_function(gdb_val): if type_kind == rustpp.TYPE_KIND_REGULAR_STRUCT: return RustStructPrinter(val, - omit_first_field = False, - omit_type_name = False, - is_tuple_like = False) + omit_first_field=False, + omit_type_name=False, + is_tuple_like=False) if type_kind == rustpp.TYPE_KIND_STRUCT_VARIANT: return RustStructPrinter(val, - omit_first_field = True, - omit_type_name = False, - is_tuple_like = False) + omit_first_field=True, + omit_type_name=False, + is_tuple_like=False) if type_kind == rustpp.TYPE_KIND_STR_SLICE: return RustStringSlicePrinter(val) if type_kind == rustpp.TYPE_KIND_TUPLE: return RustStructPrinter(val, - omit_first_field = False, - omit_type_name = True, - is_tuple_like = True) + omit_first_field=False, + omit_type_name=True, + is_tuple_like=True) if type_kind == rustpp.TYPE_KIND_TUPLE_STRUCT: return RustStructPrinter(val, - omit_first_field = False, - omit_type_name = False, - is_tuple_like = True) + omit_first_field=False, + omit_type_name=False, + is_tuple_like=True) if type_kind == rustpp.TYPE_KIND_CSTYLE_VARIANT: return RustCStyleVariantPrinter(val.get_child_at_index(0)) if type_kind == rustpp.TYPE_KIND_TUPLE_VARIANT: return RustStructPrinter(val, - omit_first_field = True, - omit_type_name = False, - is_tuple_like = True) + omit_first_field=True, + omit_type_name=False, + is_tuple_like=True) if type_kind == rustpp.TYPE_KIND_SINGLETON_ENUM: variant = get_field_at_index(gdb_val, 0) @@ -189,9 +190,9 @@ def rust_pretty_printer_lookup_function(gdb_val): return None -#=------------------------------------------------------------------------------ +# =------------------------------------------------------------------------------ # Pretty Printer Classes -#=------------------------------------------------------------------------------ +# =------------------------------------------------------------------------------ class RustEmptyPrinter(object): def __init__(self, val): self.__val = val @@ -355,6 +356,7 @@ def children_of_node(boxed_node, height, want_values): else: yield keys[i]['value']['value'] + class RustStdBTreeSetPrinter(object): def __init__(self, val): self.__val = val @@ -429,6 +431,7 @@ def to_string(self): def display_hint(self): return "string" + class RustCStyleVariantPrinter(object): def __init__(self, val): assert val.type.get_dwarf_type_kind() == rustpp.DWARF_TYPE_CODE_ENUM diff --git a/src/etc/generate-deriving-span-tests.py b/src/etc/generate-deriving-span-tests.py index afa6bbdae4e9e..c42f942c63cf5 100755 --- a/src/etc/generate-deriving-span-tests.py +++ b/src/etc/generate-deriving-span-tests.py @@ -8,7 +8,8 @@ sample usage: src/etc/generate-deriving-span-tests.py """ -import os, stat +import os +import stat TEST_DIR = os.path.abspath( os.path.join(os.path.dirname(__file__), '../test/ui/derives/')) @@ -56,6 +57,7 @@ ENUM_TUPLE, ENUM_STRUCT, STRUCT_FIELDS, STRUCT_TUPLE = range(4) + def create_test_case(type, trait, super_traits, error_count): string = [ENUM_STRING, ENUM_STRUCT_VARIANT_STRING, STRUCT_STRING, STRUCT_TUPLE_STRING][type] all_traits = ','.join([trait] + super_traits) @@ -63,8 +65,9 @@ def create_test_case(type, trait, super_traits, error_count): error_deriving = '#[derive(%s)]' % super_traits if super_traits else '' errors = '\n'.join('//~%s ERROR' % ('^' * n) for n in range(error_count)) - code = string.format(traits = all_traits, errors = errors) - return TEMPLATE.format(error_deriving=error_deriving, code = code) + code = string.format(traits=all_traits, errors=errors) + return TEMPLATE.format(error_deriving=error_deriving, code=code) + def write_file(name, string): test_file = os.path.join(TEST_DIR, 'derives-span-%s.rs' % name) @@ -86,10 +89,10 @@ def write_file(name, string): traits = { 'Default': (STRUCT, [], 1), - 'FromPrimitive': (0, [], 0), # only works for C-like enums + 'FromPrimitive': (0, [], 0), # only works for C-like enums - 'Decodable': (0, [], 0), # FIXME: quoting gives horrible spans - 'Encodable': (0, [], 0), # FIXME: quoting gives horrible spans + 'Decodable': (0, [], 0), # FIXME: quoting gives horrible spans + 'Encodable': (0, [], 0), # FIXME: quoting gives horrible spans } for (trait, supers, errs) in [('Clone', [], 1), diff --git a/src/etc/generate-keyword-tests.py b/src/etc/generate-keyword-tests.py index bc046a8f42d0b..77c3d2758c6dc 100755 --- a/src/etc/generate-keyword-tests.py +++ b/src/etc/generate-keyword-tests.py @@ -11,7 +11,6 @@ import sys import os -import datetime import stat diff --git a/src/etc/htmldocck.py b/src/etc/htmldocck.py index e8be2b9b53710..7789b24b62c83 100644 --- a/src/etc/htmldocck.py +++ b/src/etc/htmldocck.py @@ -131,6 +131,7 @@ except NameError: unichr = chr + class CustomHTMLParser(HTMLParser): """simplified HTML parser. @@ -169,21 +170,25 @@ def close(self): HTMLParser.close(self) return self.__builder.close() + Command = namedtuple('Command', 'negated cmd args lineno context') + class FailedCheck(Exception): pass + class InvalidCheck(Exception): pass + def concat_multi_lines(f): """returns a generator out of the file object, which - removes `\\` then `\n` then a shared prefix with the previous line then optional whitespace; - keeps a line number (starting from 0) of the first line being concatenated.""" - lastline = None # set to the last line when the last line has a backslash + lastline = None # set to the last line when the last line has a backslash firstlineno = None catenated = '' for lineno, line in enumerate(f): @@ -208,6 +213,7 @@ def concat_multi_lines(f): if lastline is not None: print_err(lineno, line, 'Trailing backslash at the end of the file') + LINE_PATTERN = re.compile(r''' (?<=(?!?) (?P[A-Za-z]+(?:-[A-Za-z]+)*) @@ -252,7 +258,7 @@ def flatten(node): def normalize_xpath(path): if path.startswith('//'): - return '.' + path # avoid warnings + return '.' + path # avoid warnings elif path.startswith('.//'): return path else: @@ -316,7 +322,7 @@ def get_dir(self, path): def check_string(data, pat, regexp): if not pat: - return True # special case a presence testing + return True # special case a presence testing elif regexp: return re.search(pat, data, flags=re.UNICODE) is not None else: @@ -353,7 +359,7 @@ def check_tree_text(tree, path, pat, regexp): ret = check_string(value, pat, regexp) if ret: break - except Exception as e: + except Exception: print('Failed to get path "{}"'.format(path)) raise return ret @@ -363,6 +369,7 @@ def get_tree_count(tree, path): path = normalize_xpath(path) return len(tree.findall(path)) + def stderr(*args): if sys.version_info.major < 3: file = codecs.getwriter('utf-8')(sys.stderr) @@ -371,6 +378,7 @@ def stderr(*args): print(*args, file=file) + def print_err(lineno, context, err, message=None): global ERR_COUNT ERR_COUNT += 1 @@ -381,31 +389,33 @@ def print_err(lineno, context, err, message=None): if context: stderr("\t{}".format(context)) + ERR_COUNT = 0 + def check_command(c, cache): try: cerr = "" - if c.cmd == 'has' or c.cmd == 'matches': # string test + if c.cmd == 'has' or c.cmd == 'matches': # string test regexp = (c.cmd == 'matches') - if len(c.args) == 1 and not regexp: # @has = file existence + if len(c.args) == 1 and not regexp: # @has = file existence try: cache.get_file(c.args[0]) ret = True except FailedCheck as err: cerr = str(err) ret = False - elif len(c.args) == 2: # @has/matches = string test + elif len(c.args) == 2: # @has/matches = string test cerr = "`PATTERN` did not match" ret = check_string(cache.get_file(c.args[0]), c.args[1], regexp) - elif len(c.args) == 3: # @has/matches = XML tree test + elif len(c.args) == 3: # @has/matches = XML tree test cerr = "`XPATH PATTERN` did not match" tree = cache.get_tree(c.args[0]) pat, sep, attr = c.args[1].partition('/@') - if sep: # attribute + if sep: # attribute tree = cache.get_tree(c.args[0]) ret = check_tree_attr(tree, pat, attr, c.args[2], regexp) - else: # normalized text + else: # normalized text pat = c.args[1] if pat.endswith('/text()'): pat = pat[:-7] @@ -413,16 +423,16 @@ def check_command(c, cache): else: raise InvalidCheck('Invalid number of @{} arguments'.format(c.cmd)) - elif c.cmd == 'count': # count test - if len(c.args) == 3: # @count = count test + elif c.cmd == 'count': # count test + if len(c.args) == 3: # @count = count test expected = int(c.args[2]) found = get_tree_count(cache.get_tree(c.args[0]), c.args[1]) cerr = "Expected {} occurrences but found {}".format(expected, found) ret = expected == found else: raise InvalidCheck('Invalid number of @{} arguments'.format(c.cmd)) - elif c.cmd == 'has-dir': # has-dir test - if len(c.args) == 1: # @has-dir = has-dir test + elif c.cmd == 'has-dir': # has-dir test + if len(c.args) == 1: # @has-dir = has-dir test try: cache.get_dir(c.args[0]) ret = True @@ -448,11 +458,13 @@ def check_command(c, cache): except InvalidCheck as err: print_err(c.lineno, c.context, str(err)) + def check(target, commands): cache = CachedFiles(target) for c in commands: check_command(c, cache) + if __name__ == '__main__': if len(sys.argv) != 3: stderr('Usage: {}