Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 12 pull requests #100828

Closed
wants to merge 34 commits into from
Closed
Changes from 3 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
0ff8f0b
Update src/test/assembly/x86_64-floating-point-clamp.rs
Alex-Velez Aug 15, 2022
302689f
Update src/test/assembly/x86_64-floating-point-clamp.rs
Alex-Velez Aug 17, 2022
5e1730f
Make slice::reverse const
clarfonthey Aug 17, 2022
934d259
Fix invalid comparison for Class::Decoration in `is_equal_to`
GuillaumeGomez Aug 19, 2022
7d2083c
small mir typeck cleanup
lcnr Apr 7, 2022
56b5ec8
move `type_check_internal` into `type_check`
lcnr Apr 7, 2022
07e41fb
update test for LLVM change
krasimirgg Aug 19, 2022
8b7b1f7
Minor syntax and formatting update to doc comment
eholk Aug 17, 2022
f506656
Align android `sigaddset` impl with the reference impl from Bionic
thomcc Aug 19, 2022
ae2b1db
Tracking issue for const_reverse
clarfonthey Aug 20, 2022
042e0d0
Merge "EnterSpan" events to reduce code blocks DOM size
GuillaumeGomez Aug 19, 2022
f5b5d86
Update rustdoc tests
GuillaumeGomez Aug 19, 2022
4c89c28
Clean up highlight `<span>` merge code
GuillaumeGomez Aug 19, 2022
7ab8e0c
Extend decoration test to detect regressions
GuillaumeGomez Aug 20, 2022
0c3ed96
Add `/build-rust-analyzer/` to .gitignore
Noratrieb Aug 20, 2022
0314647
Allow other directives before the `ret`
scottmcm Aug 20, 2022
ed084ba
Remove useless pointer cast
WaffleLapkin Aug 19, 2022
de9da0b
Make use of `pointer::is_aligned[_to]`
WaffleLapkin Aug 19, 2022
e4720e1
Replace most uses of `pointer::offset` with `add` and `sub`
WaffleLapkin Aug 19, 2022
3ba3934
Make some docs nicer wrt pointer offsets
WaffleLapkin Aug 19, 2022
f5be8a4
Add `rustc --print rustc-path`
CAD97 Aug 17, 2022
b2625e2
fix nitpicks from review
WaffleLapkin Aug 21, 2022
cd9c651
Rollup merge of #100556 - Alex-Velez:patch-1, r=scottmcm
matthiaskrgr Aug 21, 2022
51ea131
Rollup merge of #100663 - clarfonthey:const-reverse, r=scottmcm
matthiaskrgr Aug 21, 2022
689c930
Rollup merge of #100681 - CAD97:rustc-print-rustc, r=petrochenkov
matthiaskrgr Aug 21, 2022
3e62ffc
Rollup merge of #100697 - eholk:doc-comment-update, r=compiler-errors
matthiaskrgr Aug 21, 2022
fdda383
Rollup merge of #100760 - krasimirgg:llvm-16-pic-level, r=nikic
matthiaskrgr Aug 21, 2022
d635d60
Rollup merge of #100761 - lcnr:mir-typeck-cleanup, r=compiler-errors
matthiaskrgr Aug 21, 2022
3a4ccc8
Rollup merge of #100775 - GuillaumeGomez:reduce-span-v2, r=notriddle
matthiaskrgr Aug 21, 2022
7fff4ef
Rollup merge of #100782 - thomcc:fix-android-sigaddset, r=Mark-Simula…
matthiaskrgr Aug 21, 2022
e211509
Rollup merge of #100813 - Nilstrieb:too-much-disk-space-gitignore, r=…
matthiaskrgr Aug 21, 2022
4b880d5
Rollup merge of #100820 - WaffleLapkin:use_ptr_is_aligned_methods, r=…
matthiaskrgr Aug 21, 2022
e88e934
Rollup merge of #100821 - WaffleLapkin:ptr_add_docs, r=scottmcm
matthiaskrgr Aug 21, 2022
9b482af
Rollup merge of #100822 - WaffleLapkin:no_offset_question_mark, r=sco…
matthiaskrgr Aug 21, 2022
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: 8 additions & 5 deletions library/core/src/slice/mod.rs
Original file line number Diff line number Diff line change
@@ -674,8 +674,9 @@ impl<T> [T] {
/// assert!(v == [3, 2, 1]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_reverse", issue = "100784")]
#[inline]
pub fn reverse(&mut self) {
pub const fn reverse(&mut self) {
let half_len = self.len() / 2;
let Range { start, end } = self.as_mut_ptr_range();

@@ -698,18 +699,20 @@ impl<T> [T] {
revswap(front_half, back_half, half_len);

#[inline]
fn revswap<T>(a: &mut [T], b: &mut [T], n: usize) {
debug_assert_eq!(a.len(), n);
debug_assert_eq!(b.len(), n);
const fn revswap<T>(a: &mut [T], b: &mut [T], n: usize) {
debug_assert!(a.len() == n);
debug_assert!(b.len() == n);

// Because this function is first compiled in isolation,
// this check tells LLVM that the indexing below is
// in-bounds. Then after inlining -- once the actual
// lengths of the slices are known -- it's removed.
let (a, b) = (&mut a[..n], &mut b[..n]);

for i in 0..n {
let mut i = 0;
while i < n {
mem::swap(&mut a[i], &mut b[n - 1 - i]);
i += 1;
}
}
}