VS Code 配置 Rust-Analyzer 报错

报错信息:

Bootstrap Error" rust-analyzer requires glibc >= 2.28 in latest build.

参考了好多地方,

https://github.com/rust-lang/rust-analyzer/issues/11558

https://blog.csdn.net/aLingYun/article/details/120923694

https://rust-analyzer.github.io/manual.html#vs-code

内容:

Summary of a workaround

the last working build: 0.2.948

the first broken build: 0.2.956

who is affected: anyone running Ubuntu < v.20
Option 1 - downgrade

1.Open the extension page in VS Code

  1. Click on [V] next to Uninstall button

  2. Select 0.2.948 and reload
    Notes

You will be perpetually stuck on that version.
Option 2 - use pre-prelease via rustup

Install rust-analyzer-preview by running rustup toolchain install nightly --component rust-analyzer-preview

Go to VSCode settings and search for rust-analyzer.server.path. You should see something along these lines

image

Click on Edit in settings.json and add "rust-analyzer.server.path": "~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rust-analyzer"

Reload VSCode
Notes

You will have to update the extension manually with rustup update

Even if rust-analyzer is built using nightly you can still use stable as your default channel

Component availability: https://rust-lang.github.io/rustup-components-history/

是把rust-analyzer 安装上了,但设置路径这一步一直不起效果。

最后偷梁换柱的方式成功了,用自己下载rust-analyzer 替换了VSCode 的 rust-analyzer ,成功了。

bash 复制代码
 $  ln -s ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rust-analyzer ~/.vscode-server/extensions/rust-lang.rust-analyzer-0.3.1566-linux-x64/server/rust-analyzer

后面发现,其实是应该该这里的文件 🤦‍。同样起作用。

相关推荐
16 分钟前
JUC专题 - 并发编程带来的安全性挑战之同步锁
后端
凯哥197017 分钟前
迁移PostgreSQL数据库教程
后端
Ray6626 分钟前
单例模式
后端
用户83562907805126 分钟前
掌控PDF页面:使用Python轻松实现添加与删除
后端·python
无责任此方_修行中32 分钟前
谁动了我的数据?一个 Bug 背后的“一行代码”真凶
后端·node.js·debug
hsjkdhs39 分钟前
C++之类的继承与派生
开发语言·c++
用户47949283569151 小时前
面试官:讲讲2FA 双因素认证原理
前端·后端·安全
疯狂的程序猴1 小时前
移动端H5网页远程调试:WEINRE、Charles与Genymotion完整指南
后端
lly2024061 小时前
HTML 元素:构建网页的基础
开发语言
低调小一1 小时前
LRU缓存科普与实现(Kotlin 与 Swift)
开发语言·缓存·kotlin