Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
4ce5634
libstd: init(): dup() subsequent /dev/nulls instead of opening them a…
nabijaczleweli Feb 23, 2025
67241d2
#[allow(dead_code)]
nabijaczleweli Mar 26, 2025
1d59c57
https://github.com/rust-lang/rust/pull/139717#issuecomment-2799036117 🥴
nabijaczleweli Apr 12, 2025
2e6b8b3
Fix parameter order for `_by()` variants of `min` / `max`/ `minmax` i…
miried Apr 4, 2025
f063651
stabilize `const_array_each_ref`
fee1-dead Jul 3, 2025
0ac7b78
std/sys/fd: remove `- 1` from `READ_LIMIT` on Darwin
morinmorin Jul 25, 2025
ce46942
[Doc] Add links to the various collections
QnJ1c2kNCg Jul 31, 2025
c9890ec
corrected lifetime in core::panic::Location::file return type
ijchen Oct 24, 2024
4820c70
added regression test for `core::panic::Location::file`'s lifetime
ijchen Oct 24, 2024
e8c8c6e
corrected lifetime in core::panic::Location::file return type
ijchen Oct 24, 2024
7a58365
moved new test to updated test location
ijchen Aug 2, 2025
fd7b116
updated line number in test
ijchen Aug 2, 2025
9ae91f0
Merge ref '07b7dc90ee4d' from rust-lang/rust
Aug 4, 2025
559121a
Clarify EOF handling for `BufRead::skip_until`
ginnyTheCat Aug 6, 2025
f8272af
Merge ref '4c7749e8c8e5' from rust-lang/rust
Aug 9, 2025
b7af5d7
reorganize rwlock file
connortsui20 Jul 19, 2025
99139a8
add `nonpoison::rwlock` implementation
connortsui20 Jul 20, 2025
5087986
reorganize rwlock tests
connortsui20 Jul 21, 2025
88e5129
add nonpoison and poison rwlock tests
connortsui20 Jul 29, 2025
8f49327
Merge ref '1553adfe6884' from rust-lang/rust
Aug 13, 2025
b8efab7
std_detect: RISC-V platform guide documentation
a4lg Aug 15, 2025
65f9cb5
Merge ref '3507a749b365' from rust-lang/rust
Aug 15, 2025
6e032f4
Optimize `char::encode_utf8`
Kmeakin Aug 16, 2025
6b7066b
stdlib: Replace typedef -> type alias in doc comment
typesanitizer Aug 17, 2025
e4f579f
Add runtime detection for APX-F and AVX10
sayantn Aug 17, 2025
7941af7
bufreader::Buffer::backshift: don't move the uninit bytes
lolbinarycat Aug 17, 2025
cc5846f
Merge ref '425a9c0a0e36' from rust-lang/rust
Aug 18, 2025
162cb1d
Implement feature `int_lowest_highest_one` for integer and NonZero types
Gnurou Aug 10, 2025
2665393
cargo update
invalid-email-address Aug 17, 2025
d103ec3
std_detect: RISC-V: implement implication to "C"
a4lg Aug 19, 2025
2cad529
UnsafePinned::raw_get: sync signature with get
RalfJung Aug 19, 2025
1535c72
Remove hs_abs_cmp examples
miried Aug 19, 2025
001ff20
Merge remote-tracking branch 'upstream/master'
miried Aug 19, 2025
f802233
Rollup merge of #145538 - lolbinarycat:std-bufreader-buffer-backshift…
jieyouxu Aug 19, 2025
8c82467
`std_detect`: Use `rustc-std-workspace-*` to pull in `compiler-builtins`
joshtriplett Aug 19, 2025
33d01ad
Update lockfile for changes to `std_detect`
joshtriplett Aug 19, 2025
6de3003
Remove the std workspace patch for `compiler-builtins`
tgross35 Aug 19, 2025
6dde419
add a fallback implementation for the `prefetch_*` intrinsics
folkertdev Aug 19, 2025
a202162
Fix typos in LocalKey documentation
qxzcode Aug 19, 2025
da4a70c
Adjust wording for conciseness
qxzcode Aug 19, 2025
0a6b3f6
make `prefetch` intrinsics safe
folkertdev Aug 19, 2025
1e19dbc
Tweak wording again
qxzcode Aug 19, 2025
ede2f42
Auto merge of #145601 - jieyouxu:rollup-t5mbqhc, r=jieyouxu
bors Aug 19, 2025
bd69f8d
Rollup merge of #139357 - miried:master, r=Amanieu
jhpratt Aug 20, 2025
43b02cb
Rollup merge of #145006 - ginnyTheCat:docs-skip-until, r=ibraheemdev
jhpratt Aug 20, 2025
bbaa398
Rollup merge of #145381 - Gnurou:int_lowest_highest_one, r=jhpratt
jhpratt Aug 20, 2025
858c223
Rollup merge of #145417 - a4lg:riscv-arch-platform-guide-ch2, r=Amanieu
jhpratt Aug 20, 2025
582333a
Rollup merge of #145531 - sayantn:detect-apxf-avx10, r=Amanieu
jhpratt Aug 20, 2025
55c9d8f
Rollup merge of #145619 - joshtriplett:use-the-right-core, r=tgross35
jhpratt Aug 20, 2025
daec924
Rollup merge of #145622 - tgross35:remove-builtins-patch, r=Mark-Simu…
jhpratt Aug 20, 2025
8c27ba6
Rollup merge of #145626 - folkertdev:prefetch-fallback, r=Amanieu
jhpratt Aug 20, 2025
78be8dc
Merge ref 'f605b57042ff' from rust-lang/rust
Aug 20, 2025
49ac6d8
Pass `alloc-variant-zeroed` to LLVM
clubby789 Jul 17, 2025
ad625e6
Add flock support for cygwin
Berrysoft Aug 20, 2025
9bcee26
Auto merge of #144086 - clubby789:alloc-zeroed, r=nikic
bors Aug 20, 2025
cfa0103
fix: typo
ttajakka Aug 20, 2025
e99feb4
Migrate `panic_unwind` to use `cfg_select!`
cuviper Aug 20, 2025
3d65137
Rollup merge of #143383 - fee1-dead-contrib:push-mstmlwuskxyy, r=dtolnay
jhpratt Aug 21, 2025
23d9cd8
Rollup merge of #144758 - QnJ1c2kNCg:master, r=Noratrieb
jhpratt Aug 21, 2025
755ebb7
Rollup merge of #145415 - a4lg:riscv-implication-to-c, r=Amanieu
jhpratt Aug 21, 2025
1449934
Rollup merge of #145525 - typesanitizer:vg/doc, r=Mark-Simulacrum
jhpratt Aug 21, 2025
e51d7a5
Rollup merge of #145593 - RalfJung:unsafepinned-raw_get, r=Mark-Simul…
jhpratt Aug 21, 2025
a11eda9
Rollup merge of #145673 - Berrysoft:cygwin-fix-flock, r=joshtriplett
jhpratt Aug 21, 2025
a40847f
Rollup merge of #145678 - ttajakka:master, r=estebank
jhpratt Aug 21, 2025
84be05f
Consolidate panicking functions in `slice/index.rs`
Kmeakin Jul 25, 2025
9a75e6e
Auto merge of #145647 - RalfJung:miri, r=RalfJung
bors Aug 21, 2025
b551f75
Introduce Reborrow lang item and trait
aapoalas Aug 21, 2025
084c234
Rollup merge of #137494 - nabijaczleweli:dup, r=Mark-Simulacrum
jhpratt Aug 21, 2025
15b856b
Rollup merge of #145137 - Kmeakin:km/optimize-slice-index-panicking, …
jhpratt Aug 21, 2025
764ad79
Rollup merge of #145689 - cuviper:panic_unwind-cfg, r=joshtriplett
jhpratt Aug 21, 2025
9fdc1da
modify `LazyLock` poison panic message
connortsui20 Aug 22, 2025
3da5817
Rollup merge of #132087 - ijchen:issue-131770-fix, r=dtolnay
jhpratt Aug 23, 2025
667bde0
Rollup merge of #144648 - connortsui20:nonpoison_rwlock, r=Mark-Simul…
jhpratt Aug 23, 2025
c65cb62
Rollup merge of #145633 - qxzcode:patch-1, r=jhpratt
jhpratt Aug 23, 2025
5839559
Rollup merge of #145726 - aapoalas:reborrow-lang-experiment, r=petroc…
jhpratt Aug 23, 2025
ed6f938
Auto merge of #145567 - clubby789:cargo_update, r=clubby789
bors Aug 23, 2025
c0964b5
Rollup merge of #144452 - morinmorin:apple/update_read_limit, r=Chris…
samueltardieu Aug 23, 2025
99e758b
Rollup merge of #145515 - Kmeakin:km/optimize-char-encode-utf8, r=Mar…
samueltardieu Aug 23, 2025
1b63e44
std/src/lib.rs: mention "search button" instead of "search bar"
ada4a Aug 23, 2025
335398a
Allow `integer_to_ptr_transmutes` in core
Urgau Jul 27, 2025
14c5f44
Rollup merge of #144531 - Urgau:int_to_ptr_transmutes, r=jackh726
jhpratt Aug 24, 2025
d69503d
Rollup merge of #145307 - connortsui20:lazylock-poison-msg, r=Amanieu
jhpratt Aug 24, 2025
10ce6f6
Rollup merge of #145799 - ada4a:patch-3, r=GuillaumeGomez
jhpratt Aug 24, 2025
f10e36e
Dial down detail of B-tree description
hkBst Jan 20, 2025
6600102
focus more on ordered aspect and restore old comments
hkBst Jan 21, 2025
4401a69
Prevent confusion with insertion-ordered maps.
hkBst Jan 22, 2025
b8acf06
Rollup merge of #135761 - hkBst:patch-9, r=ibraheemdev
Zalathar Aug 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,3 @@ rustflags = ["-Cpanic=abort"]
rustc-std-workspace-core = { path = 'rustc-std-workspace-core' }
rustc-std-workspace-alloc = { path = 'rustc-std-workspace-alloc' }
rustc-std-workspace-std = { path = 'rustc-std-workspace-std' }
compiler_builtins = { path = "compiler-builtins/compiler-builtins" }
1 change: 1 addition & 0 deletions alloc/src/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ unsafe extern "Rust" {
#[rustc_allocator]
#[rustc_nounwind]
#[rustc_std_internal_symbol]
#[rustc_allocator_zeroed_variant = "__rust_alloc_zeroed"]
fn __rust_alloc(size: usize, align: usize) -> *mut u8;
#[rustc_deallocator]
#[rustc_nounwind]
Expand Down
76 changes: 45 additions & 31 deletions alloc/src/collections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,30 +40,15 @@ pub(super) const MIN_LEN: usize = node::MIN_LEN_AFTER_SPLIT;

/// An ordered map based on a [B-Tree].
///
/// B-Trees represent a fundamental compromise between cache-efficiency and actually minimizing
/// the amount of work performed in a search. In theory, a binary search tree (BST) is the optimal
/// choice for a sorted map, as a perfectly balanced BST performs the theoretical minimum amount of
/// comparisons necessary to find an element (log<sub>2</sub>n). However, in practice the way this
/// is done is *very* inefficient for modern computer architectures. In particular, every element
/// is stored in its own individually heap-allocated node. This means that every single insertion
/// triggers a heap-allocation, and every single comparison should be a cache-miss. Since these
/// are both notably expensive things to do in practice, we are forced to, at the very least,
/// reconsider the BST strategy.
///
/// A B-Tree instead makes each node contain B-1 to 2B-1 elements in a contiguous array. By doing
/// this, we reduce the number of allocations by a factor of B, and improve cache efficiency in
/// searches. However, this does mean that searches will have to do *more* comparisons on average.
/// The precise number of comparisons depends on the node search strategy used. For optimal cache
/// efficiency, one could search the nodes linearly. For optimal comparisons, one could search
/// the node using binary search. As a compromise, one could also perform a linear search
/// that initially only checks every i<sup>th</sup> element for some choice of i.
/// Given a key type with a [total order], an ordered map stores its entries in key order.
/// That means that keys must be of a type that implements the [`Ord`] trait,
/// such that two keys can always be compared to determine their [`Ordering`].
/// Examples of keys with a total order are strings with lexicographical order,
/// and numbers with their natural order.
///
/// Currently, our implementation simply performs naive linear search. This provides excellent
/// performance on *small* nodes of elements which are cheap to compare. However in the future we
/// would like to further explore choosing the optimal search strategy based on the choice of B,
/// and possibly other factors. Using linear search, searching for a random element is expected
/// to take B * log(n) comparisons, which is generally worse than a BST. In practice,
/// however, performance is excellent.
/// Iterators obtained from functions such as [`BTreeMap::iter`], [`BTreeMap::into_iter`], [`BTreeMap::values`], or
/// [`BTreeMap::keys`] produce their items in key order, and take worst-case logarithmic and
/// amortized constant time per item returned.
///
/// It is a logic error for a key to be modified in such a way that the key's ordering relative to
/// any other key, as determined by the [`Ord`] trait, changes while it is in the map. This is
Expand All @@ -72,14 +57,6 @@ pub(super) const MIN_LEN: usize = node::MIN_LEN_AFTER_SPLIT;
/// `BTreeMap` that observed the logic error and not result in undefined behavior. This could
/// include panics, incorrect results, aborts, memory leaks, and non-termination.
///
/// Iterators obtained from functions such as [`BTreeMap::iter`], [`BTreeMap::into_iter`], [`BTreeMap::values`], or
/// [`BTreeMap::keys`] produce their items in order by key, and take worst-case logarithmic and
/// amortized constant time per item returned.
///
/// [B-Tree]: https://en.wikipedia.org/wiki/B-tree
/// [`Cell`]: core::cell::Cell
/// [`RefCell`]: core::cell::RefCell
///
/// # Examples
///
/// ```
Expand Down Expand Up @@ -169,6 +146,43 @@ pub(super) const MIN_LEN: usize = node::MIN_LEN_AFTER_SPLIT;
/// // modify an entry before an insert with in-place mutation
/// player_stats.entry("mana").and_modify(|mana| *mana += 200).or_insert(100);
/// ```
///
/// # Background
///
/// A B-tree is (like) a [binary search tree], but adapted to the natural granularity that modern
/// machines like to consume data at. This means that each node contains an entire array of elements,
/// instead of just a single element.
///
/// B-Trees represent a fundamental compromise between cache-efficiency and actually minimizing
/// the amount of work performed in a search. In theory, a binary search tree (BST) is the optimal
/// choice for a sorted map, as a perfectly balanced BST performs the theoretical minimum number of
/// comparisons necessary to find an element (log<sub>2</sub>n). However, in practice the way this
/// is done is *very* inefficient for modern computer architectures. In particular, every element
/// is stored in its own individually heap-allocated node. This means that every single insertion
/// triggers a heap-allocation, and every comparison is a potential cache-miss due to the indirection.
/// Since both heap-allocations and cache-misses are notably expensive in practice, we are forced to,
/// at the very least, reconsider the BST strategy.
///
/// A B-Tree instead makes each node contain B-1 to 2B-1 elements in a contiguous array. By doing
/// this, we reduce the number of allocations by a factor of B, and improve cache efficiency in
/// searches. However, this does mean that searches will have to do *more* comparisons on average.
/// The precise number of comparisons depends on the node search strategy used. For optimal cache
/// efficiency, one could search the nodes linearly. For optimal comparisons, one could search
/// the node using binary search. As a compromise, one could also perform a linear search
/// that initially only checks every i<sup>th</sup> element for some choice of i.
///
/// Currently, our implementation simply performs naive linear search. This provides excellent
/// performance on *small* nodes of elements which are cheap to compare. However in the future we
/// would like to further explore choosing the optimal search strategy based on the choice of B,
/// and possibly other factors. Using linear search, searching for a random element is expected
/// to take B * log(n) comparisons, which is generally worse than a BST. In practice,
/// however, performance is excellent.
///
/// [B-Tree]: https://en.wikipedia.org/wiki/B-tree
/// [binary search tree]: https://en.wikipedia.org/wiki/Binary_search_tree
/// [total order]: https://en.wikipedia.org/wiki/Total_order
/// [`Cell`]: core::cell::Cell
/// [`RefCell`]: core::cell::RefCell
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "BTreeMap")]
#[rustc_insignificant_dtor]
Expand Down
8 changes: 4 additions & 4 deletions core/src/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -621,11 +621,11 @@ impl<T, const N: usize> [T; N] {
/// assert_eq!(strings.len(), 3);
/// ```
#[stable(feature = "array_methods", since = "1.77.0")]
#[rustc_const_unstable(feature = "const_array_each_ref", issue = "133289")]
#[rustc_const_stable(feature = "const_array_each_ref", since = "CURRENT_RUSTC_VERSION")]
pub const fn each_ref(&self) -> [&T; N] {
let mut buf = [null::<T>(); N];

// 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.
// 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.
let mut i = 0;
while i < N {
buf[i] = &raw const self[i];
Expand All @@ -652,11 +652,11 @@ impl<T, const N: usize> [T; N] {
/// assert_eq!(floats, [0.0, 2.7, -1.0]);
/// ```
#[stable(feature = "array_methods", since = "1.77.0")]
#[rustc_const_unstable(feature = "const_array_each_ref", issue = "133289")]
#[rustc_const_stable(feature = "const_array_each_ref", since = "CURRENT_RUSTC_VERSION")]
pub const fn each_mut(&mut self) -> [&mut T; N] {
let mut buf = [null_mut::<T>(); N];

// 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.
// 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.
let mut i = 0;
while i < N {
buf[i] = &raw mut self[i];
Expand Down
47 changes: 26 additions & 21 deletions core/src/char/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1872,28 +1872,33 @@ pub const unsafe fn encode_utf8_raw_unchecked(code: u32, dst: *mut u8) {
// SAFETY: The caller must guarantee that the buffer pointed to by `dst`
// is at least `len` bytes long.
unsafe {
match len {
1 => {
*dst = code as u8;
}
2 => {
*dst = (code >> 6 & 0x1F) as u8 | TAG_TWO_B;
*dst.add(1) = (code & 0x3F) as u8 | TAG_CONT;
}
3 => {
*dst = (code >> 12 & 0x0F) as u8 | TAG_THREE_B;
*dst.add(1) = (code >> 6 & 0x3F) as u8 | TAG_CONT;
*dst.add(2) = (code & 0x3F) as u8 | TAG_CONT;
}
4 => {
*dst = (code >> 18 & 0x07) as u8 | TAG_FOUR_B;
*dst.add(1) = (code >> 12 & 0x3F) as u8 | TAG_CONT;
*dst.add(2) = (code >> 6 & 0x3F) as u8 | TAG_CONT;
*dst.add(3) = (code & 0x3F) as u8 | TAG_CONT;
}
// SAFETY: `char` always takes between 1 and 4 bytes to encode in UTF-8.
_ => crate::hint::unreachable_unchecked(),
if len == 1 {
*dst = code as u8;
return;
}

let last1 = (code >> 0 & 0x3F) as u8 | TAG_CONT;
let last2 = (code >> 6 & 0x3F) as u8 | TAG_CONT;
let last3 = (code >> 12 & 0x3F) as u8 | TAG_CONT;
let last4 = (code >> 18 & 0x3F) as u8 | TAG_FOUR_B;

if len == 2 {
*dst = last2 | TAG_TWO_B;
*dst.add(1) = last1;
return;
}

if len == 3 {
*dst = last3 | TAG_THREE_B;
*dst.add(1) = last2;
*dst.add(2) = last1;
return;
}

*dst = last4;
*dst.add(1) = last3;
*dst.add(2) = last2;
*dst.add(3) = last1;
}
}

Expand Down
15 changes: 12 additions & 3 deletions core/src/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1554,6 +1554,9 @@ pub fn min<T: Ord>(v1: T, v2: T) -> T {
///
/// Returns the first argument if the comparison determines them to be equal.
///
/// The parameter order is preserved when calling the `compare` function, i.e. `v1` is
/// always passed as the first argument and `v2` as the second.
///
/// # Examples
///
/// ```
Expand All @@ -1574,7 +1577,7 @@ pub fn min<T: Ord>(v1: T, v2: T) -> T {
#[must_use]
#[stable(feature = "cmp_min_max_by", since = "1.53.0")]
pub fn min_by<T, F: FnOnce(&T, &T) -> Ordering>(v1: T, v2: T, compare: F) -> T {
if compare(&v2, &v1).is_lt() { v2 } else { v1 }
if compare(&v1, &v2).is_le() { v1 } else { v2 }
}

/// Returns the element that gives the minimum value from the specified function.
Expand Down Expand Up @@ -1646,6 +1649,9 @@ pub fn max<T: Ord>(v1: T, v2: T) -> T {
///
/// Returns the second argument if the comparison determines them to be equal.
///
/// The parameter order is preserved when calling the `compare` function, i.e. `v1` is
/// always passed as the first argument and `v2` as the second.
///
/// # Examples
///
/// ```
Expand All @@ -1666,7 +1672,7 @@ pub fn max<T: Ord>(v1: T, v2: T) -> T {
#[must_use]
#[stable(feature = "cmp_min_max_by", since = "1.53.0")]
pub fn max_by<T, F: FnOnce(&T, &T) -> Ordering>(v1: T, v2: T, compare: F) -> T {
if compare(&v2, &v1).is_lt() { v1 } else { v2 }
if compare(&v1, &v2).is_gt() { v1 } else { v2 }
}

/// Returns the element that gives the maximum value from the specified function.
Expand Down Expand Up @@ -1745,6 +1751,9 @@ where
///
/// Returns `[v1, v2]` if the comparison determines them to be equal.
///
/// The parameter order is preserved when calling the `compare` function, i.e. `v1` is
/// always passed as the first argument and `v2` as the second.
///
/// # Examples
///
/// ```
Expand All @@ -1769,7 +1778,7 @@ pub fn minmax_by<T, F>(v1: T, v2: T, compare: F) -> [T; 2]
where
F: FnOnce(&T, &T) -> Ordering,
{
if compare(&v2, &v1).is_lt() { [v2, v1] } else { [v1, v2] }
if compare(&v1, &v2).is_le() { [v1, v2] } else { [v2, v1] }
}

/// Returns minimum and maximum values with respect to the specified key function.
Expand Down
51 changes: 35 additions & 16 deletions core/src/intrinsics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,53 +261,72 @@ pub unsafe fn atomic_fence<const ORD: AtomicOrdering>();
pub unsafe fn atomic_singlethreadfence<const ORD: AtomicOrdering>();

/// The `prefetch` intrinsic is a hint to the code generator to insert a prefetch instruction
/// if supported; otherwise, it is a no-op.
/// for the given address if supported; otherwise, it is a no-op.
/// Prefetches have no effect on the behavior of the program but can change its performance
/// characteristics.
///
/// The `locality` argument must be a constant integer and is a temporal locality specifier
/// ranging from (0) - no locality, to (3) - extremely local keep in cache.
/// The `LOCALITY` argument is a temporal locality specifier ranging from (0) - no locality,
/// to (3) - extremely local keep in cache.
///
/// This intrinsic does not have a stable counterpart.
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn prefetch_read_data<T>(data: *const T, locality: i32);
#[miri::intrinsic_fallback_is_spec]
pub const fn prefetch_read_data<T, const LOCALITY: i32>(data: *const T) {
// This operation is a no-op, unless it is overridden by the backend.
let _ = data;
}

/// The `prefetch` intrinsic is a hint to the code generator to insert a prefetch instruction
/// if supported; otherwise, it is a no-op.
/// for the given address if supported; otherwise, it is a no-op.
/// Prefetches have no effect on the behavior of the program but can change its performance
/// characteristics.
///
/// The `locality` argument must be a constant integer and is a temporal locality specifier
/// ranging from (0) - no locality, to (3) - extremely local keep in cache.
/// The `LOCALITY` argument is a temporal locality specifier ranging from (0) - no locality,
/// to (3) - extremely local keep in cache.
///
/// This intrinsic does not have a stable counterpart.
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn prefetch_write_data<T>(data: *const T, locality: i32);
#[miri::intrinsic_fallback_is_spec]
pub const fn prefetch_write_data<T, const LOCALITY: i32>(data: *const T) {
// This operation is a no-op, unless it is overridden by the backend.
let _ = data;
}

/// The `prefetch` intrinsic is a hint to the code generator to insert a prefetch instruction
/// if supported; otherwise, it is a no-op.
/// for the given address if supported; otherwise, it is a no-op.
/// Prefetches have no effect on the behavior of the program but can change its performance
/// characteristics.
///
/// The `locality` argument must be a constant integer and is a temporal locality specifier
/// ranging from (0) - no locality, to (3) - extremely local keep in cache.
/// The `LOCALITY` argument is a temporal locality specifier ranging from (0) - no locality,
/// to (3) - extremely local keep in cache.
///
/// This intrinsic does not have a stable counterpart.
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn prefetch_read_instruction<T>(data: *const T, locality: i32);
#[miri::intrinsic_fallback_is_spec]
pub const fn prefetch_read_instruction<T, const LOCALITY: i32>(data: *const T) {
// This operation is a no-op, unless it is overridden by the backend.
let _ = data;
}

/// The `prefetch` intrinsic is a hint to the code generator to insert a prefetch instruction
/// if supported; otherwise, it is a no-op.
/// for the given address if supported; otherwise, it is a no-op.
/// Prefetches have no effect on the behavior of the program but can change its performance
/// characteristics.
///
/// The `locality` argument must be a constant integer and is a temporal locality specifier
/// ranging from (0) - no locality, to (3) - extremely local keep in cache.
/// The `LOCALITY` argument is a temporal locality specifier ranging from (0) - no locality,
/// to (3) - extremely local keep in cache.
///
/// This intrinsic does not have a stable counterpart.
#[rustc_intrinsic]
#[rustc_nounwind]
pub unsafe fn prefetch_write_instruction<T>(data: *const T, locality: i32);
#[miri::intrinsic_fallback_is_spec]
pub const fn prefetch_write_instruction<T, const LOCALITY: i32>(data: *const T) {
// This operation is a no-op, unless it is overridden by the backend.
let _ = data;
}

/// Executes a breakpoint trap, for inspection by a debugger.
///
Expand Down
1 change: 1 addition & 0 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
#![feature(no_core)]
#![feature(optimize_attribute)]
#![feature(prelude_import)]
#![feature(reborrow)]
#![feature(repr_simd)]
#![feature(rustc_allow_const_fn_unstable)]
#![feature(rustc_attrs)]
Expand Down
Loading
Loading