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 bug with Handle::get_mut not allowing non-mutable access to the database #548

Closed
wants to merge 3 commits into from

Conversation

obsgolem
Copy link
Contributor

@obsgolem obsgolem commented Aug 2, 2024

Resolves #546

Copy link

netlify bot commented Aug 2, 2024

Deploy Preview for salsa-rs canceled.

Name Link
🔨 Latest commit e1c99c3
🔍 Latest deploy log https://app.netlify.com/sites/salsa-rs/deploys/66b1f3be3b2c0f000899065e

src/handle.rs Outdated Show resolved Hide resolved
@obsgolem obsgolem force-pushed the fix_handle_flag_bug branch from 9851b0c to 8b5cd48 Compare August 5, 2024 16:29
Copy link
Member

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

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

Hmm, this is probably still relevant-- can you rebase this atop master? The handle code has gone away but you should see equivalent code in storage.rs

Also, can you add a test?

Thanks! 💜

Copy link

codspeed-hq bot commented Aug 6, 2024

CodSpeed Performance Report

Merging #548 will not alter performance

Comparing obsgolem:fix_handle_flag_bug (e1c99c3) with master (4c8e52a)

Summary

✅ 1 untouched benchmarks

@MichaReiser
Copy link
Contributor

I merged in the latest changes. We only need to add some tests

@MichaReiser
Copy link
Contributor

I don't think this PR is still needed now that Handle has been removed because the only call-site of cancel_others is inside zalza_mut which always bumps the revision.

salsa/src/storage.rs

Lines 99 to 108 in 5d3b756

fn zalsa_mut(&mut self) -> &mut Zalsa {
self.storage().cancel_others(self);
// The ref count on the `Arc` should now be 1
let storage = self.storage_mut();
let arc_zalsa_mut = storage.zalsa_impl.as_mut().unwrap();
let zalsa_mut = Arc::get_mut(arc_zalsa_mut).unwrap();
zalsa_mut.new_revision();
zalsa_mut
}

@nikomatsakis
Copy link
Member

Ah, ok, I'll close it. It may be relevant if we add some way to explicitly cancel things. Thanks @obsgolem !

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.

Handle doesn't allow reads after get_mut
3 participants