diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-03-13 10:58:13 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-13 10:58:13 +0100 |
| commit | 3b1776dc292d057f59ed94de0d2c14ff43d73a55 (patch) | |
| tree | d550dc7c4bf08c5bea96fc076d6e712b30cb89c1 /src/tools | |
| parent | 961351c76c812e3aeb65bfb542742500a6436aed (diff) | |
| parent | 707d4b7a93fbe0df653bab88e78d2baf4bfd989d (diff) | |
| download | rust-3b1776dc292d057f59ed94de0d2c14ff43d73a55.tar.gz rust-3b1776dc292d057f59ed94de0d2c14ff43d73a55.zip | |
Rollup merge of #126856 - onur-ozkan:remove-rls, r=clubby789
remove deprecated tool `rls` This tool has been deprecated for two years and now it only gives warning without doing anything useful. Zulip discussion: https://rust-lang.zulipchat.com/#narrow/stream/241545-t-release/topic/excluding.20rls.20from.20the.20release try-job: x86_64-gnu-distcheck
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/build-manifest/src/main.rs | 2 | ||||
| -rw-r--r-- | src/tools/build-manifest/src/versions.rs | 3 | ||||
| -rw-r--r-- | src/tools/rls/Cargo.toml | 8 | ||||
| -rw-r--r-- | src/tools/rls/README.md | 6 | ||||
| -rw-r--r-- | src/tools/rls/src/main.rs | 102 | ||||
| -rw-r--r-- | src/tools/tidy/src/walk.rs | 2 |
6 files changed, 0 insertions, 123 deletions
diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index dfc8f3bc7e0..741d7e3fa16 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -386,7 +386,6 @@ impl Builder { // NOTE: this profile is effectively deprecated; do not add new components to it. let mut complete = default; complete.extend([ - Rls, RustAnalyzer, RustSrc, LlvmTools, @@ -475,7 +474,6 @@ impl Builder { // but might be marked as unavailable if they weren't built. PkgType::Clippy | PkgType::Miri - | PkgType::Rls | PkgType::RustAnalyzer | PkgType::Rustfmt | PkgType::LlvmTools diff --git a/src/tools/build-manifest/src/versions.rs b/src/tools/build-manifest/src/versions.rs index 495cab582eb..6ef8a0e83de 100644 --- a/src/tools/build-manifest/src/versions.rs +++ b/src/tools/build-manifest/src/versions.rs @@ -51,7 +51,6 @@ pkg_type! { Cargo = "cargo", HtmlDocs = "rust-docs", RustAnalysis = "rust-analysis", - Rls = "rls"; preview = true, RustAnalyzer = "rust-analyzer"; preview = true, Clippy = "clippy"; preview = true, Rustfmt = "rustfmt"; preview = true, @@ -77,7 +76,6 @@ impl PkgType { fn should_use_rust_version(&self) -> bool { match self { PkgType::Cargo => false, - PkgType::Rls => false, PkgType::RustAnalyzer => false, PkgType::Clippy => false, PkgType::Rustfmt => false, @@ -118,7 +116,6 @@ impl PkgType { HtmlDocs => HOSTS, JsonDocs => HOSTS, RustSrc => &["*"], - Rls => HOSTS, RustAnalyzer => HOSTS, Clippy => HOSTS, Miri => HOSTS, diff --git a/src/tools/rls/Cargo.toml b/src/tools/rls/Cargo.toml deleted file mode 100644 index b7aa659c25a..00000000000 --- a/src/tools/rls/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] -name = "rls" -version = "2.0.0" -edition = "2021" -license = "Apache-2.0/MIT" - -[dependencies] -serde_json = "1.0.83" diff --git a/src/tools/rls/README.md b/src/tools/rls/README.md deleted file mode 100644 index 43c331c413f..00000000000 --- a/src/tools/rls/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# RLS Stub - -RLS has been replaced with [rust-analyzer](https://rust-analyzer.github.io/). - -This directory contains a stub which replaces RLS with a simple LSP server -which only displays an alert to the user that RLS is no longer available. diff --git a/src/tools/rls/src/main.rs b/src/tools/rls/src/main.rs deleted file mode 100644 index 3a95b47cd4d..00000000000 --- a/src/tools/rls/src/main.rs +++ /dev/null @@ -1,102 +0,0 @@ -//! RLS stub. -//! -//! This is a small stub that replaces RLS to alert the user that RLS is no -//! longer available. - -use std::error::Error; -use std::io::{BufRead, Write}; - -use serde_json::Value; - -const ALERT_MSG: &str = "\ -RLS is no longer available as of Rust 1.65. -Consider migrating to rust-analyzer instead. -See https://rust-analyzer.github.io/ for installation instructions. -"; - -fn main() { - if let Err(e) = run() { - eprintln!("error: {e}"); - std::process::exit(1); - } -} - -struct Message { - method: Option<String>, -} - -fn run() -> Result<(), Box<dyn Error>> { - let mut stdin = std::io::stdin().lock(); - let mut stdout = std::io::stdout().lock(); - - let init = read_message(&mut stdin)?; - if init.method.as_deref() != Some("initialize") { - return Err(format!("expected initialize, got {:?}", init.method).into()); - } - // No response, the LSP specification says that `showMessageRequest` may - // be posted before during this phase. - - // message_type 1 is "Error" - let alert = serde_json::json!({ - "jsonrpc": "2.0", - "id": 1, - "method": "window/showMessageRequest", - "params": { - "message_type": "1", - "message": ALERT_MSG - } - }); - write_message_raw(&mut stdout, serde_json::to_string(&alert).unwrap())?; - - loop { - let message = read_message(&mut stdin)?; - if message.method.as_deref() == Some("shutdown") { - std::process::exit(0); - } - } -} - -fn read_message_raw<R: BufRead>(reader: &mut R) -> Result<String, Box<dyn Error>> { - let mut content_length: usize = 0; - - // Read headers. - loop { - let mut line = String::new(); - reader.read_line(&mut line)?; - if line.is_empty() { - return Err("remote disconnected".into()); - } - if line == "\r\n" { - break; - } - if line.to_lowercase().starts_with("content-length:") { - let value = &line[15..].trim(); - content_length = usize::from_str_radix(value, 10)?; - } - } - if content_length == 0 { - return Err("no content-length".into()); - } - - let mut buffer = vec![0; content_length]; - reader.read_exact(&mut buffer)?; - let content = String::from_utf8(buffer)?; - - Ok(content) -} - -fn read_message<R: BufRead>(reader: &mut R) -> Result<Message, Box<dyn Error>> { - let m = read_message_raw(reader)?; - match serde_json::from_str::<Value>(&m) { - Ok(message) => Ok(Message { - method: message.get("method").and_then(|value| value.as_str().map(String::from)), - }), - Err(e) => Err(format!("failed to parse message {m}\n{e}").into()), - } -} - -fn write_message_raw<W: Write>(mut writer: W, output: String) -> Result<(), Box<dyn Error>> { - write!(writer, "Content-Length: {}\r\n\r\n{}", output.len(), output)?; - writer.flush()?; - Ok(()) -} diff --git a/src/tools/tidy/src/walk.rs b/src/tools/tidy/src/walk.rs index edf7658d25f..08ee5c16c12 100644 --- a/src/tools/tidy/src/walk.rs +++ b/src/tools/tidy/src/walk.rs @@ -32,8 +32,6 @@ pub fn filter_dirs(path: &Path) -> bool { "src/doc/rustc-dev-guide", "src/doc/reference", "src/gcc", - // Filter RLS output directories - "target/rls", "src/bootstrap/target", "vendor", ]; |
