diff options
| author | Finn Bear <finnbearlabs@gmail.com> | 2023-05-16 13:39:17 -0700 |
|---|---|---|
| committer | Finn Bear <finnbearlabs@gmail.com> | 2023-05-16 13:39:17 -0700 |
| commit | f0c9c1eb19864d95e6348d79c54fa4a412019f3a (patch) | |
| tree | 2158be375e94a880abebce93bb174628edb1f903 /library/alloc | |
| parent | b652d9a0fd5c5a7eeacd1ae8299166941c221230 (diff) | |
| download | rust-f0c9c1eb19864d95e6348d79c54fa4a412019f3a.tar.gz rust-f0c9c1eb19864d95e6348d79c54fa4a412019f3a.zip | |
Use an unbounded lifetime in String::leak.
Diffstat (limited to 'library/alloc')
| -rw-r--r-- | library/alloc/src/string.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index 088139a6907..559704d90af 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -1851,7 +1851,7 @@ impl String { } /// Consumes and leaks the `String`, returning a mutable reference to the contents, - /// `&'static mut str`. + /// `&'a mut str`. /// /// This is mainly useful for data that lives for the remainder of /// the program's life. Dropping the returned reference will cause a memory @@ -1874,7 +1874,7 @@ impl String { /// ``` #[unstable(feature = "string_leak", issue = "102929")] #[inline] - pub fn leak(self) -> &'static mut str { + pub fn leak<'a>(self) -> &'a mut str { let slice = self.vec.leak(); unsafe { from_utf8_unchecked_mut(slice) } } |
