Skip to content

Rls and Rustfmt stuff #44769

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
413 changes: 215 additions & 198 deletions src/Cargo.lock

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions src/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ members = [
"tools/rls/test_data/infer_custom_bin",
"tools/rls/test_data/infer_lib",
"tools/rls/test_data/omit_init_build",
"tools/rls/test_data/workspace_symbol",
]

# Curiously, compiletest will segfault if compiled with opt-level=3 on 64-bit
Expand All @@ -60,10 +61,5 @@ debug-assertions = false
[patch."https://github.com/rust-lang/cargo"]
cargo = { path = "tools/cargo" }

# Override rustfmt dependencies both on the repo and the crate (the RLS
# sometimes uses either).
# FIXME should only need the crates.io patch, long term.
[patch."https://github.com/rust-lang-nursery/rustfmt"]
rustfmt-nightly = { path = "tools/rustfmt" }
[patch.crates-io]
rustfmt-nightly = { path = "tools/rustfmt" }
12 changes: 10 additions & 2 deletions src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,11 @@ impl Step for Rls {

builder.add_rustc_lib_path(compiler, &mut cargo);

try_run(build, &mut cargo);
try_run_expecting(
build,
&mut cargo,
builder.build.config.toolstate.rls.passes(ToolState::Testing),
);
}
}

Expand Down Expand Up @@ -295,7 +299,11 @@ impl Step for Rustfmt {

builder.add_rustc_lib_path(compiler, &mut cargo);

try_run(build, &mut cargo);
try_run_expecting(
build,
&mut cargo,
builder.build.config.toolstate.rustfmt.passes(ToolState::Testing),
);
}
}

Expand Down
17 changes: 4 additions & 13 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1098,13 +1098,8 @@ impl Step for Rls {
.arg("--output-dir").arg(&distdir(build))
.arg("--non-installed-overlay").arg(&overlay)
.arg(format!("--package-name={}-{}", name, target))
.arg("--legacy-manifest-dirs=rustlib,cargo");

if build.config.channel == "nightly" {
cmd.arg("--component-name=rls");
} else {
cmd.arg("--component-name=rls-preview");
}
.arg("--legacy-manifest-dirs=rustlib,cargo")
.arg("--component-name=rls-preview");

build.run(&mut cmd);
distdir(build).join(format!("{}-{}.tar.gz", name, target))
Expand Down Expand Up @@ -1333,12 +1328,8 @@ impl Step for Extended {
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-std"), target))
.join(format!("rust-std-{}", target)),
&exe.join("rust-std"));
let rls_path = if build.config.channel == "nightly" {
work.join(&format!("{}-{}", pkgname(build, "rls"), target)).join("rls")
} else {
work.join(&format!("{}-{}", pkgname(build, "rls"), target)).join("rls-preview")
};
cp_r(&rls_path, &exe.join("rls"));
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rls"), target)).join("rls-preview"),
&exe.join("rls"));
cp_r(&work.join(&format!("{}-{}", pkgname(build, "rust-analysis"), target))
.join(format!("rust-analysis-{}", target)),
&exe.join("rust-analysis"));
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ impl Step for Rls {
tool: "rls",
mode: Mode::Librustc,
path: "src/tools/rls",
expectation: BuildExpectation::None,
expectation: builder.build.config.toolstate.rls.passes(ToolState::Compiling),
})
}
}
Expand Down Expand Up @@ -484,7 +484,7 @@ impl Step for Rustfmt {
tool: "rustfmt",
mode: Mode::Librustc,
path: "src/tools/rustfmt",
expectation: BuildExpectation::None,
expectation: builder.build.config.toolstate.rustfmt.passes(ToolState::Compiling),
})
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/toolstate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,6 @@ impl Default for ToolState {
pub struct ToolStates {
pub miri: ToolState,
pub clippy: ToolState,
pub rls: ToolState,
pub rustfmt: ToolState,
}
20 changes: 12 additions & 8 deletions src/tools/build-manifest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ struct Manifest {
manifest_version: String,
date: String,
pkg: BTreeMap<String, Package>,
renames: BTreeMap<String, Rename>
}

#[derive(Serialize)]
Expand All @@ -117,6 +118,11 @@ struct Package {
target: BTreeMap<String, Target>,
}

#[derive(Serialize)]
struct Rename {
to: String,
}

#[derive(Serialize)]
struct Target {
available: bool,
Expand Down Expand Up @@ -236,6 +242,7 @@ impl Builder {
manifest_version: "2".to_string(),
date: self.date.to_string(),
pkg: BTreeMap::new(),
renames: BTreeMap::new(),
};

self.package("rustc", &mut manifest.pkg, HOSTS);
Expand All @@ -244,14 +251,11 @@ impl Builder {
self.package("rust-std", &mut manifest.pkg, TARGETS);
self.package("rust-docs", &mut manifest.pkg, TARGETS);
self.package("rust-src", &mut manifest.pkg, &["*"]);
let rls_package_name = if self.rust_release == "nightly" {
"rls"
} else {
"rls-preview"
};
self.package(rls_package_name, &mut manifest.pkg, HOSTS);
self.package("rls-preview", &mut manifest.pkg, HOSTS);
self.package("rust-analysis", &mut manifest.pkg, TARGETS);

manifest.renames.insert("rls".to_owned(), Rename { to: "rls-preview".to_owned() });

let mut pkg = Package {
version: self.cached_version("rust").to_string(),
git_commit_hash: self.cached_git_commit_hash("rust").clone(),
Expand Down Expand Up @@ -287,7 +291,7 @@ impl Builder {
}

extensions.push(Component {
pkg: rls_package_name.to_string(),
pkg: "rls-preview".to_string(),
target: host.to_string(),
});
extensions.push(Component {
Expand Down Expand Up @@ -319,7 +323,7 @@ impl Builder {
}
manifest.pkg.insert("rust".to_string(), pkg);

return manifest
return manifest;
}

fn package(&mut self,
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rls
Submodule rls updated from 7221e3 to 93b47d
2 changes: 1 addition & 1 deletion src/tools/rustfmt
7 changes: 7 additions & 0 deletions src/tools/toolstate.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,10 @@ miri = "Testing"

# ping @Manishearth @llogiq @mcarton @oli-obk
clippy = "Broken"

# ping @nrc
rls = "Testing"

# ping @nrc
rustfmt = "Testing"