Skip to content
This repository has been archived by the owner on May 20, 2023. It is now read-only.

Commit

Permalink
upgpkg: rust-analyzer 20221114-3: Support standalone server in both l…
Browse files Browse the repository at this point in the history
…ib and libexec

Thanks to @heftig for the new patch and Akatsuki Rui (akiirui) for their testing.

Fixes FS#76568
Upstream issue: rust-lang/rust-analyzer#13589


git-svn-id: file:///srv/repos/svn-community/svn@1348996 9fca08f4-af9d-4005-b8df-a31f2cc04f65
  • Loading branch information
polyzen committed Nov 15, 2022
1 parent 1d4ce98 commit 426bffc
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 43 deletions.
8 changes: 4 additions & 4 deletions rust-analyzer/trunk/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
pkgname=rust-analyzer
_pkgver=2022-11-14
pkgver=${_pkgver//-}
pkgrel=2
pkgrel=3
pkgdesc='Rust compiler front-end for IDEs'
arch=('x86_64')
url=https://rust-analyzer.github.io/
license=('Apache' 'MIT')
depends=('gcc-libs' 'rust-src')
makedepends=('git')
source=("git+https://github.com/rust-lang/$pkgname.git#tag=$_pkgver"
'rust-analyzer-fix_unsupportedabi.patch')
'rust-analyzer-support_standalone_server_in_lib.patch')
b2sums=('SKIP'
'cda286154536f73b7f069d352b7010819d722e14448f2581ea1c4911c7dba667daebf95f2d98f680c85667502cc6de1fb2d11194a74ff7325e91897a25273018')
'48ddf95953a94fb701b240903fb8e6ebb275933fe1e3f023cab06b10abd3a8d307babfb172ea8b93f7fbebf3e61d2fe1c4bb45ca66e406dd823c4895d515432b')

prepare() {
cd $pkgname
cargo fetch --locked --target "$CARCH-unknown-linux-gnu"

patch --forward --strip=1 --input=../rust-analyzer-fix_unsupportedabi.patch
patch --forward --strip=1 --input=../rust-analyzer-support_standalone_server_in_lib.patch
}

build() {
Expand Down
39 changes: 0 additions & 39 deletions rust-analyzer/trunk/rust-analyzer-fix_unsupportedabi.patch

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
diff --git c/crates/rust-analyzer/src/cli/load_cargo.rs i/crates/rust-analyzer/src/cli/load_cargo.rs
index 5dba545b8..c9faeaa6b 100644
--- c/crates/rust-analyzer/src/cli/load_cargo.rs
+++ i/crates/rust-analyzer/src/cli/load_cargo.rs
@@ -69,10 +69,13 @@ pub fn load_workspace(
if let Some(sysroot) = sysroot.as_ref() {
let standalone_server_name =
format!("rust-analyzer-proc-macro-srv{}", std::env::consts::EXE_SUFFIX);
- let server_path = sysroot.root().join("libexec").join(&standalone_server_name);
- if std::fs::metadata(&server_path).is_ok() {
- path = server_path;
- args = vec![];
+ for dir in ["libexec", "lib"] {
+ let server_path = sysroot.root().join(dir).join(&standalone_server_name);
+ if std::fs::metadata(&server_path).is_ok() {
+ path = server_path;
+ args = vec![];
+ break;
+ }
}
}
}
diff --git c/crates/rust-analyzer/src/reload.rs i/crates/rust-analyzer/src/reload.rs
index aa0510a4e..d7cf69c3a 100644
--- c/crates/rust-analyzer/src/reload.rs
+++ i/crates/rust-analyzer/src/reload.rs
@@ -327,21 +327,22 @@ impl GlobalState {
| ProjectWorkspace::Json { sysroot, .. } = ws
{
if let Some(sysroot) = sysroot.as_ref() {
- let server_path = sysroot
- .root()
- .join("libexec")
- .join(&standalone_server_name);
- if std::fs::metadata(&server_path).is_ok() {
- tracing::debug!(
- "Sysroot proc-macro server exists at {}",
- server_path.display()
- );
- sysroot_server = Some(server_path);
- } else {
- tracing::debug!(
- "Sysroot proc-macro server does not exist at {}",
- server_path.display()
- );
+ for dir in ["libexec", "lib"] {
+ let server_path =
+ sysroot.root().join(dir).join(&standalone_server_name);
+ if std::fs::metadata(&server_path).is_ok() {
+ tracing::debug!(
+ "Sysroot proc-macro server exists at {}",
+ server_path.display()
+ );
+ sysroot_server = Some(server_path);
+ break;
+ } else {
+ tracing::debug!(
+ "Sysroot proc-macro server does not exist at {}",
+ server_path.display()
+ );
+ }
}
}
}

0 comments on commit 426bffc

Please sign in to comment.