Skip to content

Commit f907629

Browse files
committed
Auto merge of #63001 - Centril:rollup-up9baiv, r=Centril
Rollup of 14 pull requests Successful merges: - #62084 (allow clippy::unreadable_literal in unicode tables) - #62421 (Introduce `as_deref` to Option) - #62692 (rustc: precompute the largest Niche and store it in LayoutDetails.) - #62801 (Remove support for -Zlower-128bit-ops) - #62828 (Remove vector fadd/fmul reduction workarounds) - #62862 (code cleanup) - #62897 (Attempt to fix backtrace tests on i686-msvc) - #62904 (Disable d32 on armv6 hf targets) - #62907 (Initialize the MSP430 AsmParser) - #62956 (Implement slow-path for FirstSets::first) - #62963 (Allow lexer to recover from some homoglyphs) - #62970 (ci: gate toolstate repo pushes on the TOOLSTATE_PUBLISH envvar) - #62983 (Remove needless indirection through Rc) - #62985 (librustc_errors: Support ui-testing flag in annotate-snippet emitter) Failed merges: r? @ghost
2 parents 4268e7e + 5492622 commit f907629

File tree

88 files changed

+885
-2247
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+885
-2247
lines changed

Cargo.lock

+35-36
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dependencies = [
1717
name = "alloc"
1818
version = "0.0.0"
1919
dependencies = [
20-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
20+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
2121
"core 0.0.0",
2222
"rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
2323
"rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -44,6 +44,11 @@ dependencies = [
4444
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
4545
]
4646

47+
[[package]]
48+
name = "annotate-snippets"
49+
version = "0.6.1"
50+
source = "registry+https://github.com/rust-lang/crates.io-index"
51+
4752
[[package]]
4853
name = "ansi_term"
4954
version = "0.11.0"
@@ -97,32 +102,26 @@ dependencies = [
97102
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
98103
]
99104

100-
[[package]]
101-
name = "autocfg"
102-
version = "0.1.4"
103-
source = "registry+https://github.com/rust-lang/crates.io-index"
104-
105105
[[package]]
106106
name = "backtrace"
107-
version = "0.3.29"
107+
version = "0.3.33"
108108
source = "registry+https://github.com/rust-lang/crates.io-index"
109109
dependencies = [
110-
"autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
111-
"backtrace-sys 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
110+
"backtrace-sys 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)",
112111
"cfg-if 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
113-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
112+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
114113
"libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
115114
"rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
116115
"rustc-std-workspace-core 1.0.0",
117116
]
118117

119118
[[package]]
120119
name = "backtrace-sys"
121-
version = "0.1.27"
120+
version = "0.1.30"
122121
source = "registry+https://github.com/rust-lang/crates.io-index"
123122
dependencies = [
124123
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
125-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
124+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
126125
"libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
127126
"rustc-std-workspace-core 1.0.0",
128127
]
@@ -335,7 +334,7 @@ name = "cfg-if"
335334
version = "0.1.8"
336335
source = "registry+https://github.com/rust-lang/crates.io-index"
337336
dependencies = [
338-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
337+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
339338
"rustc-std-workspace-core 1.0.0",
340339
]
341340

@@ -464,7 +463,7 @@ dependencies = [
464463

465464
[[package]]
466465
name = "compiler_builtins"
467-
version = "0.1.17"
466+
version = "0.1.18"
468467
source = "registry+https://github.com/rust-lang/crates.io-index"
469468
dependencies = [
470469
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -795,7 +794,7 @@ name = "dlmalloc"
795794
version = "0.1.3"
796795
source = "registry+https://github.com/rust-lang/crates.io-index"
797796
dependencies = [
798-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
797+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
799798
"libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
800799
"rustc-std-workspace-core 1.0.0",
801800
]
@@ -868,7 +867,7 @@ name = "error-chain"
868867
version = "0.12.0"
869868
source = "registry+https://github.com/rust-lang/crates.io-index"
870869
dependencies = [
871-
"backtrace 0.3.29 (registry+https://github.com/rust-lang/crates.io-index)",
870+
"backtrace 0.3.33 (registry+https://github.com/rust-lang/crates.io-index)",
872871
]
873872

874873
[[package]]
@@ -883,7 +882,7 @@ name = "failure"
883882
version = "0.1.5"
884883
source = "registry+https://github.com/rust-lang/crates.io-index"
885884
dependencies = [
886-
"backtrace 0.3.29 (registry+https://github.com/rust-lang/crates.io-index)",
885+
"backtrace 0.3.33 (registry+https://github.com/rust-lang/crates.io-index)",
887886
"failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
888887
]
889888

@@ -960,7 +959,7 @@ name = "fortanix-sgx-abi"
960959
version = "0.3.2"
961960
source = "registry+https://github.com/rust-lang/crates.io-index"
962961
dependencies = [
963-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
962+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
964963
"rustc-std-workspace-core 1.0.0",
965964
]
966965

@@ -1137,7 +1136,7 @@ name = "hashbrown"
11371136
version = "0.4.0"
11381137
source = "registry+https://github.com/rust-lang/crates.io-index"
11391138
dependencies = [
1140-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
1139+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
11411140
"rustc-std-workspace-alloc 1.0.0",
11421141
"rustc-std-workspace-core 1.0.0",
11431142
]
@@ -1955,7 +1954,7 @@ dependencies = [
19551954
name = "panic_abort"
19561955
version = "0.0.0"
19571956
dependencies = [
1958-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
1957+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
19591958
"core 0.0.0",
19601959
"libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
19611960
]
@@ -1966,7 +1965,7 @@ version = "0.0.0"
19661965
dependencies = [
19671966
"alloc 0.0.0",
19681967
"cfg-if 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
1969-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
1968+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
19701969
"core 0.0.0",
19711970
"libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
19721971
"unwind 0.0.0",
@@ -2137,7 +2136,7 @@ name = "profiler_builtins"
21372136
version = "0.0.0"
21382137
dependencies = [
21392138
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
2140-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
2139+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
21412140
"core 0.0.0",
21422141
]
21432142

@@ -2513,7 +2512,7 @@ name = "rustc"
25132512
version = "0.0.0"
25142513
dependencies = [
25152514
"arena 0.0.0",
2516-
"backtrace 0.3.29 (registry+https://github.com/rust-lang/crates.io-index)",
2515+
"backtrace 0.3.33 (registry+https://github.com/rust-lang/crates.io-index)",
25172516
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
25182517
"byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
25192518
"chalk-engine 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2674,7 +2673,7 @@ name = "rustc-demangle"
26742673
version = "0.1.15"
26752674
source = "registry+https://github.com/rust-lang/crates.io-index"
26762675
dependencies = [
2677-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
2676+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
26782677
"rustc-std-workspace-core 1.0.0",
26792678
]
26802679

@@ -2766,7 +2765,7 @@ dependencies = [
27662765
"alloc 0.0.0",
27672766
"build_helper 0.1.0",
27682767
"cmake 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
2769-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
2768+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
27702769
"core 0.0.0",
27712770
]
27722771

@@ -2895,7 +2894,7 @@ dependencies = [
28952894
name = "rustc_errors"
28962895
version = "0.0.0"
28972896
dependencies = [
2898-
"annotate-snippets 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
2897+
"annotate-snippets 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
28992898
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
29002899
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
29012900
"rustc_data_structures 0.0.0",
@@ -2988,7 +2987,7 @@ dependencies = [
29882987
"alloc 0.0.0",
29892988
"build_helper 0.1.0",
29902989
"cmake 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
2991-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
2990+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
29922991
"core 0.0.0",
29932992
]
29942993

@@ -3051,7 +3050,7 @@ dependencies = [
30513050
"alloc 0.0.0",
30523051
"build_helper 0.1.0",
30533052
"cmake 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
3054-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
3053+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
30553054
"core 0.0.0",
30563055
]
30573056

@@ -3169,7 +3168,7 @@ dependencies = [
31693168
"alloc 0.0.0",
31703169
"build_helper 0.1.0",
31713170
"cmake 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
3172-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
3171+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
31733172
"core 0.0.0",
31743173
]
31753174

@@ -3473,10 +3472,10 @@ name = "std"
34733472
version = "0.0.0"
34743473
dependencies = [
34753474
"alloc 0.0.0",
3476-
"backtrace 0.3.29 (registry+https://github.com/rust-lang/crates.io-index)",
3475+
"backtrace 0.3.33 (registry+https://github.com/rust-lang/crates.io-index)",
34773476
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
34783477
"cfg-if 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
3479-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
3478+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
34803479
"core 0.0.0",
34813480
"dlmalloc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
34823481
"fortanix-sgx-abi 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -4103,7 +4102,7 @@ version = "0.0.0"
41034102
dependencies = [
41044103
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
41054104
"cfg-if 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
4106-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
4105+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
41074106
"core 0.0.0",
41084107
"libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
41094108
]
@@ -4284,15 +4283,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
42844283
"checksum aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e6f484ae0c99fec2e858eb6134949117399f222608d84cadb3f58c1f97c2364c"
42854284
"checksum ammonia 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "384d704f242a0a9faf793fff775a0be6ab9aa27edabffa097331d73779142520"
42864285
"checksum annotate-snippets 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e8bcdcd5b291ce85a78f2b9d082a8de9676c12b1840d386d67bc5eea6f9d2b4e"
4286+
"checksum annotate-snippets 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c7021ce4924a3f25f802b2cccd1af585e39ea1a363a1aa2e72afe54b67a3a7a7"
42874287
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
42884288
"checksum arc-swap 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1025aeae2b664ca0ea726a89d574fe8f4e77dd712d443236ad1de00379450cf6"
42894289
"checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392"
42904290
"checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee"
42914291
"checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef"
42924292
"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
4293-
"checksum autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0e49efa51329a5fd37e7c79db4621af617cd4e3e5bc224939808d076077077bf"
4294-
"checksum backtrace 0.3.29 (registry+https://github.com/rust-lang/crates.io-index)" = "2d631cd7af21b7ff796293f1990104e3cdb606852863bac32f000c193aa35dfb"
4295-
"checksum backtrace-sys 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)" = "6ea90dd7b012b3d1a2cb6bec16670a0db2c95d4e931e84f4047e0460c1b34c8d"
4293+
"checksum backtrace 0.3.33 (registry+https://github.com/rust-lang/crates.io-index)" = "88fb679bc9af8fa639198790a77f52d345fe13656c08b43afa9424c206b731c6"
4294+
"checksum backtrace-sys 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)" = "5b3a000b9c543553af61bc01cbfc403b04b5caa9e421033866f2e98061eb3e61"
42964295
"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e"
42974296
"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd"
42984297
"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400"
@@ -4317,7 +4316,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
43174316
"checksum colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b0aa3473e85a3161b59845d6096b289bb577874cafeaf75ea1b1beaa6572c7fc"
43184317
"checksum commoncrypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d056a8586ba25a1e4d61cb090900e495952c7886786fc55f909ab2f819b69007"
43194318
"checksum commoncrypto-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fed34f46747aa73dfaa578069fd8279d2818ade2b55f38f22a9401c7f4083e2"
4320-
"checksum compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "ad9b4731b9e701aefe9e6bd1e9173f30526661508f9aaadaa5caec25ddf95585"
4319+
"checksum compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "ef1c086a06d6f52f9c0d50cacdc021bfb6034ddeec9fb7e62f099f13f65472f4"
43214320
"checksum compiletest_rs 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "f40ecc9332b68270998995c00f8051ee856121764a0d3230e64c9efd059d27b6"
43224321
"checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e"
43234322
"checksum core-foundation 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4e2640d6d0bf22e82bed1b73c6aef8d5dd31e5abe6666c57e6d45e2649f4f887"

src/ci/docker/x86_64-gnu-tools/checktools.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ $COMMIT\t$(cat "$TOOLSTATE_FILE")
112112
}
113113

114114
if [ "$RUST_RELEASE_CHANNEL" = nightly ]; then
115-
if [ -n "${TOOLSTATE_REPO_ACCESS_TOKEN+is_set}" ]; then
115+
if [ -n "${TOOLSTATE_PUBLISH+is_set}" ]; then
116116
. "$(dirname $0)/repo.sh"
117117
MESSAGE_FILE=$(mktemp -t msg.XXXXXX)
118118
echo "($OS CI update)" > "$MESSAGE_FILE"

src/libcore/option.rs

+14-3
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
#![stable(feature = "rust1", since = "1.0.0")]
137137

138138
use crate::iter::{FromIterator, FusedIterator, TrustedLen};
139-
use crate::{convert, fmt, hint, mem, ops::{self, Deref}};
139+
use crate::{convert, fmt, hint, mem, ops::{self, Deref, DerefMut}};
140140
use crate::pin::Pin;
141141

142142
// Note that this is not a lang item per se, but it has a hidden dependency on
@@ -1104,17 +1104,28 @@ impl<T: Default> Option<T> {
11041104

11051105
#[unstable(feature = "inner_deref", reason = "newly added", issue = "50264")]
11061106
impl<T: Deref> Option<T> {
1107-
/// Converts from `&Option<T>` to `Option<&T::Target>`.
1107+
/// Converts from `Option<T>` (or `&Option<T>`) to `Option<&T::Target>`.
11081108
///
11091109
/// Leaves the original Option in-place, creating a new one with a reference
11101110
/// to the original one, additionally coercing the contents via [`Deref`].
11111111
///
11121112
/// [`Deref`]: ../../std/ops/trait.Deref.html
1113-
pub fn deref(&self) -> Option<&T::Target> {
1113+
pub fn as_deref(&self) -> Option<&T::Target> {
11141114
self.as_ref().map(|t| t.deref())
11151115
}
11161116
}
11171117

1118+
#[unstable(feature = "inner_deref", reason = "newly added", issue = "50264")]
1119+
impl<T: DerefMut> Option<T> {
1120+
/// Converts from `Option<T>` (or `&mut Option<T>`) to `Option<&mut T::Target>`.
1121+
///
1122+
/// Leaves the original `Option` in-place, creating a new one containing a mutable reference to
1123+
/// the inner type's `Deref::Target` type.
1124+
pub fn as_deref_mut(&mut self) -> Option<&mut T::Target> {
1125+
self.as_mut().map(|t| t.deref_mut())
1126+
}
1127+
}
1128+
11181129
impl<T, E> Option<Result<T, E>> {
11191130
/// Transposes an `Option` of a [`Result`] into a [`Result`] of an `Option`.
11201131
///

0 commit comments

Comments
 (0)