Merged
Conversation
Collaborator
Noratrieb
reviewed
May 4, 2024
| // `[ptr; mid]` and `[mid; len]` are not overlapping, so returning a mutable reference | ||
| // is fine. | ||
| unsafe { (from_raw_parts_mut(ptr, mid), from_raw_parts_mut(ptr.add(mid), len - mid)) } | ||
| unsafe { |
Member
There was a problem hiding this comment.
two local variables for the left and right sides would have been nice here to reduce the lines from 6 to 3 :3, things like this are certainly formative of your opinions about rustfmt 😆 (though i can't really complain, it's doing its best)
Member
Author
There was a problem hiding this comment.
Yeah, my preferred philosophical underpinnings for a formatter are pretty different from those that rustfmt picked :(
Member
|
@bors r+ rollup |
Collaborator
Member
|
r? Nilstrieb |
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
May 4, 2024
…_use_unchecked, r=Nilstrieb Use `unchecked_sub` in `split_at` LLVM currently isn't figuring it out on its own, even in the checked version where it hypothetically could. Before: <https://rust.godbolt.org/z/PEY38YrKs> ```llvm bb1: ; preds = %start %4 = getelementptr inbounds float, ptr %x.0, i64 %n %5 = sub i64 %x.1, %n ``` After: ```llvm bb1: ; preds = %start %4 = getelementptr inbounds float, ptr %x.0, i64 %n %5 = sub nuw i64 %x.1, %n ``` This is not using the wrapper because there's already a ubcheck covering it, so I don't want this to get a second one once rust-lang#121571 lands. --- This is basically the same as rust-lang#108763, since `split_at` is essentially doing two `get_unchecked`s.
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
May 4, 2024
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#122441 (Improve several `Read` implementations) - rust-lang#124584 (Various improvements to entrypoint code) - rust-lang#124699 (Use `unchecked_sub` in `split_at`) - rust-lang#124704 (Fix ignored tests for formatting) - rust-lang#124709 (Miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
May 4, 2024
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#122441 (Improve several `Read` implementations) - rust-lang#124584 (Various improvements to entrypoint code) - rust-lang#124699 (Use `unchecked_sub` in `split_at`) - rust-lang#124704 (Fix ignored tests for formatting) - rust-lang#124709 (Miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
May 4, 2024
…iaskrgr Rollup of 4 pull requests Successful merges: - rust-lang#122441 (Improve several `Read` implementations) - rust-lang#124584 (Various improvements to entrypoint code) - rust-lang#124699 (Use `unchecked_sub` in `split_at`) - rust-lang#124715 (interpret, miri: uniform treatments of intrinsics/functions with and without return block) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
May 4, 2024
Rollup merge of rust-lang#124699 - scottmcm:split_at_unchecked_should_use_unchecked, r=Nilstrieb Use `unchecked_sub` in `split_at` LLVM currently isn't figuring it out on its own, even in the checked version where it hypothetically could. Before: <https://rust.godbolt.org/z/PEY38YrKs> ```llvm bb1: ; preds = %start %4 = getelementptr inbounds float, ptr %x.0, i64 %n %5 = sub i64 %x.1, %n ``` After: ```llvm bb1: ; preds = %start %4 = getelementptr inbounds float, ptr %x.0, i64 %n %5 = sub nuw i64 %x.1, %n ``` This is not using the wrapper because there's already a ubcheck covering it, so I don't want this to get a second one once rust-lang#121571 lands. --- This is basically the same as rust-lang#108763, since `split_at` is essentially doing two `get_unchecked`s.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LLVM currently isn't figuring it out on its own, even in the checked version where it hypothetically could.
Before: https://rust.godbolt.org/z/PEY38YrKs
After:
This is not using the wrapper because there's already a ubcheck covering it, so I don't want this to get a second one once #121571 lands.
This is basically the same as #108763, since
split_atis essentially doing twoget_uncheckeds.