Skip to content

Commit a2a1d99

Browse files
committed
⬆️ rust-analyzer
1 parent 61c744d commit a2a1d99

File tree

126 files changed

+2089
-895
lines changed

Some content is hidden

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

126 files changed

+2089
-895
lines changed

Cargo.lock

+77-39
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/base-db/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.0.0"
44
description = "TBD"
55
license = "MIT OR Apache-2.0"
66
edition = "2021"
7-
rust-version = "1.57"
7+
rust-version = "1.65"
88

99
[lib]
1010
doctest = false

crates/cfg/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.0.0"
44
description = "TBD"
55
license = "MIT OR Apache-2.0"
66
edition = "2021"
7-
rust-version = "1.57"
7+
rust-version = "1.65"
88

99
[lib]
1010
doctest = false

crates/flycheck/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.0.0"
44
description = "TBD"
55
license = "MIT OR Apache-2.0"
66
edition = "2021"
7-
rust-version = "1.57"
7+
rust-version = "1.65"
88

99
[lib]
1010
doctest = false
@@ -17,6 +17,7 @@ rustc-hash = "1.1.0"
1717
serde = { version = "1.0.137", features = ["derive"] }
1818
serde_json = "1.0.86"
1919
jod-thread = "0.1.2"
20+
command-group = "1.0.8"
2021

2122
toolchain = { path = "../toolchain", version = "0.0.0" }
2223
stdx = { path = "../stdx", version = "0.0.0" }

crates/flycheck/src/lib.rs

+15-12
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ use std::{
1010
time::Duration,
1111
};
1212

13+
use command_group::{CommandGroup, GroupChild};
1314
use crossbeam_channel::{never, select, unbounded, Receiver, Sender};
1415
use paths::AbsPathBuf;
1516
use rustc_hash::FxHashMap;
1617
use serde::Deserialize;
17-
use stdx::{process::streaming_output, JodChild};
18+
use stdx::process::streaming_output;
1819

1920
pub use cargo_metadata::diagnostic::{
2021
Applicability, Diagnostic, DiagnosticCode, DiagnosticLevel, DiagnosticSpan,
@@ -39,7 +40,7 @@ pub enum InvocationLocation {
3940
pub enum FlycheckConfig {
4041
CargoCommand {
4142
command: String,
42-
target_triple: Option<String>,
43+
target_triples: Vec<String>,
4344
all_targets: bool,
4445
no_default_features: bool,
4546
all_features: bool,
@@ -285,7 +286,7 @@ impl FlycheckActor {
285286
let (mut cmd, args) = match &self.config {
286287
FlycheckConfig::CargoCommand {
287288
command,
288-
target_triple,
289+
target_triples,
289290
no_default_features,
290291
all_targets,
291292
all_features,
@@ -299,7 +300,7 @@ impl FlycheckActor {
299300
cmd.args(&["--workspace", "--message-format=json", "--manifest-path"])
300301
.arg(self.root.join("Cargo.toml").as_os_str());
301302

302-
if let Some(target) = target_triple {
303+
for target in target_triples {
303304
cmd.args(&["--target", target.as_str()]);
304305
}
305306
if *all_targets {
@@ -359,10 +360,12 @@ impl FlycheckActor {
359360
}
360361
}
361362

363+
struct JodChild(GroupChild);
364+
362365
/// A handle to a cargo process used for fly-checking.
363366
struct CargoHandle {
364367
/// The handle to the actual cargo process. As we cannot cancel directly from with
365-
/// a read syscall dropping and therefor terminating the process is our best option.
368+
/// a read syscall dropping and therefore terminating the process is our best option.
366369
child: JodChild,
367370
thread: jod_thread::JoinHandle<io::Result<(bool, String)>>,
368371
receiver: Receiver<CargoMessage>,
@@ -371,10 +374,10 @@ struct CargoHandle {
371374
impl CargoHandle {
372375
fn spawn(mut command: Command) -> std::io::Result<CargoHandle> {
373376
command.stdout(Stdio::piped()).stderr(Stdio::piped()).stdin(Stdio::null());
374-
let mut child = JodChild::spawn(command)?;
377+
let mut child = command.group_spawn().map(JodChild)?;
375378

376-
let stdout = child.stdout.take().unwrap();
377-
let stderr = child.stderr.take().unwrap();
379+
let stdout = child.0.inner().stdout.take().unwrap();
380+
let stderr = child.0.inner().stderr.take().unwrap();
378381

379382
let (sender, receiver) = unbounded();
380383
let actor = CargoActor::new(sender, stdout, stderr);
@@ -386,13 +389,13 @@ impl CargoHandle {
386389
}
387390

388391
fn cancel(mut self) {
389-
let _ = self.child.kill();
390-
let _ = self.child.wait();
392+
let _ = self.child.0.kill();
393+
let _ = self.child.0.wait();
391394
}
392395

393396
fn join(mut self) -> io::Result<()> {
394-
let _ = self.child.kill();
395-
let exit_status = self.child.wait()?;
397+
let _ = self.child.0.kill();
398+
let exit_status = self.child.0.wait()?;
396399
let (read_at_least_one_message, error) = self.thread.join()?;
397400
if read_at_least_one_message || exit_status.success() {
398401
Ok(())

crates/hir-def/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.0.0"
44
description = "TBD"
55
license = "MIT OR Apache-2.0"
66
edition = "2021"
7-
rust-version = "1.57"
7+
rust-version = "1.65"
88

99
[lib]
1010
doctest = false

crates/hir-def/src/data.rs

+13-5
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,19 @@ impl TraitData {
236236
.by_key("rustc_skip_array_during_method_dispatch")
237237
.exists();
238238

239-
let mut collector =
240-
AssocItemCollector::new(db, module_id, tree_id.file_id(), ItemContainerId::TraitId(tr));
241-
collector.collect(&item_tree, tree_id.tree_id(), &tr_def.items);
242-
let (items, attribute_calls, diagnostics) = collector.finish();
243-
239+
let (items, attribute_calls, diagnostics) = match &tr_def.items {
240+
Some(items) => {
241+
let mut collector = AssocItemCollector::new(
242+
db,
243+
module_id,
244+
tree_id.file_id(),
245+
ItemContainerId::TraitId(tr),
246+
);
247+
collector.collect(&item_tree, tree_id.tree_id(), items);
248+
collector.finish()
249+
}
250+
None => Default::default(),
251+
};
244252
(
245253
Arc::new(TraitData {
246254
name,

crates/hir-def/src/item_tree.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,8 @@ pub struct Trait {
666666
pub generic_params: Interned<GenericParams>,
667667
pub is_auto: bool,
668668
pub is_unsafe: bool,
669-
pub items: Box<[AssocItem]>,
669+
/// This is [`None`] if this Trait is a trait alias.
670+
pub items: Option<Box<[AssocItem]>>,
670671
pub ast_id: FileAstId<ast::Trait>,
671672
}
672673

0 commit comments

Comments
 (0)