From: Sarthak Singh <sarthak.singh99@gmail.com>
To: miguel.ojeda.sandonis@gmail.com
Cc: a.hindborg@samsung.com, alex.gaynor@gmail.com,
aliceryhl@google.com, benno.lossin@proton.me,
bjorn3_gh@protonmail.com, boqun.feng@gmail.com,
dirk.behme@de.bosch.com, gary@garyguo.net,
lukas.wirth@ferrous-systems.com, ojeda@kernel.org,
rust-for-linux@vger.kernel.org, sarthak.singh99@gmail.com,
ss269@uw.edu, wedsonaf@gmail.com
Subject: Re: [PATCH v2] rust: Support latest version of `rust-analyzer`
Date: Tue, 23 Jul 2024 21:31:28 +0530 [thread overview]
Message-ID: <20240723160128.3259768-1-sarthak.singh99@gmail.com> (raw)
In-Reply-To: <CANiq72keKdr7ZhufjdeM3g0tgDo80nk2NNBN5SBSepHry-LaQQ@mail.gmail.com>
Hello Miguel,
Thank you for reviewing. How do you send replies? To send this one I
am writing a text file manually to look like the generated patch
file that I emailed earlier. Is that the best way?
I don't have access to the ss269@uw.edu email anymore.
Should I resend the patch with the fixed email address? Afaik there is
no way to update a patch, let me know if that is possible. I can also
add the missing Tested-by tag in the new version of the patch.
In the PR [1] the ability to guess the sysroot based on the sysroot_src
was removed. That is why every version of rust-analyzer after this PR
fails with the current config generation system. rust-analyzer needs to
know the sysroot so that it can find its proc-macro server.
> From a quick look, the `sysroot` key has existed in rust-analyzer
> since 2022 (189521a4db6e), but undocumented. Then it got documented in
> 2023 (5da14237eb29). So I am not sure what "`sysroot` over
> `sysroot_src`" means (and the current docs are not very clear on what
> each does and their intended interactions, e.g. what happens if one
> specifies `sysroot_src` but not `sysroot`, or the other way around?
> Should `sysroot_src` be relative to `sysroot` like the default?)
sysroot need to point to the root location of the toolchain. This
contains the rust core and std library the compiler will link against.
It also contains the rustc and cargo for that toolchain.
sysroot_src need to point to the root location of the rust library. It
contains the source code of the core / std / alloc crates. I think for
our purposes it need to be a subset of the sysroot since we install rust
using rustup. If someone installs it in a manner where the source code
does not live in a sub directory of the sysroot path then they will have
to set it to that.
I think the main invariant that we need to uphold between them is that
the built libraries in sysroot and the source code in sysroot_src belong
to the same built of rust.
> Anyway, we are passing the paths for `core` etc. in `crates`, and we
> don't have a custom `alloc` anymore, so I wonder if we should either
> delete both keys (or however one disables auto-search) or delete the
> crates in `crates` and let the sysroot logic find them.
I think it will always need a `sysroot` key as it needs to know that
to find the proc-macro server. I don't think there is a way to specify
the version of rust in a `rust-project.json` other than specifying the
`sysroot` [2].
> Just to confirm, does this make it work for distribution and
> `rustup`-using installs?
Yes this should work with every setup. The `sysroot_src` that
rust-analyzer is internally generating is the same. The `sysroot`
that rust-analyzer was generating earlier is also defined to be
the same in this version.
Thank you,
Sarthak
[1] https://github.com/rust-lang/rust-analyzer/pull/17287/files#diff-53e4b6b2c1ff2465d8abd50db160753199426fd788ddcad925752e0838e28de2L367-L374
[2] https://rust-analyzer.github.io/manual.html#non-cargo-based-projects
next prev parent reply other threads:[~2024-07-23 16:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-23 10:40 [PATCH v2] rust: Support latest version of `rust-analyzer` Sarthak Singh
2024-07-23 14:07 ` Miguel Ojeda
2024-07-23 16:01 ` Sarthak Singh [this message]
2024-07-23 17:35 ` Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240723160128.3259768-1-sarthak.singh99@gmail.com \
--to=sarthak.singh99@gmail.com \
--cc=a.hindborg@samsung.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dirk.behme@de.bosch.com \
--cc=gary@garyguo.net \
--cc=lukas.wirth@ferrous-systems.com \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=ss269@uw.edu \
--cc=wedsonaf@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).