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

feat: Update derive field overwrite support #747

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Veykril
Copy link
Member

@Veykril Veykril commented Mar 6, 2025

I believe this should allow reducing the need for coherence dependencies like

salsa/Cargo.toml

Lines 29 to 30 in ceb9b08

# Stuff we want Update impls for by default
compact_str = { version = "0.8", optional = true }

Copy link

netlify bot commented Mar 6, 2025

Deploy Preview for salsa-rs canceled.

Name Link
🔨 Latest commit 398e134
🔍 Latest deploy log https://app.netlify.com/sites/salsa-rs/deploys/67cbf43f57e03a000838edc3

Copy link

codspeed-hq bot commented Mar 6, 2025

CodSpeed Performance Report

Merging #747 will not alter performance

Comparing Veykril:veykril/push-xzzvvzlxwmvo (398e134) with master (dbb0e5f)

Summary

✅ 11 untouched benchmarks

@Veykril Veykril force-pushed the veykril/push-xzzvvzlxwmvo branch 3 times, most recently from e808e8b to 1dc4815 Compare March 7, 2025 12:02
@Veykril
Copy link
Member Author

Veykril commented Mar 7, 2025

Actually, @MichaReiser I believe this could be a viable alternative for the Update requirement issue. You'd define a helper function fn(_: *mut Map<CompactStr, ...>, Map<CompactStr, ...>) -> bool and then just reference that in the places where you need it here. That avoids the coherence problems with third-party crate types while also not requiring a wrapper newtype that implements Update for the given foreign type.

@Veykril Veykril changed the title Update derive field overwrite support feat: Update derive field overwrite support Mar 7, 2025
@Veykril Veykril force-pushed the veykril/push-xzzvvzlxwmvo branch 2 times, most recently from b86d75b to f682959 Compare March 7, 2025 12:12
@MichaReiser
Copy link
Contributor

Yeah, it does reduce the urgency for having Update impls in salsa but I think it's still less ergonomic because it now requires a change at every use.

@Veykril
Copy link
Member Author

Veykril commented Mar 7, 2025

Well, I don't see better ways to avoid this. We obivously can't add every crate out there as a dependency to salsa just to add the Update impls for the types.

@Veykril Veykril force-pushed the veykril/push-xzzvvzlxwmvo branch from f682959 to c4cf0d9 Compare March 7, 2025 12:25
@Veykril
Copy link
Member Author

Veykril commented Mar 7, 2025

Either way I believe this to be a nice addition to the derive. Improved the diagnostics a bit so this is ready now

@MichaReiser
Copy link
Contributor

Either way I believe this to be a nice addition to the derive. Improved the diagnostics a bit so this is ready now

I agree with this. It definitely raises the bar for which Crate Salsa should provide Update implementations. But it comes at an ergonomics cost, which is why we'd probably want to keep providing Update implementations for some popular crates.

@Veykril Veykril force-pushed the veykril/push-xzzvvzlxwmvo branch from 0aebe9f to 398e134 Compare March 8, 2025 07:39
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.

2 participants