-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Add slice to the stack allocated string comment #104436
Add slice to the stack allocated string comment #104436
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (or someone else) soon. Please see the contribution instructions for more information. |
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
I'm not sure that I would agree that it's wrong. A byte array on the stack that's valid UTF-8 is a stack allocated string, just not a "String". |
The code example doesn't mention Type hinting |
I would prefer the explicitly annotated type if that helps you, I think; I'm not convinced this is a good clarification. In particular the string slice is very frequently stack "allocated" (i.e., the (ptr, len) pair), this is specifically describing the backing bytes, which I would not call a string slice. |
This makes sense, I wouldn't think this is wanted if The That comment made me think an owned I think this change could help people that might experience my situation. |
r=me with commits squashed, thanks! https://rustc-dev-guide.rust-lang.org/git.html#advanced-rebasing has some guidance on how to squash if you want it. |
c962e49
to
005c6df
Compare
@bors r+ rollup |
…ated-string-comment, r=Mark-Simulacrum Add slice to the stack allocated string comment Precise that the "stack allocated string" is not a string but a string slice. `@rustbot` label +A-docs
…iaskrgr Rollup of 14 pull requests Successful merges: - rust-lang#103876 (type alias impl trait: add tests showing that hidden type only outlives lifetimes that occur in bounds) - rust-lang#104427 (Explain why `rematch_impl` fails to be infallible) - rust-lang#104436 (Add slice to the stack allocated string comment) - rust-lang#104523 (Don't use periods in target names) - rust-lang#104627 (Print all features with --print target-features) - rust-lang#104911 (Make inferred_outlives_crate return Clause) - rust-lang#105002 (Add `PathBuf::as_mut_os_string` and `Path::as_mut_os_str`) - rust-lang#105023 (Statics used in reachable function's inline asm are reachable) - rust-lang#105045 (`rustc_ast_{passes,pretty}`: remove `ref` patterns) - rust-lang#105049 (Hermit: Minor build fixes) - rust-lang#105051 (Replace a macro with a function) - rust-lang#105062 (rustdoc: use shorthand background for rustdoc toggle CSS) - rust-lang#105066 (move `candidate_from_obligation` out of assembly) - rust-lang#105068 (Run patchelf also on rust-analyzer-proc-macro-srv.) Failed merges: - rust-lang#105050 (Remove useless borrows and derefs) r? `@ghost` `@rustbot` modify labels: rollup
Precise that the "stack allocated string" is not a string but a string slice.
@rustbot label +A-docs