Skip to content

Commit b30b77d

Browse files
committed
Auto merge of #16573 - Veykril:salsa-doc-tests, r=Veykril
internal: Remove salsa doc compile tests These don't play well with the github CI error annotations
2 parents db277c7 + 1443d49 commit b30b77d

File tree

4 files changed

+23
-140
lines changed

4 files changed

+23
-140
lines changed

crates/rust-analyzer/src/bin/main.rs

+11-17
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ extern crate rustc_driver as _;
1111

1212
mod rustc_wrapper;
1313

14-
use std::{env, fs, path::PathBuf, process, sync::Arc};
14+
use std::{env, fs, path::PathBuf, process::ExitCode, sync::Arc};
1515

1616
use anyhow::Context;
1717
use lsp_server::Connection;
@@ -27,21 +27,15 @@ static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
2727
#[global_allocator]
2828
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
2929

30-
fn main() -> anyhow::Result<()> {
30+
fn main() -> anyhow::Result<ExitCode> {
3131
if std::env::var("RA_RUSTC_WRAPPER").is_ok() {
32-
let mut args = std::env::args_os();
33-
let _me = args.next().unwrap();
34-
let rustc = args.next().unwrap();
35-
let code = match rustc_wrapper::run_rustc_skipping_cargo_checking(rustc, args.collect()) {
36-
Ok(rustc_wrapper::ExitCode(code)) => code.unwrap_or(102),
37-
Err(err) => {
38-
eprintln!("{err}");
39-
101
40-
}
41-
};
42-
process::exit(code);
32+
rustc_wrapper::main().map_err(Into::into)
33+
} else {
34+
actual_main()
4335
}
36+
}
4437

38+
fn actual_main() -> anyhow::Result<ExitCode> {
4539
let flags = flags::RustAnalyzer::from_env_or_exit();
4640

4741
#[cfg(debug_assertions)]
@@ -58,14 +52,14 @@ fn main() -> anyhow::Result<()> {
5852
let verbosity = flags.verbosity();
5953

6054
match flags.subcommand {
61-
flags::RustAnalyzerCmd::LspServer(cmd) => {
55+
flags::RustAnalyzerCmd::LspServer(cmd) => 'lsp_server: {
6256
if cmd.print_config_schema {
6357
println!("{:#}", Config::json_schema());
64-
return Ok(());
58+
break 'lsp_server;
6559
}
6660
if cmd.version {
6761
println!("rust-analyzer {}", rust_analyzer::version());
68-
return Ok(());
62+
break 'lsp_server;
6963
}
7064

7165
// rust-analyzer’s “main thread” is actually
@@ -90,7 +84,7 @@ fn main() -> anyhow::Result<()> {
9084
flags::RustAnalyzerCmd::RunTests(cmd) => cmd.run()?,
9185
flags::RustAnalyzerCmd::RustcTests(cmd) => cmd.run()?,
9286
}
93-
Ok(())
87+
Ok(ExitCode::SUCCESS)
9488
}
9589

9690
fn setup_logging(log_file_flag: Option<PathBuf>) -> anyhow::Result<()> {

crates/rust-analyzer/src/bin/rustc_wrapper.rs

+12-7
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@
77
use std::{
88
ffi::OsString,
99
io,
10-
process::{Command, Stdio},
10+
process::{Command, ExitCode, Stdio},
1111
};
1212

13-
/// ExitCode/ExitStatus are impossible to create :(.
14-
pub(crate) struct ExitCode(pub(crate) Option<i32>);
13+
pub(crate) fn main() -> io::Result<ExitCode> {
14+
let mut args = std::env::args_os();
15+
let _me = args.next().unwrap();
16+
let rustc = args.next().unwrap();
17+
run_rustc_skipping_cargo_checking(rustc, args.collect())
18+
}
1519

16-
pub(crate) fn run_rustc_skipping_cargo_checking(
20+
fn run_rustc_skipping_cargo_checking(
1721
rustc_executable: OsString,
1822
args: Vec<OsString>,
1923
) -> io::Result<ExitCode> {
@@ -35,9 +39,10 @@ pub(crate) fn run_rustc_skipping_cargo_checking(
3539
arg.starts_with("--emit=") && arg.contains("metadata") && !arg.contains("link")
3640
});
3741
if not_invoked_by_build_script && is_cargo_check {
38-
return Ok(ExitCode(Some(0)));
42+
Ok(ExitCode::from(0))
43+
} else {
44+
run_rustc(rustc_executable, args)
3945
}
40-
run_rustc(rustc_executable, args)
4146
}
4247

4348
fn run_rustc(rustc_executable: OsString, args: Vec<OsString>) -> io::Result<ExitCode> {
@@ -47,5 +52,5 @@ fn run_rustc(rustc_executable: OsString, args: Vec<OsString>) -> io::Result<Exit
4752
.stdout(Stdio::inherit())
4853
.stderr(Stdio::inherit())
4954
.spawn()?;
50-
Ok(ExitCode(child.wait()?.code()))
55+
Ok(ExitCode::from(child.wait()?.code().unwrap_or(102) as u8))
5156
}

crates/salsa/src/doctest.rs

-115
This file was deleted.

crates/salsa/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//! from previous invocations as appropriate.
1212
1313
mod derived;
14-
mod doctest;
1514
mod durability;
1615
mod hash;
1716
mod input;

0 commit comments

Comments
 (0)