-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Move rust-analyzer from a git submodule to a git subtree #12815
Comments
Proposed course of action:
|
I haven't used subtrees yet, so I don't know how involved the switch would be, but I don't like git submodules very much. So this seems like a good idea, assuming the But will all breaking changes show up on CI? I'm not sure if the RA tests are being run in |
@cuviper has done some work re: that in rust-lang/rust#99444, see also #12803 (comment) The intent was to track rust-analyzer status in rust-toolstate, but I believe it could be repurposed to run the |
The rustc dev guide has a section on git subtree: https://rustc-dev-guide.rust-lang.org/contributing.html#external-dependencies-subtree @oli-obk told me to quite literally "send y'all to clippy folks" to ask any questions you might have, they've been doing this for a while. |
@mystor seemed okay with it "provided it's relatively easy". I don't know about other proc_macro bridge maintainers. I've done it once myself to get an idea of how much work it is (and @jonas-schievink can confirm/deny). It's mostly:
|
For research purposes, I opened a draft PR on which It shows how the move would happen. All tests pass through I also found clippy's actual git subtree guide, which was immensely helpful (cc @lnicola): |
Convert rust-analyzer to an in-tree tool 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): rust-lang#99465 * [x] Remove submodule: `git rm -f src/tools/rust-analyzer` * [x] Add subtree: `git subtree add -P src/tools/rust-analyzer https://github.com/rust-lang/rust-analyzer.git master` * [x] Move to `SourceType::InTree`, * [x] Enable `rust-analyzer/in-rust-tree` feature when built through `x.py` * [x] Add 'check' step * [x] 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](https://doc.rust-lang.org/nightly/clippy/development/infrastructure/sync.html). 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.
(Related to: long-term proc macro support plan)
Before (submodule)
RA is a git submodule in src/tools. When a "sync" happens,
rust-lang/rust
is updated to point to a different commit (example).The changes suggested in #12803 (use the sysroot
proc_macro
crate) make RA/rustc incompatibilities more visible in that the submodule could then stop building.Fixing that would involve two PRs:
rust-analyzer
, fixingproc-macro-srv
to followproc_macro
bridge changesrust
, bumpingrust-analyzer
If the sync cycle isn't changed, this means the rust-analyzer RA component could be missing for up to a week, or even more, if the bridge changes haven't been followed in the
rust-analyzer
repo.After (subtree)
Just like
clippy
,rust-analyzer
would be a subtree (also insrc/tools
).Feature development / bug fixes to RA happen as usual in the
rust-lang/rust-analyzer
repository. These can be synced torust-lang/rust
whenever convenient (clippy->rust example PR).Changes to the
proc_macro
bridge are followed in therust-lang/rust
repository. These can be synced torust-lang/rust-analyzer
whenever convenient (rust->clippy example commit)proc-macro-srv never breaks again (in the rustup component version of rust-analyzer), because it's immediately fixed as part of any PRs to
rust-lang/rust
.Why does this matter?
A PR was just merged to "add support for the 1.64 ABI", but there's no such thing as "the 1.64 ABI", and it's going to be instabroken, see #12806.
Prior art
Similar discussion for rustfmt: rust-lang/rust#82385 (converted to a subtree in May 2021)
Tagging:
rust-lang/rust
folks are happy to keep theproc-macro-srv
crate up-to-date with bridge changes (pinging other maintainers as needed)proc_macro
bridge in the rust-analyzer reporust-lang/rust
historyThe text was updated successfully, but these errors were encountered: