<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/library/core/src/str/mod.rs, branch try</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=try</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=try'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2025-07-20T13:34:04+00:00</updated>
<entry>
<title>Rollup merge of #143423 - hkBst:clippy-fix-1, r=workingjubilee</title>
<updated>2025-07-20T13:34:04+00:00</updated>
<author>
<name>Guillaume Gomez</name>
<email>guillaume1.gomez@gmail.com</email>
</author>
<published>2025-07-20T13:34:04+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=5ba1251b55ed560aabf92c81db6a6612de5f648e'/>
<id>urn:sha1:5ba1251b55ed560aabf92c81db6a6612de5f648e</id>
<content type='text'>
address clippy formatting nits

- int_log10.rs: change top level doc comments to outer
- collect.rs: remove empty line after doc comment
- clippy fix: markdown indentation for indented items after line break: a markdown list item continued over multiples lines, but those following lines which are part of the same item are not indented
- clippy fix: bound in one place: when there is a bound in angle brackets and another bound on the same variable in a where clause
</content>
</entry>
<entry>
<title>Rollup merge of #143921 - oli-obk:const-index, r=fee1-dead</title>
<updated>2025-07-16T15:06:41+00:00</updated>
<author>
<name>Samuel Tardieu</name>
<email>sam@rfc1149.net</email>
</author>
<published>2025-07-16T15:06:41+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=9eda137008637d7c70e0beefe5ea51b2e4c7a599'/>
<id>urn:sha1:9eda137008637d7c70e0beefe5ea51b2e4c7a599</id>
<content type='text'>
Constify `Index` traits

tracking issue: rust-lang/rust#143775

the `SliceIndex` trait cannot be implemented by users as it is sealed. While it would be useful for the `get` method on slices, it seems weird to have a feature gate for that that isn't also gating index syntax at the same time, so I put them under the same feature gate.

r? ```````@fee1-dead```````
</content>
</entry>
<entry>
<title>Rollup merge of #143907 - Kijewski:pr-inline-split_at_unchecked, r=Mark-Simulacrum</title>
<updated>2025-07-15T10:52:41+00:00</updated>
<author>
<name>Samuel Tardieu</name>
<email>sam@rfc1149.net</email>
</author>
<published>2025-07-15T10:52:41+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=460a627b839af1eaf222d342efa93e51c9c77b24'/>
<id>urn:sha1:460a627b839af1eaf222d342efa93e51c9c77b24</id>
<content type='text'>
core: make `str::split_at_unchecked()` inline

This PR adds `#[inline]` to the method `str::split_at_unchecked()`. This is done for two reasons:

1. The method is tiny, e.g. on AMD-64 (&lt;https://godbolt.org/z/ba68fdfxn&gt;):

   ```asm
   movq    %rdi, %rax
   subq    %rcx, %rdx
   movq    %rsi, (%rdi)
   addq    %rcx, %rsi
   movq    %rcx, 8(%rdi)
   movq    %rsi, 16(%rdi)
   movq    %rdx, 24(%rdi)
   retq
   ```

2. More importantly, inlining the method enables further automatic optimizations. E.g. if you split at index 3, then in the compiler (rustc, llvm or both) knows that this code cannot fail, and the panicking path is omitted in the generated code:

   ```rust
   pub fn punctuation(i: &amp;str) -&gt; Result&lt;(), ()&gt; {
       const THREE_CHARS: &amp;[[u8; 3]] = &amp;[*b"&lt;&lt;=", *b"&gt;&gt;=", *b"...", *b"..="];

       if let Some((head, _)) = i.split_at_checked(3)
           &amp;&amp; THREE_CHARS.contains(&amp;head.as_bytes().try_into().unwrap())
       {
           Ok(())
       } else {
           Err(())
       }
   }
   ```

   &lt;details&gt;
   &lt;summary&gt;Without PR&lt;/summary&gt;

   &lt;https://play.rust-lang.org/?version=stable&amp;mode=release&amp;edition=2024&amp;gist=0234de8158f467eebd73286f20d6e27a&gt;

   ```asm
   playground::punctuation:
           subq    $40, %rsp
           movq    %rsi, %rdx
           movq    %rdi, %rsi
           movb    $1, %al
           cmpq    $3, %rdx
           ja      .LBB2_2
           je      .LBB2_3
   .LBB2_11:
           addq    $40, %rsp
           retq
   .LBB2_2:
           cmpb    $-64, 3(%rsi)
           jl      .LBB2_11
   .LBB2_3:
           leaq    8(%rsp), %rdi
           movl    $3, %ecx
           callq   *core::str::&lt;impl str&gt;::split_at_unchecked@GOTPCREL(%rip)
           movq    8(%rsp), %rcx
           movb    $1, %al
           testq   %rcx, %rcx
           je      .LBB2_11
           cmpq    $3, 16(%rsp)
           jne     .LBB2_12
           movzwl  (%rcx), %edx
           movzbl  2(%rcx), %ecx
           shll    $16, %ecx
           orl     %edx, %ecx
           cmpl    $4013115, %ecx
           jg      .LBB2_8
           cmpl    $3026478, %ecx
           je      .LBB2_10
           cmpl    $4009518, %ecx
           je      .LBB2_10
           jmp     .LBB2_11
   .LBB2_8:
           cmpl    $4013630, %ecx
           je      .LBB2_10
           cmpl    $4013116, %ecx
           jne     .LBB2_11
   .LBB2_10:
           xorl    %eax, %eax
           addq    $40, %rsp
           retq
   .LBB2_12:
           leaq    .Lanon.d98a7fbb86d10a97c24516e267466134.2(%rip), %rdi
           leaq    .Lanon.d98a7fbb86d10a97c24516e267466134.1(%rip), %rcx
           leaq    .Lanon.d98a7fbb86d10a97c24516e267466134.6(%rip), %r8
           leaq    7(%rsp), %rdx
           movl    $43, %esi
           callq   *core::result::unwrap_failed@GOTPCREL(%rip)
   ```
   &lt;/details&gt;

   &lt;details&gt;
   &lt;summary&gt;With PR&lt;/summary&gt;

   &lt;https://play.rust-lang.org/?version=stable&amp;mode=release&amp;edition=2024&amp;gist=5d4058c79ce0f6cb1a434190427d2055&gt;

   ```asm
   playground::punctuation:
           movb    $1, %al
           cmpq    $3, %rsi
           ja      .LBB0_2
           je      .LBB0_3
   .LBB0_9:
           retq
   .LBB0_2:
           cmpb    $-64, 3(%rdi)
           jl      .LBB0_9
   .LBB0_3:
           movzwl  (%rdi), %eax
           movzbl  2(%rdi), %ecx
           shll    $16, %ecx
           orl     %eax, %ecx
           movb    $1, %al
           cmpl    $4013115, %ecx
           jg      .LBB0_6
           cmpl    $3026478, %ecx
           je      .LBB0_8
           cmpl    $4009518, %ecx
           je      .LBB0_8
           jmp     .LBB0_9
   .LBB0_6:
           cmpl    $4013630, %ecx
           je      .LBB0_8
           cmpl    $4013116, %ecx
           jne     .LBB0_9
   .LBB0_8:
           xorl    %eax, %eax
           retq
   ```
   &lt;/details&gt;
</content>
</entry>
<entry>
<title>constify some methods using `SliceIndex`</title>
<updated>2025-07-15T07:58:29+00:00</updated>
<author>
<name>Oli Scherer</name>
<email>github333195615777966@oli-obk.de</email>
</author>
<published>2025-07-11T08:37:09+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=cb7d52f6430922b5ffd29073f6605b19b80e7f36'/>
<id>urn:sha1:cb7d52f6430922b5ffd29073f6605b19b80e7f36</id>
<content type='text'>
</content>
</entry>
<entry>
<title>core: make `str::split_at_unchecked()` inline</title>
<updated>2025-07-13T21:00:42+00:00</updated>
<author>
<name>René Kijewski</name>
<email>rene.kijewski@fu-berlin.de</email>
</author>
<published>2025-07-13T20:33:49+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=6760cd2859db68d47d62089d9805d860fb37d518'/>
<id>urn:sha1:6760cd2859db68d47d62089d9805d860fb37d518</id>
<content type='text'>
This PR adds `#[inline]` to the method `str::split_at_unchecked()`.
This is done for two reasons:

1. The method is tiny, e.g. on AMD-64 (&lt;https://godbolt.org/z/ba68fdfxn&gt;):

   ```asm
   movq    %rdi, %rax
   subq    %rcx, %rdx
   movq    %rsi, (%rdi)
   addq    %rcx, %rsi
   movq    %rcx, 8(%rdi)
   movq    %rsi, 16(%rdi)
   movq    %rdx, 24(%rdi)
   retq
   ```

2. More importantly, inlining the method enables further automatic
   optimizations. E.g. if you split at index 3, then in the compiler
   (rustc, llvm or both) knows that this code cannot fail, and the
   panicking path is omitted in the generated code:

   ```rust
   pub fn punctuation(i: &amp;str) -&gt; Result&lt;(), ()&gt; {
       const THREE_CHARS: &amp;[[u8; 3]] = &amp;[*b"&lt;&lt;=", *b"&gt;&gt;=", *b"...", *b"..="];

       if let Some((head, _)) = i.split_at_checked(3)
           &amp;&amp; THREE_CHARS.contains(&amp;head.as_bytes().try_into().unwrap())
       {
           Ok(())
       } else {
           Err(())
       }
   }
   ```

   &lt;details&gt;
   &lt;summary&gt;Without PR&lt;/summary&gt;

   &lt;https://play.rust-lang.org/?version=stable&amp;mode=release&amp;edition=2024&amp;gist=0234de8158f467eebd73286f20d6e27a&gt;

   ```asm
   playground::punctuation:
           subq    $40, %rsp
           movq    %rsi, %rdx
           movq    %rdi, %rsi
           movb    $1, %al
           cmpq    $3, %rdx
           ja      .LBB2_2
           je      .LBB2_3
   .LBB2_11:
           addq    $40, %rsp
           retq
   .LBB2_2:
           cmpb    $-64, 3(%rsi)
           jl      .LBB2_11
   .LBB2_3:
           leaq    8(%rsp), %rdi
           movl    $3, %ecx
           callq   *core::str::&lt;impl str&gt;::split_at_unchecked@GOTPCREL(%rip)
           movq    8(%rsp), %rcx
           movb    $1, %al
           testq   %rcx, %rcx
           je      .LBB2_11
           cmpq    $3, 16(%rsp)
           jne     .LBB2_12
           movzwl  (%rcx), %edx
           movzbl  2(%rcx), %ecx
           shll    $16, %ecx
           orl     %edx, %ecx
           cmpl    $4013115, %ecx
           jg      .LBB2_8
           cmpl    $3026478, %ecx
           je      .LBB2_10
           cmpl    $4009518, %ecx
           je      .LBB2_10
           jmp     .LBB2_11
   .LBB2_8:
           cmpl    $4013630, %ecx
           je      .LBB2_10
           cmpl    $4013116, %ecx
           jne     .LBB2_11
   .LBB2_10:
           xorl    %eax, %eax
           addq    $40, %rsp
           retq
   .LBB2_12:
           leaq    .Lanon.d98a7fbb86d10a97c24516e267466134.2(%rip), %rdi
           leaq    .Lanon.d98a7fbb86d10a97c24516e267466134.1(%rip), %rcx
           leaq    .Lanon.d98a7fbb86d10a97c24516e267466134.6(%rip), %r8
           leaq    7(%rsp), %rdx
           movl    $43, %esi
           callq   *core::result::unwrap_failed@GOTPCREL(%rip)
   ```
   &lt;/details&gt;

   &lt;details&gt;
   &lt;summary&gt;With PR&lt;/summary&gt;

   &lt;https://play.rust-lang.org/?version=stable&amp;mode=release&amp;edition=2024&amp;gist=5d4058c79ce0f6cb1a434190427d2055&gt;

   ```asm
   playground::punctuation:
           movb    $1, %al
           cmpq    $3, %rsi
           ja      .LBB0_2
           je      .LBB0_3
   .LBB0_9:
           retq
   .LBB0_2:
           cmpb    $-64, 3(%rdi)
           jl      .LBB0_9
   .LBB0_3:
           movzwl  (%rdi), %eax
           movzbl  2(%rdi), %ecx
           shll    $16, %ecx
           orl     %eax, %ecx
           movb    $1, %al
           cmpl    $4013115, %ecx
           jg      .LBB0_6
           cmpl    $3026478, %ecx
           je      .LBB0_8
           cmpl    $4009518, %ecx
           je      .LBB0_8
           jmp     .LBB0_9
   .LBB0_6:
           cmpl    $4013630, %ecx
           je      .LBB0_8
           cmpl    $4013116, %ecx
           jne     .LBB0_9
   .LBB0_8:
           xorl    %eax, %eax
           retq
   ```
   &lt;/details&gt;
</content>
</entry>
<entry>
<title>update issue number for `const_trait_impl`</title>
<updated>2025-07-13T15:55:06+00:00</updated>
<author>
<name>Deadbeef</name>
<email>ent3rm4n@gmail.com</email>
</author>
<published>2025-07-13T08:21:25+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=6b02597ed3dc7a7c3581960ca6afae575f6c691e'/>
<id>urn:sha1:6b02597ed3dc7a7c3581960ca6afae575f6c691e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>collect.rs: remove empty line after doc comment</title>
<updated>2025-07-08T11:48:15+00:00</updated>
<author>
<name>Marijn Schouten</name>
<email>mhkbst@gmail.com</email>
</author>
<published>2025-07-02T13:29:16+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=f96d5d960256557a0c2434a308fd32c98e94aa7f'/>
<id>urn:sha1:f96d5d960256557a0c2434a308fd32c98e94aa7f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Make `Default` const and add some `const Default` impls</title>
<updated>2025-07-07T22:09:37+00:00</updated>
<author>
<name>Esteban Küber</name>
<email>esteban@kuber.com.ar</email>
</author>
<published>2024-12-21T20:25:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=c3301503b97cd6b768a944661b81a92994e9db00'/>
<id>urn:sha1:c3301503b97cd6b768a944661b81a92994e9db00</id>
<content type='text'>
Full list of `impl const Default` types:

- ()
- bool
- char
- Cell
- std::ascii::Char
- usize
- u8
- u16
- u32
- u64
- u128
- i8
- i16
- i32
- i64
- i128
- f16
- f32
- f64
- f128
- std::marker::PhantomData&lt;T&gt;
- Option&lt;T&gt;
- std::iter::Empty&lt;T&gt;
- std::ptr::Alignment
- &amp;[T]
- &amp;mut [T]
- &amp;str
- &amp;mut str
- String
- Vec&lt;T&gt;
</content>
</entry>
<entry>
<title>lib: more eagerly return `self.len()` from `ceil_char_boundary`</title>
<updated>2025-07-06T23:14:58+00:00</updated>
<author>
<name>Simonas Kazlauskas</name>
<email>git@kazlauskas.me</email>
</author>
<published>2025-07-06T23:11:32+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=49806a5486e841edf5933ca75ed235afb7ad2bdb'/>
<id>urn:sha1:49806a5486e841edf5933ca75ed235afb7ad2bdb</id>
<content type='text'>
There is no reason to go through the complicated branch as it would
always return `self.len()` in this case. Also helps debug code somewhat
and I guess might make optimizations easier (although I haven't really a
sample to demonstrate this.)

ref. #93743
Suggested by @chrisduerr
</content>
</entry>
<entry>
<title>Update version placeholders</title>
<updated>2025-07-01T17:54:33+00:00</updated>
<author>
<name>Josh Stone</name>
<email>jistone@redhat.com</email>
</author>
<published>2025-06-23T17:24:40+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=9ce8930da62a9be15831b78b9834d91702872e15'/>
<id>urn:sha1:9ce8930da62a9be15831b78b9834d91702872e15</id>
<content type='text'>
</content>
</entry>
</feed>
