Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking Issue for String::leak #102929

Closed
4 tasks done
finnbear opened this issue Oct 11, 2022 · 0 comments · Fixed by #109814
Closed
4 tasks done

Tracking Issue for String::leak #102929

finnbear opened this issue Oct 11, 2022 · 0 comments · Fixed by #109814
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@finnbear
Copy link
Contributor

finnbear commented Oct 11, 2022

Feature gate: #![feature(string_leak)]

This is a tracking issue for String::leak

impl String {
    pub fn leak<'a>(self) -> &'a mut str {
        let me = self.into_bytes().leak();
        // Safety: Bytes from a [`String`] are valid utf8.
        unsafe { std::str::from_utf8_unchecked_mut(me) }
    }	
}

Steps / History

Unresolved Questions

  • None yet.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

@finnbear finnbear added C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Oct 11, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Oct 22, 2022
…htriplett

(rust-lang#102929) Implement `String::leak` (attempt 2)

Implementation of `String::leak` (rust-lang#102929)

ACP: rust-lang/libs-team#109

Supersedes rust-lang#102941 (see previous reviews there)

`@rustbot` label +T-libs-api -T-libs
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Oct 22, 2022
…htriplett

(rust-lang#102929) Implement `String::leak` (attempt 2)

Implementation of `String::leak` (rust-lang#102929)

ACP: rust-lang/libs-team#109

Supersedes rust-lang#102941 (see previous reviews there)

``@rustbot`` label +T-libs-api -T-libs
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Oct 22, 2022
…htriplett

(rust-lang#102929) Implement `String::leak` (attempt 2)

Implementation of `String::leak` (rust-lang#102929)

ACP: rust-lang/libs-team#109

Supersedes rust-lang#102941 (see previous reviews there)

```@rustbot``` label +T-libs-api -T-libs
bors added a commit to rust-lang-ci/rust that referenced this issue Oct 22, 2022
Rollup of 7 pull requests

Successful merges:

 - rust-lang#102602 (Slightly tweak comments wrt `lint_overflowing_range_endpoint`)
 - rust-lang#103190 (rustdoc: render bounds of cross-crate GAT params)
 - rust-lang#103224 (Allow semicolon after closure within parentheses in macros)
 - rust-lang#103280 ((rust-lang#102929) Implement `String::leak` (attempt 2))
 - rust-lang#103329 (Add a forgotten check for NonNull::new_unchecked's precondition)
 - rust-lang#103346 (Adjust argument type for mutable with_metadata_of (rust-lang#75091))
 - rust-lang#103360 (Reduce false positives in msys2 detection)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors closed this as completed in b8f71ea Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant