Skip to content

Rust: pick correct edition for the files #19291

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 4 commits into from
Apr 14, 2025
Merged

Conversation

redsun82
Copy link
Contributor

@redsun82 redsun82 commented Apr 11, 2025

Previously we would unconditionally set the edition to the latest stable according to rust-analyzer (2021 at the moment). Now we ask rust-analyzer itself to pick the correct edition for the file.

In order to add integration tests this includes #19293, which therefore should possibly be merged before this.

Previously we would unconditionally set the edition to the latest stable
according to rust-analyzer (2021 at the moment). Now we ask
rust-analyzer itself to pick the correct edition for the file.
@Copilot Copilot bot review requested due to automatic review settings April 11, 2025 13:38
@github-actions github-actions bot added the Rust Pull requests that update Rust code label Apr 11, 2025
Copy link
Contributor

@Copilot 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 refactors the file text retrieval and edition resolution logic in the Rust analyzer integration, allowing rust-analyzer to pick the correct edition for a file rather than using a hardcoded edition.

  • Removed the explicit aliasing of EditionedFileId from ra_ap_span.
  • Refactored parse() by extracting file data retrieval and edition resolution into a new get_file_data() method.

paldepind
paldepind previously approved these changes Apr 14, 2025
Copy link
Contributor

@paldepind paldepind left a comment

Choose a reason for hiding this comment

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

DCA seems fine to me. Rust-analyzer comparison, call graph (same), per source went up, so QL and rust_analyzer are now more often in agreement.

Many of the "bad" result probably stem from RA doing better, and hence QL looking worse in comparison. Some numbers are worse (path resolution inconsistencies), but only few project and the relative change is very small. Might just be because we extract more/better stuff.

@redsun82 redsun82 dismissed paldepind’s stale review April 14, 2025 11:31

The merge-base changed after approval.

paldepind
paldepind previously approved these changes Apr 14, 2025
@redsun82 redsun82 dismissed paldepind’s stale review April 14, 2025 11:56

The merge-base changed after approval.

paldepind
paldepind previously approved these changes Apr 14, 2025
@redsun82 redsun82 dismissed paldepind’s stale review April 14, 2025 13:09

The merge-base changed after approval.

@redsun82 redsun82 merged commit 6176202 into main Apr 14, 2025
16 checks passed
@redsun82 redsun82 deleted the redsun82/rust-pick-edition branch April 14, 2025 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants