Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
021a12c
Sprinkle some `#[inline]` in `rustc_data_structures::tagged_ptr`
WaffleLapkin Apr 25, 2023
6a41cfe
Migrate `rustc_passes` to translatable diagnostics
clubby789 Apr 25, 2023
3402e28
Downsize builders for i686-gnu
jdno Apr 26, 2023
4cbe65d
Downsize builder for mingw-check
jdno Apr 26, 2023
47528c0
Downsize builders for some x86_64-gnu targets
jdno Apr 26, 2023
ef6d4c5
Remove repeated definite articles
cuishuang Apr 25, 2023
0776a4b
docs(style): add more let-else examples
calebcartwright Apr 16, 2023
0fabceb
Make method-not-found-generic-arg-elision.rs error message not path d…
compiler-errors Apr 26, 2023
c18e7b7
IntoFuture::into_future is no longer unstable
compiler-errors Apr 26, 2023
5b6e747
Nicer ICE for #67981
Jules-Bertholet Apr 26, 2023
4cf06e5
Rollup merge of #110426 - calebcartwright:style-let-else-examples, r=…
matthiaskrgr Apr 27, 2023
2647953
Rollup merge of #110804 - cuishuang:master, r=jyn514
matthiaskrgr Apr 27, 2023
6f79f5d
Rollup merge of #110814 - WaffleLapkin:sprinkle_#inline, r=Nilstrieb
matthiaskrgr Apr 27, 2023
cc197c2
Rollup merge of #110816 - clubby789:rustc-passes-diagnostics, r=compi…
matthiaskrgr Apr 27, 2023
fb5ef4f
Rollup merge of #110846 - jdno:reduce-builder-sizes, r=pietroalbini
matthiaskrgr Apr 27, 2023
0a6cf42
Rollup merge of #110864 - compiler-errors:into-future-stable, r=jackh726
matthiaskrgr Apr 27, 2023
ce1662a
Rollup merge of #110866 - compiler-errors:test, r=jyn514
matthiaskrgr Apr 27, 2023
1f3f65b
Rollup merge of #110872 - Jules-Bertholet:err-67981, r=wesleywiser
matthiaskrgr Apr 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions compiler/rustc_data_structures/src/tagged_ptr/copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand All @@ -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) })
}
Expand Down Expand Up @@ -184,6 +188,7 @@ where
P: Pointer + Copy,
T: Tag,
{
#[inline]
fn clone(&self) -> Self {
*self
}
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -235,6 +242,7 @@ where
P: Pointer,
T: Tag,
{
#[inline]
fn eq(&self, other: &Self) -> bool {
self.packed == other.packed
}
Expand All @@ -252,6 +260,7 @@ where
P: Pointer,
T: Tag,
{
#[inline]
fn hash<H: Hasher>(&self, state: &mut H) {
self.packed.hash(state);
}
Expand Down
8 changes: 8 additions & 0 deletions compiler/rustc_data_structures/src/tagged_ptr/drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -63,6 +66,8 @@ where
T: Tag,
{
type Target = P::Target;

#[inline]
fn deref(&self) -> &Self::Target {
self.raw.deref()
}
Expand All @@ -73,6 +78,7 @@ where
P: Pointer + DerefMut,
T: Tag,
{
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {
self.raw.deref_mut()
}
Expand Down Expand Up @@ -108,6 +114,7 @@ where
P: Pointer,
T: Tag,
{
#[inline]
fn eq(&self, other: &Self) -> bool {
self.raw.eq(&other.raw)
}
Expand All @@ -125,6 +132,7 @@ where
P: Pointer,
T: Tag,
{
#[inline]
fn hash<H: Hasher>(&self, state: &mut H) {
self.raw.hash(state);
}
Expand Down