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

Convert rust-analyzer to an in-tree tool #99603

Merged
merged 10,000 commits into from
Jul 25, 2022
Merged

Conversation

fasterthanlime
Copy link
Contributor

@fasterthanlime fasterthanlime commented Jul 22, 2022

This re-adds rust-lang/rust-analyzer as a git subtree rather than a submodule.

Closes rust-lang/rust-analyzer#12815.

Prior attempt (research PR): #99465

  • Remove submodule: git rm -f src/tools/rust-analyzer
  • Add subtree: git subtree add -P src/tools/rust-analyzer https://github.com/rust-lang/rust-analyzer.git master
  • Move to SourceType::InTree,
  • Enable rust-analyzer/in-rust-tree feature when built through x.py
  • Add 'check' step
  • Add 'test' step

With this PR, rust-analyzer becomes an "in-tree" tool. Syncs can happen in both directions, see clippy's relevant book section.

Making sure proc-macro-srv doesn't break when the proc_macro bridge changes effectively becomes the responsibility of rust-lang/rust contributors. These days, that's mostly @mystor, who has been consulted throughout the process. I'm also making myself available in case there's questions / work needed that nobody else signed up for.

This doesn't change rust-analyzer's release cycle. After this PR is merged and the next nightly goes out, one can point rust-analyzer.procMacro.server to the rustup-provided rust-analyzer binary. Changes to improve the situation further (auto-discovery/install of the rust-analyzer component) will happen in rust-lang/rust-analyzer and be synced here eventually.

bors and others added 30 commits July 2, 2022 15:28
…Veykril

fix: complete enum variants as patterns in pattern path

close rust-lang#12593
fix regressions on assignment expressions

This is a follow-up PR on rust-lang#12428. I'm not sure if this is everything I overlooked, so if there are more things that are not right, we may want to revert rust-lang#12428.

This should also fix the increase of the type mismatches and the unknown types in diesel in the [metrics](https://rust-analyzer.github.io/metrics/?start=2022-06-23&end=2022-07-01) introduced by rust-lang#12428.

The regressions are:

- some coercions don't work in the ordinary (i.e. non-destructuring) assignments

    In order for coercions on ADT fields instantiations to work, lhs type has to be known before inferring rhs. rust-lang#12428 changed the inference order, making rhs inferred before lhs, breaking the coercion, so I restored the original inference mechanism for the ordinary assignments.

    Note that this kind of coercion doesn't happen in destructuring assigments, because when they are desugared, the struct expression is first assigned to a temporary, which is then assigned to the assignee, which is not coercion site anymore.

- type mismatches on individual identifiers are not reported
This change fixes issue rust-lang#10037, in more or less the most naive fashion
possible.

We continue to start with the hardcoded default of "fun_name", and now append a
counter to the end of it if that name is already in scope.

In the future, we can probably apply more heuristics here to wind up with more
useful names by default, but for now this resolves the immediate problem.
…on-duplicate-name, r=DorianListens

fix: Extract Function produces duplicate fn names

This change fixes rust-lang#10037, in more or less the most naive fashion
possible.

We continue to start with the hardcoded default of "fun_name", and now append a
counter to the end of it if that name is already in scope.

In the future, we can probably apply more heuristics here to wind up with more
useful names by default, but for now this resolves the immediate problem.
This change fixes rust-lang#10036, "Extract to function assist implements nonexistent
trait methods".

When we detect that the extraction is coming from within a trait impl, and that
a `self` param will be necessary, we adjust which `SyntaxNode` to `insert_after`,
and create a new empty `impl` block for the newly extracted function.
Improve documentation for `buildScripts.overrideCommand` / `checkOnSave.overrideCommand`
@jyn514
Copy link
Member

jyn514 commented Jul 24, 2022

@lnicola reports 2 tests still failing: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/git.20subtree.3A.20last.20stretch

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 24, 2022
@lnicola
Copy link
Member

lnicola commented Jul 24, 2022

@bors r=jyn514

@bors
Copy link
Contributor

bors commented Jul 24, 2022

📌 Commit fa0037a has been approved by jyn514

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 24, 2022
@bors
Copy link
Contributor

bors commented Jul 24, 2022

⌛ Testing commit fa0037a with merge 3ae03e0...

@bors
Copy link
Contributor

bors commented Jul 25, 2022

☀️ Test successful - checks-actions
Approved by: jyn514
Pushing 3ae03e0 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 25, 2022
@bors bors merged commit 3ae03e0 into rust-lang:master Jul 25, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jul 25, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (3ae03e0): comparison url.

Instruction count

  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
1.2% 1.2% 1
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
-0.3% -0.3% 1
All 😿🎉 (primary) N/A N/A 0

Max RSS (memory usage)

Results
  • Primary benchmarks: 😿 relevant regression found
  • Secondary benchmarks: no relevant changes found
mean1 max count2
Regressions 😿
(primary)
3.6% 3.6% 1
Regressions 😿
(secondary)
N/A N/A 0
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) 3.6% 3.6% 1

Cycles

Results
  • Primary benchmarks: no relevant changes found
  • Secondary benchmarks: 😿 relevant regressions found
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
5.7% 6.7% 5
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) N/A N/A 0

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

Footnotes

  1. the arithmetic mean of the percent change 2 3

  2. number of relevant changes 2 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move rust-analyzer from a git submodule to a git subtree