Skip to content

Commit c43753f

Browse files
committed
Auto merge of rust-lang#63015 - Centril:rollup-ydhpcas, r=Centril
Rollup of 22 pull requests Successful merges: - rust-lang#62084 (allow clippy::unreadable_literal in unicode tables) - rust-lang#62120 (Add missing type links in documentation) - rust-lang#62310 (Add missing doc links in boxed module) - rust-lang#62421 (Introduce `as_deref` to Option) - rust-lang#62583 (Implement Unpin for all raw pointers) - rust-lang#62692 (rustc: precompute the largest Niche and store it in LayoutDetails.) - rust-lang#62801 (Remove support for -Zlower-128bit-ops) - rust-lang#62828 (Remove vector fadd/fmul reduction workarounds) - rust-lang#62862 (code cleanup) - rust-lang#62904 (Disable d32 on armv6 hf targets) - rust-lang#62907 (Initialize the MSP430 AsmParser) - rust-lang#62956 (Implement slow-path for FirstSets::first) - rust-lang#62963 (Allow lexer to recover from some homoglyphs) - rust-lang#62964 (clarify and unify some type test names) - rust-lang#62970 (ci: gate toolstate repo pushes on the TOOLSTATE_PUBLISH envvar) - rust-lang#62980 (std: Add more accessors for `Metadata` on Windows) - rust-lang#62983 (Remove needless indirection through Rc) - rust-lang#62985 (librustc_errors: Support ui-testing flag in annotate-snippet emitter) - rust-lang#63002 (error_index_generator should output stdout/stderr when it panics.) - rust-lang#63004 (Add test for issue-54062) - rust-lang#63007 (ci: debug network failures while downloading awscli from PyPI) - rust-lang#63009 (Remove redundant `mut` from variable declaration.) Failed merges: r? @ghost
2 parents 1a56336 + 232d27c commit c43753f

File tree

101 files changed

+1106
-2323
lines changed

Some content is hidden

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

101 files changed

+1106
-2323
lines changed

.azure-pipelines/steps/run.yml

+27-1
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,35 @@ steps:
140140
# images, etc.
141141
- bash: |
142142
set -e
143+
# Temporary code to debug #62967.
144+
debug_failed_connections() {
145+
echo "trying to ping pypi.org"
146+
ping pypi.org -c10 || true
147+
echo "trying to ping google.com"
148+
ping google.com -c10 || true
149+
echo "trying to ping 8.8.8.8"
150+
ping 8.8.8.8 -c10 || true
151+
echo "trying to download pypi.org"
152+
curl https://pypi.org || true
153+
echo "trying to download from our S3 bucket"
154+
curl https://rust-lang-ci2.s3.amazonaws.com || true
155+
echo "trying to dig pypi.org"
156+
dig pypi.org || true
157+
echo "trying to dig files.pythonhosted.org"
158+
dig files.pythonhosted.org || true
159+
echo "trying to connect to pypi.org with openssl"
160+
echo | openssl s_client -connect pypi.org:443 || true
161+
echo "trying to connect to files.pythonhosted.org with openssl"
162+
echo | openssl s_client -connect files.pythonhosted.org:443 || true
163+
}
164+
debug_failed_connections_and_fail() {
165+
debug_failed_connections
166+
return 1
167+
}
143168
source src/ci/shared.sh
144169
sudo apt-get install -y python3-setuptools
145-
retry pip3 install -r src/ci/awscli-requirements.txt --upgrade --user
170+
debug_failed_connections
171+
retry pip3 install -r src/ci/awscli-requirements.txt --upgrade --user || debug_failed_connections_and_fail
146172
echo "##vso[task.prependpath]$HOME/.local/bin"
147173
displayName: Install awscli (Linux)
148174
condition: and(succeeded(), not(variables.SKIP_JOB), eq(variables['Agent.OS'], 'Linux'))

Cargo.lock

+26-20
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"
@@ -110,7 +115,7 @@ dependencies = [
110115
"autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
111116
"backtrace-sys 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
112117
"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)",
118+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
114119
"libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
115120
"rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
116121
"rustc-std-workspace-core 1.0.0",
@@ -122,7 +127,7 @@ version = "0.1.27"
122127
source = "registry+https://github.com/rust-lang/crates.io-index"
123128
dependencies = [
124129
"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)",
130+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
126131
"libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
127132
"rustc-std-workspace-core 1.0.0",
128133
]
@@ -331,7 +336,7 @@ name = "cfg-if"
331336
version = "0.1.8"
332337
source = "registry+https://github.com/rust-lang/crates.io-index"
333338
dependencies = [
334-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
339+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
335340
"rustc-std-workspace-core 1.0.0",
336341
]
337342

@@ -460,7 +465,7 @@ dependencies = [
460465

461466
[[package]]
462467
name = "compiler_builtins"
463-
version = "0.1.17"
468+
version = "0.1.18"
464469
source = "registry+https://github.com/rust-lang/crates.io-index"
465470
dependencies = [
466471
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -791,7 +796,7 @@ name = "dlmalloc"
791796
version = "0.1.3"
792797
source = "registry+https://github.com/rust-lang/crates.io-index"
793798
dependencies = [
794-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
799+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
795800
"libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
796801
"rustc-std-workspace-core 1.0.0",
797802
]
@@ -956,7 +961,7 @@ name = "fortanix-sgx-abi"
956961
version = "0.3.2"
957962
source = "registry+https://github.com/rust-lang/crates.io-index"
958963
dependencies = [
959-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
964+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
960965
"rustc-std-workspace-core 1.0.0",
961966
]
962967

@@ -1133,7 +1138,7 @@ name = "hashbrown"
11331138
version = "0.4.0"
11341139
source = "registry+https://github.com/rust-lang/crates.io-index"
11351140
dependencies = [
1136-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
1141+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
11371142
"rustc-std-workspace-alloc 1.0.0",
11381143
"rustc-std-workspace-core 1.0.0",
11391144
]
@@ -1951,7 +1956,7 @@ dependencies = [
19511956
name = "panic_abort"
19521957
version = "0.0.0"
19531958
dependencies = [
1954-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
1959+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
19551960
"core 0.0.0",
19561961
"libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
19571962
]
@@ -1962,7 +1967,7 @@ version = "0.0.0"
19621967
dependencies = [
19631968
"alloc 0.0.0",
19641969
"cfg-if 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
1965-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
1970+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
19661971
"core 0.0.0",
19671972
"libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
19681973
"unwind 0.0.0",
@@ -2133,7 +2138,7 @@ name = "profiler_builtins"
21332138
version = "0.0.0"
21342139
dependencies = [
21352140
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
2136-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
2141+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
21372142
"core 0.0.0",
21382143
]
21392144

@@ -2670,7 +2675,7 @@ name = "rustc-demangle"
26702675
version = "0.1.15"
26712676
source = "registry+https://github.com/rust-lang/crates.io-index"
26722677
dependencies = [
2673-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
2678+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
26742679
"rustc-std-workspace-core 1.0.0",
26752680
]
26762681

@@ -2762,7 +2767,7 @@ dependencies = [
27622767
"alloc 0.0.0",
27632768
"build_helper 0.1.0",
27642769
"cmake 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
2765-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
2770+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
27662771
"core 0.0.0",
27672772
]
27682773

@@ -2891,7 +2896,7 @@ dependencies = [
28912896
name = "rustc_errors"
28922897
version = "0.0.0"
28932898
dependencies = [
2894-
"annotate-snippets 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
2899+
"annotate-snippets 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
28952900
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
28962901
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
28972902
"rustc_data_structures 0.0.0",
@@ -2984,7 +2989,7 @@ dependencies = [
29842989
"alloc 0.0.0",
29852990
"build_helper 0.1.0",
29862991
"cmake 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
2987-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
2992+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
29882993
"core 0.0.0",
29892994
]
29902995

@@ -3047,7 +3052,7 @@ dependencies = [
30473052
"alloc 0.0.0",
30483053
"build_helper 0.1.0",
30493054
"cmake 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
3050-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
3055+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
30513056
"core 0.0.0",
30523057
]
30533058

@@ -3165,7 +3170,7 @@ dependencies = [
31653170
"alloc 0.0.0",
31663171
"build_helper 0.1.0",
31673172
"cmake 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
3168-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
3173+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
31693174
"core 0.0.0",
31703175
]
31713176

@@ -3472,7 +3477,7 @@ dependencies = [
34723477
"backtrace 0.3.29 (registry+https://github.com/rust-lang/crates.io-index)",
34733478
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
34743479
"cfg-if 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
3475-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
3480+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
34763481
"core 0.0.0",
34773482
"dlmalloc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
34783483
"fortanix-sgx-abi 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -4099,7 +4104,7 @@ version = "0.0.0"
40994104
dependencies = [
41004105
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
41014106
"cfg-if 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
4102-
"compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
4107+
"compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
41034108
"core 0.0.0",
41044109
"libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)",
41054110
]
@@ -4280,6 +4285,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
42804285
"checksum aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e6f484ae0c99fec2e858eb6134949117399f222608d84cadb3f58c1f97c2364c"
42814286
"checksum ammonia 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "384d704f242a0a9faf793fff775a0be6ab9aa27edabffa097331d73779142520"
42824287
"checksum annotate-snippets 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e8bcdcd5b291ce85a78f2b9d082a8de9676c12b1840d386d67bc5eea6f9d2b4e"
4288+
"checksum annotate-snippets 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c7021ce4924a3f25f802b2cccd1af585e39ea1a363a1aa2e72afe54b67a3a7a7"
42834289
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
42844290
"checksum arc-swap 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1025aeae2b664ca0ea726a89d574fe8f4e77dd712d443236ad1de00379450cf6"
42854291
"checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392"
@@ -4313,7 +4319,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
43134319
"checksum colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b0aa3473e85a3161b59845d6096b289bb577874cafeaf75ea1b1beaa6572c7fc"
43144320
"checksum commoncrypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d056a8586ba25a1e4d61cb090900e495952c7886786fc55f909ab2f819b69007"
43154321
"checksum commoncrypto-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fed34f46747aa73dfaa578069fd8279d2818ade2b55f38f22a9401c7f4083e2"
4316-
"checksum compiler_builtins 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "ad9b4731b9e701aefe9e6bd1e9173f30526661508f9aaadaa5caec25ddf95585"
4322+
"checksum compiler_builtins 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "ef1c086a06d6f52f9c0d50cacdc021bfb6034ddeec9fb7e62f099f13f65472f4"
43174323
"checksum compiletest_rs 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "f40ecc9332b68270998995c00f8051ee856121764a0d3230e64c9efd059d27b6"
43184324
"checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e"
43194325
"checksum core-foundation 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4e2640d6d0bf22e82bed1b73c6aef8d5dd31e5abe6666c57e6d45e2649f4f887"

src/bootstrap/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1493,7 +1493,7 @@ impl Step for ErrorIndex {
14931493

14941494
builder.info(&format!("Testing error-index stage{}", compiler.stage));
14951495
let _time = util::timeit(&builder);
1496-
builder.run(&mut tool);
1496+
builder.run_quiet(&mut tool);
14971497
markdown_test(builder, compiler, &output);
14981498
}
14991499
}

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/liballoc/boxed.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! A pointer type for heap allocation.
22
//!
3-
//! `Box<T>`, casually referred to as a 'box', provides the simplest form of
3+
//! [`Box<T>`], casually referred to as a 'box', provides the simplest form of
44
//! heap allocation in Rust. Boxes provide ownership for this allocation, and
55
//! drop their contents when they go out of scope.
66
//!
@@ -48,7 +48,7 @@
4848
//!
4949
//! It wouldn't work. This is because the size of a `List` depends on how many
5050
//! elements are in the list, and so we don't know how much memory to allocate
51-
//! for a `Cons`. By introducing a `Box`, which has a defined size, we know how
51+
//! for a `Cons`. By introducing a [`Box<T>`], which has a defined size, we know how
5252
//! big `Cons` needs to be.
5353
//!
5454
//! # Memory layout
@@ -59,15 +59,19 @@
5959
//! [`Layout`] used with the allocator is correct for the type. More precisely,
6060
//! a `value: *mut T` that has been allocated with the [`Global`] allocator
6161
//! with `Layout::for_value(&*value)` may be converted into a box using
62-
//! `Box::<T>::from_raw(value)`. Conversely, the memory backing a `value: *mut
63-
//! T` obtained from `Box::<T>::into_raw` may be deallocated using the
64-
//! [`Global`] allocator with `Layout::for_value(&*value)`.
62+
//! [`Box::<T>::from_raw(value)`]. Conversely, the memory backing a `value: *mut
63+
//! T` obtained from [`Box::<T>::into_raw`] may be deallocated using the
64+
//! [`Global`] allocator with [`Layout::for_value(&*value)`].
6565
//!
6666
//!
6767
//! [dereferencing]: ../../std/ops/trait.Deref.html
6868
//! [`Box`]: struct.Box.html
69+
//! [`Box<T>`]: struct.Box.html
70+
//! [`Box::<T>::from_raw(value)`]: struct.Box.html#method.from_raw
71+
//! [`Box::<T>::into_raw`]: struct.Box.html#method.into_raw
6972
//! [`Global`]: ../alloc/struct.Global.html
7073
//! [`Layout`]: ../alloc/struct.Layout.html
74+
//! [`Layout::for_value(&*value)`]: ../alloc/struct.Layout.html#method.for_value
7175
7276
#![stable(feature = "rust1", since = "1.0.0")]
7377

src/libcore/cmp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ impl Ordering {
319319
/// This method can be used to reverse a comparison:
320320
///
321321
/// ```
322-
/// let mut data: &mut [_] = &mut [2, 10, 5, 8];
322+
/// let data: &mut [_] = &mut [2, 10, 5, 8];
323323
///
324324
/// // sort the array from largest to smallest.
325325
/// data.sort_by(|a, b| a.cmp(b).reverse());

src/libcore/marker.rs

+6
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,12 @@ impl<'a, T: ?Sized + 'a> Unpin for &'a T {}
655655
#[stable(feature = "pin", since = "1.33.0")]
656656
impl<'a, T: ?Sized + 'a> Unpin for &'a mut T {}
657657

658+
#[stable(feature = "pin_raw", since = "1.38.0")]
659+
impl<T: ?Sized> Unpin for *const T {}
660+
661+
#[stable(feature = "pin_raw", since = "1.38.0")]
662+
impl<T: ?Sized> Unpin for *mut T {}
663+
658664
/// Implementations of `Copy` for primitive types.
659665
///
660666
/// Implementations that cannot be described in Rust

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)