<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/compiler/rustc_const_eval/src/const_eval, branch perf-tmp</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=perf-tmp</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=perf-tmp'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2025-09-16T16:04:59+00:00</updated>
<entry>
<title>Add span for struct tail recursion limit error</title>
<updated>2025-09-16T16:04:59+00:00</updated>
<author>
<name>Tawan Muadmuenwai</name>
<email>modhanami@gmail.com</email>
</author>
<published>2025-09-15T14:24:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=6912631d3ead427848a559ef5af66ab6f30e79ed'/>
<id>urn:sha1:6912631d3ead427848a559ef5af66ab6f30e79ed</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Rollup merge of #144885 - zachs18:ptr_guaranteed_cmp_more, r=RalfJung</title>
<updated>2025-08-26T04:19:16+00:00</updated>
<author>
<name>Stuart Cook</name>
<email>Zalathar@users.noreply.github.com</email>
</author>
<published>2025-08-26T04:19:16+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=e011dd47ee04cd1e62786b5a0b3bfe2d5e58ae35'/>
<id>urn:sha1:e011dd47ee04cd1e62786b5a0b3bfe2d5e58ae35</id>
<content type='text'>
Implement some more checks in `ptr_guaranteed_cmp`.

* Pointers with different residues modulo their allocations' least common alignment are never equal.
* Pointers to the same static allocation are equal if and only if they have the same offset.
* Pointers to different non-zero-sized static allocations are unequal if both point within their allocation, and not on opposite ends.

Tracking issue for `const_raw_ptr_comparison`: &lt;https://github.com/rust-lang/rust/issues/53020&gt;

This should not affect `is_null`, the only usage of this intrinsic on stable.

Closes https://github.com/rust-lang/rust/issues/144584
</content>
</entry>
<entry>
<title>Implement some more checks for `ptr_guaranteed_cmp` in consteval:</title>
<updated>2025-08-23T17:09:07+00:00</updated>
<author>
<name>Zachary S</name>
<email>zasample18+github@gmail.com</email>
</author>
<published>2025-07-28T21:13:07+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=10fde9eafe95650eca9452e960a891ec3ee35565'/>
<id>urn:sha1:10fde9eafe95650eca9452e960a891ec3ee35565</id>
<content type='text'>
Pointers with different residues modulo their least common allocation alignment are never equal.
Pointers to the same static allocation are equal if and only if they have the same offset.
Strictly in-bounds (in-bounds and not one-past-the-end) pointers to different static allocations are always unequal.
A pointer cannot be equal to an integer if `ptr-int` cannot be null.

Also adds more tests for `ptr_guaranteed_cmp`.

Co-authored-by: Ralf Jung &lt;post@ralfj.de&gt;
</content>
</entry>
<entry>
<title>Auto merge of #144081 - RalfJung:const-ptr-fragments, r=oli-obk</title>
<updated>2025-08-17T04:33:31+00:00</updated>
<author>
<name>bors</name>
<email>bors@rust-lang.org</email>
</author>
<published>2025-08-17T04:33:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=99ba5565678a51c2488322a5e75d5b59e323b498'/>
<id>urn:sha1:99ba5565678a51c2488322a5e75d5b59e323b498</id>
<content type='text'>
const-eval: full support for pointer fragments

This fixes https://github.com/rust-lang/const-eval/issues/72 and makes `swap_nonoverlapping` fully work in const-eval by enhancing per-byte provenance tracking with tracking of *which* of the bytes of the pointer this one is. Later, if we see all the same bytes in the exact same order, we can treat it like a whole pointer again without ever risking a leak of the data bytes (that encode the offset into the allocation). This lifts the limitation that was discussed quite a bit in https://github.com/rust-lang/rust/pull/137280.

For a concrete piece of code that used to fail and now works properly consider this example doing a byte-for-byte memcpy in const without using intrinsics:
```rust
use std::{mem::{self, MaybeUninit}, ptr};

type Byte = MaybeUninit&lt;u8&gt;;

const unsafe fn memcpy(dst: *mut Byte, src: *const Byte, n: usize) {
    let mut i = 0;
    while i &lt; n {
        *dst.add(i) = *src.add(i);
        i += 1;
    }
}

const _MEMCPY: () = unsafe {
    let ptr = &amp;42;
    let mut ptr2 = ptr::null::&lt;i32&gt;();
    // Copy from ptr to ptr2.
    memcpy(&amp;mut ptr2 as *mut _ as *mut _, &amp;ptr as *const _ as *const _, mem::size_of::&lt;&amp;i32&gt;());
    assert!(*ptr2 == 42);
};
```
What makes this code tricky is that pointers are "opaque blobs" in const-eval, we cannot just let people look at the individual bytes since *we don't know what those bytes look like* -- that depends on the absolute address the pointed-to object will be placed at. The code above "breaks apart" a pointer into individual bytes, and then puts them back together in the same order elsewhere. This PR implements the logic to properly track how those individual bytes relate to the original pointer, and to recognize when they are in the right order again.

We still reject constants where the final value contains a not-fully-put-together pointer: I have no idea how one could construct an LLVM global where one byte is defined as "the 3rd byte of a pointer to that other global over there" -- and even if LLVM supports this somehow, we can leave implementing that to a future PR. It seems unlikely to me anyone would even want this, but who knows.^^

This also changes the behavior of Miri, by tracking the order of bytes with provenance and only considering a pointer to have valid provenance if all bytes are in the original order again. This is related to https://github.com/rust-lang/unsafe-code-guidelines/issues/558. It means one cannot implement XOR linked lists with strict provenance any more, which is however only of theoretical interest. Practically I am curious if anyone will show up with any code that Miri now complains about - that would be interesting data. Cc `@rust-lang/opsem`
</content>
</entry>
<entry>
<title>Revert "Partially outline code inside the panic! macro".</title>
<updated>2025-08-12T10:52:39+00:00</updated>
<author>
<name>Mara Bos</name>
<email>m-ou.se@m-ou.se</email>
</author>
<published>2025-08-12T10:52:39+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=08acba30718281a068ab978f8feded9b871ec9db'/>
<id>urn:sha1:08acba30718281a068ab978f8feded9b871ec9db</id>
<content type='text'>
Without any tests/benchmarks that show some improvement, it's hard to
know whether the change had any positive effect at all. (And if it did,
whether that effect is still achieved today.)
</content>
</entry>
<entry>
<title>const-eval: full support for pointer fragments</title>
<updated>2025-07-30T06:13:58+00:00</updated>
<author>
<name>Ralf Jung</name>
<email>post@ralfj.de</email>
</author>
<published>2025-07-17T18:00:19+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=ba5b6b9ec472dc32bdaa8b18c22d30bd6abf7ebc'/>
<id>urn:sha1:ba5b6b9ec472dc32bdaa8b18c22d30bd6abf7ebc</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Remove useless lifetime parameter.</title>
<updated>2025-07-23T23:54:37+00:00</updated>
<author>
<name>Camille GILLOT</name>
<email>gillot.camille@gmail.com</email>
</author>
<published>2025-07-03T18:41:12+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=0460c92d527dbada3fde227d3f01e6d1e132a186'/>
<id>urn:sha1:0460c92d527dbada3fde227d3f01e6d1e132a186</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Give an AllocId to ConstValue::Slice.</title>
<updated>2025-07-23T23:54:37+00:00</updated>
<author>
<name>Camille GILLOT</name>
<email>gillot.camille@gmail.com</email>
</author>
<published>2023-10-13T20:20:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=9ff071219bca913e45235568defadd5ab840c50a'/>
<id>urn:sha1:9ff071219bca913e45235568defadd5ab840c50a</id>
<content type='text'>
</content>
</entry>
<entry>
<title>fix handling of base address for TypeId allocations</title>
<updated>2025-07-20T20:14:27+00:00</updated>
<author>
<name>Ralf Jung</name>
<email>post@ralfj.de</email>
</author>
<published>2025-07-19T18:04:08+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=3f9be406a6fd879a99a0eba33cc196fa2cb3957b'/>
<id>urn:sha1:3f9be406a6fd879a99a0eba33cc196fa2cb3957b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Show the memory of uninit reads</title>
<updated>2025-07-18T07:47:08+00:00</updated>
<author>
<name>Oli Scherer</name>
<email>github333195615777966@oli-obk.de</email>
</author>
<published>2025-06-18T12:51:47+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=652ba279ecc693d8b4310c40e645a62009f5b0ed'/>
<id>urn:sha1:652ba279ecc693d8b4310c40e645a62009f5b0ed</id>
<content type='text'>
</content>
</entry>
</feed>
