Skip to content

Commit 22c2454

Browse files
committed
switch back to intrinsics for better inlining
1 parent 658b758 commit 22c2454

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

compiler/rustc_mir_build/src/builder/matches/test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
372372
block,
373373
span,
374374
LangItem::Offset,
375-
&[elem_ty],
375+
&[elem_ptr_ty, tcx.types.usize],
376376
span.args([Operand::Copy(temp_elem_ptr), ptr_offset]),
377377
updated_ptr
378378
)
@@ -387,7 +387,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
387387
block,
388388
span,
389389
LangItem::AggregateRawPtr,
390-
&[elem_ty],
390+
&[slice_ptr_ty, elem_ptr_ty, tcx.types.usize],
391391
span.args([Operand::Copy(updated_ptr), slice_len]),
392392
subslice_ptr
393393
)

library/core/src/intrinsics/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1965,6 +1965,7 @@ 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")]
19681969
#[must_use = "returns a new pointer rather than modifying its argument"]
19691970
#[rustc_intrinsic_const_stable_indirect]
19701971
#[rustc_nounwind]
@@ -4202,6 +4203,7 @@ pub const fn type_id<T: ?Sized + 'static>() -> u128 {
42024203
/// This is used to implement functions like `slice::from_raw_parts_mut` and
42034204
/// `ptr::from_raw_parts` in a way compatible with the compiler being able to
42044205
/// change the possible layouts of pointers.
4206+
#[cfg_attr(not(bootstrap), lang = "aggregate_raw_ptr")]
42054207
#[rustc_nounwind]
42064208
#[unstable(feature = "core_intrinsics", issue = "none")]
42074209
#[rustc_intrinsic_const_stable_indirect]

library/core/src/match_internals.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
11
use crate::cmp::BytewiseEq;
22
use crate::{intrinsics, mem};
33

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-
}
13-
144
#[lang = "PatternConstEq"]
155
#[const_trait]
166
trait PatternConstEq<Rhs = Self>

0 commit comments

Comments
 (0)