From 0e9fff56e7a4d9bdc44fa06f763be8e1861a5bd3 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Wed, 12 Jun 2019 20:34:40 +0900 Subject: [PATCH 01/11] Update smallvec and new debug unreachable --- Cargo.lock | 77 ++++++++++++++++++++---------------------------------- 1 file changed, 28 insertions(+), 49 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 948074ce0fc48..1d657ac2a95e8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -70,7 +70,7 @@ name = "arena" version = "0.0.0" dependencies = [ "rustc_data_structures 0.0.0", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -438,7 +438,7 @@ dependencies = [ "regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -594,7 +594,7 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -980,7 +980,7 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "new_debug_unreachable 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1678,11 +1678,8 @@ dependencies = [ [[package]] name = "new_debug_unreachable" -version = "1.0.1" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "nodrop" @@ -1836,7 +1833,7 @@ dependencies = [ "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2399,7 +2396,7 @@ dependencies = [ "rustc_target 0.0.0", "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serialize 0.0.0", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "syntax 0.0.0", "syntax_pos 0.0.0", "tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2445,7 +2442,7 @@ dependencies = [ "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-rayon 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-rayon-core 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2481,7 +2478,7 @@ name = "rustc-ap-serialize" version = "407.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2497,7 +2494,7 @@ dependencies = [ "rustc-ap-serialize 407.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-ap-syntax_pos 407.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2611,7 +2608,7 @@ dependencies = [ "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2625,7 +2622,7 @@ dependencies = [ "rustc_data_structures 0.0.0", "rustc_errors 0.0.0", "rustc_target 0.0.0", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "syntax 0.0.0", "syntax_pos 0.0.0", ] @@ -2636,7 +2633,7 @@ version = "0.0.0" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_cratesio_shim 0.0.0", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2745,7 +2742,7 @@ dependencies = [ "rustc-rayon-core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_cratesio_shim 0.0.0", "serialize 0.0.0", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2779,7 +2776,7 @@ dependencies = [ "rustc_typeck 0.0.0", "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serialize 0.0.0", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "syntax 0.0.0", "syntax_ext 0.0.0", "syntax_pos 0.0.0", @@ -2844,7 +2841,7 @@ dependencies = [ "rustc_typeck 0.0.0", "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serialize 0.0.0", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "syntax 0.0.0", "syntax_ext 0.0.0", "syntax_pos 0.0.0", @@ -2905,7 +2902,7 @@ dependencies = [ "rustc_errors 0.0.0", "rustc_target 0.0.0", "serialize 0.0.0", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "syntax 0.0.0", "syntax_ext 0.0.0", @@ -2929,7 +2926,7 @@ dependencies = [ "rustc_errors 0.0.0", "rustc_target 0.0.0", "serialize 0.0.0", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "syntax 0.0.0", "syntax_pos 0.0.0", ] @@ -2994,7 +2991,7 @@ dependencies = [ "rustc_data_structures 0.0.0", "rustc_errors 0.0.0", "rustc_metadata 0.0.0", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "syntax 0.0.0", "syntax_pos 0.0.0", ] @@ -3048,7 +3045,7 @@ dependencies = [ "rustc 0.0.0", "rustc_data_structures 0.0.0", "rustc_target 0.0.0", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "syntax 0.0.0", "syntax_pos 0.0.0", ] @@ -3074,7 +3071,7 @@ dependencies = [ "rustc_data_structures 0.0.0", "rustc_errors 0.0.0", "rustc_target 0.0.0", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "syntax 0.0.0", "syntax_pos 0.0.0", ] @@ -3256,7 +3253,7 @@ name = "serialize" version = "0.0.0" dependencies = [ "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3309,11 +3306,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "smallvec" -version = "0.6.7" +version = "0.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "socket2" @@ -3361,7 +3355,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "new_debug_unreachable 1.0.3 (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)", "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3467,7 +3461,7 @@ dependencies = [ "rustc_target 0.0.0", "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serialize 0.0.0", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "syntax_pos 0.0.0", ] @@ -3480,7 +3474,7 @@ dependencies = [ "rustc_data_structures 0.0.0", "rustc_errors 0.0.0", "rustc_target 0.0.0", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "syntax 0.0.0", "syntax_pos 0.0.0", ] @@ -3915,14 +3909,6 @@ name = "unicode_categories" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "unreachable" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "unstable-book-gen" version = "0.1.0" @@ -4000,11 +3986,6 @@ name = "version_check" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "vte" version = "0.3.3" @@ -4266,7 +4247,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" "checksum miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "396aa0f2003d7df8395cb93e09871561ccc3e785f0acb369170e8cc74ddf9226" "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" -"checksum new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0cdc457076c78ab54d5e0d6fa7c47981757f1e34dc39ff92787f217dede586c4" +"checksum new_debug_unreachable 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f40f005c60db6e03bae699e414c58bf9aa7ea02a2d0b9bfbcf19286cc4c82b30" "checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2" "checksum num-derive 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8af1847c907c2f04d7bfd572fb25bbb4385c637fe5be163cf2f8c5d778fe1e7d" "checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" @@ -4373,7 +4354,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0df90a788073e8d0235a67e50441d47db7c8ad9debd91cbf43736a2a92d36537" "checksum sized-chunks 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2a2eb3fe454976eefb479f78f9b394d34d661b647c6326a3a6e66f68bb12c26" "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" -"checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db" +"checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7" "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 string_cache 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25d70109977172b127fe834e5449e5ab1740b9ba49fa18a2020f509174f25423" @@ -4427,7 +4408,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unicode_categories 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" -"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" "checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" "checksum url_serde 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "74e7d099f1ee52f823d4bdd60c93c3602043c728f5db3b97bdb548467f7bddea" "checksum utf-8 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1262dfab4c30d5cb7c07026be00ee343a6cf5027fdc0104a9160f354e5db75c" @@ -4437,7 +4417,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" "checksum vergen 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6aba5e34f93dc7051dfad05b98a18e9156f27e7b431fe1d2398cb6061c0a1dba" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" -"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum vte 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4f42f536e22f7fcbb407639765c8fd78707a33109301f834a594758bedd6e8cf" "checksum wait-timeout 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b9f3bf741a801531993db6478b95682117471f76916f5e690dd8d45395b09349" "checksum walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d9d7ed3431229a144296213105a390676cc49c9b6a72bd19f3176c98e129fa1" From 185dcebbff7f3c18fb94be82f76bdfd620cfb096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sat, 6 Apr 2019 18:07:53 +0200 Subject: [PATCH 02/11] Limit dylib symbols --- src/librustc_codegen_ssa/back/linker.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs index 260c07a7b6287..eee9533535f0d 100644 --- a/src/librustc_codegen_ssa/back/linker.rs +++ b/src/librustc_codegen_ssa/back/linker.rs @@ -377,15 +377,11 @@ impl<'a> Linker for GccLinker<'a> { return; } - // If we're compiling a dylib, then we let symbol visibility in object - // files to take care of whether they're exported or not. - // - // If we're compiling a cdylib, however, we manually create a list of - // exported symbols to ensure we don't expose any more. The object files - // have far more public symbols than we actually want to export, so we - // hide them all here. - if crate_type == CrateType::Dylib || - crate_type == CrateType::ProcMacro { + // We manually create a list of exported symbols to ensure we don't expose any more. + // The object files have far more public symbols than we actually want to export, + // so we hide them all here. + + if crate_type == CrateType::ProcMacro { return } From 52bd4f263b57faf987dc32d40642403e313e175a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sun, 14 Apr 2019 19:05:21 +0200 Subject: [PATCH 03/11] Add a limit_rdylib_exports option and disable it for Solaris --- src/librustc_codegen_ssa/back/linker.rs | 11 ++++------- src/librustc_target/spec/mod.rs | 6 ++++++ src/librustc_target/spec/solaris_base.rs | 1 + src/librustc_target/spec/wasm32_base.rs | 5 +++++ .../spec/wasm32_experimental_emscripten.rs | 1 + src/librustc_target/spec/wasm32_unknown_emscripten.rs | 1 + 6 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs index eee9533535f0d..39ccf4f46b7bd 100644 --- a/src/librustc_codegen_ssa/back/linker.rs +++ b/src/librustc_codegen_ssa/back/linker.rs @@ -381,15 +381,12 @@ impl<'a> Linker for GccLinker<'a> { // The object files have far more public symbols than we actually want to export, // so we hide them all here. - if crate_type == CrateType::ProcMacro { - return + if !self.sess.target.target.options.limit_rdylib_exports { + return; } - // Symbol visibility takes care of this for the WebAssembly. - // Additionally the only known linker, LLD, doesn't support the script - // arguments just yet - if self.sess.target.target.arch == "wasm32" { - return; + if crate_type == CrateType::ProcMacro { + return } let mut arg = OsString::new(); diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs index 844edbb946a51..329d3f2b2f3c4 100644 --- a/src/librustc_target/spec/mod.rs +++ b/src/librustc_target/spec/mod.rs @@ -748,6 +748,9 @@ pub struct TargetOptions { /// wasm32 where the whole program either has simd or not. pub simd_types_indirect: bool, + /// Pass a list of symbol which should be exported in the dylib to the linker. + pub limit_rdylib_exports: bool, + /// If set, have the linker export exactly these symbols, instead of using /// the usual logic to figure this out from the crate itself. pub override_export_symbols: Option>, @@ -843,6 +846,7 @@ impl Default for TargetOptions { emit_debug_gdb_scripts: true, requires_uwtable: false, simd_types_indirect: true, + limit_rdylib_exports: true, override_export_symbols: None, merge_functions: MergeFunctions::Aliases, target_mcount: "mcount".to_string(), @@ -1149,6 +1153,7 @@ impl Target { key!(emit_debug_gdb_scripts, bool); key!(requires_uwtable, bool); key!(simd_types_indirect, bool); + key!(limit_rdylib_exports, bool); key!(override_export_symbols, opt_list); key!(merge_functions, MergeFunctions)?; key!(target_mcount); @@ -1364,6 +1369,7 @@ impl ToJson for Target { target_option_val!(emit_debug_gdb_scripts); target_option_val!(requires_uwtable); target_option_val!(simd_types_indirect); + target_option_val!(limit_rdylib_exports); target_option_val!(override_export_symbols); target_option_val!(merge_functions); target_option_val!(target_mcount); diff --git a/src/librustc_target/spec/solaris_base.rs b/src/librustc_target/spec/solaris_base.rs index 0dfbb13b77317..9e7eda037732b 100644 --- a/src/librustc_target/spec/solaris_base.rs +++ b/src/librustc_target/spec/solaris_base.rs @@ -8,6 +8,7 @@ pub fn opts() -> TargetOptions { has_rpath: true, target_family: Some("unix".to_string()), is_like_solaris: true, + limit_rdylib_exports: false, // Linker doesn't support this .. Default::default() } diff --git a/src/librustc_target/spec/wasm32_base.rs b/src/librustc_target/spec/wasm32_base.rs index edaf902c130d8..39a8ce9282573 100644 --- a/src/librustc_target/spec/wasm32_base.rs +++ b/src/librustc_target/spec/wasm32_base.rs @@ -106,6 +106,11 @@ pub fn options() -> TargetOptions { // no dynamic linking, no need for default visibility! default_hidden_visibility: true, + // Symbol visibility takes care of this for the WebAssembly. + // Additionally the only known linker, LLD, doesn't support the script + // arguments just yet + limit_rdylib_exports: false, + // we use the LLD shipped with the Rust toolchain by default linker: Some("rust-lld".to_owned()), lld_flavor: LldFlavor::Wasm, diff --git a/src/librustc_target/spec/wasm32_experimental_emscripten.rs b/src/librustc_target/spec/wasm32_experimental_emscripten.rs index 5ecd66306d055..b802bee25ae7a 100644 --- a/src/librustc_target/spec/wasm32_experimental_emscripten.rs +++ b/src/librustc_target/spec/wasm32_experimental_emscripten.rs @@ -24,6 +24,7 @@ pub fn target() -> Result { is_like_emscripten: true, max_atomic_width: Some(32), post_link_args, + limit_rdylib_exports: false, target_family: Some("unix".to_string()), .. Default::default() }; diff --git a/src/librustc_target/spec/wasm32_unknown_emscripten.rs b/src/librustc_target/spec/wasm32_unknown_emscripten.rs index a6e9340ce28ef..e0df36884bf56 100644 --- a/src/librustc_target/spec/wasm32_unknown_emscripten.rs +++ b/src/librustc_target/spec/wasm32_unknown_emscripten.rs @@ -26,6 +26,7 @@ pub fn target() -> Result { is_like_emscripten: true, max_atomic_width: Some(32), post_link_args, + limit_rdylib_exports: false, target_family: Some("unix".to_string()), codegen_backend: "emscripten".to_string(), .. Default::default() From f8f9a2869cce570c994d96afb82f4162b1b44cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Wed, 12 Jun 2019 23:09:08 +0200 Subject: [PATCH 04/11] Ignore NVPTX tests --- src/ci/docker/test-various/Dockerfile | 4 ---- src/test/assembly/nvptx-arch-default.rs | 1 + src/test/assembly/nvptx-arch-emit-asm.rs | 1 + src/test/assembly/nvptx-arch-link-arg.rs | 1 + src/test/assembly/nvptx-arch-target-cpu.rs | 1 + src/test/assembly/nvptx-atomics.rs | 1 + src/test/assembly/nvptx-internalizing.rs | 1 + src/test/assembly/nvptx-linking-binary.rs | 1 + src/test/assembly/nvptx-linking-cdylib.rs | 1 + src/test/assembly/nvptx-safe-naming.rs | 1 + 10 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ci/docker/test-various/Dockerfile b/src/ci/docker/test-various/Dockerfile index 611a24a69bd37..c45b1a9a0f1d6 100644 --- a/src/ci/docker/test-various/Dockerfile +++ b/src/ci/docker/test-various/Dockerfile @@ -15,10 +15,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ wget \ patch -# FIXME: build the `ptx-linker` instead. -RUN curl -sL https://github.com/denzp/rust-ptx-linker/releases/download/v0.9.0-alpha.2/rust-ptx-linker.linux64.tar.gz | \ - tar -xzvC /usr/bin - RUN curl -sL https://nodejs.org/dist/v9.2.0/node-v9.2.0-linux-x64.tar.xz | \ tar -xJ diff --git a/src/test/assembly/nvptx-arch-default.rs b/src/test/assembly/nvptx-arch-default.rs index 7fe71c33521a2..8a71a6370f112 100644 --- a/src/test/assembly/nvptx-arch-default.rs +++ b/src/test/assembly/nvptx-arch-default.rs @@ -1,6 +1,7 @@ // assembly-output: ptx-linker // compile-flags: --crate-type cdylib // only-nvptx64 +// ignore-nvptx64 #![no_std] diff --git a/src/test/assembly/nvptx-arch-emit-asm.rs b/src/test/assembly/nvptx-arch-emit-asm.rs index 0ca17729c0212..b252b450fa77d 100644 --- a/src/test/assembly/nvptx-arch-emit-asm.rs +++ b/src/test/assembly/nvptx-arch-emit-asm.rs @@ -1,6 +1,7 @@ // assembly-output: emit-asm // compile-flags: --crate-type rlib // only-nvptx64 +// ignore-nvptx64 #![no_std] diff --git a/src/test/assembly/nvptx-arch-link-arg.rs b/src/test/assembly/nvptx-arch-link-arg.rs index f6b6e8ccaa127..025a9ad498778 100644 --- a/src/test/assembly/nvptx-arch-link-arg.rs +++ b/src/test/assembly/nvptx-arch-link-arg.rs @@ -1,6 +1,7 @@ // assembly-output: ptx-linker // compile-flags: --crate-type cdylib -C link-arg=--arch=sm_60 // only-nvptx64 +// ignore-nvptx64 #![no_std] diff --git a/src/test/assembly/nvptx-arch-target-cpu.rs b/src/test/assembly/nvptx-arch-target-cpu.rs index 08a7a193bbd88..824ee9cd89732 100644 --- a/src/test/assembly/nvptx-arch-target-cpu.rs +++ b/src/test/assembly/nvptx-arch-target-cpu.rs @@ -1,6 +1,7 @@ // assembly-output: ptx-linker // compile-flags: --crate-type cdylib -C target-cpu=sm_50 // only-nvptx64 +// ignore-nvptx64 #![no_std] diff --git a/src/test/assembly/nvptx-atomics.rs b/src/test/assembly/nvptx-atomics.rs index 3bbd7b3d12d2a..f963980644928 100644 --- a/src/test/assembly/nvptx-atomics.rs +++ b/src/test/assembly/nvptx-atomics.rs @@ -1,6 +1,7 @@ // assembly-output: ptx-linker // compile-flags: --crate-type cdylib // only-nvptx64 +// ignore-nvptx64 #![feature(abi_ptx, core_intrinsics)] #![no_std] diff --git a/src/test/assembly/nvptx-internalizing.rs b/src/test/assembly/nvptx-internalizing.rs index c9edc386959f8..0004fcea7a20b 100644 --- a/src/test/assembly/nvptx-internalizing.rs +++ b/src/test/assembly/nvptx-internalizing.rs @@ -1,6 +1,7 @@ // assembly-output: ptx-linker // compile-flags: --crate-type cdylib // only-nvptx64 +// ignore-nvptx64 #![feature(abi_ptx)] #![no_std] diff --git a/src/test/assembly/nvptx-linking-binary.rs b/src/test/assembly/nvptx-linking-binary.rs index d88ed9139ca6a..64b9c2f17aa7d 100644 --- a/src/test/assembly/nvptx-linking-binary.rs +++ b/src/test/assembly/nvptx-linking-binary.rs @@ -1,6 +1,7 @@ // assembly-output: ptx-linker // compile-flags: --crate-type bin // only-nvptx64 +// ignore-nvptx64 #![feature(abi_ptx)] #![no_main] diff --git a/src/test/assembly/nvptx-linking-cdylib.rs b/src/test/assembly/nvptx-linking-cdylib.rs index 1145f567d8c17..bdbc30ea97fe2 100644 --- a/src/test/assembly/nvptx-linking-cdylib.rs +++ b/src/test/assembly/nvptx-linking-cdylib.rs @@ -1,6 +1,7 @@ // assembly-output: ptx-linker // compile-flags: --crate-type cdylib // only-nvptx64 +// ignore-nvptx64 #![feature(abi_ptx)] #![no_std] diff --git a/src/test/assembly/nvptx-safe-naming.rs b/src/test/assembly/nvptx-safe-naming.rs index ab6f91423aad6..80bb04fc0f2fb 100644 --- a/src/test/assembly/nvptx-safe-naming.rs +++ b/src/test/assembly/nvptx-safe-naming.rs @@ -1,6 +1,7 @@ // assembly-output: ptx-linker // compile-flags: --crate-type cdylib // only-nvptx64 +// ignore-nvptx64 #![feature(abi_ptx)] #![no_std] From bc36aabf5f4080521037d7ebe2be86302b6f7d81 Mon Sep 17 00:00:00 2001 From: David Wood Date: Thu, 13 Jun 2019 17:19:50 +0100 Subject: [PATCH 05/11] typeck: Fix ICE for blocks in repeat expr count. This commit extends the work in #61698 to get the `DefId` of const parameters from block that resolve to a const parameter (as well as const parameters directly, as it was previously). --- src/librustc_typeck/astconv.rs | 21 ++++++++----------- src/test/ui/const-generics/issue-61336-2.rs | 16 ++++++++++++++ .../ui/const-generics/issue-61336-2.stderr | 18 ++++++++++++++++ 3 files changed, 43 insertions(+), 12 deletions(-) create mode 100644 src/test/ui/const-generics/issue-61336-2.rs create mode 100644 src/test/ui/const-generics/issue-61336-2.stderr diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 2c9309a1696cf..2f8b45bbcad3d 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -2157,6 +2157,14 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { /// Returns the `DefId` of the constant parameter that the provided expression is a path to. pub fn const_param_def_id(&self, expr: &hir::Expr) -> Option { + // Unwrap a block, so that e.g. `{ P }` is recognised as a parameter. Const arguments + // currently have to be wrapped in curly brackets, so it's necessary to special-case. + let expr = match &expr.node { + ExprKind::Block(block, _) if block.stmts.is_empty() && block.expr.is_some() => + block.expr.as_ref().unwrap(), + _ => expr, + }; + match &expr.node { ExprKind::Path(hir::QPath::Resolved(_, path)) => match path.res { Res::Def(DefKind::ConstParam, did) => Some(did), @@ -2184,18 +2192,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { ty, }; - let mut expr = &tcx.hir().body(ast_const.body).value; - - // Unwrap a block, so that e.g. `{ P }` is recognised as a parameter. Const arguments - // currently have to be wrapped in curly brackets, so it's necessary to special-case. - if let ExprKind::Block(block, _) = &expr.node { - if block.stmts.is_empty() { - if let Some(trailing) = &block.expr { - expr = &trailing; - } - } - } - + let expr = &tcx.hir().body(ast_const.body).value; if let Some(def_id) = self.const_param_def_id(expr) { // Find the name and index of the const parameter by indexing the generics of the // parent item and construct a `ParamConst`. diff --git a/src/test/ui/const-generics/issue-61336-2.rs b/src/test/ui/const-generics/issue-61336-2.rs new file mode 100644 index 0000000000000..604c14ee120a8 --- /dev/null +++ b/src/test/ui/const-generics/issue-61336-2.rs @@ -0,0 +1,16 @@ +#![feature(const_generics)] +//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash + +fn f(x: T) -> [T; N] { + [x; {N}] +} + +fn g(x: T) -> [T; N] { + [x; {N}] + //~^ ERROR the trait bound `T: std::marker::Copy` is not satisfied [E0277] +} + +fn main() { + let x: [u32; 5] = f::(3); + assert_eq!(x, [3u32; 5]); +} diff --git a/src/test/ui/const-generics/issue-61336-2.stderr b/src/test/ui/const-generics/issue-61336-2.stderr new file mode 100644 index 0000000000000..a7135b62f8cff --- /dev/null +++ b/src/test/ui/const-generics/issue-61336-2.stderr @@ -0,0 +1,18 @@ +warning: the feature `const_generics` is incomplete and may cause the compiler to crash + --> $DIR/issue-61336-2.rs:1:12 + | +LL | #![feature(const_generics)] + | ^^^^^^^^^^^^^^ + +error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied + --> $DIR/issue-61336-2.rs:9:5 + | +LL | [x; {N}] + | ^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` + | + = help: consider adding a `where T: std::marker::Copy` bound + = note: the `Copy` trait is required because the repeated element will be copied + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. From d3024138f8e49e815a205dcb80e2e21decc57aa6 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Fri, 14 Jun 2019 09:00:21 +0200 Subject: [PATCH 06/11] PatKind::Path: avoid calling resolve_ty_and_res_ufcs twice. --- src/librustc_typeck/check/_match.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index b882b696938ac..d27c62037631a 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -50,6 +50,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { debug!("check_pat_walk(pat={:?},expected={:?},def_bm={:?})", pat, expected, def_bm); + let mut path_resolution = None; let is_non_ref_pat = match pat.node { PatKind::Struct(..) | PatKind::TupleStruct(..) | @@ -65,8 +66,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } PatKind::Path(ref qpath) => { - let (def, _, _) = self.resolve_ty_and_res_ufcs(qpath, pat.hir_id, pat.span); - match def { + let resolution = self.resolve_ty_and_res_ufcs(qpath, pat.hir_id, pat.span); + path_resolution = Some(resolution); + match resolution.0 { Res::Def(DefKind::Const, _) | Res::Def(DefKind::AssocConst, _) => false, _ => true, } @@ -294,7 +296,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ) } PatKind::Path(ref qpath) => { - self.check_pat_path(pat, qpath, expected) + self.check_pat_path(pat, path_resolution.unwrap(), qpath, expected) } PatKind::Struct(ref qpath, ref fields, etc) => { self.check_pat_struct(pat, qpath, fields, etc, expected, def_bm, discrim_span) @@ -1055,13 +1057,14 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); fn check_pat_path( &self, pat: &hir::Pat, + path_resolution: (Res, Option>, &'b [hir::PathSegment]), qpath: &hir::QPath, expected: Ty<'tcx>, ) -> Ty<'tcx> { let tcx = self.tcx; - // Resolve the path and check the definition for errors. - let (res, opt_ty, segments) = self.resolve_ty_and_res_ufcs(qpath, pat.hir_id, pat.span); + // We have already resolved the path. + let (res, opt_ty, segments) = path_resolution; match res { Res::Err => { self.set_tainted_by_errors(); From 17653dd3da53c2b1114dcb36b85c7d6512c6cc5f Mon Sep 17 00:00:00 2001 From: "Zack M. Davis" Date: Thu, 13 Jun 2019 23:16:47 -0700 Subject: [PATCH 07/11] in which we decline to lint single-use lifetimes in `derive`d impls Resolves #53738. --- src/librustc/middle/resolve_lifetime.rs | 11 +++++++++++ src/test/ui/single-use-lifetime/one-use-in-struct.rs | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index edd5cb4541a96..1d88f25497269 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -1591,6 +1591,17 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { continue; } + if let Some(parent_def_id) = self.tcx.parent(def_id) { + if let Some(parent_hir_id) = self.tcx.hir() + .as_local_hir_id(parent_def_id) { + // lifetimes in `derive` expansions don't count (Issue #53738) + if self.tcx.hir().attrs_by_hir_id(parent_hir_id).iter() + .any(|attr| attr.check_name(sym::automatically_derived)) { + continue; + } + } + } + let mut err = self.tcx.struct_span_lint_hir( lint::builtin::SINGLE_USE_LIFETIMES, id, diff --git a/src/test/ui/single-use-lifetime/one-use-in-struct.rs b/src/test/ui/single-use-lifetime/one-use-in-struct.rs index e0328c9d94a14..6c4d2a4a7ad41 100644 --- a/src/test/ui/single-use-lifetime/one-use-in-struct.rs +++ b/src/test/ui/single-use-lifetime/one-use-in-struct.rs @@ -18,4 +18,11 @@ enum Bar<'f> { trait Baz<'f> { } +// `Derive`d impls shouldn't trigger a warning, either (Issue #53738). + +#[derive(Debug)] +struct Quux<'a> { + priors: &'a u32, +} + fn main() { } From 065151f8b2c31d9e4ddd34aaf8d3263a997f5cfe Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Fri, 14 Jun 2019 09:16:39 +0200 Subject: [PATCH 08/11] type_alias_enum_variants: add regression test for #61801. --- .../issue-61801-path-pattern-can-infer.rs | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/test/ui/type-alias-enum-variants/issue-61801-path-pattern-can-infer.rs diff --git a/src/test/ui/type-alias-enum-variants/issue-61801-path-pattern-can-infer.rs b/src/test/ui/type-alias-enum-variants/issue-61801-path-pattern-can-infer.rs new file mode 100644 index 0000000000000..21be61acb0c61 --- /dev/null +++ b/src/test/ui/type-alias-enum-variants/issue-61801-path-pattern-can-infer.rs @@ -0,0 +1,30 @@ +// In this regression test we check that a path pattern referring to a unit variant +// through a type alias is successful in inferring the generic argument. + +// compile-pass + +#![feature(type_alias_enum_variants)] + +enum Opt { + N, + S(T), +} + +type OptAlias = Opt; + +fn f1(x: OptAlias) { + match x { + OptAlias::N // We previously failed to infer `T` to `u8`. + => (), + _ => (), + } + + match x { + < + OptAlias<_> // And we failed to infer this type also. + >::N => (), + _ => (), + } +} + +fn main() {} From 267bf7b2d3dbf4c7059f6c2fed69a9ebb333f770 Mon Sep 17 00:00:00 2001 From: Pyry Kontio Date: Fri, 14 Jun 2019 17:17:28 +0900 Subject: [PATCH 09/11] Fix rust-lldb wrapper scripts. --- .azure-pipelines/steps/run.yml | 2 +- .travis.yml | 2 +- src/etc/rust-lldb | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.azure-pipelines/steps/run.yml b/.azure-pipelines/steps/run.yml index 3f98aa495296a..553ec88a6e188 100644 --- a/.azure-pipelines/steps/run.yml +++ b/.azure-pipelines/steps/run.yml @@ -37,7 +37,7 @@ steps: set -e brew update brew install xz - brew install swig + brew install swig@3 displayName: Install build dependencies (OSX) condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'), eq(variables['SCRIPT'],'./x.py dist')) diff --git a/.travis.yml b/.travis.yml index 49a8d5b66c356..549893d7fcc1d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -263,7 +263,7 @@ install: if [[ "$SCRIPT" == "./x.py dist" ]]; then travis_retry brew update && travis_retry brew install xz && - travis_retry brew install swig; + travis_retry brew install swig@3; fi && travis_retry curl -fo /usr/local/bin/sccache https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror/2018-04-02-sccache-x86_64-apple-darwin && chmod +x /usr/local/bin/sccache && diff --git a/src/etc/rust-lldb b/src/etc/rust-lldb index 424302d495f3e..0eb99423df576 100755 --- a/src/etc/rust-lldb +++ b/src/etc/rust-lldb @@ -31,7 +31,7 @@ category_definition="type summary add --no-value --python-function lldb_rust_for category_enable="type category enable Rust" # Call LLDB with the commands added to the argument list -exec "$lldb" --one-line-before-file="$script_import" \ - --one-line-before-file="$category_definition" \ - --one-line-before-file="$category_enable" \ +exec "$lldb" --one-line-before-file "$script_import" \ + --one-line-before-file "$category_definition" \ + --one-line-before-file "$category_enable" \ "$@" From 00bae8774cf0a464b3ba88c546d4a615bb53206a Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 12 Jun 2019 23:23:34 +0200 Subject: [PATCH 10/11] note some safety concerns of raw-ptr-to-ref casts --- src/libcore/ptr/mod.rs | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/src/libcore/ptr/mod.rs b/src/libcore/ptr/mod.rs index 80ac67d8eb57c..8f026a5b7d8dd 100644 --- a/src/libcore/ptr/mod.rs +++ b/src/libcore/ptr/mod.rs @@ -984,8 +984,17 @@ impl *const T { /// operation because the returned value could be pointing to invalid /// memory. /// + /// When calling this method, you have to ensure that if the pointer is + /// non-NULL, then it is properly aligned, dereferencable (for the whole + /// size of `T`) and points to an initialized instance of `T`. This applies + /// even if the result of this method is unused! + /// (The part about being initialized is not yet fully decided, but until + /// it is, the only safe approach is to ensure that they are indeed initialized.) + /// /// Additionally, the lifetime `'a` returned is arbitrarily chosen and does - /// not necessarily reflect the actual lifetime of the data. + /// not necessarily reflect the actual lifetime of the data. It is up to the + /// caller to ensure that for the duration of this lifetime, the memory this + /// pointer points to does not get written to outside of `UnsafeCell`. /// /// # Examples /// @@ -1610,8 +1619,17 @@ impl *mut T { /// operation because the returned value could be pointing to invalid /// memory. /// + /// When calling this method, you have to ensure that if the pointer is + /// non-NULL, then it is properly aligned, dereferencable (for the whole + /// size of `T`) and points to an initialized instance of `T`. This applies + /// even if the result of this method is unused! + /// (The part about being initialized is not yet fully decided, but until + /// it is, the only safe approach is to ensure that they are indeed initialized.) + /// /// Additionally, the lifetime `'a` returned is arbitrarily chosen and does - /// not necessarily reflect the actual lifetime of the data. + /// not necessarily reflect the actual lifetime of the data. It is up to the + /// caller to ensure that for the duration of this lifetime, the memory this + /// pointer points to does not get written to outside of `UnsafeCell`. /// /// # Examples /// @@ -1755,10 +1773,24 @@ impl *mut T { /// /// # Safety /// - /// As with `as_ref`, this is unsafe because it cannot verify the validity + /// As with [`as_ref`], this is unsafe because it cannot verify the validity /// of the returned pointer, nor can it ensure that the lifetime `'a` /// returned is indeed a valid lifetime for the contained data. /// + /// When calling this method, you have to ensure that if the pointer is + /// non-NULL, then it is properly aligned, dereferencable (for the whole + /// size of `T`) and points to an initialized instance of `T`. This applies + /// even if the result of this method is unused! + /// (The part about being initialized is not yet fully decided, but until + /// it is the only safe approach is to ensure that they are indeed initialized.) + /// + /// Additionally, the lifetime `'a` returned is arbitrarily chosen and does + /// not necessarily reflect the actual lifetime of the data. It is up to the + /// caller to ensure that for the duration of this lifetime, the memory this + /// pointer points to does not get accessed through any other pointer. + /// + /// [`as_ref`]: #method.as_ref + /// /// # Examples /// /// Basic usage: From 4d5f97e8337e40f920ec51cbc237a9d5e208965a Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou Date: Fri, 14 Jun 2019 11:24:59 +0200 Subject: [PATCH 11/11] rustbuild: include llvm-libunwind in dist tarball Signed-off-by: Marc-Antoine Perennou --- src/bootstrap/dist.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 274961916183a..45bc77ec97d47 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -804,6 +804,7 @@ fn copy_src_dirs(builder: &Builder<'_>, src_dirs: &[&str], exclude_dirs: &[&str] const LLVM_PROJECTS: &[&str] = &[ "llvm-project/clang", "llvm-project\\clang", + "llvm-project/libunwind", "llvm-project\\libunwind", "llvm-project/lld", "llvm-project\\lld", "llvm-project/lldb", "llvm-project\\lldb", "llvm-project/llvm", "llvm-project\\llvm",