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

Upgrade salsa #13757

Merged
merged 3 commits into from
Oct 15, 2024
Merged

Upgrade salsa #13757

merged 3 commits into from
Oct 15, 2024

Conversation

MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Oct 15, 2024

This pulls in a MIRI fix and salsa-rs/salsa#589 which allows us to look up interned structs by using a borrowed value (e.g. StringLiteralType can be resolved using a &str without having to allocate a Box<str> first.

@MichaReiser MichaReiser added the red-knot Multi-file analysis & type inference label Oct 15, 2024
Type::StringLiteral(StringLiteralType::new(db, "True".into()))
Type::StringLiteral(StringLiteralType::new(db, Box::<str>::from("True")))
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious to know why this and other related changes are being made. I do prefer using ::from instead of .into because it makes the conversion visible without peeking through the definition to know the final type.

Copy link
Member Author

Choose a reason for hiding this comment

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

salsa-rs/salsa#589 added a way to lookup interned types with borrowed values (rather than owned values). This made the new constructor generic. I think I'm going to wait for salsa-rs/salsa#594 because we can then change StringLiteralType::new to be called with "True" and avoid allocating if the value has already been interned.

Copy link
Contributor

github-actions bot commented Oct 15, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Nice! Love that we can get rid of all that ModuleName cloning

Cargo.toml Outdated
Copy link
Member

Choose a reason for hiding this comment

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

nit: there's lots of whitespace changes here that made the diff a bit harder to review. Not asking you to revert them as it would just be a waste of your time, just a comment for future PRs

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry for that. RustRover loves to auto format files :(

@MichaReiser MichaReiser enabled auto-merge (squash) October 15, 2024 11:01
@MichaReiser MichaReiser merged commit 5f65e84 into main Oct 15, 2024
17 checks passed
@MichaReiser MichaReiser deleted the micha/upgrade-salsa-15-10 branch October 15, 2024 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
red-knot Multi-file analysis & type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants