Skip to content

Commit 282aa14

Browse files
committed
move internals & utilities needed by the feature into a seperate module
1 parent 2a3c5d9 commit 282aa14

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

library/core/src/cmp.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
#![stable(feature = "rust1", since = "1.0.0")]
2727

2828
mod bytewise;
29-
#[cfg(not(bootstrap))]
30-
mod pattern;
3129
pub(crate) use bytewise::BytewiseEq;
3230

3331
use self::Ordering::*;

library/core/src/intrinsics/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1965,7 +1965,6 @@ pub const fn needs_drop<T: ?Sized>() -> bool {
19651965
/// of bounds or arithmetic overflow occurs then this operation is undefined behavior.
19661966
///
19671967
/// The stabilized version of this intrinsic is [`pointer::offset`].
1968-
#[cfg_attr(not(bootstrap), lang = "offset")]
19691968
#[must_use = "returns a new pointer rather than modifying its argument"]
19701969
#[rustc_intrinsic_const_stable_indirect]
19711970
#[rustc_nounwind]
@@ -4203,7 +4202,6 @@ pub const fn type_id<T: ?Sized + 'static>() -> u128 {
42034202
/// This is used to implement functions like `slice::from_raw_parts_mut` and
42044203
/// `ptr::from_raw_parts` in a way compatible with the compiler being able to
42054204
/// change the possible layouts of pointers.
4206-
#[cfg_attr(not(bootstrap), lang = "aggregate_raw_ptr")]
42074205
#[rustc_nounwind]
42084206
#[unstable(feature = "core_intrinsics", issue = "none")]
42094207
#[rustc_intrinsic_const_stable_indirect]

library/core/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,9 @@ pub use crate::macros::cfg_match;
252252
#[macro_use]
253253
mod internal_macros;
254254

255+
#[cfg(not(bootstrap))]
256+
mod match_internals;
257+
255258
#[path = "num/shells/int_macros.rs"]
256259
#[macro_use]
257260
mod int_macros;
Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
use crate::cmp::BytewiseEq;
2-
use crate::intrinsics::compare_bytes;
3-
use crate::mem;
2+
use crate::{intrinsics, mem};
3+
4+
#[lang = "aggregate_raw_ptr"]
5+
const fn aggregate_raw_ptr<T>(data: *const T, meta: usize) -> *const [T] {
6+
intrinsics::aggregate_raw_ptr(data, meta)
7+
}
8+
9+
#[lang = "offset"]
10+
const fn offset<T>(ptr: *const T, offset: usize) -> *const T {
11+
unsafe { intrinsics::offset(ptr, offset) }
12+
}
413

514
#[lang = "PatternConstEq"]
615
#[const_trait]
@@ -68,7 +77,8 @@ where
6877
// The two slices have been checked to have the same size above.
6978
unsafe {
7079
let size = mem::size_of_val(self);
71-
compare_bytes(self.as_ptr() as *const u8, other.as_ptr() as *const u8, size) == 0
80+
intrinsics::compare_bytes(self.as_ptr() as *const u8, other.as_ptr() as *const u8, size)
81+
== 0
7282
}
7383
}
7484
}

0 commit comments

Comments
 (0)