Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RawTable::allocation_info for empty table #379

Merged
merged 1 commit into from Jan 10, 2023

Conversation

stepancheg
Copy link
Contributor

Fixes #376

@@ -531,7 +531,12 @@ impl<T, A: Allocator + Clone> RawTable<T, A> {
#[inline]
#[cfg(feature = "raw")]
pub fn allocation_info(&self) -> (NonNull<u8>, Layout) {
self.table.allocation_info(Self::TABLE_LAYOUT)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this check be moved into the method in RawTableInner?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure? This way we will do branch (albeit trivial) for paths we don't use in normal operation.

At the moment I added assertion to RawTableInner.allocation_info.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason for the split between RawTable and RawTableInner is to reduce the amount of LLVM IR generated and improve compilation times. In release builds, all the RawTableInner methods are inlined into the RawTable methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Updated the PR.

@stepancheg stepancheg force-pushed the fix-all-info branch 3 times, most recently from 95b794d to 04447e8 Compare January 9, 2023 22:14
@Amanieu
Copy link
Member

Amanieu commented Jan 10, 2023

@bors r+

@bors
Copy link
Collaborator

bors commented Jan 10, 2023

📌 Commit 471c5a6 has been approved by Amanieu

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Jan 10, 2023

⌛ Testing commit 471c5a6 with merge 55175ca...

@bors
Copy link
Collaborator

bors commented Jan 10, 2023

☀️ Test successful - checks-actions
Approved by: Amanieu
Pushing 55175ca to master...

@bors bors merged commit 55175ca into rust-lang:master Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RawTable::allocation_info returns non zero size for a fresh empty map
3 participants