-
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
[core/fmt] Replace checked slice indexing by unchecked to support panic-free code #132473
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @joboet (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
The safety comment could also mention that the reasoning
from here: #126425 (comment) |
That sounds good, please add such an explanation to the comment. |
Fixes rust-lang#126425 Replace the potentially panicking `[]` indexing with `get_unchecked()` to prevent linking with panic-related code.
4e02680
to
65d8f1b
Compare
Thank you! |
…joboet [core/fmt] Replace checked slice indexing by unchecked to support panic-free code Fixes rust-lang#126425 Replace the potentially panicking `[]` indexing with `get_unchecked()` to prevent linking with panic-related code.
…kingjubilee Rollup of 10 pull requests Successful merges: - rust-lang#129884 (mark some target features as 'forbidden' so they cannot be (un)set with -Ctarget-feature) - rust-lang#132153 (Stabilise `const_char_encode_utf16`.) - rust-lang#132473 ([core/fmt] Replace checked slice indexing by unchecked to support panic-free code) - rust-lang#132571 (add const_eval_select macro to reduce redundancy) - rust-lang#132587 (Revert "Avoid nested replacement ranges" from rust-lang#129346.) - rust-lang#132596 ([rustdoc] Fix `--show-coverage` when JSON output format is used) - rust-lang#132598 (Clippy: Move some attribute lints to be early pass (post expansion)) - rust-lang#132601 (Update books) - rust-lang#132606 (Improve example of `impl Pattern for &[char]`) - rust-lang#132609 (docs: fix grammar in doc comment at unix/process.rs) r? `@ghost` `@rustbot` modify labels: rollup
…joboet [core/fmt] Replace checked slice indexing by unchecked to support panic-free code Fixes rust-lang#126425 Replace the potentially panicking `[]` indexing with `get_unchecked()` to prevent linking with panic-related code.
Rollup of 9 pull requests Successful merges: - rust-lang#131153 (Improve duplicate derive Copy/Clone diagnostics) - rust-lang#131341 (Support clobber_abi and vector registers (clobber-only) in PowerPC inline assembly) - rust-lang#132025 (fix suggestion for diagnostic error E0027) - rust-lang#132153 (Stabilise `const_char_encode_utf16`.) - rust-lang#132303 (More tests for non-exhaustive C-like enums in FFI) - rust-lang#132473 ([core/fmt] Replace checked slice indexing by unchecked to support panic-free code) - rust-lang#132598 (Clippy: Move some attribute lints to be early pass (post expansion)) - rust-lang#132606 (Improve example of `impl Pattern for &[char]`) - rust-lang#132609 (docs: fix grammar in doc comment at unix/process.rs) r? `@ghost` `@rustbot` modify labels: rollup
…kingjubilee Rollup of 4 pull requests Successful merges: - rust-lang#132153 (Stabilise `const_char_encode_utf16`.) - rust-lang#132473 ([core/fmt] Replace checked slice indexing by unchecked to support panic-free code) - rust-lang#132600 (PassWrapper: adapt for new parameter in LLVM) - rust-lang#132630 (triagebot: ping wg-const-eval when relevant files change) r? `@ghost` `@rustbot` modify labels: rollup
…kingjubilee Rollup of 4 pull requests Successful merges: - rust-lang#132153 (Stabilise `const_char_encode_utf16`.) - rust-lang#132473 ([core/fmt] Replace checked slice indexing by unchecked to support panic-free code) - rust-lang#132600 (PassWrapper: adapt for new parameter in LLVM) - rust-lang#132630 (triagebot: ping wg-const-eval when relevant files change) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#132473 - ZhekaS:core_fmt_radix_no_panic, r=joboet [core/fmt] Replace checked slice indexing by unchecked to support panic-free code Fixes rust-lang#126425 Replace the potentially panicking `[]` indexing with `get_unchecked()` to prevent linking with panic-related code.
Fixes #126425
Replace the potentially panicking
[]
indexing withget_unchecked()
to prevent linking with panic-related code.