diff --git a/Cargo.lock b/Cargo.lock index d3c6be59b75df..0b9d84916b799 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]] @@ -999,7 +999,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]] @@ -1697,11 +1697,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" @@ -1856,7 +1853,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)", ] @@ -2446,7 +2443,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)", @@ -2492,7 +2489,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)", ] @@ -2528,7 +2525,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]] @@ -2544,7 +2541,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]] @@ -2658,7 +2655,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)", ] @@ -2672,7 +2669,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", ] @@ -2683,7 +2680,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]] @@ -2792,7 +2789,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)", ] @@ -2826,7 +2823,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", @@ -2891,7 +2888,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", @@ -2952,7 +2949,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", @@ -2976,7 +2973,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", ] @@ -3041,7 +3038,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", ] @@ -3095,7 +3092,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", ] @@ -3121,7 +3118,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", ] @@ -3303,7 +3300,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]] @@ -3356,11 +3353,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" @@ -3409,7 +3403,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)", @@ -3515,7 +3509,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", ] @@ -3528,7 +3522,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", ] @@ -3963,14 +3957,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" @@ -4049,11 +4035,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" @@ -4317,7 +4298,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" @@ -4427,7 +4408,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" @@ -4481,7 +4462,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" @@ -4491,7 +4471,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" 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/libcore/benches/ascii.rs b/src/libcore/benches/ascii.rs index 10b6cc61d996a..a337c46713133 100644 --- a/src/libcore/benches/ascii.rs +++ b/src/libcore/benches/ascii.rs @@ -191,7 +191,7 @@ benches! { fn case11_mask_mult_bool_match_range(bytes: &mut [u8]) { fn is_ascii_lowercase(b: u8) -> bool { match b { - b'a'...b'z' => true, + b'a'..=b'z' => true, _ => false } } @@ -203,7 +203,7 @@ benches! { fn case12_mask_shifted_bool_match_range(bytes: &mut [u8]) { fn is_ascii_lowercase(b: u8) -> bool { match b { - b'a'...b'z' => true, + b'a'..=b'z' => true, _ => false } } @@ -215,7 +215,7 @@ benches! { fn case13_subtract_shifted_bool_match_range(bytes: &mut [u8]) { fn is_ascii_lowercase(b: u8) -> bool { match b { - b'a'...b'z' => true, + b'a'..=b'z' => true, _ => false } } @@ -227,7 +227,7 @@ benches! { fn case14_subtract_multiplied_bool_match_range(bytes: &mut [u8]) { fn is_ascii_lowercase(b: u8) -> bool { match b { - b'a'...b'z' => true, + b'a'..=b'z' => true, _ => false } } diff --git a/src/libcore/char/convert.rs b/src/libcore/char/convert.rs index ec9ac7ce8b1cb..0a870c67518c7 100644 --- a/src/libcore/char/convert.rs +++ b/src/libcore/char/convert.rs @@ -123,7 +123,7 @@ impl From for u32 { } } -/// Maps a byte in 0x00...0xFF to a `char` whose code point has the same value, in U+0000 to U+00FF. +/// Maps a byte in 0x00..=0xFF to a `char` whose code point has the same value, in U+0000..=U+00FF. /// /// Unicode is designed such that this effectively decodes bytes /// with the character encoding that IANA calls ISO-8859-1. diff --git a/src/libcore/char/methods.rs b/src/libcore/char/methods.rs index 18557e0c11d89..722c4c805168f 100644 --- a/src/libcore/char/methods.rs +++ b/src/libcore/char/methods.rs @@ -1042,8 +1042,8 @@ impl char { /// Checks if the value is an ASCII alphabetic character: /// - /// - U+0041 'A' ... U+005A 'Z', or - /// - U+0061 'a' ... U+007A 'z'. + /// - U+0041 'A' ..= U+005A 'Z', or + /// - U+0061 'a' ..= U+007A 'z'. /// /// # Examples /// @@ -1075,7 +1075,7 @@ impl char { } /// Checks if the value is an ASCII uppercase character: - /// U+0041 'A' ... U+005A 'Z'. + /// U+0041 'A' ..= U+005A 'Z'. /// /// # Examples /// @@ -1107,7 +1107,7 @@ impl char { } /// Checks if the value is an ASCII lowercase character: - /// U+0061 'a' ... U+007A 'z'. + /// U+0061 'a' ..= U+007A 'z'. /// /// # Examples /// @@ -1140,9 +1140,9 @@ impl char { /// Checks if the value is an ASCII alphanumeric character: /// - /// - U+0041 'A' ... U+005A 'Z', or - /// - U+0061 'a' ... U+007A 'z', or - /// - U+0030 '0' ... U+0039 '9'. + /// - U+0041 'A' ..= U+005A 'Z', or + /// - U+0061 'a' ..= U+007A 'z', or + /// - U+0030 '0' ..= U+0039 '9'. /// /// # Examples /// @@ -1174,7 +1174,7 @@ impl char { } /// Checks if the value is an ASCII decimal digit: - /// U+0030 '0' ... U+0039 '9'. + /// U+0030 '0' ..= U+0039 '9'. /// /// # Examples /// @@ -1207,9 +1207,9 @@ impl char { /// Checks if the value is an ASCII hexadecimal digit: /// - /// - U+0030 '0' ... U+0039 '9', or - /// - U+0041 'A' ... U+0046 'F', or - /// - U+0061 'a' ... U+0066 'f'. + /// - U+0030 '0' ..= U+0039 '9', or + /// - U+0041 'A' ..= U+0046 'F', or + /// - U+0061 'a' ..= U+0066 'f'. /// /// # Examples /// @@ -1242,10 +1242,10 @@ impl char { /// Checks if the value is an ASCII punctuation character: /// - /// - U+0021 ... U+002F `! " # $ % & ' ( ) * + , - . /`, or - /// - U+003A ... U+0040 `: ; < = > ? @`, or - /// - U+005B ... U+0060 ``[ \ ] ^ _ ` ``, or - /// - U+007B ... U+007E `{ | } ~` + /// - U+0021 ..= U+002F `! " # $ % & ' ( ) * + , - . /`, or + /// - U+003A ..= U+0040 `: ; < = > ? @`, or + /// - U+005B ..= U+0060 ``[ \ ] ^ _ ` ``, or + /// - U+007B ..= U+007E `{ | } ~` /// /// # Examples /// @@ -1277,7 +1277,7 @@ impl char { } /// Checks if the value is an ASCII graphic character: - /// U+0021 '!' ... U+007E '~'. + /// U+0021 '!' ..= U+007E '~'. /// /// # Examples /// @@ -1358,7 +1358,7 @@ impl char { } /// Checks if the value is an ASCII control character: - /// U+0000 NUL ... U+001F UNIT SEPARATOR, or U+007F DELETE. + /// U+0000 NUL ..= U+001F UNIT SEPARATOR, or U+007F DELETE. /// Note that most ASCII whitespace characters are control /// characters, but SPACE is not. /// diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 304b2fc9ebb06..d70f55670116c 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -4166,8 +4166,8 @@ impl u8 { /// Checks if the value is an ASCII alphabetic character: /// - /// - U+0041 'A' ... U+005A 'Z', or - /// - U+0061 'a' ... U+007A 'z'. + /// - U+0041 'A' ..= U+005A 'Z', or + /// - U+0061 'a' ..= U+007A 'z'. /// /// # Examples /// @@ -4202,7 +4202,7 @@ impl u8 { } /// Checks if the value is an ASCII uppercase character: - /// U+0041 'A' ... U+005A 'Z'. + /// U+0041 'A' ..= U+005A 'Z'. /// /// # Examples /// @@ -4237,7 +4237,7 @@ impl u8 { } /// Checks if the value is an ASCII lowercase character: - /// U+0061 'a' ... U+007A 'z'. + /// U+0061 'a' ..= U+007A 'z'. /// /// # Examples /// @@ -4273,9 +4273,9 @@ impl u8 { /// Checks if the value is an ASCII alphanumeric character: /// - /// - U+0041 'A' ... U+005A 'Z', or - /// - U+0061 'a' ... U+007A 'z', or - /// - U+0030 '0' ... U+0039 '9'. + /// - U+0041 'A' ..= U+005A 'Z', or + /// - U+0061 'a' ..= U+007A 'z', or + /// - U+0030 '0' ..= U+0039 '9'. /// /// # Examples /// @@ -4310,7 +4310,7 @@ impl u8 { } /// Checks if the value is an ASCII decimal digit: - /// U+0030 '0' ... U+0039 '9'. + /// U+0030 '0' ..= U+0039 '9'. /// /// # Examples /// @@ -4346,9 +4346,9 @@ impl u8 { /// Checks if the value is an ASCII hexadecimal digit: /// - /// - U+0030 '0' ... U+0039 '9', or - /// - U+0041 'A' ... U+0046 'F', or - /// - U+0061 'a' ... U+0066 'f'. + /// - U+0030 '0' ..= U+0039 '9', or + /// - U+0041 'A' ..= U+0046 'F', or + /// - U+0061 'a' ..= U+0066 'f'. /// /// # Examples /// @@ -4384,10 +4384,10 @@ impl u8 { /// Checks if the value is an ASCII punctuation character: /// - /// - U+0021 ... U+002F `! " # $ % & ' ( ) * + , - . /`, or - /// - U+003A ... U+0040 `: ; < = > ? @`, or - /// - U+005B ... U+0060 ``[ \ ] ^ _ ` ``, or - /// - U+007B ... U+007E `{ | } ~` + /// - U+0021 ..= U+002F `! " # $ % & ' ( ) * + , - . /`, or + /// - U+003A ..= U+0040 `: ; < = > ? @`, or + /// - U+005B ..= U+0060 ``[ \ ] ^ _ ` ``, or + /// - U+007B ..= U+007E `{ | } ~` /// /// # Examples /// @@ -4422,7 +4422,7 @@ impl u8 { } /// Checks if the value is an ASCII graphic character: - /// U+0021 '!' ... U+007E '~'. + /// U+0021 '!' ..= U+007E '~'. /// /// # Examples /// @@ -4509,7 +4509,7 @@ impl u8 { } /// Checks if the value is an ASCII control character: - /// U+0000 NUL ... U+001F UNIT SEPARATOR, or U+007F DELETE. + /// U+0000 NUL ..= U+001F UNIT SEPARATOR, or U+007F DELETE. /// Note that most ASCII whitespace characters are control /// characters, but SPACE is not. /// 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: diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 1b4c56c3453a1..6ace4c4174b56 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -994,7 +994,7 @@ pub enum PatKind { /// A literal. Lit(P), - /// A range pattern (e.g., `1...2` or `1..2`). + /// A range pattern (e.g., `1..=2` or `1..2`). Range(P, P, RangeEnd), /// `[a, b, ..i, y, z]` is represented as: diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 8bc3158bd3c7d..48d2a477a9af4 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -1586,6 +1586,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/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs index c605c2e47c943..32696d46cd577 100644 --- a/src/librustc_codegen_ssa/back/linker.rs +++ b/src/librustc_codegen_ssa/back/linker.rs @@ -377,25 +377,18 @@ 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 { - return - } + // 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. - // 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" { + if !self.sess.target.target.options.limit_rdylib_exports { return; } + if crate_type == CrateType::ProcMacro { + return + } + let mut arg = OsString::new(); let path = tmpdir.join("list"); diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index 1d7c450f69506..bb1a67bcdaeff 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -428,7 +428,7 @@ enum Constructor<'tcx> { Variant(DefId), /// Literal values. ConstantValue(&'tcx ty::Const<'tcx>), - /// Ranges of literal values (`2...5` and `2..5`). + /// Ranges of literal values (`2..=5` and `2..5`). ConstantRange(u128, u128, Ty<'tcx>, RangeEnd), /// Array patterns of length n. Slice(u64), @@ -816,7 +816,7 @@ fn max_slice_length<'p, 'a: 'p, 'tcx: 'a, I>( /// `IntRange`s always store a contiguous range. This means that values are /// encoded such that `0` encodes the minimum value for the integer, /// regardless of the signedness. -/// For example, the pattern `-128...127i8` is encoded as `0..=255`. +/// For example, the pattern `-128..=127i8` is encoded as `0..=255`. /// This makes comparisons and arithmetic on interval endpoints much more /// straightforward. See `signed_bias` for details. /// diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index f985c6000b5b2..28dc0d37b36f4 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -765,4 +765,21 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpretCx<'mir, 'tcx, M> { pub fn truncate(&self, value: u128, ty: TyLayout<'_>) -> u128 { truncate(value, ty.size) } + + #[inline(always)] + pub fn force_ptr( + &self, + scalar: Scalar, + ) -> InterpResult<'tcx, Pointer> { + self.memory.force_ptr(scalar) + } + + #[inline(always)] + pub fn force_bits( + &self, + scalar: Scalar, + size: Size + ) -> InterpResult<'tcx, u128> { + self.memory.force_bits(scalar, size) + } } diff --git a/src/librustc_mir/interpret/machine.rs b/src/librustc_mir/interpret/machine.rs index 58ee952879d9d..8eb891cf90a09 100644 --- a/src/librustc_mir/interpret/machine.rs +++ b/src/librustc_mir/interpret/machine.rs @@ -11,7 +11,8 @@ use rustc::ty::{self, query::TyCtxtAt}; use super::{ Allocation, AllocId, InterpResult, Scalar, AllocationExtra, - InterpretCx, PlaceTy, OpTy, ImmTy, MemoryKind, + InterpretCx, PlaceTy, OpTy, ImmTy, MemoryKind, Pointer, + InterpErrorInfo, InterpError }; /// Whether this kind of memory is allowed to leak @@ -208,4 +209,18 @@ pub trait Machine<'mir, 'tcx>: Sized { ecx: &mut InterpretCx<'mir, 'tcx, Self>, extra: Self::FrameExtra, ) -> InterpResult<'tcx>; + + fn int_to_ptr( + _int: u64, + _extra: &Self::MemoryExtra, + ) -> InterpResult<'tcx, Pointer> { + Err(InterpErrorInfo::from(InterpError::ReadBytesAsPointer)) + } + + fn ptr_to_int( + _ptr: Pointer, + _extra: &Self::MemoryExtra, + ) -> InterpResult<'tcx, u64> { + Err(InterpErrorInfo::from(InterpError::ReadPointerAsBytes)) + } } diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs index e724c377df73d..a0a34df3a5ea4 100644 --- a/src/librustc_mir/interpret/memory.rs +++ b/src/librustc_mir/interpret/memory.rs @@ -627,7 +627,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { if size.bytes() == 0 { Ok(&[]) } else { - let ptr = ptr.to_ptr()?; + let ptr = self.force_ptr(ptr)?; self.get(ptr.alloc_id)?.get_bytes(self, ptr, size) } } @@ -714,8 +714,8 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { // non-NULLness which already happened. return Ok(()); } - let src = src.to_ptr()?; - let dest = dest.to_ptr()?; + let src = self.force_ptr(src)?; + let dest = self.force_ptr(dest)?; // first copy the relocations to a temporary buffer, because // `get_bytes_mut` will clear the relocations, which is correct, @@ -874,4 +874,25 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { } Ok(()) } + + pub fn force_ptr( + &self, + scalar: Scalar, + ) -> InterpResult<'tcx, Pointer> { + match scalar { + Scalar::Ptr(ptr) => Ok(ptr), + _ => M::int_to_ptr(scalar.to_usize(self)?, &self.extra) + } + } + + pub fn force_bits( + &self, + scalar: Scalar, + size: Size + ) -> InterpResult<'tcx, u128> { + match scalar.to_bits_or_ptr(size, self) { + Ok(bits) => Ok(bits), + Err(ptr) => Ok(M::ptr_to_int(ptr, &self.extra)? as u128) + } + } } diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs index 87537ba57ae55..4b1e782ba1a45 100644 --- a/src/librustc_mir/interpret/operand.rs +++ b/src/librustc_mir/interpret/operand.rs @@ -232,7 +232,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpretCx<'mir, 'tcx, M> { } // check for integer pointers before alignment to report better errors - let ptr = ptr.to_ptr()?; + let ptr = self.force_ptr(ptr)?; self.memory.check_align(ptr.into(), ptr_align)?; match mplace.layout.abi { layout::Abi::Scalar(..) => { diff --git a/src/librustc_mir/interpret/operator.rs b/src/librustc_mir/interpret/operator.rs index e8a691733791a..029a440f34e72 100644 --- a/src/librustc_mir/interpret/operator.rs +++ b/src/librustc_mir/interpret/operator.rs @@ -347,7 +347,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpretCx<'mir, 'tcx, M> { } _ => { assert!(layout.ty.is_integral()); - let val = val.to_bits(layout.size)?; + let val = self.force_bits(val, layout.size)?; let res = match un_op { Not => !val, Neg => { diff --git a/src/librustc_mir/interpret/place.rs b/src/librustc_mir/interpret/place.rs index eef0940a8e48d..a8f88af3f3833 100644 --- a/src/librustc_mir/interpret/place.rs +++ b/src/librustc_mir/interpret/place.rs @@ -473,7 +473,7 @@ where let layout = self.layout_of(self.tcx.types.usize)?; let n = self.access_local(self.frame(), local, Some(layout))?; let n = self.read_scalar(n)?; - let n = n.to_bits(self.tcx.data_layout.pointer_size)?; + let n = self.force_bits(n.not_undef()?, self.tcx.data_layout.pointer_size)?; self.mplace_field(base, u64::try_from(n).unwrap())? } @@ -753,7 +753,7 @@ where } // check for integer pointers before alignment to report better errors - let ptr = ptr.to_ptr()?; + let ptr = self.force_ptr(ptr)?; self.memory.check_align(ptr.into(), ptr_align)?; let tcx = &*self.tcx; // FIXME: We should check that there are dest.layout.size many bytes available in diff --git a/src/librustc_mir/interpret/terminator.rs b/src/librustc_mir/interpret/terminator.rs index 316a95e9400b4..190f7818ddb03 100644 --- a/src/librustc_mir/interpret/terminator.rs +++ b/src/librustc_mir/interpret/terminator.rs @@ -79,7 +79,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpretCx<'mir, 'tcx, M> { let (fn_def, abi) = match func.layout.ty.sty { ty::FnPtr(sig) => { let caller_abi = sig.abi(); - let fn_ptr = self.read_scalar(func)?.to_ptr()?; + let fn_ptr = self.force_ptr(self.read_scalar(func)?.not_undef()?)?; let instance = self.memory.get_fn(fn_ptr)?; (instance, caller_abi) } diff --git a/src/librustc_mir/interpret/validity.rs b/src/librustc_mir/interpret/validity.rs index 8a8cc0fe1d174..0ce72721186a1 100644 --- a/src/librustc_mir/interpret/validity.rs +++ b/src/librustc_mir/interpret/validity.rs @@ -559,7 +559,7 @@ impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M> // This is the size in bytes of the whole array. let size = ty_size * len; - let ptr = mplace.ptr.to_ptr()?; + let ptr = self.ecx.force_ptr(mplace.ptr)?; // NOTE: Keep this in sync with the handling of integer and float // types above, in `visit_primitive`. diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index 6d0b142fb2409..e3cd2948d7af5 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -305,7 +305,7 @@ impl<'a> Resolver<'a> { } // Empty groups `a::b::{}` are turned into synthetic `self` imports - // `a::b::c::{self as __dummy}`, so that their prefixes are correctly + // `a::b::c::{self as _}`, so that their prefixes are correctly // resolved and checked for privacy/stability/etc. if items.is_empty() && !empty_for_self(&prefix) { let new_span = prefix[prefix.len() - 1].ident.span; @@ -314,7 +314,7 @@ impl<'a> Resolver<'a> { Ident::new(kw::SelfLower, new_span) ), kind: ast::UseTreeKind::Simple( - Some(Ident::from_str_and_span("__dummy", new_span).gensym()), + Some(Ident::new(kw::Underscore, new_span)), ast::DUMMY_NODE_ID, ast::DUMMY_NODE_ID, ), diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index fec7bf3b273ee..7f05e0f477c2d 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -1519,37 +1519,32 @@ impl<'a> NameBinding<'a> { /// /// All other types are defined somewhere and possibly imported, but the primitive ones need /// special handling, since they have no place of origin. -#[derive(Default)] struct PrimitiveTypeTable { primitive_types: FxHashMap, } impl PrimitiveTypeTable { fn new() -> PrimitiveTypeTable { - let mut table = PrimitiveTypeTable::default(); - - table.intern("bool", Bool); - table.intern("char", Char); - table.intern("f32", Float(FloatTy::F32)); - table.intern("f64", Float(FloatTy::F64)); - table.intern("isize", Int(IntTy::Isize)); - table.intern("i8", Int(IntTy::I8)); - table.intern("i16", Int(IntTy::I16)); - table.intern("i32", Int(IntTy::I32)); - table.intern("i64", Int(IntTy::I64)); - table.intern("i128", Int(IntTy::I128)); - table.intern("str", Str); - table.intern("usize", Uint(UintTy::Usize)); - table.intern("u8", Uint(UintTy::U8)); - table.intern("u16", Uint(UintTy::U16)); - table.intern("u32", Uint(UintTy::U32)); - table.intern("u64", Uint(UintTy::U64)); - table.intern("u128", Uint(UintTy::U128)); - table - } - - fn intern(&mut self, string: &str, primitive_type: PrimTy) { - self.primitive_types.insert(Symbol::intern(string), primitive_type); + let mut table = FxHashMap::default(); + + table.insert(sym::bool, Bool); + table.insert(sym::char, Char); + table.insert(sym::f32, Float(FloatTy::F32)); + table.insert(sym::f64, Float(FloatTy::F64)); + table.insert(sym::isize, Int(IntTy::Isize)); + table.insert(sym::i8, Int(IntTy::I8)); + table.insert(sym::i16, Int(IntTy::I16)); + table.insert(sym::i32, Int(IntTy::I32)); + table.insert(sym::i64, Int(IntTy::I64)); + table.insert(sym::i128, Int(IntTy::I128)); + table.insert(sym::str, Str); + table.insert(sym::usize, Uint(UintTy::Usize)); + table.insert(sym::u8, Uint(UintTy::U8)); + table.insert(sym::u16, Uint(UintTy::U16)); + table.insert(sym::u32, Uint(UintTy::U32)); + table.insert(sym::u64, Uint(UintTy::U64)); + table.insert(sym::u128, Uint(UintTy::U128)); + Self { primitive_types: table } } } diff --git a/src/librustc_target/abi/mod.rs b/src/librustc_target/abi/mod.rs index 77493fbc5dfc7..b7ad5d8ffabed 100644 --- a/src/librustc_target/abi/mod.rs +++ b/src/librustc_target/abi/mod.rs @@ -136,7 +136,7 @@ impl TargetDataLayout { } if bits >= i128_align_src && bits <= 128 { // Default alignment for i128 is decided by taking the alignment of - // largest-sized i{64...128}. + // largest-sized i{64..=128}. i128_align_src = bits; dl.i128_align = a; } diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs index 42ba49ba2b8db..08cf062e85818 100644 --- a/src/librustc_target/spec/mod.rs +++ b/src/librustc_target/spec/mod.rs @@ -750,6 +750,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>, @@ -845,6 +848,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(), @@ -1151,6 +1155,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); @@ -1366,6 +1371,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() diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index c4d841ede0797..892a7b1f73015 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -2157,6 +2157,14 @@ impl<'o, 'tcx> dyn AstConv<'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, 'tcx> dyn AstConv<'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/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index 9ffbbd384c6d5..f74dbe30d3c56 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -50,6 +50,7 @@ impl<'a, 'tcx> FnCtxt<'a, '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, 'tcx> FnCtxt<'a, '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, 'tcx> FnCtxt<'a, '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) @@ -1054,13 +1056,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(); diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index 69a3f090b0a8d..aff8eba3130d6 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -379,7 +379,23 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } }; if self.can_coerce(ref_ty, expected) { - if let Ok(src) = cm.span_to_snippet(sp) { + let mut sugg_sp = sp; + if let hir::ExprKind::MethodCall(segment, _sp, args) = &expr.node { + let clone_trait = self.tcx.lang_items().clone_trait().unwrap(); + if let ([arg], Some(true), "clone") = ( + &args[..], + self.tables.borrow().type_dependent_def_id(expr.hir_id).map(|did| { + let ai = self.tcx.associated_item(did); + ai.container == ty::TraitContainer(clone_trait) + }), + &segment.ident.as_str()[..], + ) { + // If this expression had a clone call when suggesting borrowing + // we want to suggest removing it because it'd now be unecessary. + sugg_sp = arg.span; + } + } + if let Ok(src) = cm.span_to_snippet(sugg_sp) { let needs_parens = match expr.node { // parenthesize if needed (Issue #46756) hir::ExprKind::Cast(_, _) | @@ -425,6 +441,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } } + return Some(match mutability { hir::Mutability::MutMutable => ( sp, diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 68cb8c8574d8b..54cd4035a7ba4 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1181,7 +1181,7 @@ pub enum ExprKind { Field(P, Ident), /// An indexing operation (e.g., `foo[2]`). Index(P, P), - /// A range (e.g., `1..2`, `1..`, `..2`, `1...2`, `1...`, `...2`). + /// A range (e.g., `1..2`, `1..`, `..2`, `1..=2`, `..=2`). Range(Option>, Option>, RangeLimits), /// Variable reference, possibly containing `::` and/or type diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs index 98351048c3526..ee640a1603a6c 100644 --- a/src/libsyntax/diagnostics/plugin.rs +++ b/src/libsyntax/diagnostics/plugin.rs @@ -120,19 +120,7 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt<'_>, } }); - let span = span.apply_mark(ecx.current_expansion.mark); - - let name = Ident::from_str_and_span(&format!("__register_diagnostic_{}", code), span).gensym(); - - MacEager::items(smallvec![ - ecx.item_mod( - span, - span, - name, - vec![], - vec![], - ) - ]) + MacEager::items(smallvec![]) } #[allow(deprecated)] diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 5dbf21867afa6..6b699464ba9a8 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -249,8 +249,9 @@ pub fn compile( def: &ast::Item, edition: Edition ) -> SyntaxExtension { - let lhs_nm = ast::Ident::from_str("lhs").gensym(); - let rhs_nm = ast::Ident::from_str("rhs").gensym(); + let lhs_nm = ast::Ident::new(sym::lhs, def.span); + let rhs_nm = ast::Ident::new(sym::rhs, def.span); + let tt_spec = ast::Ident::new(sym::tt, def.span); // Parse the macro_rules! invocation let body = match def.node { @@ -266,9 +267,9 @@ pub fn compile( let argument_gram = vec![ quoted::TokenTree::Sequence(DelimSpan::dummy(), Lrc::new(quoted::SequenceRepetition { tts: vec![ - quoted::TokenTree::MetaVarDecl(def.span, lhs_nm, ast::Ident::from_str("tt")), + quoted::TokenTree::MetaVarDecl(def.span, lhs_nm, tt_spec), quoted::TokenTree::token(token::FatArrow, def.span), - quoted::TokenTree::MetaVarDecl(def.span, rhs_nm, ast::Ident::from_str("tt")), + quoted::TokenTree::MetaVarDecl(def.span, rhs_nm, tt_spec), ], separator: Some(Token::new( if body.legacy { token::Semi } else { token::Comma }, def.span @@ -1115,10 +1116,9 @@ fn has_legal_fragment_specifier(sess: &ParseSess, tok: "ed::TokenTree) -> Result<(), String> { debug!("has_legal_fragment_specifier({:?})", tok); if let quoted::TokenTree::MetaVarDecl(_, _, ref frag_spec) = *tok { - let frag_name = frag_spec.as_str(); let frag_span = tok.span(); - if !is_legal_fragment_specifier(sess, features, attrs, &frag_name, frag_span) { - return Err(frag_name.to_string()); + if !is_legal_fragment_specifier(sess, features, attrs, frag_spec.name, frag_span) { + return Err(frag_spec.to_string()); } } Ok(()) @@ -1127,7 +1127,7 @@ fn has_legal_fragment_specifier(sess: &ParseSess, fn is_legal_fragment_specifier(_sess: &ParseSess, _features: &Features, _attrs: &[ast::Attribute], - frag_name: &str, + frag_name: Symbol, _frag_span: Span) -> bool { /* * If new fragment specifiers are invented in nightly, `_sess`, @@ -1136,9 +1136,9 @@ fn is_legal_fragment_specifier(_sess: &ParseSess, * this function. */ match frag_name { - "item" | "block" | "stmt" | "expr" | "pat" | "lifetime" | - "path" | "ty" | "ident" | "meta" | "tt" | "vis" | "literal" | - "" => true, + sym::item | sym::block | sym::stmt | sym::expr | sym::pat | + sym::lifetime | sym::path | sym::ty | sym::ident | sym::meta | sym::tt | + sym::vis | sym::literal | kw::Invalid => true, _ => false, } } diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs index 1998ec19f13bf..cbaf12529c101 100644 --- a/src/libsyntax/test.rs +++ b/src/libsyntax/test.rs @@ -327,7 +327,7 @@ fn mk_main(cx: &mut TestCtxt<'_>) -> P { // } let sp = ignored_span(cx, DUMMY_SP); let ecx = &cx.ext_cx; - let test_id = ecx.ident_of("test").gensym(); + let test_id = Ident::with_empty_ctxt(sym::test); // test::test_main_static(...) let mut test_runner = cx.test_runner.clone().unwrap_or( @@ -350,7 +350,7 @@ fn mk_main(cx: &mut TestCtxt<'_>) -> P { let test_extern_stmt = ecx.stmt_item(sp, ecx.item(sp, test_id, vec![], - ast::ItemKind::ExternCrate(Some(sym::test)) + ast::ItemKind::ExternCrate(None) )); // pub fn main() { ... } diff --git a/src/libsyntax/util/parser.rs b/src/libsyntax/util/parser.rs index 69dd96625cc02..fcecee8c57fc9 100644 --- a/src/libsyntax/util/parser.rs +++ b/src/libsyntax/util/parser.rs @@ -234,7 +234,7 @@ pub const PREC_RESET: i8 = -100; pub const PREC_CLOSURE: i8 = -40; pub const PREC_JUMP: i8 = -30; pub const PREC_RANGE: i8 = -10; -// The range 2 ... 14 is reserved for AssocOp binary operator precedences. +// The range 2..=14 is reserved for AssocOp binary operator precedences. pub const PREC_PREFIX: i8 = 50; pub const PREC_POSTFIX: i8 = 60; pub const PREC_PAREN: i8 = 99; diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs index 9ca64a1231f08..f121fe17a720f 100644 --- a/src/libsyntax_pos/symbol.rs +++ b/src/libsyntax_pos/symbol.rs @@ -157,6 +157,7 @@ symbols! { bin, bind_by_move_pattern_guards, block, + bool, borrowck_graphviz_postflow, borrowck_graphviz_preflow, box_patterns, @@ -171,6 +172,7 @@ symbols! { cfg_target_has_atomic, cfg_target_thread_local, cfg_target_vendor, + char, clone, Clone, clone_closures, @@ -351,6 +353,7 @@ symbols! { label_break_value, lang, lang_items, + lhs, lib, lifetime, link, @@ -511,6 +514,7 @@ symbols! { result, Result, Return, + rhs, rlib, rt, rtm_target_feature, 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] 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`. diff --git a/src/test/ui/issues/issue-61106.rs b/src/test/ui/issues/issue-61106.rs new file mode 100644 index 0000000000000..308ef1de3ccc3 --- /dev/null +++ b/src/test/ui/issues/issue-61106.rs @@ -0,0 +1,6 @@ +fn main() { + let x = String::new(); + foo(x.clone()); //~ ERROR mismatched types +} + +fn foo(_: &str) {} diff --git a/src/test/ui/issues/issue-61106.stderr b/src/test/ui/issues/issue-61106.stderr new file mode 100644 index 0000000000000..ca67d51492845 --- /dev/null +++ b/src/test/ui/issues/issue-61106.stderr @@ -0,0 +1,15 @@ +error[E0308]: mismatched types + --> $DIR/issue-61106.rs:3:9 + | +LL | foo(x.clone()); + | ^^^^^^^^^ + | | + | expected &str, found struct `std::string::String` + | help: consider borrowing here: `&x` + | + = note: expected type `&str` + found type `std::string::String` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. 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() { } 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() {}