about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-07-13 15:15:58 +0200
committerGitHub <noreply@github.com>2025-07-13 15:15:58 +0200
commit061bd28ceeebf03cb779b10ad1966ec868b1f153 (patch)
treecd41172bbd976c08b6b4a635ff9c6d87f97e79ba /compiler/rustc_const_eval/src
parent7e0721b79881fc9bddb713f7237e7dae132e9f79 (diff)
parent3751e133bca55dbec521ccb36132fa0bdbf10b88 (diff)
downloadrust-061bd28ceeebf03cb779b10ad1966ec868b1f153.tar.gz
rust-061bd28ceeebf03cb779b10ad1966ec868b1f153.zip
Rollup merge of #143554 - okaneco:const_slice_rotate, r=Amanieu,tgross35
slice: Mark `rotate_left`, `rotate_right` unstably const

Tracking issue rust-lang/rust#143812

- Add the const unstable `const_slice_rotate` feature
- Mark `<[T]>::rotate_left` and `<[T]>::rotate_right` as const unstable

The internal rotate functions use [`<*mut T>::replace`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.replace) and [`ptr::swap_nonoverlapping`](https://doc.rust-lang.org/stable/core/ptr/fn.swap_nonoverlapping.html) which were const-stabilized in 1.88.

Two changes were needed in the `rotate.rs` module to make these functions const:
1. A usage of `cmp::min` was replaced with a local function implementation of [`Ord::min`](https://doc.rust-lang.org/1.88.0/src/core/cmp.rs.html#1048-1053).
2. A `for start in 1..gcd` loop was changed to a while loop with an increment variable.

This needs libs-api approval and cc-ing const-eval.
Diffstat (limited to 'compiler/rustc_const_eval/src')
0 files changed, 0 insertions, 0 deletions