에러 (error)

Couldn't start client Rust Language Server

Source: Rust (rls) (Extension)

 

Rustup not available. Install from https://www.rustup.rs/ 

Source: Rust (rls) (Extension)

 

 

[ Error Popup ]

 

 

 

환경 (environment)

OS : macOS Catalina 10.15.3

IDE : vsCode (Visual Studio Code) 1.42.1 / extension : CodeLLDB, Rust (rls)

Build : cargo

Language : rust / ructc : 1.41.1, rustup : 1.21.1

 

참고, Rustc, Rustup 버전 확인

$ rustc --version
$ rustup --verison

 

 

상황 (situation)

개발된 Rust 프로젝트를 디버깅하기 위해 F5를 눌러서 디버깅을 시도하는데 에러가 발생했다. 두 팝업을 그대로 해석하면 extension 중에 Rust (rls)에 의해 실행되는 Rust Language Server라는 프로그램을 실행할 수 없다는 에러와 Rustup을 사용할 수 없다는 내용이다. 참고로, 현재 rust를 설치하면서 rust 관련된 환경변수들은 자동으로 세팅되어 있고, rust를 설치할 때 함께 설치된 rustc나 rustup 등의 rust 관련 프로그램들은 /Users/joker/.cargo/bin 디렉토리에 모두 위치되어 있다.

 

참고, $PATH 확인

$ echo $PATH
/Users/joker/.cargo/bin:/User/joker/...(생략)

 

 

원인 (cause)

vsCode에 rust를 (디버깅으로) 실행할 때 Rustup을 사용하게 되는데, 이 Rustup 프로그램을 찾지 못하는 상황이므로 vsCode가 찾을 수 있도록 관련된 세팅값을 변경하면 된다.

 

 

해결 (solution)

> visual studio code 상단 메뉴 Code 클릭

> Preferences > Settings

> User

> Extensions > Rust configuration

> Rust-client: Rustup Path 내용 변경 > "rustup" ==> "$HOME/.cargo/bin/rustup"

 

[ (before) 변경 전 ]
[ (after) 변경 후 ]

 

> F5 (디버깅 재시도)

 

참고, 위 내용을 변경하면 자동으로 vsCode 프로젝트 내의 settings.json 파일 내용이 자동으로 같이 수정된다.

{
    "rust-client.channel": "stable",
    "rust-client.rustupPath": "$HOME/.cargo/bin/rustup"
}

 

 

참고 (reference)

stackoverflow 해결방법

https://github.com/rust-lang/rls-vscode/issues/622#issuecomment-561596264