rust/library/core/src
Matthias Krüger a5cc1f663f
Rollup merge of #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 #121571 lands.

---

This is basically the same as #108763, since `split_at` is essentially doing two `get_unchecked`s.
2024-05-04 18:36:38 +02:00
..
alloc alloc::Layout: explicitly document size invariant on the type level 2024-03-25 20:18:46 +01:00
array Stabilize generic NonZero. 2024-04-22 18:48:47 +02:00
ascii implement Default for AsciiChar 2024-02-13 12:04:44 +01:00
async_iter Hide async_gen_internals from standard library documentation 2024-04-05 18:54:38 -07:00
cell impl get_mut_or_init and get_mut_or_try_init for OnceCell and OnceLock 2024-03-27 16:16:08 +08:00
char Add a lower bound check to unicode-table-generator output 2024-04-20 10:16:45 +02:00
cmp Use generic NonZero everywhere in core. 2024-02-22 15:17:33 +01:00
convert Remove From impls for unstable types that break inference 2024-04-11 18:04:31 -04:00
ffi Rollup merge of #124593 - GKFX:cstr-literals-in-api-docs, r=workingjubilee 2024-05-03 20:33:46 +02:00
fmt chore: fix some typos in comments 2024-04-24 13:58:51 +08:00
future Step bootstrap cfgs 2024-05-01 22:19:11 -04:00
hash Add fn const BuildHasherDefault::new 2024-03-29 17:10:17 +01:00
intrinsics Step bootstrap cfgs 2024-05-01 22:19:11 -04:00
io core: panic on overflow in BorrowedCursor 2024-04-11 18:33:46 +02:00
iter Step bootstrap cfgs 2024-05-01 22:19:11 -04:00
macros Workaround rustfmt bug replacing type ascription 2024-05-01 23:23:00 -04:00
mem Rollup merge of #123480 - Nadrieril:impl-all-derefpures, r=compiler-errors 2024-05-03 06:04:19 +02:00
net Avoid invalid socket address in length calculation 2024-04-11 17:27:23 +02:00
num Rollup merge of #124701 - scottmcm:unchecked_sub_docs, r=Nilstrieb 2024-05-04 12:37:24 +02:00
ops Step bootstrap cfgs 2024-05-01 22:19:11 -04:00
panic Replace version placeholders for 1.79 2024-05-01 21:01:51 -04:00
prelude Step bootstrap cfgs 2024-05-01 22:19:11 -04:00
ptr Rollup merge of #122492 - GrigorenkoPV:ptr_as_ref_unchecked, r=workingjubilee 2024-05-03 20:33:44 +02:00
slice Rollup merge of #124699 - scottmcm:split_at_unchecked_should_use_unchecked, r=Nilstrieb 2024-05-04 18:36:38 +02:00
str Rollup merge of #124678 - UserIsntAvailable:feat/stabilize-split-at-checked, r=jhpratt 2024-05-03 23:34:24 -04:00
sync Step bootstrap cfgs 2024-05-01 22:19:11 -04:00
task Rollup merge of #122201 - coolreader18:doc-clone_from, r=dtolnay 2024-04-17 18:01:37 +02:00
unicode Add a lower bound check to unicode-table-generator output 2024-04-20 10:16:45 +02:00
any.rs Improve wording in std::any explanation 2024-03-29 10:10:52 -07:00
arch.rs Rust is a proper name: rust → Rust 2024-03-07 07:49:22 +01:00
ascii.rs Use generic NonZero internally. 2024-02-15 08:09:42 +01:00
asserting.rs [RFC 2011] Library code 2022-05-22 07:18:32 -03:00
bool.rs core is now compilable 2023-04-16 07:20:26 +00:00
borrow.rs doc: replace wrong punctuation mark 2023-07-28 14:46:17 +02:00
cell.rs Rollup merge of #123480 - Nadrieril:impl-all-derefpures, r=compiler-errors 2024-05-03 06:04:19 +02:00
clone.rs Revert "Put basic impls for f16 and f128 behind cfg(not(bootstrap))" 2024-04-10 13:50:27 -04:00
cmp.rs Step bootstrap cfgs 2024-05-01 22:19:11 -04:00
default.rs Step bootstrap cfgs 2024-05-01 22:19:11 -04:00
error.md Fix minor grammar typo 2023-09-06 09:47:22 -07:00
error.rs style library/core/src/error.rs 2024-03-02 16:03:23 +08:00
escape.rs Use generic NonZero internally. 2024-02-15 08:09:42 +01:00
hint.rs Add support for Arm64EC to the Standard Library 2024-04-15 16:05:16 -07:00
internal_macros.rs add track_caller for arith ops 2023-11-24 00:54:06 +08:00
intrinsics.rs Rollup merge of #124293 - oli-obk:miri_intrinsic_fallback_body, r=RalfJung 2024-05-04 12:37:22 +02:00
lib.miri.rs add 'x.py miri', and make it work for 'library/{core,alloc,std}' 2024-04-03 20:27:20 +02:00
lib.rs Rollup merge of #124678 - UserIsntAvailable:feat/stabilize-split-at-checked, r=jhpratt 2024-05-03 23:34:24 -04:00
marker.rs Revert "Put basic impls for f16 and f128 behind cfg(not(bootstrap))" 2024-04-10 13:50:27 -04:00
option.rs panic_str only exists for the migration to 2021 panic macros 2024-03-26 08:11:34 +01:00
panic.rs panic_str only exists for the migration to 2021 panic macros 2024-03-26 08:11:34 +01:00
panicking.rs Step bootstrap cfgs 2024-05-01 22:19:11 -04:00
pat.rs Add pattern types to parser 2024-04-08 11:57:17 +00:00
pin.rs Rollup merge of #123480 - Nadrieril:impl-all-derefpures, r=compiler-errors 2024-05-03 06:04:19 +02:00
primitive.rs
primitive_docs.rs fixup links in never type docs 2024-05-02 06:04:16 +02:00
result.rs Import the 2021 prelude in the core crate 2024-03-25 13:12:06 -07:00
time.rs Fix cannot usage in time.rs 2024-04-24 17:37:44 +00:00
tuple.rs Rollup merge of #118307 - scottmcm:tuple-eq-simpler, r=joshtriplett 2024-02-11 08:25:41 +01:00
ub_checks.rs export assert_unsafe_precondition macro for std-internal use 2024-04-22 19:02:37 +02:00
unit.rs Import the 2021 prelude in the core crate 2024-03-25 13:12:06 -07:00