Skip to content

Commit 1afbd6e

Browse files
authored
Rollup merge of #104778 - lnicola:rust-analyzer-2022-11-23, r=lnicola
⬆️ rust-analyzer r? ```@ghost```
2 parents 2190b16 + 37c3521 commit 1afbd6e

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

src/tools/rust-analyzer/Cargo.lock

+77-39
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,16 @@ dependencies = [
221221
"tracing",
222222
]
223223

224+
[[package]]
225+
name = "command-group"
226+
version = "1.0.8"
227+
source = "registry+https://github.com/rust-lang/crates.io-index"
228+
checksum = "f7a8a86f409b4a59df3a3e4bee2de0b83f1755fdd2a25e3a9684c396fc4bed2c"
229+
dependencies = [
230+
"nix",
231+
"winapi",
232+
]
233+
224234
[[package]]
225235
name = "countme"
226236
version = "3.0.1"
@@ -300,7 +310,7 @@ dependencies = [
300310
"hashbrown",
301311
"lock_api",
302312
"once_cell",
303-
"parking_lot_core 0.9.3",
313+
"parking_lot_core 0.9.4",
304314
]
305315

306316
[[package]]
@@ -359,14 +369,14 @@ dependencies = [
359369

360370
[[package]]
361371
name = "filetime"
362-
version = "0.2.17"
372+
version = "0.2.18"
363373
source = "registry+https://github.com/rust-lang/crates.io-index"
364-
checksum = "e94a7bbaa59354bc20dd75b67f23e2797b4490e9d6928203fb105c79e448c86c"
374+
checksum = "4b9663d381d07ae25dc88dbdf27df458faa83a9b25336bcac83d5e452b5fc9d3"
365375
dependencies = [
366376
"cfg-if",
367377
"libc",
368378
"redox_syscall",
369-
"windows-sys 0.36.1",
379+
"windows-sys 0.42.0",
370380
]
371381

372382
[[package]]
@@ -390,6 +400,7 @@ name = "flycheck"
390400
version = "0.0.0"
391401
dependencies = [
392402
"cargo_metadata",
403+
"command-group",
393404
"crossbeam-channel",
394405
"jod-thread",
395406
"paths",
@@ -963,11 +974,24 @@ dependencies = [
963974

964975
[[package]]
965976
name = "miow"
966-
version = "0.4.0"
977+
version = "0.5.0"
967978
source = "registry+https://github.com/rust-lang/crates.io-index"
968-
checksum = "a7377f7792b3afb6a3cba68daa54ca23c032137010460d667fda53a8d66be00e"
979+
checksum = "52ffbca2f655e33c08be35d87278e5b18b89550a37dbd598c20db92f6a471123"
969980
dependencies = [
970-
"windows-sys 0.28.0",
981+
"windows-sys 0.42.0",
982+
]
983+
984+
[[package]]
985+
name = "nix"
986+
version = "0.22.3"
987+
source = "registry+https://github.com/rust-lang/crates.io-index"
988+
checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf"
989+
dependencies = [
990+
"bitflags",
991+
"cc",
992+
"cfg-if",
993+
"libc",
994+
"memoffset",
971995
]
972996

973997
[[package]]
@@ -1037,7 +1061,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
10371061
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
10381062
dependencies = [
10391063
"lock_api",
1040-
"parking_lot_core 0.9.3",
1064+
"parking_lot_core 0.9.4",
10411065
]
10421066

10431067
[[package]]
@@ -1056,15 +1080,15 @@ dependencies = [
10561080

10571081
[[package]]
10581082
name = "parking_lot_core"
1059-
version = "0.9.3"
1083+
version = "0.9.4"
10601084
source = "registry+https://github.com/rust-lang/crates.io-index"
1061-
checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929"
1085+
checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0"
10621086
dependencies = [
10631087
"cfg-if",
10641088
"libc",
10651089
"redox_syscall",
10661090
"smallvec",
1067-
"windows-sys 0.36.1",
1091+
"windows-sys 0.42.0",
10681092
]
10691093

10701094
[[package]]
@@ -1979,19 +2003,6 @@ version = "0.4.0"
19792003
source = "registry+https://github.com/rust-lang/crates.io-index"
19802004
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
19812005

1982-
[[package]]
1983-
name = "windows-sys"
1984-
version = "0.28.0"
1985-
source = "registry+https://github.com/rust-lang/crates.io-index"
1986-
checksum = "82ca39602d5cbfa692c4b67e3bcbb2751477355141c1ed434c94da4186836ff6"
1987-
dependencies = [
1988-
"windows_aarch64_msvc 0.28.0",
1989-
"windows_i686_gnu 0.28.0",
1990-
"windows_i686_msvc 0.28.0",
1991-
"windows_x86_64_gnu 0.28.0",
1992-
"windows_x86_64_msvc 0.28.0",
1993-
]
1994-
19952006
[[package]]
19962007
name = "windows-sys"
19972008
version = "0.36.1"
@@ -2006,10 +2017,25 @@ dependencies = [
20062017
]
20072018

20082019
[[package]]
2009-
name = "windows_aarch64_msvc"
2010-
version = "0.28.0"
2020+
name = "windows-sys"
2021+
version = "0.42.0"
2022+
source = "registry+https://github.com/rust-lang/crates.io-index"
2023+
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
2024+
dependencies = [
2025+
"windows_aarch64_gnullvm",
2026+
"windows_aarch64_msvc 0.42.0",
2027+
"windows_i686_gnu 0.42.0",
2028+
"windows_i686_msvc 0.42.0",
2029+
"windows_x86_64_gnu 0.42.0",
2030+
"windows_x86_64_gnullvm",
2031+
"windows_x86_64_msvc 0.42.0",
2032+
]
2033+
2034+
[[package]]
2035+
name = "windows_aarch64_gnullvm"
2036+
version = "0.42.0"
20112037
source = "registry+https://github.com/rust-lang/crates.io-index"
2012-
checksum = "52695a41e536859d5308cc613b4a022261a274390b25bd29dfff4bf08505f3c2"
2038+
checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
20132039

20142040
[[package]]
20152041
name = "windows_aarch64_msvc"
@@ -2018,10 +2044,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
20182044
checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
20192045

20202046
[[package]]
2021-
name = "windows_i686_gnu"
2022-
version = "0.28.0"
2047+
name = "windows_aarch64_msvc"
2048+
version = "0.42.0"
20232049
source = "registry+https://github.com/rust-lang/crates.io-index"
2024-
checksum = "f54725ac23affef038fecb177de6c9bf065787c2f432f79e3c373da92f3e1d8a"
2050+
checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
20252051

20262052
[[package]]
20272053
name = "windows_i686_gnu"
@@ -2030,10 +2056,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
20302056
checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
20312057

20322058
[[package]]
2033-
name = "windows_i686_msvc"
2034-
version = "0.28.0"
2059+
name = "windows_i686_gnu"
2060+
version = "0.42.0"
20352061
source = "registry+https://github.com/rust-lang/crates.io-index"
2036-
checksum = "51d5158a43cc43623c0729d1ad6647e62fa384a3d135fd15108d37c683461f64"
2062+
checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
20372063

20382064
[[package]]
20392065
name = "windows_i686_msvc"
@@ -2042,10 +2068,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
20422068
checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
20432069

20442070
[[package]]
2045-
name = "windows_x86_64_gnu"
2046-
version = "0.28.0"
2071+
name = "windows_i686_msvc"
2072+
version = "0.42.0"
20472073
source = "registry+https://github.com/rust-lang/crates.io-index"
2048-
checksum = "bc31f409f565611535130cfe7ee8e6655d3fa99c1c61013981e491921b5ce954"
2074+
checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
20492075

20502076
[[package]]
20512077
name = "windows_x86_64_gnu"
@@ -2054,17 +2080,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
20542080
checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
20552081

20562082
[[package]]
2057-
name = "windows_x86_64_msvc"
2058-
version = "0.28.0"
2083+
name = "windows_x86_64_gnu"
2084+
version = "0.42.0"
2085+
source = "registry+https://github.com/rust-lang/crates.io-index"
2086+
checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
2087+
2088+
[[package]]
2089+
name = "windows_x86_64_gnullvm"
2090+
version = "0.42.0"
20592091
source = "registry+https://github.com/rust-lang/crates.io-index"
2060-
checksum = "3f2b8c7cbd3bfdddd9ab98769f9746a7fad1bca236554cd032b78d768bc0e89f"
2092+
checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
20612093

20622094
[[package]]
20632095
name = "windows_x86_64_msvc"
20642096
version = "0.36.1"
20652097
source = "registry+https://github.com/rust-lang/crates.io-index"
20662098
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
20672099

2100+
[[package]]
2101+
name = "windows_x86_64_msvc"
2102+
version = "0.42.0"
2103+
source = "registry+https://github.com/rust-lang/crates.io-index"
2104+
checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
2105+
20682106
[[package]]
20692107
name = "write-json"
20702108
version = "0.1.2"

src/tools/rust-analyzer/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

src/tools/rust-analyzer/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

src/tools/rust-analyzer/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" }

src/tools/rust-analyzer/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(())

src/tools/rust-analyzer/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

src/tools/rust-analyzer/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,

src/tools/rust-analyzer/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)