Skip to content

Commit d3e384f

Browse files
committed
Auto merge of #42146 - nrc:rls-rust, r=@alexcrichton
More Rust/RLS integration r? @alexcrichton cc rust-lang/rls#310 closes #41199 closes #41197
2 parents d84693b + 2dff6b3 commit d3e384f

File tree

7 files changed

+95
-17
lines changed

7 files changed

+95
-17
lines changed

Diff for: src/Cargo.lock

+48-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: src/Cargo.toml

+12
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ members = [
1717
"tools/rust-installer",
1818
"tools/cargo",
1919
"tools/rls",
20+
# FIXME(https://github.com/rust-lang/cargo/issues/4089): move these to exclude
21+
"tools/rls/test_data/borrow_error",
22+
"tools/rls/test_data/completion",
23+
"tools/rls/test_data/find_all_refs",
24+
"tools/rls/test_data/find_all_refs_no_cfg_test",
25+
"tools/rls/test_data/goto_def",
26+
"tools/rls/test_data/highlight",
27+
"tools/rls/test_data/hover",
28+
"tools/rls/test_data/rename",
29+
"tools/rls/test_data/reformat",
30+
"tools/rls/test_data/bin_lib_no_cfg_test",
31+
"tools/rls/test_data/multiple_bins",
2032
]
2133

2234
# Curiously, compiletest will segfault if compiled with opt-level=3 on 64-bit

Diff for: src/bootstrap/check.rs

+27-9
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
1616
use std::collections::HashSet;
1717
use std::env;
18+
use std::ffi::OsString;
1819
use std::iter;
1920
use std::fmt;
2021
use std::fs::{self, File};
@@ -117,14 +118,7 @@ pub fn cargotest(build: &Build, stage: u32, host: &str) {
117118

118119
/// Runs `cargo test` for `cargo` packaged with Rust.
119120
pub fn cargo(build: &Build, stage: u32, host: &str) {
120-
let ref compiler = Compiler::new(stage, host);
121-
122-
// Configure PATH to find the right rustc. NB. we have to use PATH
123-
// and not RUSTC because the Cargo test suite has tests that will
124-
// fail if rustc is not spelled `rustc`.
125-
let path = build.sysroot(compiler).join("bin");
126-
let old_path = env::var_os("PATH").unwrap_or_default();
127-
let newpath = env::join_paths(iter::once(path).chain(env::split_paths(&old_path))).expect("");
121+
let compiler = &Compiler::new(stage, host);
128122

129123
let mut cargo = build.cargo(compiler, Mode::Tool, host, "test");
130124
cargo.arg("--manifest-path").arg(build.src.join("src/tools/cargo/Cargo.toml"));
@@ -139,7 +133,31 @@ pub fn cargo(build: &Build, stage: u32, host: &str) {
139133
// available.
140134
cargo.env("CFG_DISABLE_CROSS_TESTS", "1");
141135

142-
try_run(build, cargo.env("PATH", newpath));
136+
try_run(build, cargo.env("PATH", &path_for_cargo(build, compiler)));
137+
}
138+
139+
/// Runs `cargo test` for the rls.
140+
pub fn rls(build: &Build, stage: u32, host: &str) {
141+
let compiler = &Compiler::new(stage, host);
142+
143+
let mut cargo = build.cargo(compiler, Mode::Tool, host, "test");
144+
cargo.arg("--manifest-path").arg(build.src.join("src/tools/rls/Cargo.toml"));
145+
146+
// Don't build tests dynamically, just a pain to work with
147+
cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
148+
149+
build.add_rustc_lib_path(compiler, &mut cargo);
150+
151+
try_run(build, &mut cargo);
152+
}
153+
154+
fn path_for_cargo(build: &Build, compiler: &Compiler) -> OsString {
155+
// Configure PATH to find the right rustc. NB. we have to use PATH
156+
// and not RUSTC because the Cargo test suite has tests that will
157+
// fail if rustc is not spelled `rustc`.
158+
let path = build.sysroot(compiler).join("bin");
159+
let old_path = env::var_os("PATH").unwrap_or_default();
160+
env::join_paths(iter::once(path).chain(env::split_paths(&old_path))).expect("")
143161
}
144162

145163
/// Runs the `tidy` tool as compiled in `stage` by the `host` compiler.

Diff for: src/bootstrap/mk/Makefile.in

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ check:
5555
check-aux:
5656
$(Q)$(BOOTSTRAP) test \
5757
src/tools/cargotest \
58-
cargo \
58+
src/tools/cargo \
59+
src/tools/rls \
5960
src/test/pretty \
6061
src/test/run-pass/pretty \
6162
src/test/run-fail/pretty \

Diff for: src/bootstrap/step.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -471,10 +471,14 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
471471
.dep(|s| s.name("librustc"))
472472
.host(true)
473473
.run(move |s| check::cargotest(build, s.stage, s.target));
474-
rules.test("check-cargo", "cargo")
474+
rules.test("check-cargo", "src/tools/cargo")
475475
.dep(|s| s.name("tool-cargo"))
476476
.host(true)
477477
.run(move |s| check::cargo(build, s.stage, s.target));
478+
rules.test("check-rls", "src/tools/rls")
479+
.dep(|s| s.name("tool-rls"))
480+
.host(true)
481+
.run(move |s| check::rls(build, s.stage, s.target));
478482
rules.test("check-tidy", "src/tools/tidy")
479483
.dep(|s| s.name("tool-tidy").stage(0))
480484
.default(true)

Diff for: src/tools/rls

Submodule rls updated from 70b89fd to 0f7cb16

Diff for: src/tools/tidy/src/deps.rs

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ static EXCEPTIONS: &'static [&'static str] = &[
3232
"openssl", // BSD+advertising clause, cargo, mdbook
3333
"pest", // MPL2, mdbook via handlebars
3434
"thread-id", // Apache-2.0, mdbook
35-
"strings", // this is actually MIT/Apache-2.0 but it's not in the manifest yet
3635
];
3736

3837
pub fn check(path: &Path, bad: &mut bool) {

0 commit comments

Comments
 (0)