Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬆️ rust-analyzer #104778

Merged
merged 93 commits into from
Nov 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
7c56896
Feat: extracted method from trait impl is placed in existing impl
TiddoLangerak Aug 9, 2022
7402366
Avoid cloning IMPL node if we don't have to
TiddoLangerak Aug 10, 2022
d5e6aa3
Pre-cast impl nodes to ast::Impl in find_non_trait_impl
TiddoLangerak Sep 1, 2022
c98fc53
Generalize reborrow hints as adjustment hints
Veykril Nov 4, 2022
95d20fc
Add adjustment hint tests
Veykril Nov 4, 2022
d841ad1
Fix up adjustment hints configurations
Veykril Nov 4, 2022
e468a1a
internal: Optimize `apply_document_changes` a bit
Veykril Nov 4, 2022
28afe57
Add tests for LineEndings::normalize
Veykril Nov 5, 2022
b87a23b
Rename convertor -> converter
lowr Nov 2, 2022
41b0c54
Fix `tt::Punct`'s spacing calculation
lowr Nov 5, 2022
1dcc25a
internal: Use a process group for flycheck
Veykril Nov 5, 2022
7742077
Auto merge of #13552 - Veykril:flycheck-process-group, r=Veykril
bors Nov 7, 2022
f54c313
Auto merge of #13547 - Veykril:line-index, r=Veykril
bors Nov 7, 2022
cff7ab1
Fix typos
lnicola Nov 7, 2022
364820a
Auto merge of #13566 - lnicola:therefor, r=lnicola
bors Nov 7, 2022
f24fbc2
rustfmt
Veykril Nov 7, 2022
8ad4a1d
Update sysroot crates
Veykril Nov 7, 2022
d3d3806
Auto merge of #12991 - TiddoLangerak:extract-method-from-trait-into-i…
bors Nov 7, 2022
180b4ce
Fix the length displayed for byte string literals with escaped newlines
noritada Nov 7, 2022
c0310c1
Auto merge of #13565 - Veykril:sysroot, r=Veykril
bors Nov 7, 2022
ee2dd93
Don't trigger adjustment hints in all inlay hint tests
Veykril Nov 7, 2022
ffd7bf8
Bump Cargo rust-version fields to latest stable
Veykril Nov 7, 2022
bdf8547
Clarify the intent
noritada Nov 7, 2022
3a839ea
Auto merge of #13569 - Veykril:rust-version, r=Veykril
bors Nov 7, 2022
b0e56ef
Auto merge of #13545 - Veykril:adjustment-hints, r=Veykril
bors Nov 7, 2022
2340d70
Add test code for unescaping byte strings
noritada Nov 7, 2022
b169e1e
Remove code duplication
Veykril Nov 7, 2022
8a633fe
Auto merge of #13570 - Veykril:dedup-crates-for, r=Veykril
bors Nov 7, 2022
d1c9775
Auto merge of #13568 - noritada:fix/len-of-byte-string-with-escaped-n…
bors Nov 7, 2022
6a06f6f
Deduplicate reference search results
Veykril Nov 7, 2022
a27e4da
Auto merge of #13571 - Veykril:unique-references, r=Veykril
bors Nov 7, 2022
fa70b0a
internal: Use Cancellable in favor of Result for clarity
Veykril Nov 7, 2022
0aa0da9
Auto merge of #13572 - Veykril:cancellable, r=Veykril
bors Nov 7, 2022
1cb6ab8
internal: error instead of panic on invalid file range
Veykril Nov 7, 2022
b8b1951
Auto merge of #13573 - Veykril:invalid-file-range, r=Veykril
bors Nov 7, 2022
90e2db8
fix: Fix item completions not working properly after unit structs and…
Veykril Nov 8, 2022
236c116
Auto merge of #13581 - Veykril:unit-struct-compl, r=Veykril
bors Nov 8, 2022
4403dde
Nest Cargo.lock under Cargo.toml in Code
lnicola Nov 8, 2022
977a029
Auto merge of #13582 - lnicola:nest-cargo-toml, r=lnicola
bors Nov 8, 2022
9be0615
Don't canonicalize self type when querying FnOnce signature
Nov 8, 2022
392784a
Auto merge of #13584 - jonas-schievink:fix-signature-panic, r=jonas-s…
bors Nov 8, 2022
3c35d44
Add proc-macro dependency to rustc_private crates
Veykril Nov 9, 2022
599142c
Auto merge of #13590 - Veykril:proc-macro-rustc-src, r=Veykril
bors Nov 9, 2022
4f415fc
Ignore outermost non-delimited `Subtree` when reversing fixups
lowr Nov 10, 2022
5b07061
Test `TokenTree`s' equality modulo `Punct`s' spacing
lowr Nov 10, 2022
dea49d0
fix: check visibility of each segment in path resolution
lowr Nov 11, 2022
e75afeb
Resolve invisible defs in `fix_visibility` assist
lowr Nov 11, 2022
19306c0
Fix tests that depended on loose visibility restriction
lowr Nov 11, 2022
e35836e
Send status notification if there are no found workspaces
Veykril Nov 11, 2022
ff78d24
Auto merge of #13603 - Veykril:no-workspaces, r=Veykril
bors Nov 11, 2022
6f313ce
Auto merge of #13548 - lowr:fix/tt-punct-spacing, r=Veykril
bors Nov 11, 2022
57cc2a6
Auto merge of #13602 - lowr:fix/nameres-transitive-visibility, r=Veykril
bors Nov 11, 2022
e50712c
fix: Fix hover in attributed items not preferring similar kinded tokens
Veykril Nov 11, 2022
add8539
Auto merge of #13604 - Veykril:hover-attr, r=Veykril
bors Nov 11, 2022
c6c932d
chore: Align config property
poliorcetics Sep 24, 2022
0d4737a
feat: Support passing multiple targets to cargo (for Rust 1.64.0+)
poliorcetics Sep 24, 2022
a143ff0
fix: Fix r-a eagerly showing no discovered workspace errors
Veykril Nov 11, 2022
d3531e8
Auto merge of #13605 - Veykril:empty-ws-error, r=Veykril
bors Nov 11, 2022
6674bd8
fix: Add trait alias grammar to rust.ungram
Veykril Nov 11, 2022
2656303
Auto merge of #13606 - Veykril:trait-alias, r=Veykril
bors Nov 11, 2022
6b4b7d8
internal: Add version info to unsupported proc macro abi error
Veykril Nov 11, 2022
45ec315
Auto merge of #13607 - Veykril:proc-macro-error, r=Veykril
bors Nov 11, 2022
46417ad
Update several crates to bring support for the new Tier 3 Windows tar…
mati865 Nov 13, 2022
15dfeab
Fix GAT completion not including generic parameters
Nov 15, 2022
a516b90
Auto merge of #13622 - jonas-schievink:fix-gat-completions, r=jonas-s…
bors Nov 15, 2022
7e77d4e
Strip comments and attributes off of all trait item completions
Nov 15, 2022
8292dd8
Auto merge of #13623 - jonas-schievink:strip-trait-item-completions, …
bors Nov 15, 2022
0dd0dfb
Auto merge of #13615 - mati865:miow-update, r=jonas-schievink
bors Nov 15, 2022
1ad11b5
fix: resolve inference variable before applying adjustments
lowr Nov 16, 2022
92e393c
Auto merge of #13624 - lowr:fix/unsize-array-inference-variable, r=ln…
bors Nov 16, 2022
7577c44
Update proc-macro-srv tests
lowr Nov 16, 2022
9cf5c22
Auto merge of #13625 - lowr:fix/proc-macro-src-test, r=lnicola
bors Nov 16, 2022
cd6459e
Make "Remove dbg!()" assist work on selections
Nov 17, 2022
e162d58
Auto merge of #13629 - jonas-schievink:remove-dbg-selection, r=jonas-…
bors Nov 17, 2022
656d886
Make it more obvious which SCIP features we do not yet emit in code
Veykril Nov 18, 2022
bee27eb
Auto merge of #13632 - Veykril:scip, r=Veykril
bors Nov 18, 2022
073a63b
feat: Allow viewing the full compiler diagnostic in a readonly textview
Veykril Nov 18, 2022
8452844
Fix tests checking the data value
Veykril Nov 18, 2022
791cb87
Auto merge of #13633 - Veykril:vscode-full-diagnostics, r=Veykril
bors Nov 18, 2022
52bc15f
fix: Fix proc-macro-srv search paths for Arch Linux
Veykril Nov 18, 2022
a3f8fd7
fix: format expression parsing edge-cases
kartva Nov 19, 2022
dc8254c
fix: Fix nested macro diagnostics pointing at macro expansion files
Veykril Nov 19, 2022
ac60077
Auto merge of #13639 - Veykril:macro-diags, r=Veykril
bors Nov 19, 2022
6d4b2b4
run cargo fmt
kartva Nov 19, 2022
a4f071a
fix(assists): remove `item_const` which had default value when implem…
bvanjoi Nov 19, 2022
8050fdb
Auto merge of #13642 - bvanjoi:fix-13292, r=Veykril
bors Nov 19, 2022
2d9ed4f
Auto merge of #13641 - DesmondWillowbrook:fix-move-format-string, r=V…
bors Nov 19, 2022
38fa47f
Auto merge of #13290 - poliorcetics:multiple-targets, r=Veykril
bors Nov 19, 2022
e39d90a
Improve grammar of architecture.md
ZZzzaaKK Nov 20, 2022
ebbc549
Fix typo on 'configuration' anchor
VannTen Nov 20, 2022
75e1de8
Auto merge of #13649 - ZZzzaaKK:master, r=lnicola
bors Nov 20, 2022
2656297
Auto merge of #13653 - VannTen:fix/doc-typo-vim-lsp, r=Veykril
bors Nov 20, 2022
37c3521
:arrow_up: rust-analyzer
lnicola Nov 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 77 additions & 39 deletions src/tools/rust-analyzer/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,16 @@ dependencies = [
"tracing",
]

[[package]]
name = "command-group"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7a8a86f409b4a59df3a3e4bee2de0b83f1755fdd2a25e3a9684c396fc4bed2c"
dependencies = [
"nix",
"winapi",
]

[[package]]
name = "countme"
version = "3.0.1"
Expand Down Expand Up @@ -300,7 +310,7 @@ dependencies = [
"hashbrown",
"lock_api",
"once_cell",
"parking_lot_core 0.9.3",
"parking_lot_core 0.9.4",
]

[[package]]
Expand Down Expand Up @@ -359,14 +369,14 @@ dependencies = [

[[package]]
name = "filetime"
version = "0.2.17"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e94a7bbaa59354bc20dd75b67f23e2797b4490e9d6928203fb105c79e448c86c"
checksum = "4b9663d381d07ae25dc88dbdf27df458faa83a9b25336bcac83d5e452b5fc9d3"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"windows-sys 0.36.1",
"windows-sys 0.42.0",
]

[[package]]
Expand All @@ -390,6 +400,7 @@ name = "flycheck"
version = "0.0.0"
dependencies = [
"cargo_metadata",
"command-group",
"crossbeam-channel",
"jod-thread",
"paths",
Expand Down Expand Up @@ -963,11 +974,24 @@ dependencies = [

[[package]]
name = "miow"
version = "0.4.0"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7377f7792b3afb6a3cba68daa54ca23c032137010460d667fda53a8d66be00e"
checksum = "52ffbca2f655e33c08be35d87278e5b18b89550a37dbd598c20db92f6a471123"
dependencies = [
"windows-sys 0.28.0",
"windows-sys 0.42.0",
]

[[package]]
name = "nix"
version = "0.22.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf"
dependencies = [
"bitflags",
"cc",
"cfg-if",
"libc",
"memoffset",
]

[[package]]
Expand Down Expand Up @@ -1037,7 +1061,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"lock_api",
"parking_lot_core 0.9.3",
"parking_lot_core 0.9.4",
]

[[package]]
Expand All @@ -1056,15 +1080,15 @@ dependencies = [

[[package]]
name = "parking_lot_core"
version = "0.9.3"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929"
checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"smallvec",
"windows-sys 0.36.1",
"windows-sys 0.42.0",
]

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

[[package]]
name = "windows-sys"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82ca39602d5cbfa692c4b67e3bcbb2751477355141c1ed434c94da4186836ff6"
dependencies = [
"windows_aarch64_msvc 0.28.0",
"windows_i686_gnu 0.28.0",
"windows_i686_msvc 0.28.0",
"windows_x86_64_gnu 0.28.0",
"windows_x86_64_msvc 0.28.0",
]

[[package]]
name = "windows-sys"
version = "0.36.1"
Expand All @@ -2006,10 +2017,25 @@ dependencies = [
]

[[package]]
name = "windows_aarch64_msvc"
version = "0.28.0"
name = "windows-sys"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc 0.42.0",
"windows_i686_gnu 0.42.0",
"windows_i686_msvc 0.42.0",
"windows_x86_64_gnu 0.42.0",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc 0.42.0",
]

[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52695a41e536859d5308cc613b4a022261a274390b25bd29dfff4bf08505f3c2"
checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"

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

[[package]]
name = "windows_i686_gnu"
version = "0.28.0"
name = "windows_aarch64_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f54725ac23affef038fecb177de6c9bf065787c2f432f79e3c373da92f3e1d8a"
checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"

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

[[package]]
name = "windows_i686_msvc"
version = "0.28.0"
name = "windows_i686_gnu"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51d5158a43cc43623c0729d1ad6647e62fa384a3d135fd15108d37c683461f64"
checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"

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

[[package]]
name = "windows_x86_64_gnu"
version = "0.28.0"
name = "windows_i686_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc31f409f565611535130cfe7ee8e6655d3fa99c1c61013981e491921b5ce954"
checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"

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

[[package]]
name = "windows_x86_64_msvc"
version = "0.28.0"
name = "windows_x86_64_gnu"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"

[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f2b8c7cbd3bfdddd9ab98769f9746a7fad1bca236554cd032b78d768bc0e89f"
checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"

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

[[package]]
name = "windows_x86_64_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"

[[package]]
name = "write-json"
version = "0.1.2"
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rust-analyzer/crates/base-db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.0.0"
description = "TBD"
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.57"
rust-version = "1.65"

[lib]
doctest = false
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rust-analyzer/crates/cfg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.0.0"
description = "TBD"
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.57"
rust-version = "1.65"

[lib]
doctest = false
Expand Down
3 changes: 2 additions & 1 deletion src/tools/rust-analyzer/crates/flycheck/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.0.0"
description = "TBD"
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.57"
rust-version = "1.65"

[lib]
doctest = false
Expand All @@ -17,6 +17,7 @@ rustc-hash = "1.1.0"
serde = { version = "1.0.137", features = ["derive"] }
serde_json = "1.0.86"
jod-thread = "0.1.2"
command-group = "1.0.8"

toolchain = { path = "../toolchain", version = "0.0.0" }
stdx = { path = "../stdx", version = "0.0.0" }
Expand Down
27 changes: 15 additions & 12 deletions src/tools/rust-analyzer/crates/flycheck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ use std::{
time::Duration,
};

use command_group::{CommandGroup, GroupChild};
use crossbeam_channel::{never, select, unbounded, Receiver, Sender};
use paths::AbsPathBuf;
use rustc_hash::FxHashMap;
use serde::Deserialize;
use stdx::{process::streaming_output, JodChild};
use stdx::process::streaming_output;

pub use cargo_metadata::diagnostic::{
Applicability, Diagnostic, DiagnosticCode, DiagnosticLevel, DiagnosticSpan,
Expand All @@ -39,7 +40,7 @@ pub enum InvocationLocation {
pub enum FlycheckConfig {
CargoCommand {
command: String,
target_triple: Option<String>,
target_triples: Vec<String>,
all_targets: bool,
no_default_features: bool,
all_features: bool,
Expand Down Expand Up @@ -285,7 +286,7 @@ impl FlycheckActor {
let (mut cmd, args) = match &self.config {
FlycheckConfig::CargoCommand {
command,
target_triple,
target_triples,
no_default_features,
all_targets,
all_features,
Expand All @@ -299,7 +300,7 @@ impl FlycheckActor {
cmd.args(&["--workspace", "--message-format=json", "--manifest-path"])
.arg(self.root.join("Cargo.toml").as_os_str());

if let Some(target) = target_triple {
for target in target_triples {
cmd.args(&["--target", target.as_str()]);
}
if *all_targets {
Expand Down Expand Up @@ -359,10 +360,12 @@ impl FlycheckActor {
}
}

struct JodChild(GroupChild);

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

let stdout = child.stdout.take().unwrap();
let stderr = child.stderr.take().unwrap();
let stdout = child.0.inner().stdout.take().unwrap();
let stderr = child.0.inner().stderr.take().unwrap();

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

fn cancel(mut self) {
let _ = self.child.kill();
let _ = self.child.wait();
let _ = self.child.0.kill();
let _ = self.child.0.wait();
}

fn join(mut self) -> io::Result<()> {
let _ = self.child.kill();
let exit_status = self.child.wait()?;
let _ = self.child.0.kill();
let exit_status = self.child.0.wait()?;
let (read_at_least_one_message, error) = self.thread.join()?;
if read_at_least_one_message || exit_status.success() {
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion src/tools/rust-analyzer/crates/hir-def/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.0.0"
description = "TBD"
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.57"
rust-version = "1.65"

[lib]
doctest = false
Expand Down
18 changes: 13 additions & 5 deletions src/tools/rust-analyzer/crates/hir-def/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,19 @@ impl TraitData {
.by_key("rustc_skip_array_during_method_dispatch")
.exists();

let mut collector =
AssocItemCollector::new(db, module_id, tree_id.file_id(), ItemContainerId::TraitId(tr));
collector.collect(&item_tree, tree_id.tree_id(), &tr_def.items);
let (items, attribute_calls, diagnostics) = collector.finish();

let (items, attribute_calls, diagnostics) = match &tr_def.items {
Some(items) => {
let mut collector = AssocItemCollector::new(
db,
module_id,
tree_id.file_id(),
ItemContainerId::TraitId(tr),
);
collector.collect(&item_tree, tree_id.tree_id(), items);
collector.finish()
}
None => Default::default(),
};
(
Arc::new(TraitData {
name,
Expand Down
3 changes: 2 additions & 1 deletion src/tools/rust-analyzer/crates/hir-def/src/item_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,8 @@ pub struct Trait {
pub generic_params: Interned<GenericParams>,
pub is_auto: bool,
pub is_unsafe: bool,
pub items: Box<[AssocItem]>,
/// This is [`None`] if this Trait is a trait alias.
pub items: Option<Box<[AssocItem]>>,
pub ast_id: FileAstId<ast::Trait>,
}

Expand Down
Loading