From 4a7e2fbb7bfdb7ddcb65b6fcf23bb5b272e66d42 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sat, 20 Aug 2022 21:19:43 -0700 Subject: [PATCH] Sunset RLS --- .github/workflows/ci.yml | 2 +- .gitmodules | 3 - Cargo.lock | 479 +----------------- Cargo.toml | 15 - src/README.md | 2 +- src/bootstrap/builder.rs | 2 - src/bootstrap/check.rs | 2 +- src/bootstrap/dist.rs | 5 +- src/bootstrap/install.rs | 9 - src/bootstrap/lib.rs | 3 - src/bootstrap/tarball.rs | 8 +- src/bootstrap/test.rs | 51 -- src/bootstrap/tool.rs | 9 +- src/bootstrap/toolstate.rs | 1 - .../x86_64-gnu-tools/checktools.sh | 1 - src/ci/github-actions/ci.yml | 3 +- src/tools/publish_toolstate.py | 3 - src/tools/rls | 1 - src/tools/rls/Cargo.toml | 13 + src/tools/rls/README.md | 6 + src/tools/rls/src/main.rs | 101 ++++ src/tools/rustc-workspace-hack/Cargo.toml | 11 +- src/tools/rustc-workspace-hack/README.md | 12 +- src/tools/rustfmt/Processes.md | 4 - src/tools/rustfmt/README.md | 2 +- src/tools/rustfmt/atom.md | 4 +- src/tools/tidy/src/deps.rs | 3 +- 27 files changed, 162 insertions(+), 593 deletions(-) delete mode 160000 src/tools/rls create mode 100644 src/tools/rls/Cargo.toml create mode 100644 src/tools/rls/README.md create mode 100644 src/tools/rls/src/main.rs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 11b115cb2ff..ec1ef041b20 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -431,7 +431,7 @@ jobs: env: RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-msvc --host=aarch64-pc-windows-msvc --enable-full-tools --enable-profiler" SCRIPT: python x.py dist - DIST_REQUIRE_ALL_TOOLS: 0 + DIST_REQUIRE_ALL_TOOLS: 1 WINDOWS_SDK_20348_HACK: 1 os: windows-latest-xl - name: dist-i686-mingw diff --git a/.gitmodules b/.gitmodules index 9a664b65098..bc2dd397741 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,9 +13,6 @@ [submodule "src/doc/book"] path = src/doc/book url = https://github.com/rust-lang/book.git -[submodule "src/tools/rls"] - path = src/tools/rls - url = https://github.com/rust-lang/rls.git [submodule "src/tools/miri"] path = src/tools/miri url = https://github.com/rust-lang/miri.git diff --git a/Cargo.lock b/Cargo.lock index dda8c03e256..100e9095703 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -79,7 +79,7 @@ dependencies = [ "maplit", "once_cell", "tendril", - "url 2.2.2", + "url", ] [[package]] @@ -359,7 +359,7 @@ dependencies = [ "openssl", "os_info", "pathdiff", - "percent-encoding 2.1.0", + "percent-encoding", "pretty_env_logger", "rustc-workspace-hack", "rustfix", @@ -376,7 +376,7 @@ dependencies = [ "toml_edit", "unicode-width", "unicode-xid", - "url 2.2.2", + "url", "walkdir", "winapi", ] @@ -462,7 +462,7 @@ dependencies = [ "tar", "termcolor", "toml_edit", - "url 2.2.2", + "url", "winapi", ] @@ -665,7 +665,7 @@ dependencies = [ "compiletest_rs", "derive-new", "filetime", - "futures 0.3.19", + "futures", "if_chain", "itertools", "parking_lot 0.12.1", @@ -673,7 +673,7 @@ dependencies = [ "regex", "rustc-semver", "rustc-workspace-hack", - "rustc_tools_util 0.2.0", + "rustc_tools_util", "semver", "serde", "syn", @@ -718,7 +718,7 @@ dependencies = [ "toml", "unicode-normalization", "unicode-script", - "url 2.2.2", + "url", ] [[package]] @@ -921,10 +921,10 @@ version = "0.34.0" dependencies = [ "anyhow", "curl", - "percent-encoding 2.1.0", + "percent-encoding", "serde", "serde_json", - "url 2.2.2", + "url", ] [[package]] @@ -1093,17 +1093,6 @@ dependencies = [ "syn", ] -[[package]] -name = "derive_more" -version = "0.99.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "298998b1cf6b5b2c8a7b023dfd45821825ce3ba8a8af55c921a0e734e4653f76" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "diff" version = "0.1.13" @@ -1415,7 +1404,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" dependencies = [ "matches", - "percent-encoding 2.1.0", + "percent-encoding", ] [[package]] @@ -1440,12 +1429,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674" -[[package]] -name = "fst" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d79238883cf0307100b90aba4a755d8051a3182305dfe7f649a1e9dc0517006f" - [[package]] name = "futf" version = "0.1.5" @@ -1456,12 +1439,6 @@ dependencies = [ "new_debug_unreachable", ] -[[package]] -name = "futures" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" - [[package]] name = "futures" version = "0.3.19" @@ -1502,7 +1479,6 @@ dependencies = [ "futures-core", "futures-task", "futures-util", - "num_cpus", ] [[package]] @@ -1540,7 +1516,6 @@ version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b5cf40b47a271f77a8b1bec03ca09044d99d2372c0de244e66430761127164" dependencies = [ - "futures 0.1.31", "futures-channel", "futures-core", "futures-io", @@ -1661,7 +1636,7 @@ dependencies = [ "log", "openssl-probe", "openssl-sys", - "url 2.2.2", + "url", ] [[package]] @@ -1673,7 +1648,7 @@ dependencies = [ "curl", "git2", "log", - "url 2.2.2", + "url", ] [[package]] @@ -1814,17 +1789,6 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c1ad908cc71012b7bea4d0c53ba96a8cba9962f048fa68d143376143d863b7a" -[[package]] -name = "idna" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "idna" version = "0.2.0" @@ -1979,12 +1943,6 @@ dependencies = [ "libc", ] -[[package]] -name = "json" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "078e285eafdfb6c4b434e0d31e8cfcb5115b651496faca5749b88fafd4f23bfd" - [[package]] name = "jsondocck" version = "0.1.0" @@ -2011,110 +1969,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "jsonrpc-client-transports" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b99d4207e2a04fb4581746903c2bb7eb376f88de9c699d0f3e10feeac0cd3a" -dependencies = [ - "derive_more", - "futures 0.3.19", - "jsonrpc-core", - "jsonrpc-pubsub", - "jsonrpc-server-utils", - "log", - "parity-tokio-ipc", - "serde", - "serde_json", - "tokio", - "url 1.7.2", -] - -[[package]] -name = "jsonrpc-core" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14f7f76aef2d054868398427f6c54943cf3d1caa9a7ec7d0c38d69df97a965eb" -dependencies = [ - "futures 0.3.19", - "futures-executor", - "futures-util", - "log", - "serde", - "serde_derive", - "serde_json", -] - -[[package]] -name = "jsonrpc-core-client" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b51da17abecbdab3e3d4f26b01c5ec075e88d3abe3ab3b05dc9aa69392764ec0" -dependencies = [ - "futures 0.3.19", - "jsonrpc-client-transports", -] - -[[package]] -name = "jsonrpc-derive" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b939a78fa820cdfcb7ee7484466746a7377760970f6f9c6fe19f9edcc8a38d2" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "jsonrpc-ipc-server" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "382bb0206323ca7cda3dcd7e245cea86d37d02457a02a975e3378fb149a48845" -dependencies = [ - "futures 0.3.19", - "jsonrpc-core", - "jsonrpc-server-utils", - "log", - "parity-tokio-ipc", - "parking_lot 0.11.2", - "tower-service", -] - -[[package]] -name = "jsonrpc-pubsub" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240f87695e6c6f62fb37f05c02c04953cf68d6408b8c1c89de85c7a0125b1011" -dependencies = [ - "futures 0.3.19", - "jsonrpc-core", - "lazy_static", - "log", - "parking_lot 0.11.2", - "rand 0.7.3", - "serde", -] - -[[package]] -name = "jsonrpc-server-utils" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4fdea130485b572c39a460d50888beb00afb3e35de23ccd7fad8ff19f0e0d4" -dependencies = [ - "bytes", - "futures 0.3.19", - "globset", - "jsonrpc-core", - "lazy_static", - "log", - "tokio", - "tokio-stream", - "tokio-util", - "unicase", -] - [[package]] name = "kstring" version = "2.0.0" @@ -2257,30 +2111,6 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "lsp-codec" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa939d0b62476a5a19fb7fcb423a5c6ce8c7e09b851d37531e2fe3e0e6d9d257" -dependencies = [ - "bytes", - "serde_json", - "tokio-util", -] - -[[package]] -name = "lsp-types" -version = "0.60.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe3edefcd66dde1f7f1df706f46520a3c93adc5ca4bc5747da6621195e894efd" -dependencies = [ - "bitflags", - "serde", - "serde_json", - "serde_repr", - "url 2.2.2", -] - [[package]] name = "lzma-sys" version = "0.1.16" @@ -2445,19 +2275,6 @@ dependencies = [ "adler 1.0.2", ] -[[package]] -name = "mio" -version = "0.7.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" -dependencies = [ - "libc", - "log", - "miow", - "ntapi", - "winapi", -] - [[package]] name = "miow" version = "0.3.7" @@ -2509,15 +2326,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" -[[package]] -name = "ntapi" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" -dependencies = [ - "winapi", -] - [[package]] name = "num-integer" version = "0.1.43" @@ -2646,12 +2454,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "ordslice" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd20eec3dbe4376829cb7d80ae6ac45e0a766831dca50202ff2d40db46a8a024" - [[package]] name = "os_info" version = "3.5.0" @@ -2717,20 +2519,6 @@ dependencies = [ "unwind", ] -[[package]] -name = "parity-tokio-ipc" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9981e32fb75e004cc148f5fb70342f393830e0a4aa62e3cc93b50976218d42b6" -dependencies = [ - "futures 0.3.19", - "libc", - "log", - "rand 0.7.3", - "tokio", - "winapi", -] - [[package]] name = "parking_lot" version = "0.11.2" @@ -2785,12 +2573,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" -[[package]] -name = "percent-encoding" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" - [[package]] name = "percent-encoding" version = "2.1.0" @@ -2960,15 +2742,6 @@ dependencies = [ "log", ] -[[package]] -name = "proc-macro-crate" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" -dependencies = [ - "toml", -] - [[package]] name = "proc-macro-error" version = "1.0.4" @@ -3078,37 +2851,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "racer" -version = "2.2.2" -dependencies = [ - "bitflags", - "derive_more", - "env_logger 0.7.1", - "humantime 2.0.1", - "lazy_static", - "lazycell", - "log", - "racer-cargo-metadata", - "rls-span", -] - -[[package]] -name = "racer-cargo-metadata" -version = "0.1.2" -dependencies = [ - "racer-interner", - "serde", - "serde_json", -] - -[[package]] -name = "racer-interner" -version = "0.1.0" -dependencies = [ - "serde", -] - [[package]] name = "rand" version = "0.7.3" @@ -3303,67 +3045,9 @@ dependencies = [ [[package]] name = "rls" -version = "1.41.0" +version = "2.0.0" dependencies = [ - "anyhow", - "cargo", - "cargo-util", - "cargo_metadata 0.14.0", - "clippy_lints", - "crossbeam-channel", - "difference", - "env_logger 0.9.0", - "futures 0.3.19", - "heck", - "home", - "itertools", - "jsonrpc-core", - "lazy_static", - "log", - "lsp-codec", - "lsp-types", - "num_cpus", - "ordslice", - "racer", - "rand 0.8.5", - "rayon", - "regex", - "rls-analysis", - "rls-data", - "rls-ipc", - "rls-rustc", - "rls-span", - "rls-vfs", "rustc-workspace-hack", - "rustc_tools_util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustfmt-nightly", - "serde", - "serde_derive", - "serde_ignored", - "serde_json", - "tempfile", - "tokio", - "tokio-stream", - "tokio-util", - "toml", - "toml_edit", - "url 2.2.2", - "walkdir", -] - -[[package]] -name = "rls-analysis" -version = "0.18.3" -dependencies = [ - "derive-new", - "env_logger 0.9.0", - "fst", - "itertools", - "json", - "lazy_static", - "log", - "rls-data", - "rls-span", "serde", "serde_json", ] @@ -3378,33 +3062,6 @@ dependencies = [ "serde", ] -[[package]] -name = "rls-ipc" -version = "0.1.0" -dependencies = [ - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", - "jsonrpc-ipc-server", - "rls-data", - "serde", -] - -[[package]] -name = "rls-rustc" -version = "0.6.0" -dependencies = [ - "clippy_lints", - "env_logger 0.9.0", - "futures 0.3.19", - "log", - "rand 0.8.5", - "rls-data", - "rls-ipc", - "serde", - "tokio", -] - [[package]] name = "rls-span" version = "0.5.3" @@ -3414,16 +3071,6 @@ dependencies = [ "serde", ] -[[package]] -name = "rls-vfs" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce4b57b25b4330ed5ec14028fc02141e083ddafda327e7eb598dc0569c8c83c9" -dependencies = [ - "log", - "rls-span", -] - [[package]] name = "rust-demangler" version = "0.0.1" @@ -3523,21 +3170,13 @@ name = "rustc-workspace-hack" version = "1.0.0" dependencies = [ "bstr", - "byteorder", "clap", - "crossbeam-utils", - "libc", "libz-sys", "memchr", - "proc-macro2", - "quote", - "rand_core 0.5.1", "regex", - "serde", "serde_json", - "smallvec", "syn", - "url 2.2.2", + "url", "winapi", ] @@ -4540,12 +4179,6 @@ dependencies = [ name = "rustc_tools_util" version = "0.2.0" -[[package]] -name = "rustc_tools_util" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b725dadae9fabc488df69a287f5a99c5eaf5d10853842a8a3dfac52476f544ee" - [[package]] name = "rustc_trait_selection" version = "0.0.0" @@ -4852,18 +4485,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.140" +version = "1.0.143" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc855a42c7967b7c369eb5860f7164ef1f6f81c20c7cc1141f2a604e18723b03" +checksum = "53e8e5d5b70924f74ff5c6d64d9a5acd91422117c60f48c4e07855238a254553" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.140" +version = "1.0.143" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2122636b9fe3b81f1cb25099fcf2d3f542cdb1d45940d56c713158884a05da" +checksum = "d3d8e8de557aee63c26b85b947f5e59b690d0454c753f3adeb5cd7835ab88391" dependencies = [ "proc-macro2", "quote", @@ -4881,9 +4514,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.82" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7" +checksum = "38dd04e3c8279e75b31ef29dbdceebfe5ad89f4d0937213c53f7d49d01b3d5a7" dependencies = [ "indexmap", "itoa", @@ -4891,17 +4524,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_repr" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dc6b7951b17b051f3210b063f12cc17320e2fe30ae05b0fe2a3abb068551c76" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "sha-1" version = "0.8.2" @@ -4957,15 +4579,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42a568c8f2cd051a4d283bd6eb0343ac214c1b0f1ac19f93e1175b2dee38c73d" -[[package]] -name = "signal-hook-registry" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce32ea0c6c56d5eacaeb814fbed9960547021d3edd010ded1425f180536b20ab" -dependencies = [ - "libc", -] - [[package]] name = "similar" version = "2.1.0" @@ -5350,39 +4963,8 @@ checksum = "50dae83881bc9b0403dd5b44ea9deed3e939856cc8722d5be37f0d6e5c6d53dd" dependencies = [ "autocfg", "bytes", - "libc", "memchr", - "mio", - "num_cpus", - "once_cell", "pin-project-lite", - "signal-hook-registry", - "winapi", -] - -[[package]] -name = "tokio-stream" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b2f3f698253f03119ac0102beaa64f67a67e08074d03a22d18784104543727f" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1caa0b0c8d94a049db56b5acf8cba99dc0623aab1b26d5b5f5e2d945846b3592" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "log", - "pin-project-lite", - "tokio", ] [[package]] @@ -5413,12 +4995,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa7c7f42dea4b1b99439786f5633aeb9c14c1b53f75e282803c2ec2ad545873c" -[[package]] -name = "tower-service" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" - [[package]] name = "tracing" version = "0.1.29" @@ -5742,17 +5318,6 @@ dependencies = [ "libc", ] -[[package]] -name = "url" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" -dependencies = [ - "idna 0.1.5", - "matches", - "percent-encoding 1.0.1", -] - [[package]] name = "url" version = "2.2.2" @@ -5760,9 +5325,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" dependencies = [ "form_urlencoded", - "idna 0.2.0", + "idna", "matches", - "percent-encoding 2.1.0", + "percent-encoding", "serde", ] diff --git a/Cargo.toml b/Cargo.toml index 1e83f05e0ca..5753730053f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -97,21 +97,6 @@ gimli.debug = 0 miniz_oxide.debug = 0 object.debug = 0 -# We want the RLS to use the version of Cargo that we've got vendored in this -# repository to ensure that the same exact version of Cargo is used by both the -# RLS and the Cargo binary itself. The RLS depends on Cargo as a git repository -# so we use a `[patch]` here to override the github repository with our local -# vendored copy. -[patch."https://github.com/rust-lang/cargo"] -cargo = { path = "src/tools/cargo" } -cargo-util = { path = "src/tools/cargo/crates/cargo-util" } - -[patch."https://github.com/rust-lang/rustfmt"] -# Similar to Cargo above we want the RLS to use a vendored version of `rustfmt` -# that we're shipping as well (to ensure that the rustfmt in RLS and the -# `rustfmt` executable are the same exact version). -rustfmt-nightly = { path = "src/tools/rustfmt" } - [patch.crates-io] # See comments in `src/tools/rustc-workspace-hack/README.md` for what's going on # here diff --git a/src/README.md b/src/README.md index 9752bc3f66d..3d2e6acd576 100644 --- a/src/README.md +++ b/src/README.md @@ -2,7 +2,7 @@ This directory contains the source code of the rust project, including: - The test suite - The bootstrapping build system -- Various submodules for tools, like rustdoc, rls, etc. +- Various submodules for tools, like cargo, miri, etc. For more information on how various parts of the compiler work, see the [rustc dev guide]. diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index c4710e8faec..1e764811ea7 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -650,7 +650,6 @@ impl<'a> Builder<'a> { test::ReplacePlaceholderTest, test::Cargotest, test::Cargo, - test::Rls, test::RustAnalyzer, test::ErrorIndex, test::Distcheck, @@ -737,7 +736,6 @@ impl<'a> Builder<'a> { install::Docs, install::Std, install::Cargo, - install::Rls, install::RustAnalyzer, install::Rustfmt, install::RustDemangler, diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 4e1e8ef9dea..5c085bedf0e 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -457,7 +457,7 @@ tool_check_step!(Rustdoc, "src/tools/rustdoc", "src/librustdoc", SourceType::InT // rejected. tool_check_step!(Clippy, "src/tools/clippy", SourceType::InTree); tool_check_step!(Miri, "src/tools/miri", SourceType::Submodule); -tool_check_step!(Rls, "src/tools/rls", SourceType::Submodule); +tool_check_step!(Rls, "src/tools/rls", SourceType::InTree); tool_check_step!(Rustfmt, "src/tools/rustfmt", SourceType::InTree); tool_check_step!(Bootstrap, "src/bootstrap", SourceType::InTree, false); diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 6bf57a89e89..3580ca6085c 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -1018,10 +1018,7 @@ impl Step for Rls { let rls = builder .ensure(tool::Rls { compiler, target, extra_features: Vec::new() }) - .or_else(|| { - missing_tool("RLS", builder.build.config.missing_tools); - None - })?; + .expect("rls expected to build"); let mut tarball = Tarball::new(builder, "rls", &target.triple); tarball.set_overlay(OverlayKind::RLS); diff --git a/src/bootstrap/install.rs b/src/bootstrap/install.rs index 6e49f39ffb6..d34aa15c515 100644 --- a/src/bootstrap/install.rs +++ b/src/bootstrap/install.rs @@ -182,15 +182,6 @@ install!((self, builder, _config), .expect("missing cargo"); install_sh(builder, "cargo", self.compiler.stage, Some(self.target), &tarball); }; - Rls, alias = "rls", Self::should_build(_config), only_hosts: true, { - if let Some(tarball) = builder.ensure(dist::Rls { compiler: self.compiler, target: self.target }) { - install_sh(builder, "rls", self.compiler.stage, Some(self.target), &tarball); - } else { - builder.info( - &format!("skipping Install RLS stage{} ({})", self.compiler.stage, self.target), - ); - } - }; RustAnalyzer, alias = "rust-analyzer", Self::should_build(_config), only_hosts: true, { if let Some(tarball) = builder.ensure(dist::RustAnalyzer { compiler: self.compiler, target: self.target }) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index dcfa92d1004..30ea1c20b31 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -273,7 +273,6 @@ pub struct Build { bootstrap_out: PathBuf, rust_info: channel::GitInfo, cargo_info: channel::GitInfo, - rls_info: channel::GitInfo, rust_analyzer_info: channel::GitInfo, clippy_info: channel::GitInfo, miri_info: channel::GitInfo, @@ -407,7 +406,6 @@ impl Build { let ignore_git = config.ignore_git; let rust_info = channel::GitInfo::new(ignore_git, &src); let cargo_info = channel::GitInfo::new(ignore_git, &src.join("src/tools/cargo")); - let rls_info = channel::GitInfo::new(ignore_git, &src.join("src/tools/rls")); let rust_analyzer_info = channel::GitInfo::new(ignore_git, &src.join("src/tools/rust-analyzer")); let clippy_info = channel::GitInfo::new(ignore_git, &src.join("src/tools/clippy")); @@ -485,7 +483,6 @@ impl Build { rust_info, cargo_info, - rls_info, rust_analyzer_info, clippy_info, miri_info, diff --git a/src/bootstrap/tarball.rs b/src/bootstrap/tarball.rs index 7b0c029c191..e30067a5cbe 100644 --- a/src/bootstrap/tarball.rs +++ b/src/bootstrap/tarball.rs @@ -50,11 +50,7 @@ impl OverlayKind { OverlayKind::RustDemangler => { &["src/tools/rust-demangler/README.md", "LICENSE-APACHE", "LICENSE-MIT"] } - OverlayKind::RLS => &[ - "src/tools/rls/README.md", - "src/tools/rls/LICENSE-APACHE", - "src/tools/rls/LICENSE-MIT", - ], + OverlayKind::RLS => &["src/tools/rls/README.md", "LICENSE-APACHE", "LICENSE-MIT"], OverlayKind::RustAnalyzer => &[ "src/tools/rust-analyzer/README.md", "src/tools/rust-analyzer/LICENSE-APACHE", @@ -78,7 +74,7 @@ impl OverlayKind { OverlayKind::Rustfmt => { builder.rustfmt_info.version(builder, &builder.release_num("rustfmt")) } - OverlayKind::RLS => builder.rls_info.version(builder, &builder.release_num("rls")), + OverlayKind::RLS => builder.release(&builder.release_num("rls")), OverlayKind::RustAnalyzer => builder .rust_analyzer_info .version(builder, &builder.release_num("rust-analyzer/crates/rust-analyzer")), diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 9cbdb3aca32..f1c2a21de59 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -299,57 +299,6 @@ impl Step for Cargo { } } -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub struct Rls { - stage: u32, - host: TargetSelection, -} - -impl Step for Rls { - type Output = (); - const ONLY_HOSTS: bool = true; - - fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { - run.path("src/tools/rls") - } - - fn make_run(run: RunConfig<'_>) { - run.builder.ensure(Rls { stage: run.builder.top_stage, host: run.target }); - } - - /// Runs `cargo test` for the rls. - fn run(self, builder: &Builder<'_>) { - let stage = self.stage; - let host = self.host; - let compiler = builder.compiler(stage, host); - - let build_result = - builder.ensure(tool::Rls { compiler, target: self.host, extra_features: Vec::new() }); - if build_result.is_none() { - eprintln!("failed to test rls: could not build"); - return; - } - - let mut cargo = tool::prepare_tool_cargo( - builder, - compiler, - Mode::ToolRustc, - host, - "test", - "src/tools/rls", - SourceType::Submodule, - &[], - ); - - cargo.add_rustc_lib_path(builder, compiler); - cargo.arg("--").args(builder.config.cmd.test_args()); - - if try_run(builder, &mut cargo.into()) { - builder.save_toolstate("rls", ToolState::TestPass); - } - } -} - #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub struct RustAnalyzer { stage: u32, diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index 5bb40014eb9..c3b04a9bbce 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -857,14 +857,7 @@ tool_extended!((self, builder), Clippy, "src/tools/clippy", "clippy-driver", stable=true, in_tree=true, {}; Miri, "src/tools/miri", "miri", stable=false, {}; CargoMiri, "src/tools/miri/cargo-miri", "cargo-miri", stable=false, {}; - Rls, "src/tools/rls", "rls", stable=true, { - builder.ensure(Clippy { - compiler: self.compiler, - target: self.target, - extra_features: Vec::new(), - }); - self.extra_features.push("clippy".to_owned()); - }; + Rls, "src/tools/rls", "rls", stable=true, {}; // FIXME: tool_std is not quite right, we shouldn't allow nightly features. // But `builder.cargo` doesn't know how to handle ToolBootstrap in stages other than 0, // and this is close enough for now. diff --git a/src/bootstrap/toolstate.rs b/src/bootstrap/toolstate.rs index 2cfeae7dc78..f3a6759ab84 100644 --- a/src/bootstrap/toolstate.rs +++ b/src/bootstrap/toolstate.rs @@ -69,7 +69,6 @@ static STABLE_TOOLS: &[(&str, &str)] = &[ ("reference", "src/doc/reference"), ("rust-by-example", "src/doc/rust-by-example"), ("edition-guide", "src/doc/edition-guide"), - ("rls", "src/tools/rls"), ]; // These tools are permitted to not build on the beta/stable channels. diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh b/src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh index 412efe5c448..0fb8f41a7ec 100755 --- a/src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh +++ b/src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh @@ -14,7 +14,6 @@ python3 "$X_PY" test --stage 2 --no-fail-fast \ src/doc/rust-by-example \ src/doc/embedded-book \ src/doc/edition-guide \ - src/tools/rls \ src/tools/miri \ set -e diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index a6bdd9f3186..6e4b0b0c2c3 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -676,8 +676,7 @@ jobs: --enable-full-tools --enable-profiler SCRIPT: python x.py dist - # RLS does not build for aarch64-pc-windows-msvc. See rust-lang/rls#1693 - DIST_REQUIRE_ALL_TOOLS: 0 + DIST_REQUIRE_ALL_TOOLS: 1 # Hack around this SDK version, because it doesn't work with clang. # See https://github.com/rust-lang/rust/issues/88796 WINDOWS_SDK_20348_HACK: 1 diff --git a/src/tools/publish_toolstate.py b/src/tools/publish_toolstate.py index 1c57b731aaa..c0cef8f7b0a 100755 --- a/src/tools/publish_toolstate.py +++ b/src/tools/publish_toolstate.py @@ -31,7 +31,6 @@ except ImportError: # read privileges on it). CI will fail otherwise. MAINTAINERS = { 'miri': {'oli-obk', 'RalfJung'}, - 'rls': {'Xanewok'}, 'book': {'carols10cents'}, 'nomicon': {'frewsxcv', 'Gankra', 'JohnTitor'}, 'reference': {'Havvy', 'matthewjasper', 'ehuss'}, @@ -43,7 +42,6 @@ MAINTAINERS = { LABELS = { 'miri': ['A-miri', 'C-bug'], - 'rls': ['A-rls', 'C-bug'], 'book': ['C-bug'], 'nomicon': ['C-bug'], 'reference': ['C-bug'], @@ -55,7 +53,6 @@ LABELS = { REPOS = { 'miri': 'https://github.com/rust-lang/miri', - 'rls': 'https://github.com/rust-lang/rls', 'book': 'https://github.com/rust-lang/book', 'nomicon': 'https://github.com/rust-lang/nomicon', 'reference': 'https://github.com/rust-lang/reference', diff --git a/src/tools/rls b/src/tools/rls deleted file mode 160000 index 4d8b0a19986..00000000000 --- a/src/tools/rls +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4d8b0a19986a4daab37287a5b5fe2da0775d1873 diff --git a/src/tools/rls/Cargo.toml b/src/tools/rls/Cargo.toml new file mode 100644 index 00000000000..92b50bf4cec --- /dev/null +++ b/src/tools/rls/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "rls" +version = "2.0.0" +edition = "2021" +license = "Apache-2.0/MIT" + +[dependencies] +serde = { version = "1.0.143", features = ["derive"] } +serde_json = "1.0.83" +# A noop dependency that changes in the Rust repository, it's a bit of a hack. +# See the `src/tools/rustc-workspace-hack/README.md` file in `rust-lang/rust` +# for more information. +rustc-workspace-hack = "1.0.0" diff --git a/src/tools/rls/README.md b/src/tools/rls/README.md new file mode 100644 index 00000000000..43c331c413f --- /dev/null +++ b/src/tools/rls/README.md @@ -0,0 +1,6 @@ +# 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 new file mode 100644 index 00000000000..f96f1325d96 --- /dev/null +++ b/src/tools/rls/src/main.rs @@ -0,0 +1,101 @@ +//! RLS stub. +//! +//! This is a small stub that replaces RLS to alert the user that RLS is no +//! longer available. + +use serde::Deserialize; +use std::error::Error; +use std::io::BufRead; +use std::io::Write; + +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); + } +} + +#[derive(Deserialize)] +struct Message { + method: Option, +} + +fn run() -> Result<(), Box> { + 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(reader: &mut R) -> Result> { + 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(reader: &mut R) -> Result> { + let m = read_message_raw(reader)?; + match serde_json::from_str(&m) { + Ok(m) => Ok(m), + Err(e) => Err(format!("failed to parse message {m}\n{e}").into()), + } +} + +fn write_message_raw(mut writer: W, output: String) -> Result<(), Box> { + write!(writer, "Content-Length: {}\r\n\r\n{}", output.len(), output)?; + writer.flush()?; + Ok(()) +} diff --git a/src/tools/rustc-workspace-hack/Cargo.toml b/src/tools/rustc-workspace-hack/Cargo.toml index b1d8b86496a..3c982b26127 100644 --- a/src/tools/rustc-workspace-hack/Cargo.toml +++ b/src/tools/rustc-workspace-hack/Cargo.toml @@ -24,6 +24,7 @@ features = [ "errhandlingapi", "evntrace", "fibersapi", + "handleapi", "in6addr", "inaddr", "ioapiset", @@ -72,11 +73,8 @@ features = [ [dependencies] bstr = { version = "0.2.17", features = ["default"] } -byteorder = { version = "1", features = ['default', 'std'] } clap = { version = "3.1.1", features = ["derive", "clap_derive"]} curl-sys = { version = "0.4.13", features = ["http2", "libnghttp2-sys"], optional = true } -crossbeam-utils = { version = "0.8.0", features = ["nightly"] } -libc = { version = "0.2.79", features = ["align"] } # Ensure default features of libz-sys, which are disabled in some scenarios. libz-sys = { version = "1.1.2" } # The only user of memchr's deprecated `use_std` feature is `combine`, so this can be @@ -84,13 +82,8 @@ libz-sys = { version = "1.1.2" } memchr = { version = "2.5", features = ["std", "use_std"] } # Ensure default features of regex, which are disabled in some scenarios. regex = { version = "1.5.6" } -proc-macro2 = { version = "1", features = ["default"] } -quote = { version = "1", features = ["default"] } -rand_core_0_5 = { package = "rand_core", version = "0.5.1", features = ["getrandom", "alloc", "std"] } -serde = { version = "1.0.82", features = ['derive'] } serde_json = { version = "1.0.31", features = ["raw_value", "unbounded_depth"] } -smallvec = { version = "1.8.1", features = ['union', 'may_dangle'] } -syn = { version = "1", features = ['fold', 'full', 'extra-traits', 'visit', 'visit-mut'] } +syn = { version = "1", features = ['full', 'visit'] } url = { version = "2.0", features = ['serde'] } [target.'cfg(not(windows))'.dependencies] diff --git a/src/tools/rustc-workspace-hack/README.md b/src/tools/rustc-workspace-hack/README.md index 4a5286fae9c..3c61470358b 100644 --- a/src/tools/rustc-workspace-hack/README.md +++ b/src/tools/rustc-workspace-hack/README.md @@ -2,18 +2,18 @@ This crate is a bit of a hack to make workspaces in rustc work a bit better. The rationale for this existence is a bit subtle, but the general idea is that -we want commands like `./x.py build src/tools/{rls,clippy,cargo}` to share as +we want commands like `./x.py build src/tools/{clippy,cargo}` to share as many dependencies as possible. Each invocation is a different invocation of Cargo, however. Each time Cargo runs a build it will re-resolve the dependency graph, notably selecting different features sometimes for each build. -For example, let's say there's a very deep dependency like `num-traits` in each -of these builds. For Cargo the `num-traits`'s `default` feature is turned off. -In RLS, however, the `default` feature is turned. This means that building Cargo -and then the RLS will actually build Cargo twice (as a transitive dependency -changed). This is bad! +For example, let's say there's a very deep dependency like `winapi` in each of +these builds. For Cargo, `winapi` has 33 features enabled. In Clippy, however, +`winapi` has 22 features enabled. This means that building Cargo and then the +Clippy will actually build winapi twice, which in turn will build duplicates +of everything that depends on `winapi`. This is bad! The goal of this crate is to solve this problem and ensure that the resolved dependency graph for all of these tools is the same in the various subsets of diff --git a/src/tools/rustfmt/Processes.md b/src/tools/rustfmt/Processes.md index 9d86d52b122..f763b5714ce 100644 --- a/src/tools/rustfmt/Processes.md +++ b/src/tools/rustfmt/Processes.md @@ -51,7 +51,3 @@ git tag -s v1.2.3 -m "Release 1.2.3" `cargo publish` ## 5. Create a PR to rust-lang/rust to update the rustfmt submodule - -Note that if you are updating `rustc-ap-*` crates, then you need to update **every** submodules in the rust-lang/rust repository that depend on the crates to use the same version of those. - -As of 2019/05, there are two such crates: `rls` and `racer` (`racer` depends on `rustc-ap-syntax` and `rls` depends on `racer`, and `rls` is one of submodules of the rust-lang/rust repository). diff --git a/src/tools/rustfmt/README.md b/src/tools/rustfmt/README.md index b3a968f0c04..0f9652aecf9 100644 --- a/src/tools/rustfmt/README.md +++ b/src/tools/rustfmt/README.md @@ -135,7 +135,7 @@ completed without error (whether or not changes were made). * [Emacs](https://github.com/rust-lang/rust-mode) * [Sublime Text 3](https://packagecontrol.io/packages/RustFmt) * [Atom](atom.md) -* Visual Studio Code using [vscode-rust](https://github.com/editor-rs/vscode-rust), [vsc-rustfmt](https://github.com/Connorcpu/vsc-rustfmt) or [rls_vscode](https://github.com/jonathandturner/rls_vscode) through RLS. +* [Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer) * [IntelliJ or CLion](intellij.md) diff --git a/src/tools/rustfmt/atom.md b/src/tools/rustfmt/atom.md index f77ac149072..c7e3a991a5f 100644 --- a/src/tools/rustfmt/atom.md +++ b/src/tools/rustfmt/atom.md @@ -1,8 +1,8 @@ # Running Rustfmt from Atom -## RLS +## rust-analyzer -Rustfmt is included with the Rust Language Server, itself provided by [ide-rust](https://atom.io/packages/ide-rust). +Rustfmt can be utilized from [rust-analyzer](https://rust-analyzer.github.io/) which is provided by [ide-rust](https://atom.io/packages/ide-rust). `apm install ide-rust` diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index 7f8d6ad1288..5770bb7bc33 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -31,8 +31,7 @@ const EXCEPTIONS: &[(&str, &str)] = &[ ("mdbook", "MPL-2.0"), // mdbook ("openssl", "Apache-2.0"), // cargo, mdbook ("colored", "MPL-2.0"), // rustfmt - ("ordslice", "Apache-2.0"), // rls - ("ryu", "Apache-2.0 OR BSL-1.0"), // rls/cargo/... (because of serde) + ("ryu", "Apache-2.0 OR BSL-1.0"), // cargo/... (because of serde) ("bytesize", "Apache-2.0"), // cargo ("im-rc", "MPL-2.0+"), // cargo ("sized-chunks", "MPL-2.0+"), // cargo via im-rc