Skip to content

Commit 13a59e3

Browse files
github-actions[bot]madhav-madhusoodananfolkertdevraoulstrackxrossmacarthur
authored
Merge subtree update for toolchain nightly-2025-08-26 (model-checking#480)
This is an automated PR to merge library subtree updates from 2025-08-20 (rust-lang/rust@05f5a58) to 2025-08-26 (rust-lang/rust@54c5812), inclusive. This is a clean merge, no conflicts were detected. **Do not remove or edit the following annotations:** git-subtree-dir: library git-subtree-split: b8acf06 --------- Signed-off-by: Ayush Singh <[email protected]> Signed-off-by: Sacha Ayoun <[email protected]> Signed-off-by: Eval EXEC <[email protected]> Signed-off-by: Jens Reidel <[email protected]> Signed-off-by: Connor Tsui <[email protected]> Co-authored-by: Madhav Madhusoodanan <[email protected]> Co-authored-by: Folkert de Vries <[email protected]> Co-authored-by: Folkert de Vries <[email protected]> Co-authored-by: Raoul Strackx <[email protected]> Co-authored-by: Ross MacArthur <[email protected]> Co-authored-by: Paul Murphy <[email protected]> Co-authored-by: Michael Tautschnig <[email protected]> Co-authored-by: Chai T. Rex <[email protected]> Co-authored-by: okaneco <[email protected]> Co-authored-by: The 8472 <[email protected]> Co-authored-by: Trevor Gross <[email protected]> Co-authored-by: Josh Triplett <[email protected]> Co-authored-by: Eric Huss <[email protected]> Co-authored-by: Boxy <[email protected]> Co-authored-by: Jakub Beránek <[email protected]> Co-authored-by: ginnyTheCat <[email protected]> Co-authored-by: LorrensP-2158466 <[email protected]> Co-authored-by: Guillaume Gomez <[email protected]> Co-authored-by: Karl Meakin <[email protected]> Co-authored-by: bors <[email protected]> Co-authored-by: Stuart Cook <[email protected]> Co-authored-by: Ivan Enderlin <[email protected]> Co-authored-by: Ulrich Stark <[email protected]> Co-authored-by: Shoyu Vanilla <[email protected]> Co-authored-by: Trevor Gross <[email protected]> Co-authored-by: Roger Curley <[email protected]> Co-authored-by: Spxg <[email protected]> Co-authored-by: The Miri Cronjob Bot <[email protected]> Co-authored-by: WANG Rui <[email protected]> Co-authored-by: Connor Tsui <[email protected]> Co-authored-by: Chris Denton <[email protected]> Co-authored-by: Kivooeo <[email protected]> Co-authored-by: Ada Alakbarova <[email protected]> Co-authored-by: github-actions <[email protected]> Co-authored-by: ltdk <[email protected]> Co-authored-by: Jacob Pratt <[email protected]> Co-authored-by: Esteban Küber <[email protected]> Co-authored-by: gewitternacht <[email protected]> Co-authored-by: Ayush Singh <[email protected]> Co-authored-by: Jakub Stasiak <[email protected]> Co-authored-by: SabrinaJewson <[email protected]> Co-authored-by: Ed Page <[email protected]> Co-authored-by: Ada Alakbarova <[email protected]> Co-authored-by: Mara Bos <[email protected]> Co-authored-by: Sacha Ayoun <[email protected]> Co-authored-by: Tim (Theemathas) Chirananthavat <[email protected]> Co-authored-by: Eval EXEC <[email protected]> Co-authored-by: sayantn <[email protected]> Co-authored-by: Nicholas Nethercote <[email protected]> Co-authored-by: Marcelo Domínguez <[email protected]> Co-authored-by: Jens Reidel <[email protected]> Co-authored-by: Tsukasa OI <[email protected]> Co-authored-by: Alan Urmancheev <[email protected]> Co-authored-by: binarycat <[email protected]> Co-authored-by: Pascal S. de Kloe <[email protected]> Co-authored-by: Sebastien Marie <[email protected]> Co-authored-by: Varun Gandhi <[email protected]> Co-authored-by: Alexandre Courbot <[email protected]> Co-authored-by: Ralf Jung <[email protected]> Co-authored-by: Michael Rieder <[email protected]> Co-authored-by: 许杰友 Jieyou Xu (Joe) <[email protected]> Co-authored-by: Quinn Tucker <[email protected]> Co-authored-by: clubby789 <[email protected]> Co-authored-by: 王宇逸 <[email protected]> Co-authored-by: Tuomas Tajakka <[email protected]> Co-authored-by: Josh Stone <[email protected]> Co-authored-by: Aapo Alasuutari <[email protected]> Co-authored-by: Samuel Tardieu <[email protected]> Co-authored-by: Urgau <[email protected]> Co-authored-by: Marijn Schouten <[email protected]> Co-authored-by: gitbot <git@bot>
1 parent 047eac5 commit 13a59e3

File tree

51 files changed

+2895
-1138
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2895
-1138
lines changed

.github/workflows/flux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
env:
1111
FIXPOINT_VERSION: "556104ba5508891c357b0bdf819ce706e93d9349"
12-
FLUX_VERSION: "a17246965a8752e3d3d4e3559865311048bb61f7"
12+
FLUX_VERSION: "b0cec81c42bc6e210f675b46dd5b4b16774b0d0e"
1313

1414
jobs:
1515
check-flux-on-core:

library/Cargo.lock

Lines changed: 6 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

library/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,3 @@ rustflags = ["-Cpanic=abort"]
5959
rustc-std-workspace-core = { path = 'rustc-std-workspace-core' }
6060
rustc-std-workspace-alloc = { path = 'rustc-std-workspace-alloc' }
6161
rustc-std-workspace-std = { path = 'rustc-std-workspace-std' }
62-
compiler_builtins = { path = "compiler-builtins/compiler-builtins" }

library/alloc/src/alloc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ unsafe extern "Rust" {
1717
#[rustc_allocator]
1818
#[rustc_nounwind]
1919
#[rustc_std_internal_symbol]
20+
#[rustc_allocator_zeroed_variant = "__rust_alloc_zeroed"]
2021
fn __rust_alloc(size: usize, align: usize) -> *mut u8;
2122
#[rustc_deallocator]
2223
#[rustc_nounwind]

library/alloc/src/collections/btree/map.rs

Lines changed: 45 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -40,30 +40,15 @@ pub(super) const MIN_LEN: usize = node::MIN_LEN_AFTER_SPLIT;
4040

4141
/// An ordered map based on a [B-Tree].
4242
///
43-
/// B-Trees represent a fundamental compromise between cache-efficiency and actually minimizing
44-
/// the amount of work performed in a search. In theory, a binary search tree (BST) is the optimal
45-
/// choice for a sorted map, as a perfectly balanced BST performs the theoretical minimum amount of
46-
/// comparisons necessary to find an element (log<sub>2</sub>n). However, in practice the way this
47-
/// is done is *very* inefficient for modern computer architectures. In particular, every element
48-
/// is stored in its own individually heap-allocated node. This means that every single insertion
49-
/// triggers a heap-allocation, and every single comparison should be a cache-miss. Since these
50-
/// are both notably expensive things to do in practice, we are forced to, at the very least,
51-
/// reconsider the BST strategy.
52-
///
53-
/// A B-Tree instead makes each node contain B-1 to 2B-1 elements in a contiguous array. By doing
54-
/// this, we reduce the number of allocations by a factor of B, and improve cache efficiency in
55-
/// searches. However, this does mean that searches will have to do *more* comparisons on average.
56-
/// The precise number of comparisons depends on the node search strategy used. For optimal cache
57-
/// efficiency, one could search the nodes linearly. For optimal comparisons, one could search
58-
/// the node using binary search. As a compromise, one could also perform a linear search
59-
/// that initially only checks every i<sup>th</sup> element for some choice of i.
43+
/// Given a key type with a [total order], an ordered map stores its entries in key order.
44+
/// That means that keys must be of a type that implements the [`Ord`] trait,
45+
/// such that two keys can always be compared to determine their [`Ordering`].
46+
/// Examples of keys with a total order are strings with lexicographical order,
47+
/// and numbers with their natural order.
6048
///
61-
/// Currently, our implementation simply performs naive linear search. This provides excellent
62-
/// performance on *small* nodes of elements which are cheap to compare. However in the future we
63-
/// would like to further explore choosing the optimal search strategy based on the choice of B,
64-
/// and possibly other factors. Using linear search, searching for a random element is expected
65-
/// to take B * log(n) comparisons, which is generally worse than a BST. In practice,
66-
/// however, performance is excellent.
49+
/// Iterators obtained from functions such as [`BTreeMap::iter`], [`BTreeMap::into_iter`], [`BTreeMap::values`], or
50+
/// [`BTreeMap::keys`] produce their items in key order, and take worst-case logarithmic and
51+
/// amortized constant time per item returned.
6752
///
6853
/// It is a logic error for a key to be modified in such a way that the key's ordering relative to
6954
/// any other key, as determined by the [`Ord`] trait, changes while it is in the map. This is
@@ -72,14 +57,6 @@ pub(super) const MIN_LEN: usize = node::MIN_LEN_AFTER_SPLIT;
7257
/// `BTreeMap` that observed the logic error and not result in undefined behavior. This could
7358
/// include panics, incorrect results, aborts, memory leaks, and non-termination.
7459
///
75-
/// Iterators obtained from functions such as [`BTreeMap::iter`], [`BTreeMap::into_iter`], [`BTreeMap::values`], or
76-
/// [`BTreeMap::keys`] produce their items in order by key, and take worst-case logarithmic and
77-
/// amortized constant time per item returned.
78-
///
79-
/// [B-Tree]: https://en.wikipedia.org/wiki/B-tree
80-
/// [`Cell`]: core::cell::Cell
81-
/// [`RefCell`]: core::cell::RefCell
82-
///
8360
/// # Examples
8461
///
8562
/// ```
@@ -169,6 +146,43 @@ pub(super) const MIN_LEN: usize = node::MIN_LEN_AFTER_SPLIT;
169146
/// // modify an entry before an insert with in-place mutation
170147
/// player_stats.entry("mana").and_modify(|mana| *mana += 200).or_insert(100);
171148
/// ```
149+
///
150+
/// # Background
151+
///
152+
/// A B-tree is (like) a [binary search tree], but adapted to the natural granularity that modern
153+
/// machines like to consume data at. This means that each node contains an entire array of elements,
154+
/// instead of just a single element.
155+
///
156+
/// B-Trees represent a fundamental compromise between cache-efficiency and actually minimizing
157+
/// the amount of work performed in a search. In theory, a binary search tree (BST) is the optimal
158+
/// choice for a sorted map, as a perfectly balanced BST performs the theoretical minimum number of
159+
/// comparisons necessary to find an element (log<sub>2</sub>n). However, in practice the way this
160+
/// is done is *very* inefficient for modern computer architectures. In particular, every element
161+
/// is stored in its own individually heap-allocated node. This means that every single insertion
162+
/// triggers a heap-allocation, and every comparison is a potential cache-miss due to the indirection.
163+
/// Since both heap-allocations and cache-misses are notably expensive in practice, we are forced to,
164+
/// at the very least, reconsider the BST strategy.
165+
///
166+
/// A B-Tree instead makes each node contain B-1 to 2B-1 elements in a contiguous array. By doing
167+
/// this, we reduce the number of allocations by a factor of B, and improve cache efficiency in
168+
/// searches. However, this does mean that searches will have to do *more* comparisons on average.
169+
/// The precise number of comparisons depends on the node search strategy used. For optimal cache
170+
/// efficiency, one could search the nodes linearly. For optimal comparisons, one could search
171+
/// the node using binary search. As a compromise, one could also perform a linear search
172+
/// that initially only checks every i<sup>th</sup> element for some choice of i.
173+
///
174+
/// Currently, our implementation simply performs naive linear search. This provides excellent
175+
/// performance on *small* nodes of elements which are cheap to compare. However in the future we
176+
/// would like to further explore choosing the optimal search strategy based on the choice of B,
177+
/// and possibly other factors. Using linear search, searching for a random element is expected
178+
/// to take B * log(n) comparisons, which is generally worse than a BST. In practice,
179+
/// however, performance is excellent.
180+
///
181+
/// [B-Tree]: https://en.wikipedia.org/wiki/B-tree
182+
/// [binary search tree]: https://en.wikipedia.org/wiki/Binary_search_tree
183+
/// [total order]: https://en.wikipedia.org/wiki/Total_order
184+
/// [`Cell`]: core::cell::Cell
185+
/// [`RefCell`]: core::cell::RefCell
172186
#[stable(feature = "rust1", since = "1.0.0")]
173187
#[cfg_attr(not(test), rustc_diagnostic_item = "BTreeMap")]
174188
#[rustc_insignificant_dtor]

library/core/src/array/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -621,11 +621,11 @@ impl<T, const N: usize> [T; N] {
621621
/// assert_eq!(strings.len(), 3);
622622
/// ```
623623
#[stable(feature = "array_methods", since = "1.77.0")]
624-
#[rustc_const_unstable(feature = "const_array_each_ref", issue = "133289")]
624+
#[rustc_const_stable(feature = "const_array_each_ref", since = "CURRENT_RUSTC_VERSION")]
625625
pub const fn each_ref(&self) -> [&T; N] {
626626
let mut buf = [null::<T>(); N];
627627

628-
// FIXME(const-hack): We would like to simply use iterators for this (as in the original implementation), but this is not allowed in constant expressions.
628+
// FIXME(const_trait_impl): We would like to simply use iterators for this (as in the original implementation), but this is not allowed in constant expressions.
629629
let mut i = 0;
630630
while i < N {
631631
buf[i] = &raw const self[i];
@@ -652,11 +652,11 @@ impl<T, const N: usize> [T; N] {
652652
/// assert_eq!(floats, [0.0, 2.7, -1.0]);
653653
/// ```
654654
#[stable(feature = "array_methods", since = "1.77.0")]
655-
#[rustc_const_unstable(feature = "const_array_each_ref", issue = "133289")]
655+
#[rustc_const_stable(feature = "const_array_each_ref", since = "CURRENT_RUSTC_VERSION")]
656656
pub const fn each_mut(&mut self) -> [&mut T; N] {
657657
let mut buf = [null_mut::<T>(); N];
658658

659-
// FIXME(const-hack): We would like to simply use iterators for this (as in the original implementation), but this is not allowed in constant expressions.
659+
// FIXME(const_trait_impl): We would like to simply use iterators for this (as in the original implementation), but this is not allowed in constant expressions.
660660
let mut i = 0;
661661
while i < N {
662662
buf[i] = &raw mut self[i];

library/core/src/char/methods.rs

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1874,28 +1874,33 @@ pub const unsafe fn encode_utf8_raw_unchecked(code: u32, dst: *mut u8) {
18741874
// SAFETY: The caller must guarantee that the buffer pointed to by `dst`
18751875
// is at least `len` bytes long.
18761876
unsafe {
1877-
match len {
1878-
1 => {
1879-
*dst = code as u8;
1880-
}
1881-
2 => {
1882-
*dst = (code >> 6 & 0x1F) as u8 | TAG_TWO_B;
1883-
*dst.add(1) = (code & 0x3F) as u8 | TAG_CONT;
1884-
}
1885-
3 => {
1886-
*dst = (code >> 12 & 0x0F) as u8 | TAG_THREE_B;
1887-
*dst.add(1) = (code >> 6 & 0x3F) as u8 | TAG_CONT;
1888-
*dst.add(2) = (code & 0x3F) as u8 | TAG_CONT;
1889-
}
1890-
4 => {
1891-
*dst = (code >> 18 & 0x07) as u8 | TAG_FOUR_B;
1892-
*dst.add(1) = (code >> 12 & 0x3F) as u8 | TAG_CONT;
1893-
*dst.add(2) = (code >> 6 & 0x3F) as u8 | TAG_CONT;
1894-
*dst.add(3) = (code & 0x3F) as u8 | TAG_CONT;
1895-
}
1896-
// SAFETY: `char` always takes between 1 and 4 bytes to encode in UTF-8.
1897-
_ => crate::hint::unreachable_unchecked(),
1877+
if len == 1 {
1878+
*dst = code as u8;
1879+
return;
1880+
}
1881+
1882+
let last1 = (code >> 0 & 0x3F) as u8 | TAG_CONT;
1883+
let last2 = (code >> 6 & 0x3F) as u8 | TAG_CONT;
1884+
let last3 = (code >> 12 & 0x3F) as u8 | TAG_CONT;
1885+
let last4 = (code >> 18 & 0x3F) as u8 | TAG_FOUR_B;
1886+
1887+
if len == 2 {
1888+
*dst = last2 | TAG_TWO_B;
1889+
*dst.add(1) = last1;
1890+
return;
18981891
}
1892+
1893+
if len == 3 {
1894+
*dst = last3 | TAG_THREE_B;
1895+
*dst.add(1) = last2;
1896+
*dst.add(2) = last1;
1897+
return;
1898+
}
1899+
1900+
*dst = last4;
1901+
*dst.add(1) = last3;
1902+
*dst.add(2) = last2;
1903+
*dst.add(3) = last1;
18991904
}
19001905
}
19011906

library/core/src/cmp.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,6 +1554,9 @@ pub fn min<T: Ord>(v1: T, v2: T) -> T {
15541554
///
15551555
/// Returns the first argument if the comparison determines them to be equal.
15561556
///
1557+
/// The parameter order is preserved when calling the `compare` function, i.e. `v1` is
1558+
/// always passed as the first argument and `v2` as the second.
1559+
///
15571560
/// # Examples
15581561
///
15591562
/// ```
@@ -1574,7 +1577,7 @@ pub fn min<T: Ord>(v1: T, v2: T) -> T {
15741577
#[must_use]
15751578
#[stable(feature = "cmp_min_max_by", since = "1.53.0")]
15761579
pub fn min_by<T, F: FnOnce(&T, &T) -> Ordering>(v1: T, v2: T, compare: F) -> T {
1577-
if compare(&v2, &v1).is_lt() { v2 } else { v1 }
1580+
if compare(&v1, &v2).is_le() { v1 } else { v2 }
15781581
}
15791582

15801583
/// Returns the element that gives the minimum value from the specified function.
@@ -1646,6 +1649,9 @@ pub fn max<T: Ord>(v1: T, v2: T) -> T {
16461649
///
16471650
/// Returns the second argument if the comparison determines them to be equal.
16481651
///
1652+
/// The parameter order is preserved when calling the `compare` function, i.e. `v1` is
1653+
/// always passed as the first argument and `v2` as the second.
1654+
///
16491655
/// # Examples
16501656
///
16511657
/// ```
@@ -1666,7 +1672,7 @@ pub fn max<T: Ord>(v1: T, v2: T) -> T {
16661672
#[must_use]
16671673
#[stable(feature = "cmp_min_max_by", since = "1.53.0")]
16681674
pub fn max_by<T, F: FnOnce(&T, &T) -> Ordering>(v1: T, v2: T, compare: F) -> T {
1669-
if compare(&v2, &v1).is_lt() { v1 } else { v2 }
1675+
if compare(&v1, &v2).is_gt() { v1 } else { v2 }
16701676
}
16711677

16721678
/// Returns the element that gives the maximum value from the specified function.
@@ -1745,6 +1751,9 @@ where
17451751
///
17461752
/// Returns `[v1, v2]` if the comparison determines them to be equal.
17471753
///
1754+
/// The parameter order is preserved when calling the `compare` function, i.e. `v1` is
1755+
/// always passed as the first argument and `v2` as the second.
1756+
///
17481757
/// # Examples
17491758
///
17501759
/// ```
@@ -1769,7 +1778,7 @@ pub fn minmax_by<T, F>(v1: T, v2: T, compare: F) -> [T; 2]
17691778
where
17701779
F: FnOnce(&T, &T) -> Ordering,
17711780
{
1772-
if compare(&v2, &v1).is_lt() { [v2, v1] } else { [v1, v2] }
1781+
if compare(&v1, &v2).is_le() { [v1, v2] } else { [v2, v1] }
17731782
}
17741783

17751784
/// Returns minimum and maximum values with respect to the specified key function.

library/core/src/intrinsics/mod.rs

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -267,53 +267,72 @@ pub unsafe fn atomic_fence<const ORD: AtomicOrdering>();
267267
pub unsafe fn atomic_singlethreadfence<const ORD: AtomicOrdering>();
268268

269269
/// The `prefetch` intrinsic is a hint to the code generator to insert a prefetch instruction
270-
/// if supported; otherwise, it is a no-op.
270+
/// for the given address if supported; otherwise, it is a no-op.
271271
/// Prefetches have no effect on the behavior of the program but can change its performance
272272
/// characteristics.
273273
///
274-
/// The `locality` argument must be a constant integer and is a temporal locality specifier
275-
/// ranging from (0) - no locality, to (3) - extremely local keep in cache.
274+
/// The `LOCALITY` argument is a temporal locality specifier ranging from (0) - no locality,
275+
/// to (3) - extremely local keep in cache.
276276
///
277277
/// This intrinsic does not have a stable counterpart.
278278
#[rustc_intrinsic]
279279
#[rustc_nounwind]
280-
pub unsafe fn prefetch_read_data<T>(data: *const T, locality: i32);
280+
#[miri::intrinsic_fallback_is_spec]
281+
pub const fn prefetch_read_data<T, const LOCALITY: i32>(data: *const T) {
282+
// This operation is a no-op, unless it is overridden by the backend.
283+
let _ = data;
284+
}
285+
281286
/// The `prefetch` intrinsic is a hint to the code generator to insert a prefetch instruction
282-
/// if supported; otherwise, it is a no-op.
287+
/// for the given address if supported; otherwise, it is a no-op.
283288
/// Prefetches have no effect on the behavior of the program but can change its performance
284289
/// characteristics.
285290
///
286-
/// The `locality` argument must be a constant integer and is a temporal locality specifier
287-
/// ranging from (0) - no locality, to (3) - extremely local keep in cache.
291+
/// The `LOCALITY` argument is a temporal locality specifier ranging from (0) - no locality,
292+
/// to (3) - extremely local keep in cache.
288293
///
289294
/// This intrinsic does not have a stable counterpart.
290295
#[rustc_intrinsic]
291296
#[rustc_nounwind]
292-
pub unsafe fn prefetch_write_data<T>(data: *const T, locality: i32);
297+
#[miri::intrinsic_fallback_is_spec]
298+
pub const fn prefetch_write_data<T, const LOCALITY: i32>(data: *const T) {
299+
// This operation is a no-op, unless it is overridden by the backend.
300+
let _ = data;
301+
}
302+
293303
/// The `prefetch` intrinsic is a hint to the code generator to insert a prefetch instruction
294-
/// if supported; otherwise, it is a no-op.
304+
/// for the given address if supported; otherwise, it is a no-op.
295305
/// Prefetches have no effect on the behavior of the program but can change its performance
296306
/// characteristics.
297307
///
298-
/// The `locality` argument must be a constant integer and is a temporal locality specifier
299-
/// ranging from (0) - no locality, to (3) - extremely local keep in cache.
308+
/// The `LOCALITY` argument is a temporal locality specifier ranging from (0) - no locality,
309+
/// to (3) - extremely local keep in cache.
300310
///
301311
/// This intrinsic does not have a stable counterpart.
302312
#[rustc_intrinsic]
303313
#[rustc_nounwind]
304-
pub unsafe fn prefetch_read_instruction<T>(data: *const T, locality: i32);
314+
#[miri::intrinsic_fallback_is_spec]
315+
pub const fn prefetch_read_instruction<T, const LOCALITY: i32>(data: *const T) {
316+
// This operation is a no-op, unless it is overridden by the backend.
317+
let _ = data;
318+
}
319+
305320
/// The `prefetch` intrinsic is a hint to the code generator to insert a prefetch instruction
306-
/// if supported; otherwise, it is a no-op.
321+
/// for the given address if supported; otherwise, it is a no-op.
307322
/// Prefetches have no effect on the behavior of the program but can change its performance
308323
/// characteristics.
309324
///
310-
/// The `locality` argument must be a constant integer and is a temporal locality specifier
311-
/// ranging from (0) - no locality, to (3) - extremely local keep in cache.
325+
/// The `LOCALITY` argument is a temporal locality specifier ranging from (0) - no locality,
326+
/// to (3) - extremely local keep in cache.
312327
///
313328
/// This intrinsic does not have a stable counterpart.
314329
#[rustc_intrinsic]
315330
#[rustc_nounwind]
316-
pub unsafe fn prefetch_write_instruction<T>(data: *const T, locality: i32);
331+
#[miri::intrinsic_fallback_is_spec]
332+
pub const fn prefetch_write_instruction<T, const LOCALITY: i32>(data: *const T) {
333+
// This operation is a no-op, unless it is overridden by the backend.
334+
let _ = data;
335+
}
317336

318337
/// Executes a breakpoint trap, for inspection by a debugger.
319338
///

0 commit comments

Comments
 (0)