diff options
| author | bors <bors@rust-lang.org> | 2019-05-01 17:24:11 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-05-01 17:24:11 +0000 |
| commit | 9b67bd42b7cbf97f72d039afcba02f5177d0d68c (patch) | |
| tree | b2bf473a8d54ef27fbf5b390e0fd4f411e792c9f /src/liballoc | |
| parent | 6cc24f26036b28fb3366de86efe3da6c4464057a (diff) | |
| parent | e5b69978c1137f05bf8b469875503d5f7fa7f747 (diff) | |
| download | rust-9b67bd42b7cbf97f72d039afcba02f5177d0d68c.tar.gz rust-9b67bd42b7cbf97f72d039afcba02f5177d0d68c.zip | |
Auto merge of #60435 - Centril:rollup-aa5lmuw, r=Centril
Rollup of 7 pull requests Successful merges: - #60287 (Use references for variances_of) - #60327 (Search for incompatible universes in borrow errors) - #60330 (Suggest using an inclusive range instead of an exclusive range when the endpoint overflows by 1) - #60366 (build-gcc: Create missing cc symlink) - #60369 (Support ZSTs in DispatchFromDyn) - #60404 (Implement `BorrowMut<str>` for `String`) - #60417 (Rename hir::ExprKind::Use to ::DropTemps and improve docs.) Failed merges: r? @ghost
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/str.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/liballoc/str.rs b/src/liballoc/str.rs index e5d4e1c533c..f66ff894ae8 100644 --- a/src/liballoc/str.rs +++ b/src/liballoc/str.rs @@ -28,7 +28,7 @@ // It's cleaner to just turn off the unused_imports warning than to fix them. #![allow(unused_imports)] -use core::borrow::Borrow; +use core::borrow::{Borrow, BorrowMut}; use core::str::pattern::{Pattern, Searcher, ReverseSearcher, DoubleEndedSearcher}; use core::mem; use core::ptr; @@ -190,6 +190,14 @@ impl Borrow<str> for String { } } +#[stable(feature = "string_borrow_mut", since = "1.36.0")] +impl BorrowMut<str> for String { + #[inline] + fn borrow_mut(&mut self) -> &mut str { + &mut self[..] + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl ToOwned for str { type Owned = String; |
