diff options
| author | bors <bors@rust-lang.org> | 2023-04-27 13:38:19 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-04-27 13:38:19 +0000 |
| commit | 901fdb3b04375e3456b5cf771f86ecca8d6c1917 (patch) | |
| tree | c839aa495a143234447b43187b00bfa2e019aa3c /compiler/rustc_data_structures/src | |
| parent | 6ce22733b973355573efd1e6294e585460e90e17 (diff) | |
| parent | 52d550b20ee1a327565b2002ac7f02243d0fa12e (diff) | |
| download | rust-901fdb3b04375e3456b5cf771f86ecca8d6c1917.tar.gz rust-901fdb3b04375e3456b5cf771f86ecca8d6c1917.zip | |
Auto merge of #110896 - matthiaskrgr:rollup-h8fetzd, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #110426 (docs(style): add more let-else examples) - #110804 (Remove repeated definite articles) - #110814 (Sprinkle some `#[inline]` in `rustc_data_structures::tagged_ptr`) - #110816 (Migrate `rustc_passes` to translatable diagnostics) - #110864 (`IntoFuture::into_future` is no longer unstable) - #110866 (Make `method-not-found-generic-arg-elision.rs` error message not path dependent) - #110872 (Nicer ICE for #67981) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_data_structures/src')
| -rw-r--r-- | compiler/rustc_data_structures/src/tagged_ptr/copy.rs | 9 | ||||
| -rw-r--r-- | compiler/rustc_data_structures/src/tagged_ptr/drop.rs | 8 |
2 files changed, 17 insertions, 0 deletions
diff --git a/compiler/rustc_data_structures/src/tagged_ptr/copy.rs b/compiler/rustc_data_structures/src/tagged_ptr/copy.rs index 691e92f196a..e893a2c7813 100644 --- a/compiler/rustc_data_structures/src/tagged_ptr/copy.rs +++ b/compiler/rustc_data_structures/src/tagged_ptr/copy.rs @@ -82,11 +82,13 @@ where /// drop, use [`TaggedPtr`] instead. /// /// [`TaggedPtr`]: crate::tagged_ptr::TaggedPtr + #[inline] pub fn new(pointer: P, tag: T) -> Self { Self { packed: Self::pack(P::into_ptr(pointer), tag), tag_ghost: PhantomData } } /// Retrieves the pointer. + #[inline] pub fn pointer(self) -> P where P: Copy, @@ -123,6 +125,7 @@ where /// according to `self.packed` encoding scheme. /// /// [`P::into_ptr`]: Pointer::into_ptr + #[inline] fn pack(ptr: NonNull<P::Target>, tag: T) -> NonNull<P::Target> { // Trigger assert! let () = Self::ASSERTION; @@ -145,6 +148,7 @@ where } /// Retrieves the original raw pointer from `self.packed`. + #[inline] pub(super) fn pointer_raw(&self) -> NonNull<P::Target> { self.packed.map_addr(|addr| unsafe { NonZeroUsize::new_unchecked(addr.get() << T::BITS) }) } @@ -184,6 +188,7 @@ where P: Pointer + Copy, T: Tag, { + #[inline] fn clone(&self) -> Self { *self } @@ -196,6 +201,7 @@ where { type Target = P::Target; + #[inline] fn deref(&self) -> &Self::Target { // Safety: // `pointer_raw` returns the original pointer from `P::into_ptr` which, @@ -209,6 +215,7 @@ where P: Pointer + DerefMut, T: Tag, { + #[inline] fn deref_mut(&mut self) -> &mut Self::Target { // Safety: // `pointer_raw` returns the original pointer from `P::into_ptr` which, @@ -235,6 +242,7 @@ where P: Pointer, T: Tag, { + #[inline] fn eq(&self, other: &Self) -> bool { self.packed == other.packed } @@ -252,6 +260,7 @@ where P: Pointer, T: Tag, { + #[inline] fn hash<H: Hasher>(&self, state: &mut H) { self.packed.hash(state); } diff --git a/compiler/rustc_data_structures/src/tagged_ptr/drop.rs b/compiler/rustc_data_structures/src/tagged_ptr/drop.rs index d418c06b7eb..4e42b5b4afe 100644 --- a/compiler/rustc_data_structures/src/tagged_ptr/drop.rs +++ b/compiler/rustc_data_structures/src/tagged_ptr/drop.rs @@ -30,16 +30,19 @@ where T: Tag, { /// Tags `pointer` with `tag`. + #[inline] pub fn new(pointer: P, tag: T) -> Self { TaggedPtr { raw: CopyTaggedPtr::new(pointer, tag) } } /// Retrieves the tag. + #[inline] pub fn tag(&self) -> T { self.raw.tag() } /// Sets the tag to a new value. + #[inline] pub fn set_tag(&mut self, tag: T) { self.raw.set_tag(tag) } @@ -63,6 +66,8 @@ where T: Tag, { type Target = P::Target; + + #[inline] fn deref(&self) -> &Self::Target { self.raw.deref() } @@ -73,6 +78,7 @@ where P: Pointer + DerefMut, T: Tag, { + #[inline] fn deref_mut(&mut self) -> &mut Self::Target { self.raw.deref_mut() } @@ -108,6 +114,7 @@ where P: Pointer, T: Tag, { + #[inline] fn eq(&self, other: &Self) -> bool { self.raw.eq(&other.raw) } @@ -125,6 +132,7 @@ where P: Pointer, T: Tag, { + #[inline] fn hash<H: Hasher>(&self, state: &mut H) { self.raw.hash(state); } |
