diff options
| author | Simonas Kazlauskas <git@kazlauskas.me> | 2018-05-04 00:49:22 +0300 |
|---|---|---|
| committer | Simonas Kazlauskas <git@kazlauskas.me> | 2018-05-17 23:13:42 +0300 |
| commit | 6d5bf8b23f4e59fdc67f635a10f450dfab2f076b (patch) | |
| tree | d73787a67d3af203fc03693ff7f47c5e2ea9d406 /src/libcore/slice | |
| parent | 680031b0164a94aaeee17a1d8c3027e6e8865a4c (diff) | |
| download | rust-6d5bf8b23f4e59fdc67f635a10f450dfab2f076b.tar.gz rust-6d5bf8b23f4e59fdc67f635a10f450dfab2f076b.zip | |
Remove the intrinsic for align_offset
Keep only the language item. This removes some indirection and makes codegen worse for debug builds, but simplifies code significantly, which is a good tradeoff to make, in my opinion. Besides, the codegen can be improved even further with some constant evaluation improvements that we expect to happen in the future.
Diffstat (limited to 'src/libcore/slice')
| -rw-r--r-- | src/libcore/slice/mod.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index ffa4a66346c..fdc9aa473e8 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -1794,8 +1794,11 @@ impl<T> [T] { // handle ZSTs specially, which is – don't handle them at all. return (self, &[], &[]); } + + // First, find at what point do we split between the first and 2nd slice. Easy with + // ptr.align_offset. let ptr = self.as_ptr(); - let offset = ::intrinsics::align_offset(ptr, ::mem::align_of::<U>()); + let offset = ::ptr::align_offset(ptr, ::mem::align_of::<U>()); if offset > self.len() { return (self, &[], &[]); } else { @@ -1848,7 +1851,7 @@ impl<T> [T] { // First, find at what point do we split between the first and 2nd slice. Easy with // ptr.align_offset. let ptr = self.as_ptr(); - let offset = ::intrinsics::align_offset(ptr, ::mem::align_of::<U>()); + let offset = ::ptr::align_offset(ptr, ::mem::align_of::<U>()); if offset > self.len() { return (self, &mut [], &mut []); } else { |
