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 @@ impl
CopyTaggedPtr
/// 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 @@ pub fn set_tag(&mut self, tag: T) {
/// according to `self.packed` encoding scheme.
///
/// [`P::into_ptr`]: Pointer::into_ptr
+ #[inline]
fn pack(ptr: NonNull Clone for CopyTaggedPtr
P: Pointer + Copy,
T: Tag,
{
+ #[inline]
fn clone(&self) -> Self {
*self
}
@@ -196,6 +201,7 @@ impl Deref for CopyTaggedPtr
{
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 @@ impl DerefMut for CopyTaggedPtr
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 @@ impl PartialEq for CopyTaggedPtr
P: Pointer,
T: Tag,
{
+ #[inline]
fn eq(&self, other: &Self) -> bool {
self.packed == other.packed
}
@@ -252,6 +260,7 @@ impl Hash for CopyTaggedPtr
P: Pointer,
T: Tag,
{
+ #[inline]
fn hash TaggedPtr
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 @@ impl Deref for TaggedPtr
T: Tag,
{
type Target = P::Target;
+
+ #[inline]
fn deref(&self) -> &Self::Target {
self.raw.deref()
}
@@ -73,6 +78,7 @@ impl DerefMut for TaggedPtr
P: Pointer + DerefMut,
T: Tag,
{
+ #[inline]
fn deref_mut(&mut self) -> &mut Self::Target {
self.raw.deref_mut()
}
@@ -108,6 +114,7 @@ impl PartialEq for TaggedPtr
P: Pointer,
T: Tag,
{
+ #[inline]
fn eq(&self, other: &Self) -> bool {
self.raw.eq(&other.raw)
}
@@ -125,6 +132,7 @@ impl Hash for TaggedPtr
P: Pointer,
T: Tag,
{
+ #[inline]
fn hash