Skip to content

Commit

Permalink
Auto merge of #16573 - Veykril:salsa-doc-tests, r=Veykril
Browse files Browse the repository at this point in the history
internal: Remove salsa doc compile tests

These don't play well with the github CI error annotations
  • Loading branch information
bors committed Feb 15, 2024
2 parents db277c7 + 69e813f commit ff6d77b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 140 deletions.
28 changes: 11 additions & 17 deletions crates/rust-analyzer/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extern crate rustc_driver as _;

mod rustc_wrapper;

use std::{env, fs, path::PathBuf, process, sync::Arc};
use std::{env, fs, path::PathBuf, process::ExitCode, sync::Arc};

use anyhow::Context;
use lsp_server::Connection;
Expand All @@ -27,21 +27,15 @@ static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;

fn main() -> anyhow::Result<()> {
fn main() -> anyhow::Result<ExitCode> {
if std::env::var("RA_RUSTC_WRAPPER").is_ok() {
let mut args = std::env::args_os();
let _me = args.next().unwrap();
let rustc = args.next().unwrap();
let code = match rustc_wrapper::run_rustc_skipping_cargo_checking(rustc, args.collect()) {
Ok(rustc_wrapper::ExitCode(code)) => code.unwrap_or(102),
Err(err) => {
eprintln!("{err}");
101
}
};
process::exit(code);
rustc_wrapper::main().map_err(Into::into)
} else {
actual_main()
}
}

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

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

match flags.subcommand {
flags::RustAnalyzerCmd::LspServer(cmd) => {
flags::RustAnalyzerCmd::LspServer(cmd) => 'lsp_server: {
if cmd.print_config_schema {
println!("{:#}", Config::json_schema());
return Ok(());
break 'lsp_server;
}
if cmd.version {
println!("rust-analyzer {}", rust_analyzer::version());
return Ok(());
break 'lsp_server;
}

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

fn setup_logging(log_file_flag: Option<PathBuf>) -> anyhow::Result<()> {
Expand Down
19 changes: 12 additions & 7 deletions crates/rust-analyzer/src/bin/rustc_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
use std::{
ffi::OsString,
io,
process::{Command, Stdio},
process::{Command, ExitCode, Stdio},
};

/// ExitCode/ExitStatus are impossible to create :(.
pub(crate) struct ExitCode(pub(crate) Option<i32>);
pub fn main() -> io::Result<ExitCode> {

Check failure on line 13 in crates/rust-analyzer/src/bin/rustc_wrapper.rs

View workflow job for this annotation

GitHub Actions / Rust (ubuntu-latest)

unreachable `pub` item
let mut args = std::env::args_os();
let _me = args.next().unwrap();
let rustc = args.next().unwrap();
run_rustc_skipping_cargo_checking(rustc, args.collect())
}

pub(crate) fn run_rustc_skipping_cargo_checking(
pub fn run_rustc_skipping_cargo_checking(

Check failure on line 20 in crates/rust-analyzer/src/bin/rustc_wrapper.rs

View workflow job for this annotation

GitHub Actions / Rust (ubuntu-latest)

unreachable `pub` item
rustc_executable: OsString,
args: Vec<OsString>,
) -> io::Result<ExitCode> {
Expand All @@ -35,9 +39,10 @@ pub(crate) fn run_rustc_skipping_cargo_checking(
arg.starts_with("--emit=") && arg.contains("metadata") && !arg.contains("link")
});
if not_invoked_by_build_script && is_cargo_check {
return Ok(ExitCode(Some(0)));
Ok(ExitCode::from(0))
} else {
run_rustc(rustc_executable, args)
}
run_rustc(rustc_executable, args)
}

fn run_rustc(rustc_executable: OsString, args: Vec<OsString>) -> io::Result<ExitCode> {
Expand All @@ -47,5 +52,5 @@ fn run_rustc(rustc_executable: OsString, args: Vec<OsString>) -> io::Result<Exit
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
.spawn()?;
Ok(ExitCode(child.wait()?.code()))
Ok(ExitCode::from(child.wait()?.code().unwrap_or(102) as u8))
}
115 changes: 0 additions & 115 deletions crates/salsa/src/doctest.rs

This file was deleted.

1 change: 0 additions & 1 deletion crates/salsa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
//! from previous invocations as appropriate.

mod derived;
mod doctest;
mod durability;
mod hash;
mod input;
Expand Down

0 comments on commit ff6d77b

Please sign in to comment.