diff options
| author | onur-ozkan <work@onurozkan.dev> | 2025-03-10 18:19:03 +0300 |
|---|---|---|
| committer | onur-ozkan <work@onurozkan.dev> | 2025-03-12 09:13:59 +0300 |
| commit | 56d0b160f8180c0f40c21081a65e60566b56d891 (patch) | |
| tree | c463cc2fed4677005fa5902b12db22f0978aa8a9 | |
| parent | ac819aa924afbed4f0af9456b24825abb3a6561d (diff) | |
| download | rust-56d0b160f8180c0f40c21081a65e60566b56d891.tar.gz rust-56d0b160f8180c0f40c21081a65e60566b56d891.zip | |
remove rls source from the repository
Signed-off-by: onur-ozkan <work@onurozkan.dev>
| -rw-r--r-- | Cargo.lock | 7 | ||||
| -rw-r--r-- | Cargo.toml | 1 | ||||
| -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 |
5 files changed, 0 insertions, 124 deletions
diff --git a/Cargo.lock b/Cargo.lock index a804638f702..e5e7d2731b3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3045,13 +3045,6 @@ dependencies = [ ] [[package]] -name = "rls" -version = "2.0.0" -dependencies = [ - "serde_json", -] - -[[package]] name = "run_make_support" version = "0.2.0" dependencies = [ diff --git a/Cargo.toml b/Cargo.toml index 20a43aaaeeb..915ec2e00ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,6 @@ members = [ "src/tools/remote-test-server", "src/tools/rust-installer", "src/tools/rustdoc", - "src/tools/rls", "src/tools/rustfmt", "src/tools/miri", "src/tools/miri/cargo-miri", 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(()) -} |
