Skip to content

Commit 25f5483

Browse files
authored
Rollup merge of rust-lang#102053 - lnicola:rust-analyzer-2022-09-20, r=lnicola
⬆️ rust-analyzer r? ``@ghost``
2 parents 3fac4bb + 9dcd19b commit 25f5483

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1587
-628
lines changed

src/tools/rust-analyzer/Cargo.lock

+2
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ dependencies = [
394394
"crossbeam-channel",
395395
"jod-thread",
396396
"paths",
397+
"rustc-hash",
397398
"serde",
398399
"serde_json",
399400
"stdx",
@@ -660,6 +661,7 @@ dependencies = [
660661
"indexmap",
661662
"itertools",
662663
"limit",
664+
"memchr",
663665
"once_cell",
664666
"parser",
665667
"profile",

src/tools/rust-analyzer/crates/flycheck/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ doctest = false
1313
crossbeam-channel = "0.5.5"
1414
tracing = "0.1.35"
1515
cargo_metadata = "0.15.0"
16+
rustc-hash = "1.1.0"
1617
serde = { version = "1.0.137", features = ["derive"] }
1718
serde_json = "1.0.81"
1819
jod-thread = "0.1.2"

src/tools/rust-analyzer/crates/flycheck/src/lib.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use std::{
1212

1313
use crossbeam_channel::{never, select, unbounded, Receiver, Sender};
1414
use paths::AbsPathBuf;
15+
use rustc_hash::FxHashMap;
1516
use serde::Deserialize;
1617
use stdx::{process::streaming_output, JodChild};
1718

@@ -30,18 +31,20 @@ pub enum FlycheckConfig {
3031
all_features: bool,
3132
features: Vec<String>,
3233
extra_args: Vec<String>,
34+
extra_env: FxHashMap<String, String>,
3335
},
3436
CustomCommand {
3537
command: String,
3638
args: Vec<String>,
39+
extra_env: FxHashMap<String, String>,
3740
},
3841
}
3942

4043
impl fmt::Display for FlycheckConfig {
4144
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4245
match self {
4346
FlycheckConfig::CargoCommand { command, .. } => write!(f, "cargo {}", command),
44-
FlycheckConfig::CustomCommand { command, args } => {
47+
FlycheckConfig::CustomCommand { command, args, .. } => {
4548
write!(f, "{} {}", command, args.join(" "))
4649
}
4750
}
@@ -256,6 +259,7 @@ impl FlycheckActor {
256259
all_features,
257260
extra_args,
258261
features,
262+
extra_env,
259263
} => {
260264
let mut cmd = Command::new(toolchain::cargo());
261265
cmd.arg(command);
@@ -281,11 +285,13 @@ impl FlycheckActor {
281285
}
282286
}
283287
cmd.args(extra_args);
288+
cmd.envs(extra_env);
284289
cmd
285290
}
286-
FlycheckConfig::CustomCommand { command, args } => {
291+
FlycheckConfig::CustomCommand { command, args, extra_env } => {
287292
let mut cmd = Command::new(command);
288293
cmd.args(args);
294+
cmd.envs(extra_env);
289295
cmd
290296
}
291297
};

0 commit comments

Comments
 (0)