Skip to content

Commit 79041ed

Browse files
committed
Auto merge of rust-lang#148412 - matthiaskrgr:rollup-59a302x, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#146573 (Constify Range functions) - rust-lang#146699 (Add `is_ascii` function optimized for LoongArch64 for [u8]) - rust-lang#148026 (std: don't leak the thread closure if destroying the thread attributes fails) - rust-lang#148135 (Ignore unix socket related tests for VxWorks) - rust-lang#148211 (clippy fixes and code simplification) - rust-lang#148395 (Generalize branch references) - rust-lang#148405 (Fix suggestion when there were a colon already in generics) r? `@ghost` `@rustbot` modify labels: rollup
2 parents daced61 + d149ea1 commit 79041ed

File tree

8 files changed

+223
-115
lines changed

8 files changed

+223
-115
lines changed

core/src/intrinsics/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
//! intrinsics via stable wrapper functions. Use these instead.
66
//!
77
//! These are the imports making intrinsics available to Rust code. The actual implementations live in the compiler.
8-
//! Some of these intrinsics are lowered to MIR in <https://github.com/rust-lang/rust/blob/master/compiler/rustc_mir_transform/src/lower_intrinsics.rs>.
9-
//! The remaining intrinsics are implemented for the LLVM backend in <https://github.com/rust-lang/rust/blob/master/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs>
10-
//! and <https://github.com/rust-lang/rust/blob/master/compiler/rustc_codegen_llvm/src/intrinsic.rs>,
11-
//! and for const evaluation in <https://github.com/rust-lang/rust/blob/master/compiler/rustc_const_eval/src/interpret/intrinsics.rs>.
8+
//! Some of these intrinsics are lowered to MIR in <https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc_mir_transform/src/lower_intrinsics.rs>.
9+
//! The remaining intrinsics are implemented for the LLVM backend in <https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs>
10+
//! and <https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc_codegen_llvm/src/intrinsic.rs>,
11+
//! and for const evaluation in <https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc_const_eval/src/interpret/intrinsics.rs>.
1212
//!
1313
//! # Const intrinsics
1414
//!
1515
//! In order to make an intrinsic unstable usable at compile-time, copy the implementation from
1616
//! <https://github.com/rust-lang/miri/blob/master/src/intrinsics> to
17-
//! <https://github.com/rust-lang/rust/blob/master/compiler/rustc_const_eval/src/interpret/intrinsics.rs>
17+
//! <https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc_const_eval/src/interpret/intrinsics.rs>
1818
//! and make the intrinsic declaration below a `const fn`. This should be done in coordination with
1919
//! wg-const-eval.
2020
//!

core/src/ops/index_range.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ use crate::ub_checks;
99
///
1010
/// (Normal `Range` code needs to handle degenerate ranges like `10..0`,
1111
/// which takes extra checks compared to only handling the canonical form.)
12-
#[derive(Clone, Debug, PartialEq, Eq)]
12+
#[derive(Debug)]
13+
#[derive_const(Clone, Eq, PartialEq)]
1314
pub(crate) struct IndexRange {
1415
start: usize,
1516
end: usize,
@@ -54,7 +55,7 @@ impl IndexRange {
5455
/// # Safety
5556
/// - Can only be called when `start < end`, aka when `len > 0`.
5657
#[inline]
57-
unsafe fn next_unchecked(&mut self) -> usize {
58+
const unsafe fn next_unchecked(&mut self) -> usize {
5859
debug_assert!(self.start < self.end);
5960

6061
let value = self.start;
@@ -66,7 +67,7 @@ impl IndexRange {
6667
/// # Safety
6768
/// - Can only be called when `start < end`, aka when `len > 0`.
6869
#[inline]
69-
unsafe fn next_back_unchecked(&mut self) -> usize {
70+
const unsafe fn next_back_unchecked(&mut self) -> usize {
7071
debug_assert!(self.start < self.end);
7172

7273
// SAFETY: The range isn't empty, so this cannot overflow
@@ -116,7 +117,7 @@ impl IndexRange {
116117
}
117118

118119
#[inline]
119-
fn assume_range(&self) {
120+
const fn assume_range(&self) {
120121
// SAFETY: This is the type invariant
121122
unsafe { crate::hint::assert_unchecked(self.start <= self.end) }
122123
}

0 commit comments

Comments
 (0)