Skip to content

Commit 29efcdc

Browse files
paldepindCopilot
andcommitted
Rust: remove fixed toolchain workarounds
Use the project's configured Rust toolchain again and stop preinstalling the extractor's formerly fixed toolchain in test setup. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent fc530c8 commit 29efcdc

13 files changed

Lines changed: 9 additions & 138 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MODULE.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ use_repo(
139139
"vendor_ts__ra_ap_stdx-0.0.347",
140140
"vendor_ts__ra_ap_syntax-0.0.347",
141141
"vendor_ts__ra_ap_syntax-bridge-0.0.347",
142-
"vendor_ts__ra_ap_toolchain-0.0.347",
143142
"vendor_ts__ra_ap_vfs-0.0.347",
144143
"vendor_ts__rand-0.10.2",
145144
"vendor_ts__rayon-1.12.0",

misc/bazel/3rdparty/tree_sitter_extractors_deps/BUILD.bazel

Lines changed: 0 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

misc/bazel/3rdparty/tree_sitter_extractors_deps/crates.bzl

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

misc/bazel/3rdparty/tree_sitter_extractors_deps/ra_ap_toolchain-0.0.347/BUILD.bazel

Lines changed: 0 additions & 15 deletions
This file was deleted.

misc/bazel/3rdparty/tree_sitter_extractors_deps/ra_ap_toolchain/BUILD.bazel

Lines changed: 0 additions & 15 deletions
This file was deleted.

rust/extractor/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ ra_ap_paths = "0.0.347"
2121
ra_ap_project_model = "0.0.347"
2222
ra_ap_syntax = "0.0.347"
2323
ra_ap_syntax-bridge = "0.0.347"
24-
ra_ap_toolchain = "0.0.347"
2524
ra_ap_vfs = "0.0.347"
2625
ra_ap_parser = "0.0.347"
2726
ra_ap_span = "0.0.347"

rust/extractor/src/config.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ use std::fmt::Debug;
2424
use std::ops::Not;
2525
use std::path::{Path, PathBuf};
2626

27-
use crate::toolchain::select_toolchain;
28-
2927
#[derive(Debug, PartialEq, Eq, Default, Serialize, Deserialize, Clone, Copy, clap::ValueEnum)]
3028
#[serde(rename_all = "lowercase")]
3129
#[clap(rename_all = "lowercase")]
@@ -142,7 +140,6 @@ impl Config {
142140
);
143141
}
144142
extra_env.extend(self.cargo_extra_env.clone());
145-
extra_env.insert("RUSTUP_TOOLCHAIN".to_owned(), Some(select_toolchain()));
146143
extra_env
147144
}
148145

rust/extractor/src/main.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::diagnostics::{ExtractionStep, emit_extraction_diagnostics};
22
use crate::rust_analyzer::{RustAnalyzerNoSemantics, path_to_file_id};
3-
use crate::toolchain::log_project_toolchain;
43
use crate::translate::SourceKind;
54
use crate::trap::TrapId;
65
use anyhow::Context;
@@ -33,7 +32,6 @@ mod diagnostics;
3332
pub mod generated;
3433
mod qltest;
3534
mod rust_analyzer;
36-
mod toolchain;
3735
mod translate;
3836
pub mod trap;
3937

@@ -271,7 +269,6 @@ fn main() -> anyhow::Result<()> {
271269
);
272270
}
273271
let cwd = cwd()?;
274-
log_project_toolchain();
275272
let (cargo_config, load_cargo_config) = cfg.to_cargo_config(&cwd);
276273
let library_mode = if cfg.extract_dependencies_as_source {
277274
SourceKind::Source

rust/extractor/src/qltest.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use itertools::Itertools;
55
use std::ffi::OsStr;
66
use std::fs;
77
use std::path::Path;
8+
use std::process::Command;
89
use tracing::info;
910

1011
const DEFAULT_EDITION: &str = "2021";
@@ -90,8 +91,15 @@ fn set_sources(config: &mut Config) -> anyhow::Result<()> {
9091
}
9192

9293
fn cargo_check(config: &Config) -> anyhow::Result<()> {
93-
let mut command = ra_ap_toolchain::command("cargo", ".", &config.get_extra_env());
94+
let mut command = Command::new("cargo");
9495
command.env("CARGO_TARGET_DIR", config.cargo_target_dir());
96+
// Pass the extra environment variables to the initial `cargo check`.
97+
for (key, value) in config.get_extra_env() {
98+
match value {
99+
Some(value) => command.env(key, value),
100+
None => command.env_remove(key),
101+
};
102+
}
95103
let status = command
96104
.arg("check")
97105
.arg("-q")

0 commit comments

Comments
 (0)