diff options
| author | bors <bors@rust-lang.org> | 2020-03-15 17:27:47 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-03-15 17:27:47 +0000 |
| commit | e0f5df017368dc3f7cb458fc6d5a5e0420e1d2e5 (patch) | |
| tree | 9c345daf32ba2b8a08337ccac954bb9ae905ca48 /src/liballoc | |
| parent | 5da2e53f471f5eea60f534845b90c97ecabb71cb (diff) | |
| parent | bde77af0944e7b6f666b64f92bc30f8fd55296d2 (diff) | |
| download | rust-e0f5df017368dc3f7cb458fc6d5a5e0420e1d2e5.tar.gz rust-e0f5df017368dc3f7cb458fc6d5a5e0420e1d2e5.zip | |
Auto merge of #70024 - Centril:rollup-cppmaxr, r=Centril
Rollup of 8 pull requests Successful merges: - #69528 (Add undo_leak to reset RefCell borrow state) - #69589 (ast: `Mac`/`Macro` -> `MacCall`) - #69661 (Implement From<&mut str> for String) - #69988 (rustc_metadata: Remove `rmeta::MacroDef`) - #70006 (resolve: Fix two issues in fresh binding disambiguation) - #70011 (def_collector: Fully visit async functions) - #70013 (Return feature gate as a `Symbol` ) - #70018 (Fix "since" field for `Once::is_complete`'s `#[stable]` attribute) Failed merges: r? @ghost
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/string.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index c95f79472fe..0e48f1548e6 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -2225,6 +2225,17 @@ impl From<&str> for String { } } +#[stable(feature = "from_mut_str_for_string", since = "1.44.0")] +impl From<&mut str> for String { + /// Converts a `&mut str` into a `String`. + /// + /// The result is allocated on the heap. + #[inline] + fn from(s: &mut str) -> String { + s.to_owned() + } +} + #[stable(feature = "from_ref_string", since = "1.35.0")] impl From<&String> for String { #[inline] |
