diff options
| author | bors <bors@rust-lang.org> | 2015-08-14 01:06:37 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-08-14 01:06:37 +0000 |
| commit | e2bebf32fa4bc4dfe8b7cacb713091b8ccbf62bf (patch) | |
| tree | 5be3aa2ddda81822d597fdcedd3d6f916ced1e52 /src/libcollections | |
| parent | 82b89645fb6ec31138d5788b588ddd7e44c434fa (diff) | |
| parent | bec64090a70a25c75b1856cf35dcdcf20993f8f8 (diff) | |
| download | rust-e2bebf32fa4bc4dfe8b7cacb713091b8ccbf62bf.tar.gz rust-e2bebf32fa4bc4dfe8b7cacb713091b8ccbf62bf.zip | |
Auto merge of #27696 - bluss:into-boxed-str, r=alexcrichton
Rename String::into_boxed_slice -> into_boxed_str This is the name that was decided in rust-lang/rfcs#1152, and it's better if we say “boxed str” for `Box<str>`. The old name `String::into_boxed_slice` is deprecated.
Diffstat (limited to 'src/libcollections')
| -rw-r--r-- | src/libcollections/string.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index e5886800748..f468fc25ca9 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -729,10 +729,20 @@ impl String { /// Note that this will drop any excess capacity. #[unstable(feature = "box_str", reason = "recently added, matches RFC")] - pub fn into_boxed_slice(self) -> Box<str> { + pub fn into_boxed_str(self) -> Box<str> { let slice = self.vec.into_boxed_slice(); unsafe { mem::transmute::<Box<[u8]>, Box<str>>(slice) } } + + /// Converts the string into `Box<str>`. + /// + /// Note that this will drop any excess capacity. + #[unstable(feature = "box_str", + reason = "recently added, matches RFC")] + #[deprecated(since = "1.4.0", reason = "renamed to `into_boxed_str`")] + pub fn into_boxed_slice(self) -> Box<str> { + self.into_boxed_str() + } } impl FromUtf8Error { |
