Skip to content

Remove InputIngot constructor helper#1072

Closed
micahscopes wants to merge 1 commit intoargotorg:masterfrom
micahscopes:remove-input-ingot-constructor-helper
Closed

Remove InputIngot constructor helper#1072
micahscopes wants to merge 1 commit intoargotorg:masterfrom
micahscopes:remove-input-ingot-constructor-helper

Conversation

@micahscopes
Copy link
Copy Markdown
Collaborator

I'm having second thoughts on how useful this is 😅

@micahscopes micahscopes requested review from Copilot and sbillig April 1, 2025 22:00
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR removes the manual InputIngot constructor helper in favor of a generated constructor via the salsa attribute. The key changes include updating all call sites to convert their path parameters using .into() and adjusting the parameters passed to InputIngot::new.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/language-server/src/backend/workspace.rs Updated the constructor call to pass config_path with into().
crates/hir/src/lib.rs Modified test setup to use into() and extra parameters.
crates/hir/src/hir_def/module_tree.rs Changed the path literal to use into() and added default values.
crates/hir-analysis/tests/test_db.rs Updated stand-alone ingot creation with into() and added parameters.
crates/driver/src/db.rs Updated multiple InputIngot::new calls to reflect new parameter requirements.
crates/common/src/input.rs Removed the helper constructor and updated a reference in core().
Comments suppressed due to low confidence (1)

crates/common/src/input.rs:71

  • Replacing the call to __new_impl with Self::new may result in unexpected recursion if Self::new refers back to itself. Verify that the generated new function provided by the salsa attribute is used without creating an infinite loop.
Self::new(

@sbillig
Copy link
Copy Markdown
Collaborator

sbillig commented Apr 1, 2025

I'm having second thoughts on how useful this is 😅

It's only useful if you also remove the subsequent .set_files calls. Then the functions that create InputIngots don't need mutable access to the db, which could maybe open up some the possibility of further restructuring of the code.

@micahscopes
Copy link
Copy Markdown
Collaborator Author

Ahh, right! Thank you

@micahscopes
Copy link
Copy Markdown
Collaborator Author

Hmm, I'm realizing now that this would clash with the changes in #1070

@micahscopes
Copy link
Copy Markdown
Collaborator Author

I moved over to here: #1073

@micahscopes micahscopes closed this Apr 3, 2025
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.

3 participants