8000 internal: Upgrade to the next Salsa by ChayimFriedman2 · Pull Request #19661 · rust-lang/rust-analyzer · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

internal: Upgrade to the next Salsa #19661

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

Merged
merged 6 commits into from
Apr 22, 2025
Merged

Conversation

ChayimFriedman2
Copy link
Contributor
@ChayimFriedman2 ChayimFriedman2 commented Apr 22, 2025

This depends on Salsa from GitHub; should maybe wait until there is a release.

Fixes #19455.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 22, 2025
@Veykril
Copy link
Member
Veykril commented Apr 22, 2025

I can kick off a new salsa release if you want

@ChayimFriedman2
Copy link
Contributor Author

It'll be better if you could also insert salsa-rs/salsa#803 into it :)

@Veykril
Copy link
Member
Veykril commented Apr 22, 2025

Alright can you verify things work with latest salsa master? If yes I'll cut a release there

@ChayimFriedman2
Copy link
Contributor Author
ChayimFriedman2 commented Apr 22, 2025

Just checked - it works fine! 🚀

@Veykril
Copy link
Member
Veykril commented Apr 22, 2025

0.20.0 released

@@ -136,7 +136,8 @@ pub fn from_assoc_type_id(id: AssocTypeId) -> TypeAliasId {

pub fn from_placeholder_idx(db: &dyn HirDatabase, idx: PlaceholderIndex) -> TypeOrConstParamId {
assert_eq!(idx.ui, chalk_ir::UniverseIndex::ROOT);
let interned_id = FromId::from_id(Id::from_u32(idx.idx.try_into().unwrap()));
// SAFETY: We cannot really encapsulate this unfortunately, so just hope this is sound.
let interned_id = FromId::from_id(unsafe { Id::from_u32(idx.idx.try_into().unwrap()) });
Copy link
Member
@Veykril Veykril Apr 22, 2025

Choose a reason for hiding this comment

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

This is really fishy in general I have to say, chalk even seems to allocate its own PlaceholderIndexes so we just gotta hope those don't ever leak out of it 😅

(this was kind of unsound already etiher way)

Hopefully whatever the new trait solver does allows us to get rid of this weird interning here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

salsa even seems to allocate its own PlaceholderIndexes

You mean Chalk?

Copy link
Member

Choose a reason for hiding this comment

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

Yes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In general I'm not sure how unsafe using an incorrect Id is; it should not cause UB because you can safely create an Id then use it on a different database.

Comment on lines +30 to +33
/// # Invariant
///
/// This is either a valid `salsa::Id` or a root `SyntaxContext`.
u32,
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need this change? Ideally in the future we will be able to use the salsa macros to define the type here and then this change is moot.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did it in order to encapsulate the unsafety of creating an Id well; previously it was already an Id and you could just hope nobody will ever use it incorrectly if it's a root SyntaxContext (that isn't really an Id), now the conversion to Id checks if it is a root.

If/when we convert this to Salsa macros this can go.

@ChayimFriedman2
Copy link
Contributor Author

Okay. Rebased and changed to use Salsa from crates.io.

@Veykril Veykril enabled auto-merge April 22, 2025 12:22
@Veykril Veykril added this pull request to the merge queue Apr 22, 2025
Merged via the queue into rust-lang:master with commit 40d37b0 Apr 22, 2025
14 checks passed
@ChayimFriedman2 ChayimFriedman2 deleted the salsa-v20 branch April 22, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

39B0 Wrong lifetime variance in hover for recursive types
3 participants
0